diff pidgin/plugins/notify.c @ 22773:369d68b5b4d4

merge of '7f78e4be502956bb580a87289cf2acfe6254ea62' and 'adc2c416311e49c2c9279f1452fea30a94be7bfb'
author Etan Reisner <pidgin@unreliablesource.net>
date Thu, 01 May 2008 03:06:17 +0000
parents cc8903c59d6b 122476d8821d
children 6593855e1ed9
line wrap: on
line diff
--- a/pidgin/plugins/notify.c	Wed Apr 30 22:52:16 2008 +0000
+++ b/pidgin/plugins/notify.c	Thu May 01 03:06:17 2008 +0000
@@ -112,7 +112,7 @@
 
 /* notification set/unset */
 static int notify(PurpleConversation *conv, gboolean increment);
-static void notify_win(PidginWindow *purplewin);
+static void notify_win(PidginWindow *purplewin, PurpleConversation *conv);
 static void unnotify(PurpleConversation *conv, gboolean reset);
 static int unnotify_cb(GtkWidget *widget, gpointer data,
                        PurpleConversation *conv);
@@ -141,6 +141,9 @@
 /* raise function */
 static void handle_raise(PidginWindow *purplewin);
 
+/* present function */
+static void handle_present(PurpleConversation *conv);
+
 /****************************************/
 /* Begin doing stuff below this line... */
 /****************************************/
@@ -193,14 +196,14 @@
 			purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count));
 		}
 
-		notify_win(purplewin);
+		notify_win(purplewin, conv);
 	}
 
 	return 0;
 }
 
 static void
-notify_win(PidginWindow *purplewin)
+notify_win(PidginWindow *purplewin, PurpleConversation *conv)
 {
 	if (count_messages(purplewin) <= 0)
 		return;
@@ -215,6 +218,8 @@
 		handle_urgent(purplewin, TRUE);
 	if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise"))
 		handle_raise(purplewin);
+	if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present"))
+		handle_present(conv);
 }
 
 static void
@@ -564,6 +569,12 @@
 }
 
 static void
+handle_present(PurpleConversation *conv)
+{
+	purple_conversation_present(conv);
+}
+
+static void
 type_toggle_cb(GtkWidget *widget, gpointer data)
 {
 	gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
@@ -771,6 +782,14 @@
 	g_signal_connect(G_OBJECT(toggle), "toggled",
 	                 G_CALLBACK(method_toggle_cb), "method_raise");
 
+	/* Present conversation method button */
+	toggle = gtk_check_button_new_with_mnemonic(_("_Present conversation window"));
+	gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0);
+	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle),
+	                             purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present"));
+	g_signal_connect(G_OBJECT(toggle), "toggled",
+	                 G_CALLBACK(method_toggle_cb), "method_present");
+
 	/*---------- "Notification Removals" ----------*/
 	frame = pidgin_make_frame(ret, _("Notification Removal"));
 	vbox = gtk_vbox_new(FALSE, 5);
@@ -945,6 +964,7 @@
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count_xprop", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE);
+	purple_prefs_add_bool("/plugins/gtk/X11/notify/method_present", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", TRUE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE);
 	purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE);