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