changeset 5554:7b36d02031a2

[gaim-migrate @ 5955] More work done... Got some painful stuff to do now. committer: Tailor Script <tailor@pidgin.im>
author Christian Hammond <chipx86@chipx86.com>
date Fri, 30 May 2003 00:00:48 +0000
parents c0593bcdd5d6
children 6503d24fda09
files plugins/docklet/docklet.c src/gaimrc.c src/gtkprefs.c src/gtkutils.c src/log.c src/server.c
diffstat 6 files changed, 34 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/docklet/docklet.c	Thu May 29 23:44:44 2003 +0000
+++ b/plugins/docklet/docklet.c	Fri May 30 00:00:48 2003 +0000
@@ -31,8 +31,9 @@
 #include "gtkplugin.h"
 #include "gaim.h"
 #include "sound.h"
+#include "prefs.h"
+#include "gtkblist.h"
 #include "eggtrayicon.h"
-#include "gtkblist.h"
 
 #define DOCKLET_PLUGIN_ID "gtk-docklet"
 
@@ -62,16 +63,10 @@
 	gaim_sound_set_mute(GTK_CHECK_MENU_ITEM(toggle)->active);
 }
 
-static void docklet_toggle_queue(GtkWidget *widget, void *data) {
-	away_options ^= OPT_AWAY_QUEUE_UNREAD;
-	save_prefs();
+static void docklet_set_bool(GtkWidget *widget, const char *key) {
+	gaim_prefs_set_bool(key, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)));
 }
 
-/* static void docklet_toggle_blist_show(GtkWidget *widget, void *data) {
-	blist_options ^= OPT_BLIST_APP_BUDDY_SHOW;
-	save_prefs();
-} */
-
 static void docklet_flush_queue() {
 	if (unread_message_queue) {
 		purge_away_queue(&unread_message_queue);
@@ -397,6 +392,9 @@
 static gboolean
 plugin_load(GaimPlugin *plugin)
 {
+	gaim_prefs_add_none("/plugins/gtk/docklet");
+	gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE);
+
 	docklet_create(NULL);
 
 	gaim_signal_connect(plugin, event_signon, gaim_signon, NULL);
@@ -444,6 +442,7 @@
 	GtkWidget *frame;
 	GtkWidget *vbox, *hbox;
 	GtkWidget *toggle;
+	static const char *qmpref = "/plugins/gtk/docklet/queue_messages";
 
 	frame = gtk_vbox_new(FALSE, 18);
 	gtk_container_set_border_width(GTK_CONTAINER(frame), 12);
@@ -452,14 +451,9 @@
 	hbox = gtk_hbox_new(FALSE, 18);
 	gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0);
 
-/*	toggle = gtk_check_button_new_with_mnemonic(_("_Automatically show buddy list on sign on"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), blist_options & OPT_BLIST_APP_BUDDY_SHOW);
-	g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_toggle_blist_show), NULL);
-	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); */
-
 	toggle = gtk_check_button_new_with_mnemonic(_("_Hide new messages until tray icon is clicked"));
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), away_options & OPT_AWAY_QUEUE_UNREAD);
-	g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_toggle_queue), NULL);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), gaim_prefs_get_bool(qmpref));
+	g_signal_connect(G_OBJECT(toggle), "clicked", G_CALLBACK(docklet_set_bool), (void *)qmpref);
 	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
 
 	gtk_widget_show_all(frame);
--- a/src/gaimrc.c	Thu May 29 23:44:44 2003 +0000
+++ b/src/gaimrc.c	Fri May 30 00:00:48 2003 +0000
@@ -72,9 +72,9 @@
 #define OPT_LOG_INDIVIDUAL		0x00000040
 #define OPT_LOG_CHATS			0x00000100
 
-#define OPT_BLIST_APP_BUDDY_SHOW	0x00000001
+/* #define OPT_BLIST_APP_BUDDY_SHOW	0x00000001
 #define OPT_BLIST_SAVED_WINDOWS		0x00000002
-#define OPT_BLIST_NEAR_APPLET		0x00000004
+#define OPT_BLIST_NEAR_APPLET		0x00000004 */
 #define OPT_BLIST_SHOW_GRPNUM		0x00000008
 #define OPT_BLIST_SHOW_PIXMAPS		0x00000010
 #define OPT_BLIST_SHOW_IDLETIME		0x00000020
@@ -154,7 +154,7 @@
 #define OPT_AWAY_NO_AUTO_RESP		0x00000010
 #define OPT_AWAY_QUEUE			0x00000020
 #define OPT_AWAY_IDLE_RESP		0x00000040
-#define OPT_AWAY_QUEUE_UNREAD           0x00000080
+#define OPT_AWAY_QUEUE_UNREAD		0x00000080
 #define OPT_AWAY_DELAY_IN_USE		0x00000100
 
 
--- a/src/gtkprefs.c	Thu May 29 23:44:44 2003 +0000
+++ b/src/gtkprefs.c	Fri May 30 00:00:48 2003 +0000
@@ -2666,7 +2666,7 @@
 
 	/* XXX Move this! HACK! :( Aww... */
 	gaim_prefs_add_none("/plugins/gtk/docklet");
