Tue, 13 Oct 2020 00:42:59 -0500
Replace pidgin_set_urgent with gtk_window_set_urgency_hint
Testing Done:
Compiled and grepped for usage of the winpidgin functions that were removed.
Reviewed at https://reviews.imfreedom.org/r/161/
| 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 | |
| 128 | /* raise 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
|
129 | static void handle_raise(PidginConvWindow *purplewin); |
| 3710 | 130 | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
131 | /* 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
|
132 | 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
|
133 | |
| 6302 | 134 | /****************************************/ |
| 135 | /* Begin doing stuff below this line... */ | |
| 136 | /****************************************/ | |
| 14389 | 137 | 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
|
138 | count_messages(PidginConvWindow *purplewin) |
| 9298 | 139 | { |
| 14389 | 140 | guint count = 0; |
| 14385 | 141 | GList *convs = NULL, *l; |
| 9298 | 142 | |
| 15884 | 143 | 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
|
144 | PidginConversation *conv = convs->data; |
| 14385 | 145 | 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
|
146 | count += GPOINTER_TO_INT(g_object_get_data(G_OBJECT(l->data), "notify-message-count")); |
| 14385 | 147 | } |
| 9298 | 148 | } |
| 149 | ||
| 150 | return count; | |
| 151 | } | |
| 6302 | 152 | |
| 6977 | 153 | static int |
| 15884 | 154 | notify(PurpleConversation *conv, gboolean increment) |
| 6977 | 155 | { |
| 14385 | 156 | gint count; |
| 14326 | 157 | 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
|
158 | PidginConvWindow *purplewin = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
159 | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
160 | if (conv == NULL || PIDGIN_CONVERSATION(conv) == NULL) |
| 6302 | 161 | return 0; |
| 162 | ||
| 6977 | 163 | /* We want to remove the notifications, but not reset the counter */ |
| 164 | unnotify(conv, FALSE); | |
| 165 | ||
| 15884 | 166 | purplewin = PIDGIN_CONVERSATION(conv)->win; |
| 5021 | 167 | |
| 6977 | 168 | /* 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
|
169 | if ((PURPLE_IS_IM_CONVERSATION(conv) && |
| 15884 | 170 | !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
|
171 | (PURPLE_IS_CHAT_CONVERSATION(conv) && |
| 15884 | 172 | !purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) |
| 6977 | 173 | return 0; |
| 4203 | 174 | |
| 15884 | 175 | g_object_get(G_OBJECT(purplewin->window), |
| 9298 | 176 | "has-toplevel-focus", &has_focus, NULL); |
| 3374 | 177 | |
| 15884 | 178 | 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
|
179 | !has_focus) { |
| 14385 | 180 | 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
|
181 | count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "notify-message-count")); |
| 14385 | 182 | 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
|
183 | g_object_set_data(G_OBJECT(conv), "notify-message-count", GINT_TO_POINTER(count)); |
| 14385 | 184 | } |
| 185 | ||
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
186 | notify_win(purplewin, conv); |
| 6977 | 187 | } |
| 6302 | 188 | |
| 189 | return 0; | |
| 190 | } | |
| 191 | ||
| 9298 | 192 | 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
|
193 | notify_win(PidginConvWindow *purplewin, PurpleConversation *conv) |
| 9298 | 194 | { |
| 15884 | 195 | if (count_messages(purplewin) <= 0) |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
196 | return; |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
197 | |
| 15884 | 198 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) |
| 199 | handle_count_title(purplewin); | |
| 200 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count_xprop")) | |
| 201 | handle_count_xprop(purplewin); | |
| 202 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) | |
| 203 | handle_string(purplewin); | |
| 204 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | |
| 205 | handle_urgent(purplewin, TRUE); | |
| 206 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")) | |
| 207 | handle_raise(purplewin); | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
208 | 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
|
209 | handle_present(conv); |
| 9298 | 210 | } |
| 211 | ||
| 212 | static void | |
| 15884 | 213 | unnotify(PurpleConversation *conv, gboolean reset) |
| 9298 | 214 | { |
| 15884 | 215 | PurpleConversation *active_conv = NULL; |
|
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
|
216 | PidginConvWindow *purplewin = NULL; |
| 9298 | 217 | |
| 218 | g_return_if_fail(conv != NULL); | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
219 | if (PIDGIN_CONVERSATION(conv) == NULL) |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
220 | return; |
| 9298 | 221 | |
| 15884 | 222 | purplewin = PIDGIN_CONVERSATION(conv)->win; |
| 223 | active_conv = pidgin_conv_window_get_active_conversation(purplewin); | |
| 9298 | 224 | |
| 225 | /* reset the conversation window title */ | |
| 15884 | 226 | purple_conversation_autoset_title(active_conv); |
| 9298 | 227 | |
| 228 | if (reset) { | |
| 14389 | 229 | /* Only need to actually remove the urgent hinting here, since |
| 230 | * removing it just to have it readded in re-notify is an | |
| 231 | * unnecessary couple extra RTs to the server */ | |
| 15884 | 232 | 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
|
233 | g_object_set_data(G_OBJECT(conv), "notify-message-count", GINT_TO_POINTER(0)); |
| 14389 | 234 | /* Same logic as for the urgent hint, xprops are also a RT. |
| 235 | * This needs to go here so that it gets the updated message | |
| 236 | * count. */ | |
| 15884 | 237 | handle_count_xprop(purplewin); |
| 9298 | 238 | } |
| 239 | ||
| 240 | return; | |
| 241 | } | |
| 242 | ||
| 243 | static int | |
| 15884 | 244 | unnotify_cb(GtkWidget *widget, gpointer data, PurpleConversation *conv) |
| 9298 | 245 | { |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
246 | if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "notify-message-count")) != 0) |
| 9298 | 247 | unnotify(conv, TRUE); |
| 248 | ||
| 249 | return 0; | |
| 250 | } | |
| 251 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
252 | static gboolean |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36098
diff
changeset
|
253 | message_displayed_cb(PurpleConversation *conv, PurpleMessage *msg, gpointer _unused) |
| 6977 | 254 | { |
|
36110
63663622e327
Switch write_conv and (displaying|displayed)-(im|chat)-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36098
diff
changeset
|
255 | PurpleMessageFlags flags = purple_message_get_flags(msg); |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
256 | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
257 | /* 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
|
258 | 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
|
259 | return FALSE; |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
260 | /* Don't highlight for delayed messages */ |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
261 | 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
|
262 | return FALSE; |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
263 | /* 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
|
264 | 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
|
265 | 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
|
266 | 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
|
267 | 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
|
268 | } 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
|
269 | 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
|
270 | 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
|
271 | } 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
|
272 | /* 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
|
273 | return FALSE; |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
274 | } |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
275 | } |
| 37194 | 276 | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
277 | /* If it's a chat, check if we should only highlight when nick is mentioned */ |
| 37194 | 278 | if ((PURPLE_IS_CHAT_CONVERSATION(conv) && |
| 279 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick") && | |
| 280 | !(flags & PURPLE_MESSAGE_NICK))) | |
| 281 | return FALSE; | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
282 | |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
283 | /* Nothing speaks against notifying, do so */ |
|
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
284 | notify(conv, TRUE); |
| 9298 | 285 | |
| 286 | return FALSE; | |
| 287 | } | |
| 288 | ||
| 6977 | 289 | static void |
|
36081
6764e037a308
Switch sent-im-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35610
diff
changeset
|
290 | im_sent_im(PurpleAccount *account, PurpleMessage *msg, gpointer _unused) |
| 14389 | 291 | { |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
292 | PurpleIMConversation *im = NULL; |
| 9298 | 293 | |
| 15884 | 294 | 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
|
295 | 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
|
296 | 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
|
297 | unnotify(PURPLE_CONVERSATION(im), TRUE); |
| 9298 | 298 | } |
| 299 | } | |
| 300 | ||
| 301 | static void | |
|
36082
247d94c903c3
Switch sent-chat-msg to PurpleMessage
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
36081
diff
changeset
|
302 | chat_sent_im(PurpleAccount *account, PurpleMessage *msg, int id) |
| 6977 | 303 | { |
|
34660
68c776e3436e
Refactored pidgin plugins to use the GObject conversation API
Ankit Vani <a@nevitus.org>
parents:
34655
diff
changeset
|
304 | PurpleChatConversation *chat = NULL; |
| 6977 | 305 | |
| 15884 | 306 | 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
|
307 | 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
|
308 | unnotify(PURPLE_CONVERSATION(chat), TRUE); |
| 6977 | 309 | } |
| 3710 | 310 | } |
| 311 | ||
| 6977 | 312 | static int |
| 15884 | 313 | attach_signals(PurpleConversation *conv) |
| 6977 | 314 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
315 | 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
|
316 | GSList *webview_ids = NULL, *entry_ids = NULL; |
| 6977 | 317 | guint id; |
| 318 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
319 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 11581 | 320 | if (!gtkconv) { |
| 15884 | 321 | purple_debug_misc("notify", "Failed to find gtkconv\n"); |
| 11581 | 322 | return 0; |
| 323 | } | |
| 324 | ||
| 15884 | 325 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { |
| 14389 | 326 | /* TODO should really find a way to make this work no matter |
| 327 | * where the focus is inside the conv window, without having | |
| 328 | * to bind to focus-in-event on the g(d|t)kwindow */ | |
| 9298 | 329 | /* try setting the signal on the focus-in-event for |
| 330 | * gtkwin->notebook->container? */ | |
| 331 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", | |
| 332 | G_CALLBACK(unnotify_cb), conv); | |
| 11728 | 333 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 9298 | 334 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
335 | id = g_signal_connect(G_OBJECT(gtkconv->webview), "focus-in-event", |
| 9298 | 336 | 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
|
337 | webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); |
| 6977 | 338 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
339 | |
| 15884 | 340 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { |
| 14389 | 341 | /* TODO similarly should really find a way to allow for |
| 342 | * clicking in other places of the window */ | |
| 9298 | 343 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", |
| 344 | G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 345 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 12286 | 346 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
347 | id = g_signal_connect(G_OBJECT(gtkconv->webview), "button-press-event", |
| 12286 | 348 | 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
|
349 | webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); |
| 3374 | 350 | } |
| 3710 | 351 | |
| 15884 | 352 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { |
| 9298 | 353 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", |
| 354 | G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 355 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 3374 | 356 | } |
| 357 | ||
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
358 | 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
|
359 | g_object_set_data(G_OBJECT(conv), "notify-entry-signals", entry_ids); |
| 4035 | 360 | |
| 3428 | 361 | return 0; |
| 191 | 362 | } |
| 363 | ||
| 6977 | 364 | static void |
| 15884 | 365 | detach_signals(PurpleConversation *conv) |
| 6977 | 366 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
367 | PidginConversation *gtkconv = NULL; |
| 11606 | 368 | GSList *ids = NULL, *l; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
369 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
370 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 11581 | 371 | if (!gtkconv) |
| 372 | return; | |
| 4203 | 373 | |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
374 | ids = g_object_get_data(G_OBJECT(conv), "notify-webview-signals"); |
| 11606 | 375 | 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
|
376 | g_signal_handler_disconnect(gtkconv->webview, GPOINTER_TO_INT(l->data)); |
| 11606 | 377 | g_slist_free(ids); |
| 6302 | 378 | |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
379 | ids = g_object_get_data(G_OBJECT(conv), "notify-entry-signals"); |
| 11606 | 380 | for (l = ids; l != NULL; l = l->next) |
| 381 | g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(l->data)); | |
| 382 | g_slist_free(ids); | |
| 3710 | 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-message-count", GINT_TO_POINTER(0)); |
| 14385 | 385 | |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
386 | 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
|
387 | g_object_set_data(G_OBJECT(conv), "notify-entry-signals", NULL); |
| 3710 | 388 | } |
| 389 | ||
| 6977 | 390 | static void |
| 15884 | 391 | conv_created(PurpleConversation *conv) |
| 6977 | 392 | { |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
393 | g_object_set_data(G_OBJECT(conv), "notify-message-count", |
| 14389 | 394 | GINT_TO_POINTER(0)); |
| 14385 | 395 | |
| 14389 | 396 | /* always attach the signals, notify() will take care of conversation |
| 397 | * type checking */ | |
| 6977 | 398 | attach_signals(conv); |
| 3374 | 399 | } |
| 400 | ||
| 6977 | 401 | static void |
| 15884 | 402 | conv_switched(PurpleConversation *conv) |
| 6977 | 403 | { |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
404 | #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
|
405 | PidginConvWindow *purplewin = purple_conversation_get_window(new_conv); |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
406 | #endif |
| 6302 | 407 | |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
408 | /* |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
409 | * If the conversation was switched, then make sure we re-notify |
| 15884 | 410 | * because Purple will have overwritten our custom window title. |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
411 | */ |
| 14385 | 412 | notify(conv, FALSE); |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
413 | |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
414 | #if 0 |
| 9298 | 415 | printf("conv_switched - %p - %p\n", old_conv, new_conv); |
| 15884 | 416 | printf("count - %d\n", count_messages(purplewin)); |
| 417 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) | |
| 9298 | 418 | unnotify(new_conv, FALSE); |
| 419 | else { | |
| 420 | /* if we don't have notification on the window then we don't want to | |
| 421 | * re-notify it */ | |
| 15884 | 422 | if (count_messages(purplewin)) |
| 423 | notify_win(purplewin); | |
| 9298 | 424 | } |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
425 | #endif |
| 6977 | 426 | } |
| 6302 | 427 | |
| 6977 | 428 | static void |
| 15884 | 429 | deleting_conv(PurpleConversation *conv) |
| 6977 | 430 | { |
|
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
|
431 | PidginConvWindow *purplewin = NULL; |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
432 | PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
433 | |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
434 | if (gtkconv == NULL) |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
435 | return; |
| 9298 | 436 | |
| 6977 | 437 | detach_signals(conv); |
| 3392 | 438 | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
439 | purplewin = gtkconv->win; |
| 11606 | 440 | |
| 15884 | 441 | 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
|
442 | g_object_set_data(G_OBJECT(conv), "notify-message-count", GINT_TO_POINTER(0)); |
| 11606 | 443 | |
| 444 | return; | |
| 445 | ||
| 11581 | 446 | #if 0 |
| 447 | /* i think this line crashes */ | |
| 15884 | 448 | if (count_messages(purplewin)) |
| 449 | notify_win(purplewin); | |
| 11581 | 450 | #endif |
| 6977 | 451 | } |
| 452 | ||
|
9303
e257ad08c77c
[gaim-migrate @ 10107]
Mark Doliner <markdoliner@pidgin.im>
parents:
9298
diff
changeset
|
453 | #if 0 |
| 6977 | 454 | static void |
| 15884 | 455 | conversation_dragging(PurpleConversation *active_conv, |
|
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
|
456 | PidginConvWindow *old_purplewin, |
|
24b06c5e7760
Renamed PidginWindow to PidginConvWindow so that introspection associates it with pidgin_conv_window_* API
Ankit Vani <a@nevitus.org>
parents:
35526
diff
changeset
|
457 | PidginConvWindow *new_purplewin) |
| 6977 | 458 | { |
| 15884 | 459 | if (old_purplewin != new_purplewin) { |
| 460 | if (old_purplewin == NULL) { | |
| 9298 | 461 | /* |
| 15884 | 462 | purple_conversation_autoset_title(active_conv); |
| 463 | handle_urgent(new_purplewin, FALSE); | |
| 9298 | 464 | */ |
| 465 | ||
| 15884 | 466 | if (count_messages(new_purplewin)) |
| 467 | notify_win(new_purplewin); | |
| 9298 | 468 | } else { |
| 15884 | 469 | printf("if else count = %d\n", count_messages(new_purplewin)); |
| 470 | printf("if else count = %d\n", count_messages(old_purplewin)); | |
| 9298 | 471 | /* |
| 15884 | 472 | PurpleConversation *old_active_conv = NULL; |
|
34635
bbecf6e1daee
Replace purple_conv_ by purple_conversation_ calls
Ankit Vani <a@nevitus.org>
parents:
34625
diff
changeset
|
473 | old_active_conv = purple_conversation_window_get_active_conversation(new_purplewin); |
| 9298 | 474 | |
| 15884 | 475 | purple_conversation_autoset_title(old_active_conv); |
| 476 | handle_urgent(old_purplewin, FALSE); | |
| 6302 | 477 | |
| 15884 | 478 | if (count_messages(old_purplewin)) |
| 479 | notify_win(old_purplewin); | |
| 9298 | 480 | |
| 15884 | 481 | purple_conversation_autoset_title(active_conv); |
| 482 | handle_urgent(new_purplewin, FALSE); | |
| 9298 | 483 | |
| 15884 | 484 | if (count_messages(new_purplewin)) |
| 485 | notify_win(new_purplewin); | |
| 9298 | 486 | */ |
| 487 | } | |
| 488 | } else { | |
| 15884 | 489 | printf("else count = %d\n", count_messages(new_purplewin)); |
| 490 | printf("else count = %d\n", count_messages(old_purplewin)); | |
| 9298 | 491 | /* |
| 15884 | 492 | purple_conversation_autoset_title(active_conv); |
| 493 | handle_urgent(old_purplewin, FALSE); | |
| 9298 | 494 | |
| 15884 | 495 | if (count_messages(old_purplewin)) |
| 496 | notify_win(old_purplewin); | |
| 9298 | 497 | */ |
| 498 | } | |
| 4035 | 499 | } |
|
9303
e257ad08c77c
[gaim-migrate @ 10107]
Mark Doliner <markdoliner@pidgin.im>
parents:
9298
diff
changeset
|
500 | #endif |
| 4035 | 501 | |
| 6977 | 502 | 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
|
503 | handle_string(PidginConvWindow *purplewin) |
| 9298 | 504 | { |
| 505 | GtkWindow *window = NULL; | |
| 506 | gchar newtitle[256]; | |
| 507 | ||
| 15884 | 508 | g_return_if_fail(purplewin != NULL); |
| 9298 | 509 | |
| 15884 | 510 | window = GTK_WINDOW(purplewin->window); |
| 9298 | 511 | g_return_if_fail(window != NULL); |
| 512 | ||
| 513 | g_snprintf(newtitle, sizeof(newtitle), "%s%s", | |
| 15884 | 514 | purple_prefs_get_string("/plugins/gtk/X11/notify/title_string"), |
| 9298 | 515 | gtk_window_get_title(window)); |
| 516 | gtk_window_set_title(window, newtitle); | |
| 517 | } | |
| 518 | ||
| 519 | 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
|
520 | handle_count_title(PidginConvWindow *purplewin) |
| 9298 | 521 | { |
| 522 | GtkWindow *window; | |
| 523 | char newtitle[256]; | |
| 524 | ||
| 15884 | 525 | g_return_if_fail(purplewin != NULL); |
| 9298 | 526 | |
| 15884 | 527 | window = GTK_WINDOW(purplewin->window); |
| 9298 | 528 | g_return_if_fail(window != NULL); |
| 529 | ||
| 10606 | 530 | g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", |
| 15884 | 531 | count_messages(purplewin), gtk_window_get_title(window)); |
| 9298 | 532 | gtk_window_set_title(window, newtitle); |
| 533 | } | |
| 534 | ||
| 535 | 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
|
536 | handle_count_xprop(PidginConvWindow *purplewin) |
| 14389 | 537 | { |
|
33472
24393ecae82e
Make this plugin a bit more friendly with Quartz-enabled GTK+ in MacPorts.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30706
diff
changeset
|
538 | #ifdef HAVE_X11 |
| 14389 | 539 | guint count; |
| 540 | GtkWidget *window; | |
| 541 | GdkWindow *gdkwin; | |
| 542 | ||
| 15884 | 543 | window = purplewin->window; |
| 14389 | 544 | g_return_if_fail(window != NULL); |
| 545 | ||
| 15884 | 546 | if (_PurpleUnseenCount == GDK_NONE) { |
| 547 | _PurpleUnseenCount = gdk_atom_intern("_PIDGIN_UNSEEN_COUNT", FALSE); | |
| 14389 | 548 | } |
| 549 | ||
| 550 | if (_Cardinal == GDK_NONE) { | |
| 551 | _Cardinal = gdk_atom_intern("CARDINAL", FALSE); | |
| 552 | } | |
| 553 | ||
| 15884 | 554 | 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
|
555 | gdkwin = gtk_widget_get_window(window); |
| 14389 | 556 | |
| 15884 | 557 | gdk_property_change(gdkwin, _PurpleUnseenCount, _Cardinal, 32, |
| 14389 | 558 | GDK_PROP_MODE_REPLACE, (guchar *) &count, 1); |
| 559 | #endif | |
| 560 | } | |
| 561 | ||
| 562 | 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
|
563 | handle_urgent(PidginConvWindow *purplewin, gboolean set) |
| 6977 | 564 | { |
|
25382
6a3ab0bc549d
Check that the PidginWindow we get in handle_urgent actually exists and has
Etan Reisner <deryni@pidgin.im>
parents:
24506
diff
changeset
|
565 | 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
|
566 | 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
|
567 | |
|
40555
0bf5825aab0a
Replace pidgin_set_urgent with gtk_window_set_urgency_hint
Gary Kramlich <grim@reaperworld.com>
parents:
40502
diff
changeset
|
568 | gtk_window_set_urgency_hint(GTK_WINDOW(purplewin->window), set); |
| 4035 | 569 | } |
| 570 | ||
| 6977 | 571 | 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
|
572 | handle_raise(PidginConvWindow *purplewin) |
| 10606 | 573 | { |
| 15884 | 574 | pidgin_conv_window_raise(purplewin); |
| 10606 | 575 | } |
| 576 | ||
| 577 | 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
|
578 | 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
|
579 | { |
|
27858
3ade5991f52f
Fix a crash with the Message Notification plugin and the 'hidden' gtkconv
Paul Aurich <darkrain42@pidgin.im>
parents:
25382
diff
changeset
|
580 | 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
|
581 | return; |
|
3ade5991f52f
Fix a crash with the Message Notification plugin and the 'hidden' gtkconv
Paul Aurich <darkrain42@pidgin.im>
parents:
25382
diff
changeset
|
582 | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
583 | 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
|
584 | } |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
585 | |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
586 | static void |
| 6977 | 587 | type_toggle_cb(GtkWidget *widget, gpointer data) |
| 588 | { | |
| 589 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 590 | gchar pref[256]; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
591 | |
| 14389 | 592 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 593 | (char *)data); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
594 | |
| 15884 | 595 | purple_prefs_set_bool(pref, on); |
| 3374 | 596 | } |
| 597 | ||
| 6977 | 598 | static void |
| 599 | method_toggle_cb(GtkWidget *widget, gpointer data) | |
| 600 | { | |
| 601 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 602 | gchar pref[256]; | |
| 603 | ||
| 14389 | 604 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 605 | (char *)data); | |
| 3374 | 606 | |
| 15884 | 607 | purple_prefs_set_bool(pref, on); |
| 6977 | 608 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37874
diff
changeset
|
609 | if (purple_strequal(data, "method_string")) { |
| 6977 | 610 | GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry"); |
| 611 | gtk_widget_set_sensitive(entry, on); | |
| 612 | ||
| 15884 | 613 | purple_prefs_set_string("/plugins/gtk/X11/notify/title_string", |
| 14448 | 614 | gtk_entry_get_text(GTK_ENTRY(entry))); |
| 6977 | 615 | } |
| 616 | ||
| 617 | apply_method(); | |
| 3374 | 618 | } |
| 619 | ||
| 6977 | 620 | static void |
| 621 | notify_toggle_cb(GtkWidget *widget, gpointer data) | |
| 622 | { | |
| 623 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 624 | gchar pref[256]; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
625 | |
| 14389 | 626 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 627 | (char *)data); | |
| 3374 | 628 | |
| 15884 | 629 | purple_prefs_set_bool(pref, on); |
| 6977 | 630 | |
| 631 | apply_notify(); | |
| 3374 | 632 | } |
| 633 | ||
| 6977 | 634 | static gboolean |
| 635 | options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data) | |
| 636 | { | |
| 637 | if (data == NULL) | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6977
diff
changeset
|
638 | return FALSE; |
| 6302 | 639 | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
37874
diff
changeset
|
640 | if (purple_strequal(data, "method_string")) { |
| 15884 | 641 | purple_prefs_set_string("/plugins/gtk/X11/notify/title_string", |
| 14389 | 642 | gtk_entry_get_text(GTK_ENTRY(widget))); |
| 3374 | 643 | } |
| 6302 | 644 | |
| 6977 | 645 | apply_method(); |
| 6302 | 646 | |
| 647 | return FALSE; | |
| 648 | } | |
| 649 | ||
| 6977 | 650 | static void |
| 14389 | 651 | apply_method() |
| 652 | { | |
|
13664
fdc3b588f248
[gaim-migrate @ 16065]
Richard Laager <rlaager@pidgin.im>
parents:
13550
diff
changeset
|
653 | GList *convs; |
| 6977 | 654 | |
|
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
|
655 | for (convs = purple_conversations_get_all(); convs != NULL; |
| 14389 | 656 | convs = convs->next) { |
| 15884 | 657 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 6302 | 658 | |
| 6977 | 659 | /* remove notifications */ |
| 9298 | 660 | unnotify(conv, FALSE); |
| 661 | ||
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34660
diff
changeset
|
662 | if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "notify-message-count")) != 0) |
| 6977 | 663 | /* reattach appropriate notifications */ |
| 14385 | 664 | notify(conv, FALSE); |
| 6977 | 665 | } |
| 3374 | 666 | } |
| 667 | ||
| 6977 | 668 | static void |
| 669 | apply_notify() | |
| 670 | { | |
|
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
|
671 | GList *convs = purple_conversations_get_all(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
672 | |
| 6977 | 673 | while (convs) { |
| 15884 | 674 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 4203 | 675 | |
| 6977 | 676 | /* detach signals */ |
| 677 | detach_signals(conv); | |
| 678 | /* reattach appropriate signals */ | |
| 679 | attach_signals(conv); | |
| 4035 | 680 | |
| 6977 | 681 | convs = convs->next; |
| 4035 | 682 | } |
| 683 | } | |
| 684 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
685 | static GtkWidget * |
| 15884 | 686 | get_config_frame(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
687 | { |
| 6977 | 688 | GtkWidget *ret = NULL, *frame = NULL; |
| 689 | GtkWidget *vbox = NULL, *hbox = NULL; | |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
690 | GtkWidget *toggle = NULL, *entry = NULL, *ref; |
| 6302 | 691 | |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35037
diff
changeset
|
692 | ret = gtk_box_new(GTK_ORIENTATION_VERTICAL, 18); |
| 6302 | 693 | gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
| 3392 | 694 | |
| 6302 | 695 | /*---------- "Notify For" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
696 | 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
|
697 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 6302 | 698 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 699 | ||
| 3710 | 700 | toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
| 701 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 6977 | 702 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 703 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); |
| 6977 | 704 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 705 | G_CALLBACK(type_toggle_cb), "type_im"); |
| 3710 | 706 | |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
707 | ref = toggle; |
|
37874
660e41d31deb
Message Notification: Drop redundant "Notify for"
Richard Laager <rlaager@pidgin.im>
parents:
37220
diff
changeset
|
708 | 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
|
709 | 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
|
710 | 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
|
711 | 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
|
712 | 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
|
713 | 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
|
714 | 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
|
715 | G_BINDING_SYNC_CREATE); |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
716 | |
| 6977 | 717 | toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
| 3710 | 718 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 6977 | 719 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 720 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); |
| 6977 | 721 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 722 | G_CALLBACK(type_toggle_cb), "type_chat"); |
| 6977 | 723 | |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
724 | ref = toggle; |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22782
diff
changeset
|
725 | 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
|
726 | 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
|
727 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 728 | 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
|
729 | g_signal_connect(G_OBJECT(toggle), "toggled", |
|
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
730 | 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
|
731 | 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
|
732 | G_BINDING_SYNC_CREATE); |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
733 | |
|
37874
660e41d31deb
Message Notification: Drop redundant "Notify for"
Richard Laager <rlaager@pidgin.im>
parents:
37220
diff
changeset
|
734 | 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
|
735 | 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
|
736 | 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
|
737 | 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
|
738 | 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
|
739 | 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
|
740 | 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
|
741 | G_BINDING_SYNC_CREATE); |
|
37190
7e315013fb73
notify: Add support for notifications for system messages
Sebastian Schmidt <yath@yath.de>
parents:
33476
diff
changeset
|
742 | |
| 6977 | 743 | toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); |
| 744 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 745 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 746 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); |
| 6977 | 747 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 748 | G_CALLBACK(type_toggle_cb), "type_focused"); |
| 3710 | 749 | |
| 6302 | 750 | /*---------- "Notification Methods" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
751 | 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
|
752 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 6302 | 753 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 754 | ||
| 6977 | 755 | /* String method button */ |
|
35526
ed1be305c985
Fix gtk_[hv]box_new gtk3 deprecation warnings
Tomasz Wasilczyk <twasilczyk@pidgin.im>
parents:
35037
diff
changeset
|
756 | hbox = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 18); |
| 3565 | 757 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
| 6302 | 758 | toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
| 6977 | 759 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 760 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
| 3565 | 761 | gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 6977 | 762 | |
| 6302 | 763 | entry = gtk_entry_new(); |
| 764 | gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
| 765 | gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
| 6977 | 766 | gtk_widget_set_sensitive(GTK_WIDGET(entry), |
| 15884 | 767 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
| 6977 | 768 | gtk_entry_set_text(GTK_ENTRY(entry), |
| 15884 | 769 | purple_prefs_get_string("/plugins/gtk/X11/notify/title_string")); |
| 6977 | 770 | g_object_set_data(G_OBJECT(toggle), "title-entry", entry); |
| 771 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 772 | G_CALLBACK(method_toggle_cb), "method_string"); |
| 6977 | 773 | g_signal_connect(G_OBJECT(entry), "focus-out-event", |
| 9298 | 774 | G_CALLBACK(options_entry_cb), "method_string"); |
| 3374 | 775 | |
| 6977 | 776 | /* Count method button */ |
| 777 | toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | |
| 778 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 779 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); |
| 6977 | 780 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 781 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 782 | G_CALLBACK(method_toggle_cb), "method_count"); |
| 4035 | 783 | |
|
33472
24393ecae82e
Make this plugin a bit more friendly with Quartz-enabled GTK+ in MacPorts.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
30706
diff
changeset
|
784 | #ifdef HAVE_X11 |
| 14389 | 785 | /* Count xprop method button */ |
| 786 | toggle = gtk_check_button_new_with_mnemonic(_("Insert count of new message into _X property")); | |
| 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/method_count_xprop")); |
| 14389 | 790 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 791 | G_CALLBACK(method_toggle_cb), "method_count_xprop"); | |
| 792 | ||
| 6977 | 793 | /* Urgent method button */ |
| 794 | 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
|
795 | #else |
|
24506
4d624cd775bd
Mark for translation now that we're unfrozen.
Daniel Atallah <datallah@pidgin.im>
parents:
24431
diff
changeset
|
796 | 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
|
797 | #endif |
| 6977 | 798 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 799 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 800 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); |
| 9298 | 801 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 802 | G_CALLBACK(method_toggle_cb), "method_urgent"); | |
| 3710 | 803 | |
| 10606 | 804 | /* Raise window method button */ |
| 805 | toggle = gtk_check_button_new_with_mnemonic(_("R_aise conversation window")); | |
| 806 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 807 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 808 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")); |
| 10606 | 809 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 810 | G_CALLBACK(method_toggle_cb), "method_raise"); | |
| 811 | ||
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
812 | /* Present conversation method button */ |
|
37220
5b46f15834d9
Add a note for translators
Richard Laager <rlaager@pidgin.im>
parents:
37190
diff
changeset
|
813 | /* 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
|
814 | * 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
|
815 | 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
|
816 | 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
|
817 | 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
|
818 | 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
|
819 | 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
|
820 | 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
|
821 | |
| 6977 | 822 | /*---------- "Notification Removals" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
823 | 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
|
824 | vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); |
| 6302 | 825 | gtk_container_add(GTK_CONTAINER(frame), vbox); |
| 3374 | 826 | |
| 6977 | 827 | /* Remove on focus button */ |
| 828 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | |
| 829 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 830 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 831 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); |
| 6977 | 832 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); |
| 833 | ||
| 834 | /* Remove on click button */ | |
| 835 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | |
| 836 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 837 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 838 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); |
| 6977 | 839 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 840 | G_CALLBACK(notify_toggle_cb), "notify_click"); |
| 3710 | 841 | |
| 6977 | 842 | /* Remove on type button */ |
| 843 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | |
| 844 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 845 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 846 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); |
| 6977 | 847 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 848 | G_CALLBACK(notify_toggle_cb), "notify_type"); |
| 4035 | 849 | |
| 6977 | 850 | /* Remove on message send button */ |
| 851 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | |
| 852 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 853 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 854 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); |
| 6977 | 855 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 856 | G_CALLBACK(notify_toggle_cb), "notify_send"); |
| 3565 | 857 | |
| 6977 | 858 | #if 0 |
| 859 | /* Remove on conversation switch button */ | |
| 9298 | 860 | toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); |
| 6977 | 861 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 862 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 863 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); |
| 6977 | 864 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 865 | G_CALLBACK(notify_toggle_cb), "notify_switch"); |
| 6977 | 866 | #endif |
| 867 | ||
| 868 | gtk_widget_show_all(ret); | |
| 869 | return ret; | |
| 3374 | 870 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
871 | |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
872 | static PidginPluginInfo * |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
873 | plugin_query(GError **error) |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
874 | { |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
875 | const gchar * const authors[] = { |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
876 | "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
|
877 | "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
|
878 | NULL |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
879 | }; |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
880 | |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
881 | 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
|
882 | "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
|
883 | "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
|
884 | "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
|
885 | "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
|
886 | "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
|
887 | "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
|
888 | "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
|
889 | "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
|
890 | "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
|
891 | "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
|
892 | "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
|
893 | "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
|
894 | NULL |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
895 | ); |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
896 | } |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
897 | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
898 | static gboolean |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
899 | plugin_load(PurplePlugin *plugin, GError **error) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
900 | { |
|
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
|
901 | GList *convs = purple_conversations_get_all(); |
| 15884 | 902 | void *conv_handle = purple_conversations_get_handle(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
903 | void *gtk_conv_handle = pidgin_conversations_get_handle(); |
| 6302 | 904 | |
| 905 | my_plugin = plugin; | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
906 | |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
907 | 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
|
908 | 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
|
909 | 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
|
910 | |
|
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
911 | 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
|
912 | 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
|
913 | 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
|
914 | 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
|
915 | 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
|
916 | 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
|
917 | 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
|
918 | 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
|
919 | 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
|
920 | 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
|
921 | 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
|
922 | 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
|
923 | 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
|
924 | 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
|
925 | 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
|
926 | 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
|
927 | 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
|
928 | 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
|
929 | |
| 15884 | 930 | purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin, |
| 931 | PURPLE_CALLBACK(message_displayed_cb), NULL); | |
| 932 | purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin, | |
| 933 | PURPLE_CALLBACK(message_displayed_cb), NULL); | |
| 934 | purple_signal_connect(gtk_conv_handle, "conversation-switched", plugin, | |
| 935 | PURPLE_CALLBACK(conv_switched), NULL); | |
| 936 | purple_signal_connect(conv_handle, "sent-im-msg", plugin, | |
| 937 | PURPLE_CALLBACK(im_sent_im), NULL); | |
| 938 | purple_signal_connect(conv_handle, "sent-chat-msg", plugin, | |
| 939 | PURPLE_CALLBACK(chat_sent_im), NULL); | |
| 940 | purple_signal_connect(conv_handle, "conversation-created", plugin, | |
| 941 | PURPLE_CALLBACK(conv_created), NULL); | |
| 942 | purple_signal_connect(conv_handle, "deleting-conversation", plugin, | |
| 943 | PURPLE_CALLBACK(deleting_conv), NULL); | |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
944 | #if 0 |
| 15884 | 945 | purple_signal_connect(gtk_conv_handle, "conversation-dragging", plugin, |
| 946 | PURPLE_CALLBACK(conversation_dragging), NULL); | |
|
9303
e257ad08c77c
[gaim-migrate @ 10107]
Mark Doliner <markdoliner@pidgin.im>
parents:
9298
diff
changeset
|
947 | #endif |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
948 | |
| 6977 | 949 | while (convs) { |
| 15884 | 950 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 6302 | 951 | |
| 952 | /* attach signals */ | |
| 6977 | 953 | attach_signals(conv); |
| 6302 | 954 | |
| 6977 | 955 | convs = convs->next; |
| 6302 | 956 | } |
| 957 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
958 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
959 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
960 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
961 | static gboolean |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
962 | plugin_unload(PurplePlugin *plugin, GError **error) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
963 | { |
|
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
|
964 | GList *convs = purple_conversations_get_all(); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
965 | |
| 6977 | 966 | while (convs) { |
| 15884 | 967 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
968 | |
| 6302 | 969 | /* kill signals */ |
| 6977 | 970 | detach_signals(conv); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
971 | |
| 6977 | 972 | convs = convs->next; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
973 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
974 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
975 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
976 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
977 | |
|
36757
2e04586cf6e8
Refactored some pidgin plugins to use the new plugin API
Ankit Vani <a@nevitus.org>
parents:
34678
diff
changeset
|
978 | PURPLE_PLUGIN_INIT(notify, plugin_query, plugin_load, plugin_unload); |