Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
22772:7e28f2b64982 | 22773:369d68b5b4d4 |
---|---|
110 static GdkAtom _PurpleUnseenCount = GDK_NONE; | 110 static GdkAtom _PurpleUnseenCount = GDK_NONE; |
111 #endif | 111 #endif |
112 | 112 |
113 /* notification set/unset */ | 113 /* notification set/unset */ |
114 static int notify(PurpleConversation *conv, gboolean increment); | 114 static int notify(PurpleConversation *conv, gboolean increment); |
115 static void notify_win(PidginWindow *purplewin); | 115 static void notify_win(PidginWindow *purplewin, PurpleConversation *conv); |
116 static void unnotify(PurpleConversation *conv, gboolean reset); | 116 static void unnotify(PurpleConversation *conv, gboolean reset); |
117 static int unnotify_cb(GtkWidget *widget, gpointer data, | 117 static int unnotify_cb(GtkWidget *widget, gpointer data, |
118 PurpleConversation *conv); | 118 PurpleConversation *conv); |
119 | 119 |
120 /* gtk widget callbacks for prefs panel */ | 120 /* gtk widget callbacks for prefs panel */ |
139 static void handle_urgent(PidginWindow *purplewin, gboolean set); | 139 static void handle_urgent(PidginWindow *purplewin, gboolean set); |
140 | 140 |
141 /* raise function */ | 141 /* raise function */ |
142 static void handle_raise(PidginWindow *purplewin); | 142 static void handle_raise(PidginWindow *purplewin); |
143 | 143 |
144 /* present function */ | |
145 static void handle_present(PurpleConversation *conv); | |
146 | |
144 /****************************************/ | 147 /****************************************/ |
145 /* Begin doing stuff below this line... */ | 148 /* Begin doing stuff below this line... */ |
146 /****************************************/ | 149 /****************************************/ |
147 static guint | 150 static guint |
148 count_messages(PidginWindow *purplewin) | 151 count_messages(PidginWindow *purplewin) |
191 count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")); | 194 count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")); |
192 count++; | 195 count++; |
193 purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); | 196 purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); |
194 } | 197 } |
195 | 198 |
196 notify_win(purplewin); | 199 notify_win(purplewin, conv); |
197 } | 200 } |
198 | 201 |
199 return 0; | 202 return 0; |
200 } | 203 } |
201 | 204 |
202 static void | 205 static void |
203 notify_win(PidginWindow *purplewin) | 206 notify_win(PidginWindow *purplewin, PurpleConversation *conv) |
204 { | 207 { |
205 if (count_messages(purplewin) <= 0) | 208 if (count_messages(purplewin) <= 0) |
206 return; | 209 return; |
207 | 210 |
208 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) | 211 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) |
213 handle_string(purplewin); | 216 handle_string(purplewin); |
214 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | 217 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) |
215 handle_urgent(purplewin, TRUE); | 218 handle_urgent(purplewin, TRUE); |
216 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")) | 219 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")) |
217 handle_raise(purplewin); | 220 handle_raise(purplewin); |
221 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present")) | |
222 handle_present(conv); | |
218 } | 223 } |
219 | 224 |
220 static void | 225 static void |
221 unnotify(PurpleConversation *conv, gboolean reset) | 226 unnotify(PurpleConversation *conv, gboolean reset) |
222 { | 227 { |
562 { | 567 { |
563 pidgin_conv_window_raise(purplewin); | 568 pidgin_conv_window_raise(purplewin); |
564 } | 569 } |
565 | 570 |
566 static void | 571 static void |
572 handle_present(PurpleConversation *conv) | |
573 { | |
574 purple_conversation_present(conv); | |
575 } | |
576 | |
577 static void | |
567 type_toggle_cb(GtkWidget *widget, gpointer data) | 578 type_toggle_cb(GtkWidget *widget, gpointer data) |
568 { | 579 { |
569 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | 580 gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); |
570 gchar pref[256]; | 581 gchar pref[256]; |
571 | 582 |
768 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 779 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
769 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 780 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
770 purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")); | 781 purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")); |
771 g_signal_connect(G_OBJECT(toggle), "toggled", | 782 g_signal_connect(G_OBJECT(toggle), "toggled", |
772 G_CALLBACK(method_toggle_cb), "method_raise"); | 783 G_CALLBACK(method_toggle_cb), "method_raise"); |
784 | |
785 /* Present conversation method button */ | |
786 toggle = gtk_check_button_new_with_mnemonic(_("_Present conversation window")); | |
787 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
788 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
789 purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present")); | |
790 g_signal_connect(G_OBJECT(toggle), "toggled", | |
791 G_CALLBACK(method_toggle_cb), "method_present"); | |
773 | 792 |
774 /*---------- "Notification Removals" ----------*/ | 793 /*---------- "Notification Removals" ----------*/ |
775 frame = pidgin_make_frame(ret, _("Notification Removal")); | 794 frame = pidgin_make_frame(ret, _("Notification Removal")); |
776 vbox = gtk_vbox_new(FALSE, 5); | 795 vbox = gtk_vbox_new(FALSE, 5); |
777 gtk_container_add(GTK_CONTAINER(frame), vbox); | 796 gtk_container_add(GTK_CONTAINER(frame), vbox); |
943 purple_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | 962 purple_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); |
944 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | 963 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); |
945 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | 964 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); |
946 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count_xprop", FALSE); | 965 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count_xprop", FALSE); |
947 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE); | 966 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE); |
967 purple_prefs_add_bool("/plugins/gtk/X11/notify/method_present", FALSE); | |
948 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", TRUE); | 968 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", TRUE); |
949 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | 969 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); |
950 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | 970 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); |
951 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); | 971 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
952 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); | 972 purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); |