-	gaim_prefs_add_bool("/plugins/gtk/docklet/queue-messages", FALSE);
+	gaim_prefs_add_bool("/plugins/gtk/docklet/queue_messages", FALSE);
 
 	/* Browsers */
 	gaim_prefs_add_none("/gaim/gtk/browsers");
--- a/src/gtkutils.c	Thu May 29 23:44:44 2003 +0000
+++ b/src/gtkutils.c	Fri May 30 00:00:48 2003 +0000
@@ -343,21 +343,24 @@
 gaim_gtk_get_dispstyle(GaimConversationType type)
 {
 	int dispstyle = 2;
+	int value;
 
 	if (type == GAIM_CONV_CHAT) {
-		switch (chat_options & (OPT_CHAT_BUTTON_TEXT | OPT_CHAT_BUTTON_XPM)) {
+		value = gaim_prefs_get_int("/gaim/gtk/conversations/chat/button_type");
 
-			case OPT_CHAT_BUTTON_TEXT: dispstyle = 1; break;
-			case OPT_CHAT_BUTTON_XPM:  dispstyle = 0; break;
-			default:                   dispstyle = 2; break; /* both/neither */
+		switch (value) {
+			case GAIM_BUTTON_TEXT:  dispstyle = 1; break;
+			case GAIM_BUTTON_IMAGE: dispstyle = 0; break;
+			default:                dispstyle = 2; break; /* both/neither */
 		}
 	}
 	else if (type == GAIM_CONV_IM) {
-		switch (im_options & (OPT_IM_BUTTON_TEXT | OPT_IM_BUTTON_XPM)) {
+		value = gaim_prefs_get_int("/gaim/gtk/conversations/im/button_type");
 
-			case OPT_IM_BUTTON_TEXT: dispstyle = 1; break;
-			case OPT_IM_BUTTON_XPM:  dispstyle = 0; break;
-			default:                 dispstyle = 2; break; /* both/neither */
+		switch (value) {
+			case GAIM_BUTTON_TEXT:  dispstyle = 1; break;
+			case GAIM_BUTTON_IMAGE: dispstyle = 0; break;
+			default:                dispstyle = 2; break; /* both/neither */
 		}
 	}
 
--- a/src/log.c	Thu May 29 23:44:44 2003 +0000
+++ b/src/log.c	Fri May 30 00:00:48 2003 +0000
@@ -241,7 +241,7 @@
 	FILE *fd;
 	int flag = 0;
 
-	if (((is_chat == 2) && !(logging_options & OPT_LOG_INDIVIDUAL))
+	if (((is_chat == 2) && !gaim_prefs_get_bool("/gaim/gtk/logging/individual_logs"))
 		|| ((is_chat == 1) && !gaim_prefs_get_bool("/gaim/gtk/logging/log_chats"))
 		|| ((is_chat == 0) && !gaim_prefs_get_bool("/gaim/gtk/logging/log_ims"))) {
 
@@ -255,7 +255,7 @@
 		fd = fopen(l->filename, "a");
 
 		if (flag) {	/* is a new file */
-			if (logging_options & OPT_LOG_STRIP_HTML) {
+			if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) {
 				fprintf(fd, _("IM Sessions with %s\n"), name);
 			} else {
 				fprintf(fd, "<HTML><HEAD><TITLE>");
@@ -271,7 +271,7 @@
 	fd = open_gaim_log_file(realname, &flag);
 
 	if (fd && flag) {	/* is a new file */
-		if (logging_options & OPT_LOG_STRIP_HTML) {
+		if (gaim_prefs_get_bool("/gaim/gtk/logging/strip_html")) {
 			fprintf(fd, _("IM Sessions with %s\n"), name);
 		} else {
 			fprintf(fd, "<HTML><HEAD><TITLE>");
--- a/src/server.c	Thu May 29 23:44:44 2003 +0000
+++ b/src/server.c	Fri May 30 00:00:48 2003 +0000
@@ -987,11 +987,13 @@
 		 * earlier), then play a sound indicating we've received it and
 		 * then display it. Easy.
 		 */
-#if 0
-		/* XXX This is never TRUE, since nothing sets OPT_AWAY_QUEUE_UNREAD */
-		if (away_options & OPT_AWAY_QUEUE_UNREAD &&
-			!gaim_find_conversation(name) && docklet_count) {
 
+		/* XXX UGLY HACK OF THE YEAR
+		 * Robot101 will fix this after his exams. honest.
+		 */
+		if (docklet_count &&
+		    gaim_prefs_get_bool("/plugins/gtk/docklet/queue_unread") &&
+		    !gaim_find_conversation(name)) {
 			/*
 			 * We're gonna queue it up and wait for the user to ask for
 			 * it... probably by clicking the docklet or windows tray icon.
@@ -1007,16 +1009,13 @@
 			unread_message_queue = g_slist_append(unread_message_queue, qm);
 		}
 		else {
-#endif
 			if (cnv == NULL)
 				cnv = gaim_conversation_new(GAIM_CONV_IM, gc->account, name);
 
 			gaim_im_write(GAIM_IM(cnv), NULL, message, len,
 						  away | WFLAG_RECV, mtime);
 			gaim_window_flash(gaim_conversation_get_window(cnv));
-#if 0
 		}
-#endif
 	}
 
 	gaim_event_broadcast(event_im_displayed_rcvd, gc, name, message, flags, mtime);