Wed, 21 Sep 2011 06:45:26 +0000
Apply conversation theme when opening the GTK conversation. All the
parsing stuff was moved out of the theme code and into the conversation
code.
Someone (not me!) needs to check the code I commented out and see if
we really need that stuff (and then port it to WebKit/styling).
We also need to determine where to place Template.html and the rest
of our (not-yet-written) default theme.
| 6302 | 1 | /* |
| 15884 | 2 | * Purple buddy notification plugin. |
| 6302 | 3 | * |
| 4 | * Copyright (C) 2000-2001, Eric Warmenhoven (original code) | |
| 5 | * Copyright (C) 2002, Etan Reisner <deryni@eden.rutgers.edu> (rewritten code) | |
| 6 | * Copyright (C) 2003, Christian Hammond (update for changed API) | |
|
6322
35fdae8a156f
[gaim-migrate @ 6821]
Mark Doliner <markdoliner@pidgin.im>
parents:
6302
diff
changeset
|
7 | * Copyright (C) 2003, Brian Tarricone <bjt23@cornell.edu> (mostly rewritten) |
| 6302 | 8 | * Copyright (C) 2003, Mark Doliner (minor cleanup) |
| 6977 | 9 | * Copyright (C) 2003, Etan Reisner (largely rewritten again) |
| 6302 | 10 | * |
| 11 | * This program is free software; you can redistribute it and/or modify | |
| 12 | * it under the terms of the GNU General Public License as published by | |
| 13 | * the Free Software Foundation; either version 2 of the License, or | |
| 14 | * (at your option) any later version. | |
| 15 | * | |
| 16 | * This program is distributed in the hope that it will be useful, | |
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
| 19 | * GNU General Public License for more details. | |
| 3374 | 20 | * |
| 6302 | 21 | * You should have received a copy of the GNU General Public License |
| 22 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19717
diff
changeset
|
23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA |
| 6302 | 24 | * |
| 25 | */ | |
| 26 | ||
| 10606 | 27 | /* TODO |
| 28 | * 22:22:17 <seanegan> deryni: speaking of notify.c... you know what else | |
| 29 | * might be a neat feature? | |
| 30 | * 22:22:30 <seanegan> Changing the window icon. | |
| 31 | * 22:23:25 <deryni> seanegan: To what? | |
| 32 | * 22:23:42 <seanegan> deryni: I dunno. Flash it between the regular icon and | |
| 33 | * blank or something. | |
| 15884 | 34 | * 22:23:53 <deryni> Also I think purple might re-set that sort of frequently, |
| 10606 | 35 | * but I'd have to look. |
| 11581 | 36 | * 22:25:16 <seanegan> deryni: I keep my conversations in one workspace and am |
| 10606 | 37 | * frequently in an another, and the icon flashing in the pager would be a |
| 38 | * neat visual clue. | |
| 39 | */ | |
| 40 | ||
| 6302 | 41 | /* |
| 42 | * From Etan, 2002: | |
| 43 | * -Added config dialog | |
| 44 | * -Added control over notification method | |
| 45 | * -Added control over when to release notification | |
| 46 | * | |
| 47 | * -Added option to get notification for chats also | |
| 48 | * -Cleaned up code | |
| 49 | * -Added option to notify on click as it's own option | |
| 50 | * rather then as what happens when on focus isn't clicked | |
| 51 | * -Added apply button to change the denotification methods for | |
| 52 | * open conversation windows | |
| 53 | * -Fixed apply to conversations, count now keeps count across applies | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
54 | * -Fixed(?) memory leak, and in the process fixed some stupidities |
| 6302 | 55 | * -Hit enter when done editing the title string entry box to save it |
| 3392 | 56 | * |
| 57 | * Thanks to Carles Pina i Estany <carles@pinux.info> | |
| 58 | * for count of new messages option | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
59 | * |
| 6302 | 60 | * From Brian, 20 July 2003: |
| 61 | * -Use new xml prefs | |
| 62 | * -Better handling of notification states tracking | |
| 63 | * -Better pref change handling | |
| 64 | * -Fixed a possible memleak and possible crash (rare) | |
| 65 | * -Use gtk_window_get_title() rather than gtkwin->title | |
| 66 | * -Other random fixes and cleanups | |
| 6977 | 67 | * |
| 9298 | 68 | * Etan again, 12 August 2003: |
| 6977 | 69 | * -Better use of the new xml prefs |
| 70 | * -Removed all bitmask stuff | |
| 71 | * -Even better pref change handling | |
| 72 | * -Removed unnecessary functions | |
| 73 | * -Reworking of notification/unnotification stuff | |
| 74 | * -Header file include cleanup | |
| 75 | * -General code cleanup | |
| 9298 | 76 | * |
| 77 | * Etan yet again, 04 April 2004: | |
| 78 | * -Re-added Urgent option | |
| 79 | * -Re-added unnotify on focus option (still needs work, as it will only | |
| 80 | * react to focus-in events when the entry or history widgets are focused) | |
| 10492 | 81 | * |
| 82 | * Sean, 08 January, 2005: | |
| 15884 | 83 | * -Added Raise option, formally in Purple proper |
| 3392 | 84 | */ |
| 85 | ||
| 9791 | 86 | #include "internal.h" |
| 15577 | 87 | #include "pidgin.h" |
| 10492 | 88 | #include "gtkprefs.h" |
| 6302 | 89 | |
|
12604
893fbf89317c
[gaim-migrate @ 14939]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
12600
diff
changeset
|
90 | #include "conversation.h" |
| 6302 | 91 | #include "prefs.h" |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
92 | #include "signals.h" |
| 9943 | 93 | #include "version.h" |
| 11581 | 94 | #include "debug.h" |
|
4202
8b92de3b1c07
[gaim-migrate @ 4438]
Christian Hammond <chipx86@chipx86.com>
parents:
4165
diff
changeset
|
95 | |
| 6302 | 96 | #include "gtkplugin.h" |
| 97 | #include "gtkutils.h" | |
| 98 | ||
| 12959 | 99 | #ifndef _WIN32 |
| 6977 | 100 | #include <X11/Xatom.h> |
| 3385 | 101 | #include <X11/Xlib.h> |
| 3374 | 102 | #include <X11/Xutil.h> |
| 12959 | 103 | #endif |
| 3374 | 104 | |
| 6302 | 105 | #define NOTIFY_PLUGIN_ID "gtk-x11-notify" |
| 3710 | 106 | |
| 15884 | 107 | static PurplePlugin *my_plugin = NULL; |
| 15527 | 108 | #ifndef _WIN32 |
| 14389 | 109 | static GdkAtom _Cardinal = GDK_NONE; |
| 15884 | 110 | static GdkAtom _PurpleUnseenCount = GDK_NONE; |
| 15527 | 111 | #endif |
|
5436
a0e0bacaa196
[gaim-migrate @ 5818]
Christian Hammond <chipx86@chipx86.com>
parents:
5205
diff
changeset
|
112 | |
| 6302 | 113 | /* notification set/unset */ |
| 15884 | 114 | static int notify(PurpleConversation *conv, gboolean increment); |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
115 | static void notify_win(PidginWindow *purplewin, PurpleConversation *conv); |
| 15884 | 116 | static void unnotify(PurpleConversation *conv, gboolean reset); |
| 14389 | 117 | static int unnotify_cb(GtkWidget *widget, gpointer data, |
| 15884 | 118 | PurpleConversation *conv); |
| 6302 | 119 | |
| 120 | /* gtk widget callbacks for prefs panel */ | |
| 6977 | 121 | static void type_toggle_cb(GtkWidget *widget, gpointer data); |
| 122 | static void method_toggle_cb(GtkWidget *widget, gpointer data); | |
| 123 | static void notify_toggle_cb(GtkWidget *widget, gpointer data); | |
| 14389 | 124 | static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, |
| 125 | gpointer data); | |
|
12397
aa64ec827fdf
[gaim-migrate @ 14704]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
126 | static void apply_method(void); |
|
aa64ec827fdf
[gaim-migrate @ 14704]
Richard Laager <rlaager@pidgin.im>
parents:
12286
diff
changeset
|
127 | static void apply_notify(void); |
| 191 | 128 | |
| 6977 | 129 | /* string function */ |
| 15884 | 130 | static void handle_string(PidginWindow *purplewin); |
| 6302 | 131 | |
| 14389 | 132 | /* count_title function */ |
| 15884 | 133 | static void handle_count_title(PidginWindow *purplewin); |
| 14389 | 134 | |
| 135 | /* count_xprop function */ | |
| 15884 | 136 | static void handle_count_xprop(PidginWindow *purplewin); |
| 6302 | 137 | |
| 6977 | 138 | /* urgent function */ |
| 15884 | 139 | static void handle_urgent(PidginWindow *purplewin, gboolean set); |
| 10606 | 140 | |
| 141 | /* raise function */ | |
| 15884 | 142 | static void handle_raise(PidginWindow *purplewin); |
| 3710 | 143 | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
144 | /* 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
|
145 | 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
|
146 | |
| 6302 | 147 | /****************************************/ |
| 148 | /* Begin doing stuff below this line... */ | |
| 149 | /****************************************/ | |
| 14389 | 150 | static guint |
| 15884 | 151 | count_messages(PidginWindow *purplewin) |
| 9298 | 152 | { |
| 14389 | 153 | guint count = 0; |
| 14385 | 154 | GList *convs = NULL, *l; |
| 9298 | 155 | |
| 15884 | 156 | 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
|
157 | PidginConversation *conv = convs->data; |
| 14385 | 158 | for (l = conv->convs; l != NULL; l = l->next) { |
| 15884 | 159 | count += GPOINTER_TO_INT(purple_conversation_get_data(l->data, "notify-message-count")); |
| 14385 | 160 | } |
| 9298 | 161 | } |
| 162 | ||
| 163 | return count; | |
| 164 | } | |
| 6302 | 165 | |
| 6977 | 166 | static int |
| 15884 | 167 | notify(PurpleConversation *conv, gboolean increment) |
| 6977 | 168 | { |
| 14385 | 169 | gint count; |
| 14326 | 170 | gboolean has_focus; |
| 15884 | 171 | PidginWindow *purplewin = NULL; |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
172 | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
173 | if (conv == NULL || PIDGIN_CONVERSATION(conv) == NULL) |
| 6302 | 174 | return 0; |
| 175 | ||
| 6977 | 176 | /* We want to remove the notifications, but not reset the counter */ |
| 177 | unnotify(conv, FALSE); | |
| 178 | ||
| 15884 | 179 | purplewin = PIDGIN_CONVERSATION(conv)->win; |
| 5021 | 180 | |
| 6977 | 181 | /* If we aren't doing notifications for this type of conversation, return */ |
| 15884 | 182 | if (((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_IM) && |
| 183 | !purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) || | |
| 184 | ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT) && | |
| 185 | !purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) | |
| 6977 | 186 | return 0; |
| 4203 | 187 | |
| 15884 | 188 | g_object_get(G_OBJECT(purplewin->window), |
| 9298 | 189 | "has-toplevel-focus", &has_focus, NULL); |
| 3374 | 190 | |
| 15884 | 191 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || |
|
10984
8d8c654bf34d
[gaim-migrate @ 12819]
Mark Doliner <markdoliner@pidgin.im>
parents:
10971
diff
changeset
|
192 | !has_focus) { |
| 14385 | 193 | if (increment) { |
| 15884 | 194 | count = GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")); |
| 14385 | 195 | count++; |
| 15884 | 196 | purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); |
| 14385 | 197 | } |
| 198 | ||
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
199 | notify_win(purplewin, conv); |
| 6977 | 200 | } |
| 6302 | 201 | |
| 202 | return 0; | |
| 203 | } | |
| 204 | ||
| 9298 | 205 | 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
|
206 | notify_win(PidginWindow *purplewin, PurpleConversation *conv) |
| 9298 | 207 | { |
| 15884 | 208 | if (count_messages(purplewin) <= 0) |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
209 | return; |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
210 | |
| 15884 | 211 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) |
| 212 | handle_count_title(purplewin); | |
| 213 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count_xprop")) | |
| 214 | handle_count_xprop(purplewin); | |
| 215 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) | |
| 216 | handle_string(purplewin); | |
| 217 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | |
| 218 | handle_urgent(purplewin, TRUE); | |
| 219 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")) | |
| 220 | handle_raise(purplewin); | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
221 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_present")) |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
222 | handle_present(conv); |
| 9298 | 223 | } |
| 224 | ||
| 225 | static void | |
| 15884 | 226 | unnotify(PurpleConversation *conv, gboolean reset) |
| 9298 | 227 | { |
| 15884 | 228 | PurpleConversation *active_conv = NULL; |
| 229 | PidginWindow *purplewin = NULL; | |
| 9298 | 230 | |
| 231 | g_return_if_fail(conv != NULL); | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
232 | if (PIDGIN_CONVERSATION(conv) == NULL) |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
233 | return; |
| 9298 | 234 | |
| 15884 | 235 | purplewin = PIDGIN_CONVERSATION(conv)->win; |
| 236 | active_conv = pidgin_conv_window_get_active_conversation(purplewin); | |
| 9298 | 237 | |
| 238 | /* reset the conversation window title */ | |
| 15884 | 239 | purple_conversation_autoset_title(active_conv); |
| 9298 | 240 | |
| 241 | if (reset) { | |
| 14389 | 242 | /* Only need to actually remove the urgent hinting here, since |
| 243 | * removing it just to have it readded in re-notify is an | |
| 244 | * unnecessary couple extra RTs to the server */ | |
| 15884 | 245 | handle_urgent(purplewin, FALSE); |
| 246 | purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); | |
| 14389 | 247 | /* Same logic as for the urgent hint, xprops are also a RT. |
| 248 | * This needs to go here so that it gets the updated message | |
| 249 | * count. */ | |
| 15884 | 250 | handle_count_xprop(purplewin); |
| 9298 | 251 | } |
| 252 | ||
| 253 | return; | |
| 254 | } | |
| 255 | ||
| 256 | static int | |
| 15884 | 257 | unnotify_cb(GtkWidget *widget, gpointer data, PurpleConversation *conv) |
| 9298 | 258 | { |
| 15884 | 259 | if (GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")) != 0) |
| 9298 | 260 | unnotify(conv, TRUE); |
| 261 | ||
| 262 | return 0; | |
| 263 | } | |
| 264 | ||
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
265 | static gboolean |
| 15884 | 266 | message_displayed_cb(PurpleAccount *account, const char *who, char *message, |
| 267 | PurpleConversation *conv, PurpleMessageFlags flags) | |
| 6977 | 268 | { |
| 15884 | 269 | if ((purple_conversation_get_type(conv) == PURPLE_CONV_TYPE_CHAT && |
| 270 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat_nick") && | |
| 271 | !(flags & PURPLE_MESSAGE_NICK))) | |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
272 | return FALSE; |
|
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
273 | |
| 15884 | 274 | if ((flags & PURPLE_MESSAGE_RECV) && !(flags & PURPLE_MESSAGE_DELAYED)) |
| 14385 | 275 | notify(conv, TRUE); |
| 9298 | 276 | |
| 277 | return FALSE; | |
| 278 | } | |
| 279 | ||
| 6977 | 280 | static void |
| 15884 | 281 | im_sent_im(PurpleAccount *account, const char *receiver, const char *message) |
| 14389 | 282 | { |
| 15884 | 283 | PurpleConversation *conv = NULL; |
| 9298 | 284 | |
| 15884 | 285 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { |
| 286 | conv = purple_find_conversation_with_account(PURPLE_CONV_TYPE_IM, receiver, account); | |
| 9298 | 287 | unnotify(conv, TRUE); |
| 288 | } | |
| 289 | } | |
| 290 | ||
| 291 | static void | |
| 15884 | 292 | chat_sent_im(PurpleAccount *account, const char *message, int id) |
| 6977 | 293 | { |
| 15884 | 294 | PurpleConversation *conv = NULL; |
| 6977 | 295 | |
| 15884 | 296 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { |
| 297 | conv = purple_find_chat(purple_account_get_connection(account), id); | |
| 6977 | 298 | unnotify(conv, TRUE); |
| 299 | } | |
| 3710 | 300 | } |
| 301 | ||
| 6977 | 302 | static int |
| 15884 | 303 | attach_signals(PurpleConversation *conv) |
| 6977 | 304 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
305 | PidginConversation *gtkconv = NULL; |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
306 | GSList *webview_ids = NULL, *entry_ids = NULL; |
| 6977 | 307 | guint id; |
| 308 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
309 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 11581 | 310 | if (!gtkconv) { |
| 15884 | 311 | purple_debug_misc("notify", "Failed to find gtkconv\n"); |
| 11581 | 312 | return 0; |
| 313 | } | |
| 314 | ||
| 15884 | 315 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { |
| 14389 | 316 | /* TODO should really find a way to make this work no matter |
| 317 | * where the focus is inside the conv window, without having | |
| 318 | * to bind to focus-in-event on the g(d|t)kwindow */ | |
| 9298 | 319 | /* try setting the signal on the focus-in-event for |
| 320 | * gtkwin->notebook->container? */ | |
| 321 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", | |
| 322 | G_CALLBACK(unnotify_cb), conv); | |
| 11728 | 323 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 9298 | 324 | |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
325 | id = g_signal_connect(G_OBJECT(gtkconv->webview), "focus-in-event", |
| 9298 | 326 | G_CALLBACK(unnotify_cb), conv); |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
327 | webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); |
| 6977 | 328 | } |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
329 | |
| 15884 | 330 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { |
| 14389 | 331 | /* TODO similarly should really find a way to allow for |
| 332 | * clicking in other places of the window */ | |
| 9298 | 333 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", |
| 334 | G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 335 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 12286 | 336 | |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
337 | id = g_signal_connect(G_OBJECT(gtkconv->webview), "button-press-event", |
| 12286 | 338 | G_CALLBACK(unnotify_cb), conv); |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
339 | webview_ids = g_slist_append(webview_ids, GUINT_TO_POINTER(id)); |
| 3374 | 340 | } |
| 3710 | 341 | |
| 15884 | 342 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { |
| 9298 | 343 | id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", |
| 344 | G_CALLBACK(unnotify_cb), conv); | |
| 6977 | 345 | entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
| 3374 | 346 | } |
| 347 | ||
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
348 | purple_conversation_set_data(conv, "notify-webview-signals", webview_ids); |
| 15884 | 349 | purple_conversation_set_data(conv, "notify-entry-signals", entry_ids); |
| 4035 | 350 | |
| 3428 | 351 | return 0; |
| 191 | 352 | } |
| 353 | ||
| 6977 | 354 | static void |
| 15884 | 355 | detach_signals(PurpleConversation *conv) |
| 6977 | 356 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
357 | PidginConversation *gtkconv = NULL; |
| 11606 | 358 | GSList *ids = NULL, *l; |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
359 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
360 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 11581 | 361 | if (!gtkconv) |
| 362 | return; | |
| 4203 | 363 | |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
364 | ids = purple_conversation_get_data(conv, "notify-webview-signals"); |
| 11606 | 365 | for (l = ids; l != NULL; l = l->next) |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
366 | g_signal_handler_disconnect(gtkconv->webview, GPOINTER_TO_INT(l->data)); |
| 11606 | 367 | g_slist_free(ids); |
| 6302 | 368 | |
| 15884 | 369 | ids = purple_conversation_get_data(conv, "notify-entry-signals"); |
| 11606 | 370 | for (l = ids; l != NULL; l = l->next) |
| 371 | g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(l->data)); | |
| 372 | g_slist_free(ids); | |
| 3710 | 373 | |
| 15884 | 374 | purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
| 14385 | 375 | |
|
32516
825033ff76c1
Fix notify plugin compile.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
30706
diff
changeset
|
376 | purple_conversation_set_data(conv, "notify-webview-signals", NULL); |
| 15884 | 377 | purple_conversation_set_data(conv, "notify-entry-signals", NULL); |
| 3710 | 378 | } |
| 379 | ||
| 6977 | 380 | static void |
| 15884 | 381 | conv_created(PurpleConversation *conv) |
| 6977 | 382 | { |
| 15884 | 383 | purple_conversation_set_data(conv, "notify-message-count", |
| 14389 | 384 | GINT_TO_POINTER(0)); |
| 14385 | 385 | |
| 14389 | 386 | /* always attach the signals, notify() will take care of conversation |
| 387 | * type checking */ | |
| 6977 | 388 | attach_signals(conv); |
| 3374 | 389 | } |
| 390 | ||
| 6977 | 391 | static void |
| 15884 | 392 | conv_switched(PurpleConversation *conv) |
| 6977 | 393 | { |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
394 | #if 0 |
| 15884 | 395 | PidginWindow *purplewin = purple_conversation_get_window(new_conv); |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
396 | #endif |
| 6302 | 397 | |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
398 | /* |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
399 | * If the conversation was switched, then make sure we re-notify |
| 15884 | 400 | * because Purple will have overwritten our custom window title. |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
401 | */ |
| 14385 | 402 | notify(conv, FALSE); |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
403 | |
|
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
404 | #if 0 |
| 9298 | 405 | printf("conv_switched - %p - %p\n", old_conv, new_conv); |
| 15884 | 406 | printf("count - %d\n", count_messages(purplewin)); |
| 407 | if (purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) | |
| 9298 | 408 | unnotify(new_conv, FALSE); |
| 409 | else { | |
| 410 | /* if we don't have notification on the window then we don't want to | |
| 411 | * re-notify it */ | |
| 15884 | 412 | if (count_messages(purplewin)) |
| 413 | notify_win(purplewin); | |
| 9298 | 414 | } |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
415 | #endif |
| 6977 | 416 | } |
| 6302 | 417 | |
| 6977 | 418 | static void |
| 15884 | 419 | deleting_conv(PurpleConversation *conv) |
| 6977 | 420 | { |
| 15884 | 421 | PidginWindow *purplewin = NULL; |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
422 | PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
423 | |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
424 | if (gtkconv == NULL) |
|
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
425 | return; |
| 9298 | 426 | |
| 6977 | 427 | detach_signals(conv); |
| 3392 | 428 | |
|
19717
bfc9d0446b60
Do not crash on hidden conversations.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
16749
diff
changeset
|
429 | purplewin = gtkconv->win; |
| 11606 | 430 | |
| 15884 | 431 | handle_urgent(purplewin, FALSE); |
| 432 | purple_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); | |
| 11606 | 433 | |
| 434 | return; | |
| 435 | ||
| 11581 | 436 | #if 0 |
| 437 | /* i think this line crashes */ | |
| 15884 | 438 | if (count_messages(purplewin)) |
| 439 | notify_win(purplewin); | |
| 11581 | 440 | #endif |
| 6977 | 441 | } |
| 442 | ||
|
9303
e257ad08c77c
[gaim-migrate @ 10107]
Mark Doliner <markdoliner@pidgin.im>
parents:
9298
diff
changeset
|
443 | #if 0 |
| 6977 | 444 | static void |
| 15884 | 445 | conversation_dragging(PurpleConversation *active_conv, |
| 446 | PidginWindow *old_purplewin, | |
| 447 | PidginWindow *new_purplewin) | |
| 6977 | 448 | { |
| 15884 | 449 | if (old_purplewin != new_purplewin) { |
| 450 | if (old_purplewin == NULL) { | |
| 9298 | 451 | /* |
| 15884 | 452 | purple_conversation_autoset_title(active_conv); |
| 453 | handle_urgent(new_purplewin, FALSE); | |
| 9298 | 454 | */ |
| 455 | ||
| 15884 | 456 | if (count_messages(new_purplewin)) |
| 457 | notify_win(new_purplewin); | |
| 9298 | 458 | } else { |
| 15884 | 459 | printf("if else count = %d\n", count_messages(new_purplewin)); |
| 460 | printf("if else count = %d\n", count_messages(old_purplewin)); | |
| 9298 | 461 | /* |
| 15884 | 462 | PurpleConversation *old_active_conv = NULL; |
| 463 | old_active_conv = purple_conv_window_get_active_conversation(new_purplewin); | |
| 9298 | 464 | |
| 15884 | 465 | purple_conversation_autoset_title(old_active_conv); |
| 466 | handle_urgent(old_purplewin, FALSE); | |
| 6302 | 467 | |
| 15884 | 468 | if (count_messages(old_purplewin)) |
| 469 | notify_win(old_purplewin); | |
| 9298 | 470 | |
| 15884 | 471 | purple_conversation_autoset_title(active_conv); |
| 472 | handle_urgent(new_purplewin, FALSE); | |
| 9298 | 473 | |
| 15884 | 474 | if (count_messages(new_purplewin)) |
| 475 | notify_win(new_purplewin); | |
| 9298 | 476 | */ |
| 477 | } | |
| 478 | } else { | |
| 15884 | 479 | printf("else count = %d\n", count_messages(new_purplewin)); |
| 480 | printf("else count = %d\n", count_messages(old_purplewin)); | |
| 9298 | 481 | /* |
| 15884 | 482 | purple_conversation_autoset_title(active_conv); |
| 483 | handle_urgent(old_purplewin, FALSE); | |
| 9298 | 484 | |
| 15884 | 485 | if (count_messages(old_purplewin)) |
| 486 | notify_win(old_purplewin); | |
| 9298 | 487 | */ |
| 488 | } | |
| 4035 | 489 | } |
|
9303
e257ad08c77c
[gaim-migrate @ 10107]
Mark Doliner <markdoliner@pidgin.im>
parents:
9298
diff
changeset
|
490 | #endif |
| 4035 | 491 | |
| 6977 | 492 | static void |
| 15884 | 493 | handle_string(PidginWindow *purplewin) |
| 9298 | 494 | { |
| 495 | GtkWindow *window = NULL; | |
| 496 | gchar newtitle[256]; | |
| 497 | ||
| 15884 | 498 | g_return_if_fail(purplewin != NULL); |
| 9298 | 499 | |
| 15884 | 500 | window = GTK_WINDOW(purplewin->window); |
| 9298 | 501 | g_return_if_fail(window != NULL); |
| 502 | ||
| 503 | g_snprintf(newtitle, sizeof(newtitle), "%s%s", | |
| 15884 | 504 | purple_prefs_get_string("/plugins/gtk/X11/notify/title_string"), |
| 9298 | 505 | gtk_window_get_title(window)); |
| 506 | gtk_window_set_title(window, newtitle); | |
| 507 | } | |
| 508 | ||
| 509 | static void | |
| 15884 | 510 | handle_count_title(PidginWindow *purplewin) |
| 9298 | 511 | { |
| 512 | GtkWindow *window; | |
| 513 | char newtitle[256]; | |
| 514 | ||
| 15884 | 515 | g_return_if_fail(purplewin != NULL); |
| 9298 | 516 | |
| 15884 | 517 | window = GTK_WINDOW(purplewin->window); |
| 9298 | 518 | g_return_if_fail(window != NULL); |
| 519 | ||
| 10606 | 520 | g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", |
| 15884 | 521 | count_messages(purplewin), gtk_window_get_title(window)); |
| 9298 | 522 | gtk_window_set_title(window, newtitle); |
| 523 | } | |
| 524 | ||
| 525 | static void | |
| 15884 | 526 | handle_count_xprop(PidginWindow *purplewin) |
| 14389 | 527 | { |
| 528 | #ifndef _WIN32 | |
| 529 | guint count; | |
| 530 | GtkWidget *window; | |
| 531 | GdkWindow *gdkwin; | |
| 532 | ||
| 15884 | 533 | window = purplewin->window; |
| 14389 | 534 | g_return_if_fail(window != NULL); |
| 535 | ||
| 15884 | 536 | if (_PurpleUnseenCount == GDK_NONE) { |
| 537 | _PurpleUnseenCount = gdk_atom_intern("_PIDGIN_UNSEEN_COUNT", FALSE); | |
| 14389 | 538 | } |
| 539 | ||
| 540 | if (_Cardinal == GDK_NONE) { | |
| 541 | _Cardinal = gdk_atom_intern("CARDINAL", FALSE); | |
| 542 | } | |
| 543 | ||
| 15884 | 544 | 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
|
545 | #if GTK_CHECK_VERSION(2,14,0) |
|
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
|
546 | gdkwin = gtk_widget_get_window(window); |
|
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
|
547 | #else |
| 14389 | 548 | gdkwin = window->window; |
|
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
|
549 | #endif |
| 14389 | 550 | |
| 15884 | 551 | gdk_property_change(gdkwin, _PurpleUnseenCount, _Cardinal, 32, |
| 14389 | 552 | GDK_PROP_MODE_REPLACE, (guchar *) &count, 1); |
| 553 | #endif | |
| 554 | } | |
| 555 | ||
| 556 | static void | |
|
25382
6a3ab0bc549d
Check that the PidginWindow we get in handle_urgent actually exists and has
Etan Reisner <deryni@pidgin.im>
parents:
24506
diff
changeset
|
557 | handle_urgent(PidginWindow *purplewin, gboolean set) |
| 6977 | 558 | { |
|
25382
6a3ab0bc549d
Check that the PidginWindow we get in handle_urgent actually exists and has
Etan Reisner <deryni@pidgin.im>
parents:
24506
diff
changeset
|
559 | 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
|
560 | 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
|
561 | |
|
6a3ab0bc549d
Check that the PidginWindow we get in handle_urgent actually exists and has
Etan Reisner <deryni@pidgin.im>
parents:
24506
diff
changeset
|
562 | pidgin_set_urgent(GTK_WINDOW(purplewin->window), set); |
| 4035 | 563 | } |
| 564 | ||
| 6977 | 565 | static void |
| 15884 | 566 | handle_raise(PidginWindow *purplewin) |
| 10606 | 567 | { |
| 15884 | 568 | pidgin_conv_window_raise(purplewin); |
| 10606 | 569 | } |
| 570 | ||
| 571 | 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
|
572 | 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
|
573 | { |
|
27858
3ade5991f52f
Fix a crash with the Message Notification plugin and the 'hidden' gtkconv
Paul Aurich <darkrain42@pidgin.im>
parents:
25382
diff
changeset
|
574 | 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
|
575 | return; |
|
3ade5991f52f
Fix a crash with the Message Notification plugin and the 'hidden' gtkconv
Paul Aurich <darkrain42@pidgin.im>
parents:
25382
diff
changeset
|
576 | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
577 | 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
|
578 | } |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
579 | |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
580 | static void |
| 6977 | 581 | type_toggle_cb(GtkWidget *widget, gpointer data) |
| 582 | { | |
| 583 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 584 | gchar pref[256]; | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
585 | |
| 14389 | 586 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 587 | (char *)data); | |
|
4359
cf899ee07d1d
[gaim-migrate @ 4625]
Christian Hammond <chipx86@chipx86.com>
parents:
4218
diff
changeset
|
588 | |
| 15884 | 589 | purple_prefs_set_bool(pref, on); |
| 3374 | 590 | } |
| 591 | ||
| 6977 | 592 | static void |
| 593 | method_toggle_cb(GtkWidget *widget, gpointer data) | |
| 594 | { | |
| 595 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 596 | gchar pref[256]; | |
| 597 | ||
| 14389 | 598 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 599 | (char *)data); | |
| 3374 | 600 | |
| 15884 | 601 | purple_prefs_set_bool(pref, on); |
| 6977 | 602 | |
| 603 | if (!strcmp(data, "method_string")) { | |
| 604 | GtkWidget *entry = g_object_get_data(G_OBJECT(widget), "title-entry"); | |
| 605 | gtk_widget_set_sensitive(entry, on); | |
| 606 | ||
| 15884 | 607 | purple_prefs_set_string("/plugins/gtk/X11/notify/title_string", |
| 14448 | 608 | gtk_entry_get_text(GTK_ENTRY(entry))); |
| 6977 | 609 | } |
| 610 | ||
| 611 | apply_method(); | |
| 3374 | 612 | } |
| 613 | ||
| 6977 | 614 | static void |
| 615 | notify_toggle_cb(GtkWidget *widget, gpointer data) | |
| 616 | { | |
| 617 | gboolean on = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); | |
| 618 | gchar pref[256]; | |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
619 | |
| 14389 | 620 | g_snprintf(pref, sizeof(pref), "/plugins/gtk/X11/notify/%s", |
| 621 | (char *)data); | |
| 3374 | 622 | |
| 15884 | 623 | purple_prefs_set_bool(pref, on); |
| 6977 | 624 | |
| 625 | apply_notify(); | |
| 3374 | 626 | } |
| 627 | ||
| 6977 | 628 | static gboolean |
| 629 | options_entry_cb(GtkWidget *widget, GdkEventFocus *evt, gpointer data) | |
| 630 | { | |
| 631 | if (data == NULL) | |
|
6982
12f08de92674
[gaim-migrate @ 7538]
Mark Doliner <markdoliner@pidgin.im>
parents:
6977
diff
changeset
|
632 | return FALSE; |
| 6302 | 633 | |
| 6977 | 634 | if (!strcmp(data, "method_string")) { |
| 15884 | 635 | purple_prefs_set_string("/plugins/gtk/X11/notify/title_string", |
| 14389 | 636 | gtk_entry_get_text(GTK_ENTRY(widget))); |
| 3374 | 637 | } |
| 6302 | 638 | |
| 6977 | 639 | apply_method(); |
| 6302 | 640 | |
| 641 | return FALSE; | |
| 642 | } | |
| 643 | ||
| 6977 | 644 | static void |
| 14389 | 645 | apply_method() |
| 646 | { | |
|
13664
fdc3b588f248
[gaim-migrate @ 16065]
Richard Laager <rlaager@pidgin.im>
parents:
13550
diff
changeset
|
647 | GList *convs; |
| 6977 | 648 | |
| 15884 | 649 | for (convs = purple_get_conversations(); convs != NULL; |
| 14389 | 650 | convs = convs->next) { |
| 15884 | 651 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 6302 | 652 | |
| 6977 | 653 | /* remove notifications */ |
| 9298 | 654 | unnotify(conv, FALSE); |
| 655 | ||
| 15884 | 656 | if (GPOINTER_TO_INT(purple_conversation_get_data(conv, "notify-message-count")) != 0) |
| 6977 | 657 | /* reattach appropriate notifications */ |
| 14385 | 658 | notify(conv, FALSE); |
| 6977 | 659 | } |
| 3374 | 660 | } |
| 661 | ||
| 6977 | 662 | static void |
| 663 | apply_notify() | |
| 664 | { | |
| 15884 | 665 | GList *convs = purple_get_conversations(); |
|
6485
3c7ba18e32f1
[gaim-migrate @ 6999]
Christian Hammond <chipx86@chipx86.com>
parents:
6464
diff
changeset
|
666 | |
| 6977 | 667 | while (convs) { |
| 15884 | 668 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 4203 | 669 | |
| 6977 | 670 | /* detach signals */ |
| 671 | detach_signals(conv); | |
| 672 | /* reattach appropriate signals */ | |
| 673 | attach_signals(conv); | |
| 4035 | 674 | |
| 6977 | 675 | convs = convs->next; |
| 4035 | 676 | } |
| 677 | } | |
| 678 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
679 | static GtkWidget * |
| 15884 | 680 | get_config_frame(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
681 | { |
| 6977 | 682 | GtkWidget *ret = NULL, *frame = NULL; |
| 683 | GtkWidget *vbox = NULL, *hbox = NULL; | |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
684 | GtkWidget *toggle = NULL, *entry = NULL, *ref; |
| 6302 | 685 | |
| 3565 | 686 | ret = gtk_vbox_new(FALSE, 18); |
| 6302 | 687 | gtk_container_set_border_width(GTK_CONTAINER (ret), 12); |
| 3392 | 688 | |
| 6302 | 689 | /*---------- "Notify For" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
690 | frame = pidgin_make_frame(ret, _("Notify For")); |
| 6302 | 691 | vbox = gtk_vbox_new(FALSE, 5); |
| 692 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 693 | ||
| 3710 | 694 | toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
| 695 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 6977 | 696 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 697 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); |
| 6977 | 698 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 699 | G_CALLBACK(type_toggle_cb), "type_im"); |
| 3710 | 700 | |
| 6977 | 701 | toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
| 3710 | 702 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 6977 | 703 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 704 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); |
| 6977 | 705 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 706 | G_CALLBACK(type_toggle_cb), "type_chat"); |
| 6977 | 707 | |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
708 | ref = toggle; |
|
22942
2bf494f8e2a4
Change the string "screen name" to "username" everywhere. I think most
Mark Doliner <markdoliner@pidgin.im>
parents:
22782
diff
changeset
|
709 | 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
|
710 | 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
|
711 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 712 | 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
|
713 | g_signal_connect(G_OBJECT(toggle), "toggled", |
|
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
714 | G_CALLBACK(type_toggle_cb), "type_chat_nick"); |
|
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
715 | gtk_widget_set_sensitive(toggle, gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(ref))); |
|
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
716 | g_signal_connect(G_OBJECT(ref), "toggled", |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
717 | G_CALLBACK(pidgin_toggle_sensitive), toggle); |
|
13237
9556cdf38196
[gaim-migrate @ 15602]
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
13234
diff
changeset
|
718 | |
| 6977 | 719 | toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); |
| 720 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 721 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 722 | purple_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); |
| 6977 | 723 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 724 | G_CALLBACK(type_toggle_cb), "type_focused"); |
| 3710 | 725 | |
| 6302 | 726 | /*---------- "Notification Methods" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
727 | frame = pidgin_make_frame(ret, _("Notification Methods")); |
| 6302 | 728 | vbox = gtk_vbox_new(FALSE, 5); |
| 729 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 730 | ||
| 6977 | 731 | /* String method button */ |
| 3565 | 732 | hbox = gtk_hbox_new(FALSE, 18); |
| 733 | gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
| 6302 | 734 | toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
| 6977 | 735 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
| 15884 | 736 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
| 3565 | 737 | gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
| 6977 | 738 | |
| 6302 | 739 | entry = gtk_entry_new(); |
| 740 | gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | |
| 741 | gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | |
| 6977 | 742 | gtk_widget_set_sensitive(GTK_WIDGET(entry), |
| 15884 | 743 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
| 6977 | 744 | gtk_entry_set_text(GTK_ENTRY(entry), |
| 15884 | 745 | purple_prefs_get_string("/plugins/gtk/X11/notify/title_string")); |
| 6977 | 746 | g_object_set_data(G_OBJECT(toggle), "title-entry", entry); |
| 747 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 748 | G_CALLBACK(method_toggle_cb), "method_string"); |
| 6977 | 749 | g_signal_connect(G_OBJECT(entry), "focus-out-event", |
| 9298 | 750 | G_CALLBACK(options_entry_cb), "method_string"); |
| 3374 | 751 | |
| 6977 | 752 | /* Count method button */ |
| 753 | toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | |
| 754 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 755 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); |
| 6977 | 756 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 757 | g_signal_connect(G_OBJECT(toggle), "toggled", | |
| 9298 | 758 | G_CALLBACK(method_toggle_cb), "method_count"); |
| 4035 | 759 | |
| 12959 | 760 | #ifndef _WIN32 |
| 14389 | 761 | /* Count xprop method button */ |
| 762 | toggle = gtk_check_button_new_with_mnemonic(_("Insert count of new message into _X property")); | |
| 763 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 764 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 765 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count_xprop")); |
| 14389 | 766 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 767 | G_CALLBACK(method_toggle_cb), "method_count_xprop"); | |
| 768 | ||
| 6977 | 769 | /* Urgent method button */ |
| 770 | 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
|
771 | #else |
|
24506
4d624cd775bd
Mark for translation now that we're unfrozen.
Daniel Atallah <datallah@pidgin.im>
parents:
24431
diff
changeset
|
772 | 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
|
773 | #endif |
| 6977 | 774 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 775 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 776 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); |
| 9298 | 777 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 778 | G_CALLBACK(method_toggle_cb), "method_urgent"); | |
| 3710 | 779 | |
| 10606 | 780 | /* Raise window method button */ |
| 781 | toggle = gtk_check_button_new_with_mnemonic(_("R_aise conversation window")); | |
| 782 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 783 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 784 | purple_prefs_get_bool("/plugins/gtk/X11/notify/method_raise")); |
| 10606 | 785 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 786 | G_CALLBACK(method_toggle_cb), "method_raise"); | |
| 787 | ||
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
788 | /* Present conversation method button */ |
|
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
789 | 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
|
790 | 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
|
791 | 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
|
792 | 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
|
793 | 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
|
794 | 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
|
795 | |
| 6977 | 796 | /*---------- "Notification Removals" ----------*/ |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
797 | frame = pidgin_make_frame(ret, _("Notification Removal")); |
| 6302 | 798 | vbox = gtk_vbox_new(FALSE, 5); |
| 799 | gtk_container_add(GTK_CONTAINER(frame), vbox); | |
| 3374 | 800 | |
| 6977 | 801 | /* Remove on focus button */ |
| 802 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | |
| 803 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 804 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 805 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); |
| 6977 | 806 | g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); |
| 807 | ||
| 808 | /* Remove on click button */ | |
| 809 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | |
| 810 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 811 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 812 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); |
| 6977 | 813 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 814 | G_CALLBACK(notify_toggle_cb), "notify_click"); |
| 3710 | 815 | |
| 6977 | 816 | /* Remove on type button */ |
| 817 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | |
| 818 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 819 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 820 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); |
| 6977 | 821 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 822 | G_CALLBACK(notify_toggle_cb), "notify_type"); |
| 4035 | 823 | |
| 6977 | 824 | /* Remove on message send button */ |
| 825 | toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | |
| 826 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | |
| 827 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 828 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); |
| 6977 | 829 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 830 | G_CALLBACK(notify_toggle_cb), "notify_send"); |
| 3565 | 831 | |
| 6977 | 832 | #if 0 |
| 833 | /* Remove on conversation switch button */ | |
| 9298 | 834 | toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); |
| 6977 | 835 | gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
| 836 | gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | |
| 15884 | 837 | purple_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); |
| 6977 | 838 | g_signal_connect(G_OBJECT(toggle), "toggled", |
| 9298 | 839 | G_CALLBACK(notify_toggle_cb), "notify_switch"); |
| 6977 | 840 | #endif |
| 841 | ||
| 842 | gtk_widget_show_all(ret); | |
| 843 | return ret; | |
| 3374 | 844 | } |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
845 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
846 | static gboolean |
| 15884 | 847 | plugin_load(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
848 | { |
| 15884 | 849 | GList *convs = purple_get_conversations(); |
| 850 | void *conv_handle = purple_conversations_get_handle(); | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
851 | void *gtk_conv_handle = pidgin_conversations_get_handle(); |
| 6302 | 852 | |
| 853 | my_plugin = plugin; | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
854 | |
| 15884 | 855 | purple_signal_connect(gtk_conv_handle, "displayed-im-msg", plugin, |
| 856 | PURPLE_CALLBACK(message_displayed_cb), NULL); | |
| 857 | purple_signal_connect(gtk_conv_handle, "displayed-chat-msg", plugin, | |
| 858 | PURPLE_CALLBACK(message_displayed_cb), NULL); | |
| 859 | purple_signal_connect(gtk_conv_handle, "conversation-switched", plugin, | |
| 860 | PURPLE_CALLBACK(conv_switched), NULL); | |
| 861 | purple_signal_connect(conv_handle, "sent-im-msg", plugin, | |
| 862 | PURPLE_CALLBACK(im_sent_im), NULL); | |
| 863 | purple_signal_connect(conv_handle, "sent-chat-msg", plugin, | |
| 864 | PURPLE_CALLBACK(chat_sent_im), NULL); | |
| 865 | purple_signal_connect(conv_handle, "conversation-created", plugin, | |
| 866 | PURPLE_CALLBACK(conv_created), NULL); | |
| 867 | purple_signal_connect(conv_handle, "deleting-conversation", plugin, | |
| 868 | PURPLE_CALLBACK(deleting_conv), NULL); | |
|
10971
4c823ffab27a
[gaim-migrate @ 12796]
Mark Doliner <markdoliner@pidgin.im>
parents:
10841
diff
changeset
|
869 | #if 0 |
| 15884 | 870 | purple_signal_connect(gtk_conv_handle, "conversation-dragging", plugin, |
| 871 | PURPLE_CALLBACK(conversation_dragging), NULL); | |
|
9303
e257ad08c77c
[gaim-migrate @ 10107]
Mark Doliner <markdoliner@pidgin.im>
parents:
9298
diff
changeset
|
872 | #endif |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
873 | |
| 6977 | 874 | while (convs) { |
| 15884 | 875 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
| 6302 | 876 | |
| 877 | /* attach signals */ | |
| 6977 | 878 | attach_signals(conv); |
| 6302 | 879 | |
| 6977 | 880 | convs = convs->next; |
| 6302 | 881 | } |
| 882 | ||
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
883 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
884 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
885 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
886 | static gboolean |
| 15884 | 887 | plugin_unload(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
888 | { |
| 15884 | 889 | GList *convs = purple_get_conversations(); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
890 | |
| 6977 | 891 | while (convs) { |
| 15884 | 892 | PurpleConversation *conv = (PurpleConversation *)convs->data; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
893 | |
| 6302 | 894 | /* kill signals */ |
| 6977 | 895 | detach_signals(conv); |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
896 | |
| 6977 | 897 | convs = convs->next; |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
898 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
899 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
900 | return TRUE; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
901 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
902 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
903 | static PidginPluginUiInfo ui_info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
904 | { |
|
12600
7ecd4441fdc7
[gaim-migrate @ 14934]
Richard Laager <rlaager@pidgin.im>
parents:
12397
diff
changeset
|
905 | get_config_frame, |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
906 | 0, /* page_num (Reserved) */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
907 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
908 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
909 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
910 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
911 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
912 | NULL |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
913 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
914 | |
| 15884 | 915 | static PurplePluginInfo info = |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
916 | { |
| 15884 | 917 | PURPLE_PLUGIN_MAGIC, |
| 918 | PURPLE_MAJOR_VERSION, | |
| 919 | PURPLE_MINOR_VERSION, | |
| 920 | PURPLE_PLUGIN_STANDARD, /**< type */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15527
diff
changeset
|
921 | PIDGIN_PLUGIN_TYPE, /**< ui_requirement */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
922 | 0, /**< flags */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
923 | NULL, /**< dependencies */ |
| 15884 | 924 | PURPLE_PRIORITY_DEFAULT, /**< priority */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
925 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
926 | NOTIFY_PLUGIN_ID, /**< id */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
927 | N_("Message Notification"), /**< name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
928 | DISPLAY_VERSION, /**< version */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
929 | /** summary */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
930 | N_("Provides a variety of ways of notifying you of unread messages."), |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
931 | /** description */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
932 | N_("Provides a variety of ways of notifying you of unread messages."), |
| 14389 | 933 | /**< author */ |
|
22782
c465a8b48510
Massage some plugin metadata to look better with the fixed up description pane.
Will Thompson <resiak@pidgin.im>
parents:
22539
diff
changeset
|
934 | "Etan Reisner <deryni@eden.rutgers.edu>,\nBrian Tarricone <bjt23@cornell.edu>", |
| 15884 | 935 | PURPLE_WEBSITE, /**< homepage */ |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
936 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
937 | plugin_load, /**< load */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
938 | plugin_unload, /**< unload */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
939 | NULL, /**< destroy */ |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
940 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
941 | &ui_info, /**< ui_info */ |
| 8993 | 942 | NULL, /**< extra_info */ |
| 943 | NULL, | |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
944 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
945 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
946 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
947 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
948 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
949 | NULL, |
| 8993 | 950 | NULL |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
951 | }; |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
952 | |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
953 | static void |
| 15884 | 954 | init_plugin(PurplePlugin *plugin) |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
955 | { |
| 15884 | 956 | purple_prefs_add_none("/plugins/gtk"); |
| 957 | purple_prefs_add_none("/plugins/gtk/X11"); | |
| 958 | purple_prefs_add_none("/plugins/gtk/X11/notify"); | |
| 6302 | 959 | |
| 15884 | 960 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_im", TRUE); |
| 961 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat", FALSE); | |
| 962 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_chat_nick", FALSE); | |
| 963 | purple_prefs_add_bool("/plugins/gtk/X11/notify/type_focused", FALSE); | |
| 964 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_string", FALSE); | |
| 965 | purple_prefs_add_string("/plugins/gtk/X11/notify/title_string", "(*)"); | |
| 966 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_urgent", FALSE); | |
| 967 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count", FALSE); | |
| 968 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_count_xprop", FALSE); | |
| 969 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_raise", FALSE); | |
|
22909
de65ba1caca4
Finally get around to committing charkin's version of the patch from #2145.
Etan Reisner <deryni@pidgin.im>
parents:
22782
diff
changeset
|
970 | purple_prefs_add_bool("/plugins/gtk/X11/notify/method_present", FALSE); |
| 15884 | 971 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_focus", TRUE); |
| 972 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_click", FALSE); | |
| 973 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_type", TRUE); | |
| 974 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_send", TRUE); | |
| 975 | purple_prefs_add_bool("/plugins/gtk/X11/notify/notify_switch", TRUE); | |
|
5205
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
976 | } |
|
242b8aa81328
[gaim-migrate @ 5573]
Christian Hammond <chipx86@chipx86.com>
parents:
5021
diff
changeset
|
977 | |
| 15884 | 978 | PURPLE_INIT_PLUGIN(notify, init_plugin, info) |