Mercurial > pidgin.yaz
annotate pidgin/gtkdocklet.c @ 20912:f34539eb7a61
Add some xsl magic to generate a .devhelp index from doxygen's XML output,
allowing the documentation to be viewed in Devhelp. It's not perfect ---
there are some broken links and the transformation is a bit fragile --- but
works well enough to be useful.
author | Will Thompson <will.thompson@collabora.co.uk> |
---|---|
date | Sat, 13 Oct 2007 15:44:43 +0000 |
parents | dc94a669bbf6 |
children | 1d8969748cd9 8b9c48347004 |
rev | line source |
---|---|
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
1 /* |
15823 | 2 * System tray icon (aka docklet) plugin for Purple |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
3 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
4 * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
5 * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
6 * Inspired by a similar plugin by: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
7 * John (J5) Palmieri <johnp@martianrock.com> |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
8 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
9 * This program is free software; you can redistribute it and/or |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
10 * modify it under the terms of the GNU General Public License as |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
11 * published by the Free Software Foundation; either version 2 of the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
12 * License, or (at your option) any later version. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
13 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
14 * This program is distributed in the hope that it will be useful, but |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
15 * WITHOUT ANY WARRANTY; without even the implied warranty of |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
17 * General Public License for more details. |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
18 * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
19 * You should have received a copy of the GNU General Public License |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
20 * along with this program; if not, write to the Free Software |
19680
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18853
diff
changeset
|
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
44b4e8bd759b
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
18853
diff
changeset
|
22 * 02111-1301, USA. |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
23 */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
24 #include "internal.h" |
15514 | 25 #include "pidgin.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
26 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
27 #include "core.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
28 #include "conversation.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
29 #include "debug.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
30 #include "prefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
31 #include "signals.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
32 #include "sound.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
33 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
34 #include "gtkaccount.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
35 #include "gtkblist.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
36 #include "gtkconv.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
37 #include "gtkplugin.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
38 #include "gtkprefs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
39 #include "gtksavedstatuses.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
40 #include "gtksound.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
41 #include "gtkutils.h" |
15822
84b0f9b23ede
According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@gmail.com>
parents:
15821
diff
changeset
|
42 #include "pidginstock.h" |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
43 #include "gtkdocklet.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
44 #include "gtkdialogs.h" |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
45 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
46 #ifndef DOCKLET_TOOLTIP_LINE_LIMIT |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
47 #define DOCKLET_TOOLTIP_LINE_LIMIT 5 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
48 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
49 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
50 /* globals */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
51 static struct docklet_ui_ops *ui_ops = NULL; |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
52 static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE; |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
53 static gboolean pending = FALSE; |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
54 static gboolean connecting = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
55 static gboolean enable_join_chat = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
56 static guint docklet_blinking_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
57 static gboolean visible = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
58 static gboolean visibility_manager = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
59 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
60 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
61 * docklet status and utility functions |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
62 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
63 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
64 docklet_blink_icon() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
65 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
66 static gboolean blinked = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
67 gboolean ret = FALSE; /* by default, don't keep blinking */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
68 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
69 blinked = !blinked; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
70 |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
71 if(pending && !connecting) { |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
72 if (blinked) { |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
73 if (ui_ops && ui_ops->blank_icon) |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
74 ui_ops->blank_icon(); |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
75 } else { |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
76 pidgin_docklet_update_icon(); |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
77 } |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
78 ret = TRUE; /* keep blinking */ |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
79 } else { |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
80 docklet_blinking_timer = 0; |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
81 blinked = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
82 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
83 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
84 return ret; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
85 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
86 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
87 static GList * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
88 get_pending_list(guint max) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
89 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
90 GList *l_im = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
91 GList *l_chat = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
92 |
15823 | 93 l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM, |
15505
762b6547adf9
GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents:
15502
diff
changeset
|
94 PIDGIN_UNSEEN_TEXT, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
95 FALSE, max); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
96 |
15823 | 97 l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT, |
15505
762b6547adf9
GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@gmail.com>
parents:
15502
diff
changeset
|
98 PIDGIN_UNSEEN_NICK, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
99 FALSE, max); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
100 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
101 if (l_im != NULL && l_chat != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
102 return g_list_concat(l_im, l_chat); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
103 else if (l_im != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
104 return l_im; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
105 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
106 return l_chat; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
107 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
108 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
109 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
110 docklet_update_status() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
111 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
112 GList *convs, *l; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
113 int count; |
15823 | 114 PurpleSavedStatus *saved_status; |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
115 PurpleStatusPrimitive newstatus = PURPLE_STATUS_OFFLINE; |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
116 gboolean newpending = FALSE, newconnecting = FALSE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
117 |
16630
112fa61799f4
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
118 /* get the current savedstatus */ |
112fa61799f4
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
119 saved_status = purple_savedstatus_get_current(); |
112fa61799f4
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
120 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
121 /* determine if any ims have unseen messages */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
122 convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
123 |
18853
fab096e7b804
reverting the show docklet preference the correct way
Ka-Hing Cheung <khc@hxbc.us>
parents:
18833
diff
changeset
|
124 if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
125 if (convs && ui_ops->create && !visible) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
126 g_list_free(convs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
127 ui_ops->create(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
128 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
129 } else if (!convs && ui_ops->destroy && visible) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
130 ui_ops->destroy(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
131 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
132 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
133 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
134 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
135 if (!visible) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
136 g_list_free(convs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
137 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
138 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
139 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
140 if (convs != NULL) { |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
141 newpending = TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
142 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
143 /* set tooltip if messages are pending */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
144 if (ui_ops->set_tooltip) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
145 GString *tooltip_text = g_string_new(""); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
146 for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { |
15632
a830f9756f23
Some more pidgininfication
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15615
diff
changeset
|
147 if (PIDGIN_IS_PIDGIN_CONVERSATION(l->data)) { |
15823 | 148 PidginConversation *gtkconv = PIDGIN_CONVERSATION((PurpleConversation *)l->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
149 if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
150 g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
151 else |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
152 g_string_append_printf(tooltip_text, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
153 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
154 gtkconv->unseen_count, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
155 gtk_label_get_text(GTK_LABEL(gtkconv->tab_label))); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
156 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
157 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
158 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
159 /* get rid of the last newline */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
160 if (tooltip_text->len > 0) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
161 tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
162 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
163 ui_ops->set_tooltip(tooltip_text->str); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
164 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
165 g_string_free(tooltip_text, TRUE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
166 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
167 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
168 g_list_free(convs); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
169 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
170 } else if (ui_ops->set_tooltip) { |
16932
b668951121d8
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@wiktel.com>
parents:
16922
diff
changeset
|
171 char *tooltip_text = g_strconcat(PIDGIN_NAME, " - ", |
16630
112fa61799f4
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
172 purple_savedstatus_get_title(saved_status), NULL); |
112fa61799f4
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
173 ui_ops->set_tooltip(tooltip_text); |
112fa61799f4
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@wiktel.com>
parents:
16202
diff
changeset
|
174 g_free(tooltip_text); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
175 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
176 |
15823 | 177 for(l = purple_accounts_get_all(); l != NULL; l = l->next) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
178 |
15823 | 179 PurpleAccount *account = (PurpleAccount*)l->data; |
180 PurpleStatus *account_status; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
181 |
15823 | 182 if (!purple_account_get_enabled(account, PIDGIN_UI)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
183 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
184 |
15823 | 185 if (purple_account_is_disconnected(account)) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
186 continue; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
187 |
15823 | 188 account_status = purple_account_get_active_status(account); |
189 if (purple_account_is_connecting(account)) | |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
190 newconnecting = TRUE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
191 } |
15701
4a331e8d01df
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15699
diff
changeset
|
192 |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
193 newstatus = purple_savedstatus_get_type(saved_status); |
15701
4a331e8d01df
Fix win32 docklet. This is pretty ugly - we'll force GTK+ 2.10 at some point and use GtkStatusIcon to avoid converting the stock images to HICONs directly.
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15699
diff
changeset
|
194 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
195 /* update the icon if we changed status */ |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
196 if (status != newstatus || pending!=newpending || connecting!=newconnecting) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
197 status = newstatus; |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
198 pending = newpending; |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
199 connecting = newconnecting; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
200 |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
201 pidgin_docklet_update_icon(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
202 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
203 /* and schedule the blinker function if messages are pending */ |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
204 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink") |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
205 && pending && !connecting && docklet_blinking_timer == 0) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
206 docklet_blinking_timer = g_timeout_add(500, docklet_blink_icon, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
207 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
208 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
209 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
210 return FALSE; /* for when we're called by the glib idle handler */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
211 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
212 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
213 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
214 online_account_supports_chat() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
215 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
216 GList *c = NULL; |
15823 | 217 c = purple_connections_get_all(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
218 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
219 while(c != NULL) { |
15823 | 220 PurpleConnection *gc = c->data; |
221 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
222 if (prpl_info != NULL && prpl_info->chat_info != NULL) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
223 return TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
224 c = c->next; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
225 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
226 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
227 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
228 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
229 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
230 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
231 * callbacks and signal handlers |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
232 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
233 #if 0 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
234 static void |
15821 | 235 pidgin_quit_cb() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
236 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
237 /* TODO: confirm quit while pending */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
238 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
239 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
240 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
241 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
242 docklet_update_status_cb(void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
243 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
244 docklet_update_status(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
245 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
246 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
247 static void |
15823 | 248 docklet_conv_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
249 { |
15823 | 250 if (type == PURPLE_CONV_UPDATE_UNSEEN) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
251 docklet_update_status(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
252 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
253 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
254 static void |
15823 | 255 docklet_signed_on_cb(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
256 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
257 if (!enable_join_chat) { |
15823 | 258 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
259 enable_join_chat = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
260 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
261 docklet_update_status(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
262 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
263 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
264 static void |
15823 | 265 docklet_signed_off_cb(PurpleConnection *gc) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
266 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
267 if (enable_join_chat) { |
15823 | 268 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
269 enable_join_chat = online_account_supports_chat(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
270 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
271 docklet_update_status(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
272 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
273 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
274 static void |
15823 | 275 docklet_show_pref_changed_cb(const char *name, PurplePrefType type, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
276 gconstpointer value, gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
277 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
278 const char *val = value; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
279 if (!strcmp(val, "always")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
280 if (ui_ops->create) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
281 if (!visible) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
282 ui_ops->create(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
283 else if (!visibility_manager) { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
284 pidgin_blist_visibility_manager_add(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
285 visibility_manager = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
286 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
287 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
288 } else if (!strcmp(val, "never")) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
289 if (visible && ui_ops->destroy) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
290 ui_ops->destroy(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
291 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
292 if (visibility_manager) { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
293 pidgin_blist_visibility_manager_remove(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
294 visibility_manager = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
295 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
296 docklet_update_status(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
297 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
298 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
299 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
300 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
301 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
302 * docklet pop-up menu |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
303 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
304 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
305 docklet_toggle_mute(GtkWidget *toggle, void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
306 { |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
307 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", GTK_CHECK_MENU_ITEM(toggle)->active); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
308 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
309 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
310 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
311 docklet_toggle_blink(GtkWidget *toggle, void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
312 { |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
313 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/blink", GTK_CHECK_MENU_ITEM(toggle)->active); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
314 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
315 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
316 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
317 docklet_toggle_blist(GtkWidget *toggle, void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
318 { |
15823 | 319 purple_blist_set_visible(GTK_CHECK_MENU_ITEM(toggle)->active); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
320 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
321 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
322 #ifdef _WIN32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
323 /* This is a workaround for a bug in windows GTK+. Clicking outside of the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
324 menu does not get rid of it, so instead we get rid of it as soon as the |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
325 pointer leaves the menu. */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
326 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
327 hide_docklet_menu(gpointer data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
328 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
329 if (data != NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
330 gtk_menu_popdown(GTK_MENU(data)); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
331 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
332 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
333 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
334 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
335 static gboolean |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
336 docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
337 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
338 static guint hide_docklet_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
339 if (event->type == GDK_LEAVE_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { |
15823 | 340 purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu leave-notify-event\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
341 /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
342 if (hide_docklet_timer == 0) { |
15823 | 343 hide_docklet_timer = purple_timeout_add(500, |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
344 hide_docklet_menu, menu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
345 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
346 } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { |
15823 | 347 purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu enter-notify-event\n"); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
348 if (hide_docklet_timer != 0) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
349 /* Cancel the hiding if we reenter */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
350 |
15823 | 351 purple_timeout_remove(hide_docklet_timer); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
352 hide_docklet_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
353 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
354 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
355 return FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
356 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
357 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
358 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
359 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
360 show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
361 { |
15823 | 362 PurpleSavedStatus *saved_status; |
363 saved_status = purple_savedstatus_get_current(); | |
16119
e57d9d5e5c86
sf patch #1622581, from Greg Taeger
Mark Doliner <mark@kingant.net>
parents:
16070
diff
changeset
|
364 |
e57d9d5e5c86
sf patch #1622581, from Greg Taeger
Mark Doliner <mark@kingant.net>
parents:
16070
diff
changeset
|
365 if (purple_savedstatus_get_type(saved_status) == PURPLE_STATUS_AVAILABLE) |
e57d9d5e5c86
sf patch #1622581, from Greg Taeger
Mark Doliner <mark@kingant.net>
parents:
16070
diff
changeset
|
366 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY); |
e57d9d5e5c86
sf patch #1622581, from Greg Taeger
Mark Doliner <mark@kingant.net>
parents:
16070
diff
changeset
|
367 |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
368 pidgin_status_editor_show(FALSE, |
15823 | 369 purple_savedstatus_is_transient(saved_status) ? saved_status : NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
370 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
371 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
372 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
373 activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
374 { |
15823 | 375 PurpleStatusPrimitive primitive; |
376 PurpleSavedStatus *saved_status; | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
377 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
378 primitive = GPOINTER_TO_INT(user_data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
379 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
380 /* Try to lookup an already existing transient saved status */ |
15823 | 381 saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
382 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
383 /* Create a new transient saved status if we weren't able to find one */ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
384 if (saved_status == NULL) |
15823 | 385 saved_status = purple_savedstatus_new(NULL, primitive); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
386 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
387 /* Set the status for each account */ |
15823 | 388 purple_savedstatus_activate(saved_status); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
389 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
390 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
391 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
392 activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
393 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
394 time_t creation_time; |
15823 | 395 PurpleSavedStatus *saved_status; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
396 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
397 creation_time = GPOINTER_TO_INT(user_data); |
15823 | 398 saved_status = purple_savedstatus_find_by_creation_time(creation_time); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
399 if (saved_status != NULL) |
15823 | 400 purple_savedstatus_activate(saved_status); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
401 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
402 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
403 static GtkWidget * |
15823 | 404 new_menu_item_with_status_icon(GtkWidget *menu, const char *str, PurpleStatusPrimitive primitive, GtkSignalFunc sf, gpointer data, guint accel_key, guint accel_mods, char *mod) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
405 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
406 GtkWidget *menuitem; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
407 GdkPixbuf *pixbuf; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
408 GtkWidget *image; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
409 |
20894
39a793dcb9df
Patch from QuLogic to not use underscores in saved-statuses as mnemonics
Sadrul Habib Chowdhury <imadil@gmail.com>
parents:
20153
diff
changeset
|
410 menuitem = gtk_image_menu_item_new_with_label(str); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
411 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
412 if (menu) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
413 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
414 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
415 if (sf) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
416 g_signal_connect(G_OBJECT(menuitem), "activate", sf, data); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
417 |
15738
20225df32b7e
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@gmail.com>
parents:
15702
diff
changeset
|
418 pixbuf = pidgin_create_status_icon(primitive, menu, PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
419 image = gtk_image_new_from_pixbuf(pixbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
420 g_object_unref(pixbuf); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
421 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
422 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
423 gtk_widget_show_all(menuitem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
424 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
425 return menuitem; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
426 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
427 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
428 static GtkWidget * |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
429 docklet_status_submenu() |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
430 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
431 GtkWidget *submenu, *menuitem; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
432 GList *popular_statuses, *cur; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
433 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
434 submenu = gtk_menu_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
435 menuitem = gtk_menu_item_new_with_label(_("Change Status")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
436 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
437 |
15821 | 438 new_menu_item_with_status_icon(submenu, _("Available"), |
15823 | 439 PURPLE_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb), |
440 GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE), 0, 0, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
441 |
15821 | 442 new_menu_item_with_status_icon(submenu, _("Away"), |
15823 | 443 PURPLE_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb), |
444 GINT_TO_POINTER(PURPLE_STATUS_AWAY), 0, 0, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
445 |
15821 | 446 new_menu_item_with_status_icon(submenu, _("Invisible"), |
15823 | 447 PURPLE_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb), |
448 GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE), 0, 0, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
449 |
15821 | 450 new_menu_item_with_status_icon(submenu, _("Offline"), |
15823 | 451 PURPLE_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb), |
452 GINT_TO_POINTER(PURPLE_STATUS_OFFLINE), 0, 0, NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
453 |
15823 | 454 popular_statuses = purple_savedstatuses_get_popular(6); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
455 if (popular_statuses != NULL) |
15507 | 456 pidgin_separator(submenu); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
457 for (cur = popular_statuses; cur != NULL; cur = cur->next) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
458 { |
15823 | 459 PurpleSavedStatus *saved_status = cur->data; |
460 time_t creation_time = purple_savedstatus_get_creation_time(saved_status); | |
15821 | 461 new_menu_item_with_status_icon(submenu, |
15823 | 462 purple_savedstatus_get_title(saved_status), |
463 purple_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb), | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
464 GINT_TO_POINTER(creation_time), 0, 0, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
465 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
466 g_list_free(popular_statuses); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
467 |
15507 | 468 pidgin_separator(submenu); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
469 |
16922
0aa5e1e5c937
Telcontar on #pidgin-win32 pointed out that the "New..." and "Saved..."
Casey Harkins <charkins@pidgin.im>
parents:
16872
diff
changeset
|
470 pidgin_new_item_from_stock(submenu, _("New..."), NULL, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL); |
0aa5e1e5c937
Telcontar on #pidgin-win32 pointed out that the "New..." and "Saved..."
Casey Harkins <charkins@pidgin.im>
parents:
16872
diff
changeset
|
471 pidgin_new_item_from_stock(submenu, _("Saved..."), NULL, G_CALLBACK(pidgin_status_window_show), NULL, 0, 0, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
472 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
473 return menuitem; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
474 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
475 |
20881
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
476 |
20895
dc94a669bbf6
merge of '0799c401a032f2fe66af5bbf14c1269fa11fe738'
Sadrul Habib Chowdhury <imadil@gmail.com>
diff
changeset
|
477 |
20881
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
478 static void |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
479 plugin_act(GtkObject *obj, PurplePluginAction *pam) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
480 { |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
481 if (pam && pam->callback) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
482 pam->callback(pam); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
483 } |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
484 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
485 static void |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
486 build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin, |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
487 gpointer context) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
488 { |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
489 GtkWidget *menuitem; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
490 PurplePluginAction *action = NULL; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
491 GList *actions, *l; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
492 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
493 actions = PURPLE_PLUGIN_ACTIONS(plugin, context); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
494 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
495 for (l = actions; l != NULL; l = l->next) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
496 { |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
497 if (l->data) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
498 { |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
499 action = (PurplePluginAction *) l->data; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
500 action->plugin = plugin; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
501 action->context = context; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
502 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
503 menuitem = gtk_menu_item_new_with_label(action->label); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
504 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
505 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
506 g_signal_connect(G_OBJECT(menuitem), "activate", |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
507 G_CALLBACK(plugin_act), action); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
508 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action", |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
509 action, |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
510 (GDestroyNotify)purple_plugin_action_free); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
511 gtk_widget_show(menuitem); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
512 } |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
513 else |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
514 pidgin_separator(menu); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
515 } |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
516 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
517 g_list_free(actions); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
518 } |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
519 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
520 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
521 static void |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
522 docklet_plugin_actions(GtkWidget *menu) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
523 { |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
524 GtkWidget *menuitem, *submenu; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
525 PurplePlugin *plugin = NULL; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
526 GList *l; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
527 int c = 0; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
528 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
529 g_return_if_fail(menu != NULL); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
530 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
531 /* Add a submenu for each plugin with custom actions */ |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
532 for (l = purple_plugins_get_loaded(); l; l = l->next) { |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
533 plugin = (PurplePlugin *) l->data; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
534 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
535 if (PURPLE_IS_PROTOCOL_PLUGIN(plugin)) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
536 continue; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
537 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
538 if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin)) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
539 continue; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
540 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
541 menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name)); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
542 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
543 gtk_widget_show(menuitem); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
544 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
545 submenu = gtk_menu_new(); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
546 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
547 gtk_widget_show(submenu); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
548 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
549 build_plugin_actions(submenu, plugin, NULL); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
550 |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
551 c++; |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
552 } |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
553 if(c>0) |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
554 pidgin_separator(menu); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
555 } |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
556 |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
557 static void |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
558 docklet_menu() { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
559 static GtkWidget *menu = NULL; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
560 GtkWidget *menuitem; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
561 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
562 if (menu) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
563 gtk_widget_destroy(menu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
564 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
565 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
566 menu = gtk_menu_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
567 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
568 menuitem = gtk_check_menu_item_new_with_label(_("Show Buddy List")); |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
569 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
570 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
571 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
572 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
573 menuitem = gtk_menu_item_new_with_label(_("Unread Messages")); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
574 |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
575 if (pending) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
576 GtkWidget *submenu = gtk_menu_new(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
577 GList *l = get_pending_list(0); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
578 if (l == NULL) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
579 gtk_widget_set_sensitive(menuitem, FALSE); |
15823 | 580 purple_debug_warning("docklet", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
581 "status indicates messages pending, but no conversations with unseen messages were found."); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
582 } else { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
583 pidgin_conversations_fill_menu(submenu, l); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
584 g_list_free(l); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
585 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
586 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
587 } else { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
588 gtk_widget_set_sensitive(menuitem, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
589 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
590 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
591 |
15507 | 592 pidgin_separator(menu); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
593 |
16202
0973688f4b74
Word on the street is that we don't want things named pidginfoo_bar(), but
Richard Laager <rlaager@wiktel.com>
parents:
16119
diff
changeset
|
594 menuitem = pidgin_new_item_from_stock(menu, _("New Message..."), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, G_CALLBACK(pidgin_dialogs_im), NULL, 0, 0, NULL); |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
595 if (status == PURPLE_STATUS_OFFLINE) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
596 gtk_widget_set_sensitive(menuitem, FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
597 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
598 menuitem = docklet_status_submenu(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
599 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
600 |
15507 | 601 pidgin_separator(menu); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
602 |
15560
442128853bdb
toolbar/menu icons. reduce the imhtmltoolbar spacing. more gaimstock pruning
Sean Egan <seanegan@gmail.com>
parents:
15514
diff
changeset
|
603 pidgin_new_item_from_stock(menu, _("Accounts"), NULL, G_CALLBACK(pidgin_accounts_window_show), NULL, 0, 0, NULL); |
15702
87e807f25b3c
Add plugins stock icon to docklet menu
Daniel Atallah <daniel.atallah@gmail.com>
parents:
15701
diff
changeset
|
604 pidgin_new_item_from_stock(menu, _("Plugins"), PIDGIN_STOCK_TOOLBAR_PLUGINS, G_CALLBACK(pidgin_plugin_dialog_show), NULL, 0, 0, NULL); |
15507 | 605 pidgin_new_item_from_stock(menu, _("Preferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(pidgin_prefs_show), NULL, 0, 0, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
606 |
15507 | 607 pidgin_separator(menu); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
608 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
609 menuitem = gtk_check_menu_item_new_with_label(_("Mute Sounds")); |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
610 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")); |
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
611 if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
612 gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
613 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
614 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
615 |
20153
3b5d20590146
(10:23:40 PM) khc: charkins: shouldn't "on" be lower case?
Casey Harkins <charkins@pidgin.im>
parents:
20136
diff
changeset
|
616 menuitem = gtk_check_menu_item_new_with_label(_("Blink on New Message")); |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
617 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
618 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
619 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
620 |
15507 | 621 pidgin_separator(menu); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
622 |
20881
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
623 /* add plugin actions */ |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
624 docklet_plugin_actions(menu); |
c7b20abc3885
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20153
diff
changeset
|
625 |
15823 | 626 pidgin_new_item_from_stock(menu, _("Quit"), GTK_STOCK_QUIT, G_CALLBACK(purple_core_quit), NULL, 0, 0, NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
627 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
628 #ifdef _WIN32 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
629 g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
630 g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
631 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
632 gtk_widget_show_all(menu); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
633 gtk_menu_popup(GTK_MENU(menu), NULL, NULL, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
634 ui_ops->position_menu, |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
635 NULL, 0, gtk_get_current_event_time()); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
636 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
637 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
638 /************************************************************************** |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
639 * public api for ui_ops |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
640 **************************************************************************/ |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
641 void |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
642 pidgin_docklet_update_icon() |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
643 { |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
644 if (ui_ops && ui_ops->update_icon) |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
645 ui_ops->update_icon(status, connecting, pending); |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
646 } |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
647 |
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
648 void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
649 pidgin_docklet_clicked(int button_type) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
650 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
651 switch (button_type) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
652 case 1: |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
653 if (pending) { |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
654 GList *l = get_pending_list(1); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
655 if (l != NULL) { |
15823 | 656 purple_conversation_present((PurpleConversation *)l->data); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
657 g_list_free(l); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
658 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
659 } else { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
660 pidgin_blist_toggle_visibility(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
661 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
662 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
663 case 3: |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
664 docklet_menu(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
665 break; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
666 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
667 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
668 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
669 void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
670 pidgin_docklet_embedded() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
671 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
672 if (!visibility_manager |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
673 && strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
674 pidgin_blist_visibility_manager_add(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
675 visibility_manager = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
676 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
677 visible = TRUE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
678 docklet_update_status(); |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
679 pidgin_docklet_update_icon(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
680 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
681 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
682 void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
683 pidgin_docklet_remove() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
684 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
685 if (visible) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
686 if (visibility_manager) { |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
687 pidgin_blist_visibility_manager_remove(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
688 visibility_manager = FALSE; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
689 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
690 if (docklet_blinking_timer) { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
691 g_source_remove(docklet_blinking_timer); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
692 docklet_blinking_timer = 0; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
693 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
694 visible = FALSE; |
16949
06f6768b6e29
Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents:
16932
diff
changeset
|
695 status = PURPLE_STATUS_OFFLINE; |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
696 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
697 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
698 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
699 void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
700 pidgin_docklet_set_ui_ops(struct docklet_ui_ops *ops) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
701 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
702 ui_ops = ops; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
703 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
704 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
705 void* |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
706 pidgin_docklet_get_handle() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
707 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
708 static int i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
709 return &i; |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
710 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
711 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
712 void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
713 pidgin_docklet_init() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
714 { |
15823 | 715 void *conn_handle = purple_connections_get_handle(); |
716 void *conv_handle = purple_conversations_get_handle(); | |
717 void *accounts_handle = purple_accounts_get_handle(); | |
16872
38b3ca4b353d
Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents:
16763
diff
changeset
|
718 void *status_handle = purple_savedstatuses_get_handle(); |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
719 void *docklet_handle = pidgin_docklet_get_handle(); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
720 |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
721 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet"); |
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
722 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/blink", FALSE); |
18853
fab096e7b804
reverting the show docklet preference the correct way
Ka-Hing Cheung <khc@hxbc.us>
parents:
18833
diff
changeset
|
723 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/docklet/show", "always"); |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
724 purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show", |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
725 docklet_show_pref_changed_cb, NULL); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
726 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
727 docklet_ui_init(); |
16062
07554cc5d090
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <stu@nosnilmot.com>
parents:
15823
diff
changeset
|
728 if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always") && ui_ops && ui_ops->create) |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
729 ui_ops->create(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
730 |
15823 | 731 purple_signal_connect(conn_handle, "signed-on", |
732 docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL); | |
733 purple_signal_connect(conn_handle, "signed-off", | |
734 docklet_handle, PURPLE_CALLBACK(docklet_signed_off_cb), NULL); | |
16872
38b3ca4b353d
Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents:
16763
diff
changeset
|
735 purple_signal_connect(accounts_handle, "account-connecting", |
15823 | 736 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
737 purple_signal_connect(conv_handle, "received-im-msg", | |
738 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
739 purple_signal_connect(conv_handle, "conversation-created", | |
740 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
741 purple_signal_connect(conv_handle, "deleting-conversation", | |
742 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
743 purple_signal_connect(conv_handle, "conversation-updated", | |
744 docklet_handle, PURPLE_CALLBACK(docklet_conv_updated_cb), NULL); | |
16872
38b3ca4b353d
Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents:
16763
diff
changeset
|
745 purple_signal_connect(status_handle, "savedstatus-changed", |
38b3ca4b353d
Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents:
16763
diff
changeset
|
746 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
747 #if 0 |
15823 | 748 purple_signal_connect(purple_get_core(), "quitting", |
749 docklet_handle, PURPLE_CALLBACK(purple_quit_cb), NULL); | |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
750 #endif |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
751 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
752 enable_join_chat = online_account_supports_chat(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
753 } |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
754 |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
755 void |
15501
d75099d2567e
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@gmail.com>
parents:
15374
diff
changeset
|
756 pidgin_docklet_uninit() |
15374
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
757 { |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
758 if (visible && ui_ops && ui_ops->destroy) |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
759 ui_ops->destroy(); |
5fe8042783c1
Rename gtk/ and libgaim/ to pidgin/ and libpurple/
Sean Egan <seanegan@gmail.com>
parents:
diff
changeset
|
760 } |