Sat, 17 Sep 2022 21:49:25 -0500
Rename PidginConversationWindow to PidginDisplayWindow as it holds more than conversations now
Renaming the files will come after this has landed.
Testing Done:
Opened a conversation.
Bugs closed: PIDGIN-17657
Reviewed at https://reviews.imfreedom.org/r/1774/
| 6302 | 1 | /* |
| 15884 | 2 | * Purple buddy notification plugin. |
| 6302 | 3 | * |
| 4 | * Copyright (C) 2000-2001, Eric Warmenhoven (original code) | |
| 5 | * Copyright (C) 2002, Etan Reisner <deryni@eden.rutgers.edu> (rewritten code) | |
| 6 | * Copyright (C) 2003, Christian Hammond (update for changed API) | |
|
6322
35fdae8a156f
[gaim-migrate @ 6821]
Mark Doliner <markdoliner@pidgin.im>
parents:
6302
diff
changeset
|
7 | * Copyright (C) 2003, Brian Tarricone <bjt23@cornell.edu> (mostly rewritten) |
| 6302 | 8 | * Copyright (C) 2003, Mark Doliner (minor cleanup) |
| 6977 | 9 | * Copyright (C) 2003, Etan Reisner (largely rewritten again) |
| 6302 | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 3374 | 20 | * |
| 6302 | 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19717
diff
changeset
|
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6302 | 24 | * |
| 25 | */ | |
| 26 | ||
| 10606 | 27 | /* TODO |
| 28 | * 22:22:17 <seanegan> deryni: speaking of notify.c... you know what else | |
| 29 | * might be a neat feature? | |
| 30 | * 22:22:30 <seanegan> Changing the window icon. | |
| 31 | * 22:23:25 <deryni> seanegan: To what? | |
| 32 | * 22:23:42 <seanegan> deryni: I dunno. Flash it between the regular icon and | |
| 33 | * blank or something. | |
| 15884 | 34 | * 22:23:53 <deryni> Also I think purple might re-set that sort of frequently, |
| 10606 | 35 | * but I'd have to look. |
| 11581 | 36 | * 22:25:16 <seanegan> deryni: I keep my conversations in one workspace and am |
| 10606 | 37 | * frequently in an another, and the icon flashing in the pager would be a |
| 38 | * neat visual clue. | |
| 39 | */ | |
| 40 | ||
| 6302 | 41 | /* |
| 42 | * From Etan, 2002: | |
| 43 | * -Added config dialog | |
| 44 | * -Added control over notification method | |
| 45 | * -Added control over when to release notification | |
| 46 | * | |
| 47 | * -Added option to get notification for chats also | |
| 48 | * -Cleaned up code | |
| 49 | * -Added option to notify on click as it's own option | |
| 50 | * rather then as what happens when on focus isn't clicked | |
| 51 | * -Added apply button to change the denotification methods for | |
| 52 | * open conversation windows | |
| 53 | * -Fixed apply to conversations, count now keeps count across applies | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
54 | * -Fixed(?) memory leak, and in the process fixed some stupidities |
| 6302 | 55 | * -Hit enter when done editing the title string entry box to save it |
| 3392 | 56 | * |
| 57 | * Thanks to Carles Pina i Estany <carles@pinux.info> | |
| 58 | * for count of new messages option | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
59 | * |
| 6302 | 60 | * From Brian, 20 July 2003: |
| 61 | * -Use new xml prefs | |
| 62 | * -Better handling of notification states tracking | |
| 63 | * -Better pref change handling | |
| 64 | * -Fixed a possible memleak and possible crash (rare) | |
| 65 | * -Use gtk_window_get_title() rather than gtkwin->title | |
| 66 | * -Other random fixes and cleanups | |
| 6977 | 67 | * |
| 9298 | 68 | * Etan again, 12 August 2003: |
| 6977 | 69 | * -Better use of the new xml prefs |
| 70 | * -Removed all bitmask stuff | |
| 71 | * -Even better pref change handling | |
| 72 | * -Removed unnecessary functions | |
| 73 | * -Reworking of notification/unnotification stuff | |
| 74 | * -Header file include cleanup | |
| 75 | * -General code cleanup | |
| 9298 | 76 | * |
| 77 | * Etan yet again, 04 April 2004: | |
| 78 | * -Re-added Urgent option | |
| 79 | * -Re-added unnotify on focus option (still needs work, as it will only | |
| 80 | * react to focus-in events when the entry or history widgets are focused) | |
| 10492 | 81 | * |
| 82 | * Sean, 08 January, 2005: | |
| 15884 | 83 | * -Added Raise option, formally in Purple proper |
| 3392 | 84 | */ |
| 85 | ||
|
40502
875489636847
pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
86 | #include <glib/gi18n-lib.h> |
| 6302 | 87 | |
|
40360
e21f3bbcc2a5
Update all of the pidgin code to include purple.h
Gary Kramlich <grim@reaperworld.com>
parents:
40197
diff
changeset
|
88 | #include <purple.h> |
|
4202
8b92de3b1c07
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
89 | |
|
40502
875489636847
pidgin.h phase3: create pidgin.h and force its usage
Gary Kramlich <grim@reaperworld.com>
parents:
40360
diff
changeset
|
90 | #include <pidgin.h> |
| 6302 | 91 | |
| 92 | #define NOTIFY_PLUGIN_ID "gtk-x11-notify" | |
| 3710 | 93 | |
| 15884 | 94 | static PurplePlugin *my_plugin = NULL; |
|
33472
24393ecae82e
Make this plugin a bit more friendly with Quartz-enabled GTK+ in MacPorts.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30706
diff
changeset
|
95 | #ifdef HAVE_X11 |
| 14389 | 96 | static GdkAtom _Cardinal = GDK_NONE; |
| 15884 | 97 | static GdkAtom _PurpleUnseenCount = GDK_NONE; |
| 15527 | 98 | #endif |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
99 | |
| 6302 | 100 | /* notification set/unset */ |
| 15884 | 101 | static int notify(PurpleConversation *conv, gboolean increment); |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
102 | static void notify_win(PidginConvWindow *purplewin, PurpleConversation *conv); |
| 15884 | 103 | static void unnotify(PurpleConversation *conv, gboolean reset); |
| 14389 | 104 | static int unnotify_cb(GtkWidget *widget, gpointer data, |
| 15884 | 105 | PurpleConversation *conv); |
| 6302 | 106 | |
| 107 | /* gtk widget callbacks for prefs panel */ | |
| 6977 | 108 | static void type_toggle_cb(GtkWidget *widget, gpointer data); |
| 109 | static void method_toggle_cb(GtkWidget *widget, gpointer data); | |
| 110 | static void notify_toggle_cb(GtkWidget *widget, gpointer data); | |
| 14389 | 111 | static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, |
| 112 | gpointer data); | |
|
12397
aa64ec827fdf
[gaim-migrate @ 14704]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
113 | static void apply_method(void); |
|
aa64ec827fdf
[gaim-migrate @ 14704]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
114 | static void apply_notify(void); |
| 191 | 115 | |
| 6977 | 116 | /* string function */ |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
117 | static void handle_string(PidginConvWindow *purplewin); |
| 6302 | 118 | |
| 14389 | 119 | /* count_title function */ |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
120 | static void handle_count_title(PidginConvWindow *purplewin); |
| 14389 | 121 | |
| 122 | /* count_xprop function */ | |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
123 | static void handle_count_xprop(PidginConvWindow *purplewin); |
| 6302 | 124 | |
| 6977 | 125 | /* urgent function */ |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
126 | static void handle_urgent(PidginConvWindow *purplewin, gboolean set); |
| 10606 | 127 | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
128 | /* present function */ |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
129 | static void handle_present(PurpleConversation *conv); |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
130 | |
| 6302 | 131 | /****************************************/ |
| 132 | /* Begin doing stuff below this line... */ | |
| 133 | /****************************************/ | |
| 14389 | 134 | static guint |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
135 | count_messages(PidginConvWindow *purplewin) |
| 9298 | 136 | { |
| 14389 | 137 | guint count = 0; |
| 14385 | 138 | GList *convs = NULL, *l; |
| 9298 | 139 | |
| 15884 | 140 | for (convs = purplewin->gtkconvs; convs != NULL; convs = convs->next) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
141 | PidginConversation *conv = convs->data; |
| 14385 | 142 | for (l = conv->convs; l != NULL; l = l->next) { |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
143 | count += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(l->data), "notify-message-count")); |
| 14385 | 144 | } |
| 9298 | 145 | } |
| 146 | ||
| 147 | return count; | |
| 148 | } | |
| 6302 | 149 | |
| 6977 | 150 | static int |
| 15884 | 151 | notify(PurpleConversation *conv, gboolean increment) |
| 6977 | 152 | { |
| 14385 | 153 | gint count; |
| 14326 | 154 | gboolean has_focus; |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
155 | PidginConvWindow *purplewin = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
156 | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
157 | if (conv == NULL || PIDGIN_CONVERSATION(conv) == NULL) |
| 6302 | 158 | return 0; |
| 159 | ||
| 6977 | 160 | /* We want to remove the notifications, but not reset the counter */ |
| 161 | unnotify(conv, FALSE); | |
| 162 | ||
| 15884 | 163 | purplewin = PIDGIN_CONVERSATION(conv)->win; |
| 5021 | 164 | |
| 6977 | 165 | /* If we aren't doing notifications for this type of conversation, return */ |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
166 | if ((PURPLE_IS_IM_CONVERSATION(conv) && |
| 15884 | 167 | !purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) || |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
168 | (PURPLE_IS_CHAT_CONVERSATION(conv) && |
| 15884 | 169 | !purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) |
| 6977 | 170 | return 0; |
| 4203 | 171 | |
| 15884 | 172 | g_object_get(G_OBJECT(purplewin->window), |
| 9298 | 173 | "has-toplevel-focus", &has_focus, NULL); |
| 3374 | 174 | |
| 15884 | 175 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || |
|
10984
8d8c654bf34d
[gaim-migrate @ 12819]
Mark Doliner <markdoliner@pidgin.im>
parents:
10971
diff
changeset
|
176 | !has_focus) { |
| 14385 | 177 | if (increment) { |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
178 | count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "notify-message-count")); |
| 14385 | 179 | count++; |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
180 | g_object_set_data(G_OBJECT(conv), "notify-message-count", GINT_TO_POINTER(count)); |
| 14385 | 181 | } |
| 182 | ||
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
183 | notify_win(purplewin, conv); |
| 6977 | 184 | } |
| 6302 | 185 | |
| 186 | return 0; | |
| 187 | } | |
| 188 | ||
| 9298 | 189 | static void |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
190 | notify_win(PidginConvWindow *purplewin, PurpleConversation *conv) |
| 9298 | 191 | { |
| 15884 | 192 | if (count_messages(purplewin) <= 0) |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
193 | return; |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
194 | |
| 15884 | 195 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) |
| 196 | handle_count_title(purplewin); | |
| 197 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count_xprop")) | |
| 198 | handle_count_xprop(purplewin); | |
| 199 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) | |
| 200 | handle_string(purplewin); | |
| 201 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | |
| 202 | handle_urgent(purplewin, TRUE); | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
203 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present")) |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
204 | handle_present(conv); |
| 9298 | 205 | } |
| 206 | ||
| 207 | static void | |
| 15884 | 208 | unnotify(PurpleConversation *conv, gboolean reset) |
| 9298 | 209 | { |
| 15884 | 210 | PurpleConversation *active_conv = NULL; |
|
41696
35f8ce475b21
Rename PidginConversationWindow to PidginDisplayWindow as it holds more than conversations now
Gary Kramlich <grim@reaperworld.com>
parents:
41665
diff
changeset
|
211 | PidginDisplayWindow *displaywin = NULL; |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
212 | GtkWidget *win; |
| 9298 | 213 | |
| 214 | g_return_if_fail(conv != NULL); | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
215 | if (PIDGIN_CONVERSATION(conv) == NULL) |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
216 | return; |
| 9298 | 217 | |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
218 | win = gtk_widget_get_toplevel(PIDGIN_CONVERSATION(conv)->tab_cont); |
|
41696
35f8ce475b21
Rename PidginConversationWindow to PidginDisplayWindow as it holds more than conversations now
Gary Kramlich <grim@reaperworld.com>
parents:
41665
diff
changeset
|
219 | displaywin = PIDGIN_DISPLAY_WINDOW(win); |
|
41184
05b5c210352b
Move conversation management from gtkconv.c to PidginConversationWindow.
Gary Kramlich <grim@reaperworld.com>
parents:
41086
diff
changeset
|
220 | |
|
41696
35f8ce475b21
Rename PidginConversationWindow to PidginDisplayWindow as it holds more than conversations now
Gary Kramlich <grim@reaperworld.com>
parents:
41665
diff
changeset
|
221 | activate_conv = pidgin_display_window_get_selected(purplewin); |
| 9298 | 222 | |
| 223 | /* reset the conversation window title */ | |
| 15884 | 224 | purple_conversation_autoset_title(active_conv); |
| 9298 | 225 | |
| 226 | if (reset) { | |
| 14389 | 227 | /* Only need to actually remove the urgent hinting here, since |
|
41086
631e6cba8635
Fix typos in Pidgin
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
41081
diff
changeset
|
228 | * removing it just to have it re-added in re-notify is an |
| 14389 | 229 | * unnecessary couple extra RTs to the server */ |
| 15884 | 230 | handle_urgent(purplewin, FALSE); |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
231 | g_object_set_data(G_OBJECT(conv), "notify-message-count", GINT_TO_POINTER(0)); |
| 14389 | 232 | /* Same logic as for the urgent hint, xprops are also a RT. |
| 233 | * This needs to go here so that it gets the updated message | |
| 234 | * count. */ | |
| 15884 | 235 | handle_count_xprop(purplewin); |
| 9298 | 236 | } |
| 237 | ||
| 238 | return; | |
| 239 | } | |
| 240 | ||
| 241 | static int | |
| 15884 | 242 | unnotify_cb(GtkWidget *widget, gpointer data, PurpleConversation *conv) |
| 9298 | 243 | { |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
244 | if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "notify-message-count")) != 0) |
| 9298 | 245 | unnotify(conv, TRUE); |
| 246 | ||
| 247 | return 0; | |
| 248 | } | |
| 249 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
250 | static gboolean |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36098
diff
changeset
|
251 | message_displayed_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer _unused) |
| 6977 | 252 | { |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36098
diff
changeset
|
253 | PurpleMessageFlags flags = purple_message_get_flags(msg); |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
254 | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
255 | /* Ignore anything that's not a received message or a system message */ |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
256 | if (!(flags & (PURPLE_MESSAGE_RECV|PURPLE_MESSAGE_SYSTEM))) |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
257 | return FALSE; |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
258 | /* Don't highlight for delayed messages */ |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
259 | if ((flags & PURPLE_MESSAGE_RECV) && (flags & PURPLE_MESSAGE_DELAYED)) |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
260 | return FALSE; |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
261 | /* Check whether to highlight for system message for either chat or IM */ |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
262 | if (flags & PURPLE_MESSAGE_SYSTEM) { |
|
37193
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
263 | if (PURPLE_IS_CHAT_CONVERSATION(conv)) { |
|
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
264 | if (!purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_sys")) |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
265 | return FALSE; |
|
37193
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
266 | } else if (PURPLE_IS_IM_CONVERSATION(conv)) { |
|
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
267 | if (!purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im_sys")) |
|
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
268 | return FALSE; |
|
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
269 | } else { |
|
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
270 | /* System message not from chat or IM, ignore */ |
|
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
271 | return FALSE; |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
272 | } |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
273 | } |
| 37194 | 274 | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
275 | /* If it's a chat, check if we should only highlight when nick is mentioned */ |
| 37194 | 276 | if ((PURPLE_IS_CHAT_CONVERSATION(conv) && |
| 277 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick") && | |
| 278 | !(flags & PURPLE_MESSAGE_NICK))) | |
| 279 | return FALSE; | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
280 | |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
281 | /* Nothing speaks against notifying, do so */ |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
282 | notify(conv, TRUE); |
| 9298 | 283 | |
| 284 | return FALSE; | |
| 285 | } | |
| 286 | ||
| 6977 | 287 | static void |
|
36081
6764e037a308
Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
288 | im_sent_im(PurpleAccount *account, PurpleMessage *msg, gpointer _unused) |
| 14389 | 289 | { |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
290 | PurpleIMConversation *im = NULL; |
| 9298 | 291 | |
| 15884 | 292 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { |
|
36081
6764e037a308
Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
293 | im = purple_conversations_find_im_with_account( |
|
36098
4951752ad038
Split PurpleMessage into incoming, outgoing and system
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36082
diff
changeset
|
294 | purple_message_get_recipient(msg), account); |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
295 | unnotify(PURPLE_CONVERSATION(im), TRUE); |
| 9298 | 296 | } |
| 297 | } | |
| 298 | ||
| 299 | static void | |
|
36082
247d94c903c3
Switch sent-chat-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36081
diff
changeset
|
300 | chat_sent_im(PurpleAccount *account, PurpleMessage *msg, int id) |
| 6977 | 301 | { |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
302 | PurpleChatConversation *chat = NULL; |
| 6977 | 303 | |
| 15884 | 304 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
305 | chat = purple_conversations_find_chat(purple_account_get_connection(account), id); |
|
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
306 | unnotify(PURPLE_CONVERSATION(chat), TRUE); |
| 6977 | 307 | } |
| 3710 | 308 | } |
| 309 | ||
| 6977 | 310 | static int |
| 15884 | 311 | attach_signals(PurpleConversation *conv) |
| 6977 | 312 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
313 | PidginConversation *gtkconv = NULL; |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
314 | GSList *webview_ids = NULL, *entry_ids = NULL; |
| 6977 | 315 | guint id; |
| 316 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
317 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 11581 | 318 | if (!gtkconv) { |
| 15884 | 319 | purple_debug_misc("notify", "Failed to find gtkconv\n"); |
| 11581 | 320 | return 0; |
| 321 | } | |
| 322 | ||
| 15884 | 323 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { |
| 14389 | 324 | /* TODO should really find a way to make this work no matter |
| 325 | * where the focus is inside the conv window, without having | |
| 326 | * to bind to focus-in-event on the g(d|t)kwindow */ | |
| 9298 | 327 | /* try setting the signal on the focus-in-event for |
| 328 | * gtkwin->notebook->container? */ | |
| 329 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", | |
| 330 | G_CALLBACK(unnotify_cb), conv); | |
| 11728 | 331 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 9298 | 332 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
333 | id = g_signal_connect(G_OBJECT(gtkconv->webview), "focus-in-event", |
| 9298 | 334 | G_CALLBACK(unnotify_cb), conv); |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
335 | webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); |
| 6977 | 336 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
337 | |
| 15884 | 338 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { |
| 14389 | 339 | /* TODO similarly should really find a way to allow for |
| 340 | * clicking in other places of the window */ | |
| 9298 | 341 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", |
| 342 | G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 343 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 12286 | 344 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
345 | id = g_signal_connect(G_OBJECT(gtkconv->webview), "button-press-event", |
| 12286 | 346 | G_CALLBACK(unnotify_cb), conv); |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
347 | webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); |
| 3374 | 348 | } |
| 3710 | 349 | |
| 15884 | 350 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { |
| 9298 | 351 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", |
| 352 | G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 353 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 3374 | 354 | } |
| 355 | ||
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
356 | g_object_set_data(G_OBJECT(conv), "notify-webview-signals", webview_ids); |
|
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
357 | g_object_set_data(G_OBJECT(conv), "notify-entry-signals", entry_ids); |
| 4035 | 358 | |
| 3428 | 359 | return 0; |
| 191 | 360 | } |
| 361 | ||
| 6977 | 362 | static void |
| 15884 | 363 | detach_signals(PurpleConversation *conv) |
| 6977 | 364 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
365 | PidginConversation *gtkconv = NULL; |
| 11606 | 366 | GSList *ids = NULL, *l; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
367 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
368 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 11581 | 369 | if (!gtkconv) |
| 370 | return; | |
| 4203 | 371 | |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
372 | ids = g_object_get_data(G_OBJECT(conv), "notify-webview-signals"); |
| 11606 | 373 | for (l = ids; l != NULL; l = l->next) |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
374 | g_signal_handler_disconnect(gtkconv->webview, GPOINTER_TO_INT(l->data)); |
| 11606 | 375 | g_slist_free(ids); |
| 6302 | 376 | |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
377 | ids = g_object_get_data(G_OBJECT(conv), "notify-entry-signals"); |
| 11606 | 378 | for (l = ids; l != NULL; l = l->next) |
| 379 | g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(l->data)); | |
| 380 | g_slist_free(ids); | |
| 3710 | 381 | |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
382 | g_object_set_data(G_OBJECT(conv), "notify-message-count", GINT_TO_POINTER(0)); |
| 14385 | 383 | |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
384 | g_object_set_data(G_OBJECT(conv), "notify-webview-signals", NULL); |
|
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
385 | g_object_set_data(G_OBJECT(conv), "notify-entry-signals", NULL); |
| 3710 | 386 | } |
| 387 | ||
| 6977 | 388 | static void |
| 15884 | 389 | conv_created(PurpleConversation *conv) |
| 6977 | 390 | { |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
391 | g_object_set_data(G_OBJECT(conv), "notify-message-count", |
| 14389 | 392 | GINT_TO_POINTER(0)); |
| 14385 | 393 | |
| 14389 | 394 | /* always attach the signals, notify() will take care of conversation |
| 395 | * type checking */ | |
| 6977 | 396 | attach_signals(conv); |
| 3374 | 397 | } |
| 398 | ||
| 6977 | 399 | static void |
| 15884 | 400 | conv_switched(PurpleConversation *conv) |
| 6977 | 401 | { |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
402 | #if 0 |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
403 | PidginConvWindow *purplewin = purple_conversation_get_window(new_conv); |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
404 | #endif |
| 6302 | 405 | |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
406 | /* |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
407 | * If the conversation was switched, then make sure we re-notify |
| 15884 | 408 | * because Purple will have overwritten our custom window title. |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
409 | */ |
| 14385 | 410 | notify(conv, FALSE); |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
411 | |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
412 | #if 0 |
| 9298 | 413 | printf("conv_switched - %p - %p\n", old_conv, new_conv); |
| 15884 | 414 | printf("count - %d\n", count_messages(purplewin)); |
| 415 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) | |
| 9298 | 416 | unnotify(new_conv, FALSE); |
| 417 | else { | |
| 418 | /* if we don't have notification on the window then we don't want to | |
| 419 | * re-notify it */ | |
| 15884 | 420 | if (count_messages(purplewin)) |
| 421 | notify_win(purplewin); | |
| 9298 | 422 | } |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
423 | #endif |
| 6977 | 424 | } |
| 6302 | 425 | |
| 6977 | 426 | static void |
| 15884 | 427 | deleting_conv(PurpleConversation *conv) |
| 6977 | 428 | { |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
429 | PidginConvWindow *purplewin = NULL; |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
430 | PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
431 | |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
432 | if (gtkconv == NULL) |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
433 | return; |
| 9298 | 434 | |
| 6977 | 435 | detach_signals(conv); |
| 3392 | 436 | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
437 | purplewin = gtkconv->win; |
| 11606 | 438 | |
| 15884 | 439 | handle_urgent(purplewin, FALSE); |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
440 | g_object_set_data(G_OBJECT(conv), "notify-message-count", GINT_TO_POINTER(0)); |
| 11606 | 441 | |
| 442 | return; | |
| 443 | ||
| 11581 | 444 | #if 0 |
| 445 | /* i think this line crashes */ | |
| 15884 | 446 | if (count_messages(purplewin)) |
| 447 | notify_win(purplewin); | |
| 11581 | 448 | #endif |
| 6977 | 449 | } |
| 450 | ||
| 451 | static void | |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
452 | handle_string(PidginConvWindow *purplewin) |
| 9298 | 453 | { |
| 454 | GtkWindow *window = NULL; | |
| 455 | gchar newtitle[256]; | |
| 456 | ||
| 15884 | 457 | g_return_if_fail(purplewin != NULL); |
| 9298 | 458 | |
| 15884 | 459 | window = GTK_WINDOW(purplewin->window); |
| 9298 | 460 | g_return_if_fail(window != NULL); |
| 461 | ||
| 462 | g_snprintf(newtitle, sizeof(newtitle), "%s%s", | |
| 15884 | 463 | purple_prefs_get_string("/plugins/gtk/X11/notify/title_string"), |
| 9298 | 464 | gtk_window_get_title(window)); |
| 465 | gtk_window_set_title(window, newtitle); | |
| 466 | } | |
| 467 | ||
| 468 | static void | |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
469 | handle_count_title(PidginConvWindow *purplewin) |
| 9298 | 470 | { |
| 471 | GtkWindow *window; | |
| 472 | char newtitle[256]; | |
| 473 | ||
| 15884 | 474 | g_return_if_fail(purplewin != NULL); |
| 9298 | 475 | |
| 15884 | 476 | window = GTK_WINDOW(purplewin->window); |
| 9298 | 477 | g_return_if_fail(window != NULL); |
| 478 | ||
| 10606 | 479 | g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", |
| 15884 | 480 | count_messages(purplewin), gtk_window_get_title(window)); |
| 9298 | 481 | gtk_window_set_title(window, newtitle); |
| 482 | } | |
| 483 | ||
| 484 | static void | |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
485 | handle_count_xprop(PidginConvWindow *purplewin) |
| 14389 | 486 | { |
|
33472
24393ecae82e
Make this plugin a bit more friendly with Quartz-enabled GTK+ in MacPorts.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30706
diff
changeset
|
487 | #ifdef HAVE_X11 |
| 14389 | 488 | guint count; |
| 489 | GtkWidget *window; | |
| 490 | GdkWindow *gdkwin; | |
| 491 | ||
| 15884 | 492 | window = purplewin->window; |
| 14389 | 493 | g_return_if_fail(window != NULL); |
| 494 | ||
| 15884 | 495 | if (_PurpleUnseenCount == GDK_NONE) { |
| 496 | _PurpleUnseenCount = gdk_atom_intern("_PIDGIN_UNSEEN_COUNT", FALSE); | |
| 14389 | 497 | } |
| 498 | ||
| 499 | if (_Cardinal == GDK_NONE) { | |
| 500 | _Cardinal = gdk_atom_intern("CARDINAL", FALSE); | |
| 501 | } | |
| 502 | ||
| 15884 | 503 | count = count_messages(purplewin); |
|
30010
2b3e5bbd0492
Prepare Pidgin plugins for GTK+3.0. They're almost GSeal-compliant, except
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
27858
diff
changeset
|
504 | gdkwin = gtk_widget_get_window(window); |
| 14389 | 505 | |
| 15884 | 506 | gdk_property_change(gdkwin, _PurpleUnseenCount, _Cardinal, 32, |
| 14389 | 507 | GDK_PROP_MODE_REPLACE, (guchar *) &count, 1); |
| 508 | #endif | |
| 509 | } | |
| 510 | ||
| 511 | static void | |
|
35610
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
512 | handle_urgent(PidginConvWindow *purplewin, gboolean set) |
| 6977 | 513 | { |
|
25382
6a3ab0bc549d
Check that the PidginWindow we get in handle_urgent actually exists and has
Etan Reisner <deryni@pidgin.im>
parents:
24506
diff
changeset
|
514 | g_return_if_fail(purplewin != NULL); |
|
6a3ab0bc549d
Check that the PidginWindow we get in handle_urgent actually exists and has
Etan Reisner <deryni@pidgin.im>
parents:
24506
diff
changeset
|
515 | g_return_if_fail(purplewin->window != NULL); |
|
6a3ab0bc549d
Check that the PidginWindow we get in handle_urgent actually exists and has
Etan Reisner <deryni@pidgin.im>
parents:
24506
diff
changeset
|
516 | |
|
40555
0bf5825aab0a
Replace pidgin_set_urgent with gtk_window_set_urgency_hint
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
517 | gtk_window_set_urgency_hint(GTK_WINDOW(purplewin->window), set); |
| 4035 | 518 | } |
| 519 | ||
| 6977 | 520 | static void |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
521 | handle_present(PurpleConversation *conv) |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
522 | { |
|
27858
3ade5991f52f
Fix a crash with the Message Notification plugin and the 'hidden' gtkconv
Paul Aurich <darkrain42@pidgin.im>
parents:
25382
diff
changeset
|
523 | if (pidgin_conv_is_hidden(PIDGIN_CONVERSATION(conv))) |
|
3ade5991f52f
Fix a crash with the Message Notification plugin and the 'hidden' gtkconv
Paul Aurich <darkrain42@pidgin.im>
parents:
25382
diff
changeset
|
524 | return; |
|
3ade5991f52f
Fix a crash with the Message Notification plugin and the 'hidden' gtkconv
Paul Aurich <darkrain42@pidgin.im>
parents:
25382
diff
changeset
|
525 | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
526 | purple_conversation_present(conv); |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
527 | } |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
528 | |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
529 | static void |
| 6977 | 530 | type_toggle_cb(GtkWidget *widget, gpointer data) |
| 531 | { | |
| 532 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 533 | gchar pref[256]; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
534 | |
| 14389 | 535 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 536 | (char *)data); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
537 | |
| 15884 | 538 | purple_prefs_set_bool(pref, on); |
| 3374 | 539 | } |
| 540 | ||
| 6977 | 541 | static void |
| 542 | method_toggle_cb(GtkWidget *widget, gpointer data) | |
| 543 | { | |
| 544 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 545 | gchar pref[256]; | |
| 546 | ||
| 14389 | 547 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 548 | (char *)data); | |
| 3374 | 549 | |
| 15884 | 550 | purple_prefs_set_bool(pref, on); |
| 6977 | 551 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37874
diff
changeset
|
552 | if (purple_strequal(data, "method_string")) { |
| 6977 | 553 | GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry"); |
| 554 | gtk_widget_set_sensitive(entry, on); | |
| 555 | ||
| 15884 | 556 | purple_prefs_set_string("/plugins/gtk/X11/notify/title_string", |
|
41531
2b86501d13fe
Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
557 | gtk_editable_get_text(GTK_EDITABLE(entry))); |
| 6977 | 558 | } |
| 559 | ||
| 560 | apply_method(); | |
| 3374 | 561 | } |
| 562 | ||
| 6977 | 563 | static void |
| 564 | notify_toggle_cb(GtkWidget *widget, gpointer data) | |
| 565 | { | |
| 566 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 567 | gchar pref[256]; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
568 | |
| 14389 | 569 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 570 | (char *)data); | |
| 3374 | 571 | |
| 15884 | 572 | purple_prefs_set_bool(pref, on); |
| 6977 | 573 | |
| 574 | apply_notify(); | |
| 3374 | 575 | } |
| 576 | ||
| 6977 | 577 | static gboolean |
| 578 | options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data) | |
| 579 | { | |
| 580 | if (data == NULL) | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6977
diff
changeset
|
581 | return FALSE; |
| 6302 | 582 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37874
diff
changeset
|
583 | if (purple_strequal(data, "method_string")) { |
| 15884 | 584 | purple_prefs_set_string("/plugins/gtk/X11/notify/title_string", |
|
41531
2b86501d13fe
Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
585 | gtk_editable_get_text(GTK_EDITABLE(widget))); |
| 3374 | 586 | } |
| 6302 | 587 | |
| 6977 | 588 | apply_method(); |
| 6302 | 589 | |
| 590 | return FALSE; | |
| 591 | } | |
| 592 | ||
| 6977 | 593 | static void |
| 14389 | 594 | apply_method() |
| 595 | { | |
|
13664
fdc3b588f248
[gaim-migrate @ 16065]
Richard Laager <rlaager@pidgin.im>
parents:
13550
diff
changeset
|
596 | GList *convs; |
| 6977 | 597 | |
|
34655
6a939719ea98
Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents:
34635
diff
changeset
|
598 | for (convs = purple_conversations_get_all(); convs != NULL; |
| 14389 | 599 | convs = convs->next) { |
| 15884 | 600 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 6302 | 601 | |
| 6977 | 602 | /* remove notifications */ |
| 9298 | 603 | unnotify(conv, FALSE); |
| 604 | ||
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
605 | if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "notify-message-count")) != 0) |
| 6977 | 606 | /* reattach appropriate notifications */ |
| 14385 | 607 | notify(conv, FALSE); |
| 6977 | 608 | } |
| 3374 | 609 | } |
| 610 | ||
| 6977 | 611 | static void |
| 612 | apply_notify() | |
| 613 | { | |
|
34655
6a939719ea98
Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents:
34635
diff
changeset
|
614 | GList *convs = purple_conversations_get_all(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
615 | |
| 6977 | 616 | while (convs) { |
| 15884 | 617 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 4203 | 618 | |
| 6977 | 619 | /* detach signals */ |
| 620 | detach_signals(conv); | |
| 621 | /* reattach appropriate signals */ | |
| 622 | attach_signals(conv); | |
| 4035 | 623 | |
| 6977 | 624 | convs = convs->next; |
| 4035 | 625 | } |
| 626 | } | |
| 627 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
628 | static GtkWidget * |
| 15884 | 629 | get_config_frame(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
630 | { |
| 6977 | 631 | GtkWidget *ret = NULL, *frame = NULL; |
| 632 | GtkWidget *vbox = NULL, *hbox = NULL; | |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
633 | GtkWidget *toggle = NULL, *entry = NULL, *ref; |
| 6302 | 634 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35037
diff
changeset
|
635 | ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18); |
| 6302 | 636 | gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
| 3392 | 637 | |
| 6302 | 638 | /*---------- "Notify For" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
639 | frame = pidgin_make_frame(ret, _("Notify For")); |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35037
diff
changeset
|
640 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 6302 | 641 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 642 | ||
| 3710 | 643 | toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
| 644 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 6977 | 645 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 646 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); |
| 6977 | 647 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 648 | G_CALLBACK(type_toggle_cb), "type_im"); |
| 3710 | 649 | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
650 | ref = toggle; |
|
37874
660e41d31deb
Message Notification: Drop redundant "Notify for"
Richard Laager <rlaager@pidgin.im>
parents:
37220
diff
changeset
|
651 | toggle = gtk_check_button_new_with_mnemonic(_("\tS_ystem messages")); |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
652 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
653 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
654 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im_sys")); |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
655 | g_signal_connect(G_OBJECT(toggle), "toggled", |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
656 | G_CALLBACK(type_toggle_cb), "type_im_sys"); |
|
39173
7adf95ad7b4a
Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
657 | g_object_bind_property(ref, "active", toggle, "sensitive", |
|
7adf95ad7b4a
Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
658 | G_BINDING_SYNC_CREATE); |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
659 | |
| 6977 | 660 | toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
| 3710 | 661 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 6977 | 662 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 663 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); |
| 6977 | 664 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 665 | G_CALLBACK(type_toggle_cb), "type_chat"); |
| 6977 | 666 | |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
667 | ref = toggle; |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22782
diff
changeset
|
668 | toggle = gtk_check_button_new_with_mnemonic(_("\t_Only when someone says your username")); |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
669 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
|
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
670 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 671 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick")); |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
672 | g_signal_connect(G_OBJECT(toggle), "toggled", |
|
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
673 | G_CALLBACK(type_toggle_cb), "type_chat_nick"); |
|
39173
7adf95ad7b4a
Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
674 | g_object_bind_property(ref, "active", toggle, "sensitive", |
|
7adf95ad7b4a
Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
675 | G_BINDING_SYNC_CREATE); |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
676 | |
|
37874
660e41d31deb
Message Notification: Drop redundant "Notify for"
Richard Laager <rlaager@pidgin.im>
parents:
37220
diff
changeset
|
677 | toggle = gtk_check_button_new_with_mnemonic(_("\tS_ystem messages")); |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
678 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
679 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
680 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_sys")); |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
681 | g_signal_connect(G_OBJECT(toggle), "toggled", |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
682 | G_CALLBACK(type_toggle_cb), "type_chat_sys"); |
|
39173
7adf95ad7b4a
Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
683 | g_object_bind_property(ref, "active", toggle, "sensitive", |
|
7adf95ad7b4a
Replace pidgin_toggle_sensitive by g_object_bind_property.
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
38358
diff
changeset
|
684 | G_BINDING_SYNC_CREATE); |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
685 | |
| 6977 | 686 | toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); |
| 687 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 688 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 689 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); |
| 6977 | 690 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 691 | G_CALLBACK(type_toggle_cb), "type_focused"); |
| 3710 | 692 | |
| 6302 | 693 | /*---------- "Notification Methods" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
694 | frame = pidgin_make_frame(ret, _("Notification Methods")); |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35037
diff
changeset
|
695 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 6302 | 696 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 697 | ||
| 6977 | 698 | /* String method button */ |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35037
diff
changeset
|
699 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 18); |
| 3565 | 700 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 6302 | 701 | toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
| 6977 | 702 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 703 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
| 3565 | 704 | gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 6977 | 705 | |
| 6302 | 706 | entry = gtk_entry_new(); |
| 707 | gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
| 708 | gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
| 6977 | 709 | gtk_widget_set_sensitive(GTK_WIDGET(entry), |
| 15884 | 710 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
|
41531
2b86501d13fe
Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
711 | gtk_editable_set_text(GTK_EDITABLE(entry), |
|
2b86501d13fe
Replace gtk_entry_[gs]et_text with gtk_editable_[gs]et_text
Gary Kramlich <grim@reaperworld.com>
parents:
41314
diff
changeset
|
712 | purple_prefs_get_string("/plugins/gtk/X11/notify/title_string")); |
| 6977 | 713 | g_object_set_data(G_OBJECT(toggle), "title-entry", entry); |
| 714 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 715 | G_CALLBACK(method_toggle_cb), "method_string"); |
| 6977 | 716 | g_signal_connect(G_OBJECT(entry), "focus-out-event", |
| 9298 | 717 | G_CALLBACK(options_entry_cb), "method_string"); |
| 3374 | 718 | |
| 6977 | 719 | /* Count method button */ |
| 720 | toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | |
| 721 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 722 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); |
| 6977 | 723 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 724 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 725 | G_CALLBACK(method_toggle_cb), "method_count"); |
| 4035 | 726 | |
|
33472
24393ecae82e
Make this plugin a bit more friendly with Quartz-enabled GTK+ in MacPorts.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30706
diff
changeset
|
727 | #ifdef HAVE_X11 |
| 14389 | 728 | /* Count xprop method button */ |
| 729 | toggle = gtk_check_button_new_with_mnemonic(_("Insert count of new message into _X property")); | |
| 730 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 731 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 732 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count_xprop")); |
| 14389 | 733 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 734 | G_CALLBACK(method_toggle_cb), "method_count_xprop"); | |
| 735 | ||
| 6977 | 736 | /* Urgent method button */ |
| 737 | toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); | |
|
24431
f4b9e73eec48
Allow the message notification plugin to flash windows on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
22945
diff
changeset
|
738 | #else |
|
24506
4d624cd775bd
Mark for translation now that we're unfrozen.
Daniel Atallah <datallah@pidgin.im>
parents:
24431
diff
changeset
|
739 | toggle = gtk_check_button_new_with_mnemonic(_("_Flash window")); |
|
24431
f4b9e73eec48
Allow the message notification plugin to flash windows on win32.
Daniel Atallah <datallah@pidgin.im>
parents:
22945
diff
changeset
|
740 | #endif |
| 6977 | 741 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 742 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 743 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); |
| 9298 | 744 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 745 | G_CALLBACK(method_toggle_cb), "method_urgent"); | |
| 3710 | 746 | |
| 10606 | 747 | /* Raise window method button */ |
| 748 | toggle = gtk_check_button_new_with_mnemonic(_("R_aise conversation window")); | |
| 749 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 750 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 751 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")); |
| 10606 | 752 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 753 | G_CALLBACK(method_toggle_cb), "method_raise"); | |
| 754 | ||
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
755 | /* Present conversation method button */ |
|
37220
5b46f15834d9
Add a note for translators
Richard Laager <rlaager@pidgin.im>
parents:
37190
diff
changeset
|
756 | /* Translators: "Present" as used here is a verb. The plugin presents |
|
5b46f15834d9
Add a note for translators
Richard Laager <rlaager@pidgin.im>
parents:
37190
diff
changeset
|
757 | * the window to the user. */ |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
758 | toggle = gtk_check_button_new_with_mnemonic(_("_Present conversation window")); |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
759 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
760 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
761 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present")); |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
762 | g_signal_connect(G_OBJECT(toggle), "toggled", |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
763 | G_CALLBACK(method_toggle_cb), "method_present"); |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
764 | |
| 6977 | 765 | /*---------- "Notification Removals" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
766 | frame = pidgin_make_frame(ret, _("Notification Removal")); |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35037
diff
changeset
|
767 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 6302 | 768 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 3374 | 769 | |
| 6977 | 770 | /* Remove on focus button */ |
| 771 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | |
| 772 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 773 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 774 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); |
| 6977 | 775 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); |
| 776 | ||
| 777 | /* Remove on click button */ | |
| 778 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | |
| 779 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 780 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 781 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); |
| 6977 | 782 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 783 | G_CALLBACK(notify_toggle_cb), "notify_click"); |
| 3710 | 784 | |
| 6977 | 785 | /* Remove on type button */ |
| 786 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | |
| 787 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 788 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 789 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); |
| 6977 | 790 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 791 | G_CALLBACK(notify_toggle_cb), "notify_type"); |
| 4035 | 792 | |
| 6977 | 793 | /* Remove on message send button */ |
| 794 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | |
| 795 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 796 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 797 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); |
| 6977 | 798 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 799 | G_CALLBACK(notify_toggle_cb), "notify_send"); |
| 3565 | 800 | |
| 6977 | 801 | #if 0 |
| 802 | /* Remove on conversation switch button */ | |
| 9298 | 803 | toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); |
| 6977 | 804 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 805 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 806 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); |
| 6977 | 807 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 808 | G_CALLBACK(notify_toggle_cb), "notify_switch"); |
| 6977 | 809 | #endif |
| 810 | ||
| 811 | gtk_widget_show_all(ret); | |
| 812 | return ret; | |
| 3374 | 813 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
814 | |
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
815 | static GPluginPluginInfo * |
|
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
816 | notify_query(GError **error) |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
817 | { |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
818 | const gchar * const authors[] = { |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
819 | "Etan Reisner <deryni@eden.rutgers.edu>", |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
820 | "Brian Tarricone <bjt23@cornell.edu>", |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
821 | NULL |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
822 | }; |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
823 | |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
824 | return pidgin_plugin_info_new( |
|
36935
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
825 | "id", NOTIFY_PLUGIN_ID, |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
826 | "name", N_("Message Notification"), |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
827 | "version", DISPLAY_VERSION, |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
828 | "category", N_("Notification"), |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
829 | "summary", N_("Provides a variety of ways of notifying " |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
830 | "you of unread messages."), |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
831 | "description", N_("Provides a variety of ways of notifying " |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
832 | "you of unread messages."), |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
833 | "authors", authors, |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
834 | "website", PURPLE_WEBSITE, |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
835 | "abi-version", PURPLE_ABI_VERSION, |
|
5384600e613c
Made finch and pidgin pref property names shorter: "gnt-pref-frame-cb" and "gtk-config-frame-cb"
Ankit Vani <a@nevitus.org>
parents:
36934
diff
changeset
|
836 | "gtk-config-frame-cb", get_config_frame, |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
837 | NULL |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
838 | ); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
839 | } |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
840 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
841 | static gboolean |
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
842 | notify_load(GPluginPlugin *plugin, GError **error) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
843 | { |
|
34655
6a939719ea98
Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents:
34635
diff
changeset
|
844 | GList *convs = purple_conversations_get_all(); |
| 15884 | 845 | void *conv_handle = purple_conversations_get_handle(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
846 | void *gtk_conv_handle = pidgin_conversations_get_handle(); |
| 6302 | 847 | |
| 848 | my_plugin = plugin; | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
849 | |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
850 | purple_prefs_add_none("/plugins/gtk"); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
851 | purple_prefs_add_none("/plugins/gtk/X11"); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
852 | purple_prefs_add_none("/plugins/gtk/X11/notify"); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
853 | |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
854 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
|
37193
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
855 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_im_sys", FALSE); |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
856 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
857 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_nick", FALSE); |
|
37193
ab3750dcd85e
Merge with release-2.x.y (with some manual merge fixes, most notably in pidgin/plugins/notify.c)
Daniel Atallah <datallah@pidgin.im>
diff
changeset
|
858 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_sys", FALSE); |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
859 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
860 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
861 | purple_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
862 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
863 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
864 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count_xprop", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
865 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
866 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_present", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
867 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", TRUE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
868 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
869 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
870 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
871 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
872 | |
| 15884 | 873 | purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41299
diff
changeset
|
874 | G_CALLBACK(message_displayed_cb), NULL); |
| 15884 | 875 | purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41299
diff
changeset
|
876 | G_CALLBACK(message_displayed_cb), NULL); |
| 15884 | 877 | purple_signal_connect(gtk_conv_handle, "conversation-switched", plugin, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41299
diff
changeset
|
878 | G_CALLBACK(conv_switched), NULL); |
| 15884 | 879 | purple_signal_connect(conv_handle, "sent-im-msg", plugin, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41299
diff
changeset
|
880 | G_CALLBACK(im_sent_im), NULL); |
| 15884 | 881 | purple_signal_connect(conv_handle, "sent-chat-msg", plugin, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41299
diff
changeset
|
882 | G_CALLBACK(chat_sent_im), NULL); |
| 15884 | 883 | purple_signal_connect(conv_handle, "conversation-created", plugin, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41299
diff
changeset
|
884 | G_CALLBACK(conv_created), NULL); |
| 15884 | 885 | purple_signal_connect(conv_handle, "deleting-conversation", plugin, |
|
41314
0dc72eacd8bf
Replace PURPLE_CALLBACK by G_CALLBACK
Elliott Sales de Andrade <quantum.analyst@gmail.com>
parents:
41299
diff
changeset
|
886 | G_CALLBACK(deleting_conv), NULL); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
887 | |
| 6977 | 888 | while (convs) { |
| 15884 | 889 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 6302 | 890 | |
| 891 | /* attach signals */ | |
| 6977 | 892 | attach_signals(conv); |
| 6302 | 893 | |
| 6977 | 894 | convs = convs->next; |
| 6302 | 895 | } |
| 896 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
897 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
898 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
899 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
900 | static gboolean |
|
41081
0c1c063d71f6
Add the unload parameter to a few plugins that I missed on the gplugin 0.35.0 update
Gary Kramlich <grim@reaperworld.com>
parents:
40894
diff
changeset
|
901 | notify_unload(GPluginPlugin *plugin, gboolean shutdown, GError **error) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
902 | { |
|
34655
6a939719ea98
Replaced purple_conversations_get() with purple_conversations_get_all(), similar to other purple entities
Ankit Vani <a@nevitus.org>
parents:
34635
diff
changeset
|
903 | GList *convs = purple_conversations_get_all(); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
904 | |
| 6977 | 905 | while (convs) { |
| 15884 | 906 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
907 | |
| 6302 | 908 | /* kill signals */ |
| 6977 | 909 | detach_signals(conv); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
910 | |
| 6977 | 911 | convs = convs->next; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
912 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
913 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
914 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
915 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
916 | |
|
40894
80d9d7a73a60
Convert the Pidgin plugins to use GPLUGIN_NATIVE_PLUGIN_DECLARE
Gary Kramlich <grim@reaperworld.com>
parents:
40555
diff
changeset
|
917 | GPLUGIN_NATIVE_PLUGIN_DECLARE(notify) |