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