pidgin/gtkdocklet.c

Fri, 03 Dec 2010 23:03:58 +0000

author
Marcus Lundblad <malu@pidgin.im>
date
Fri, 03 Dec 2010 23:03:58 +0000
branch
cpw.qulogic.gtk3
changeset 32411
21e9527afb95
parent 32395
058f5a09a522
child 32438
dc8991868906
child 33120
f6f1a27ade72
permissions
-rw-r--r--

updates to work with the latest GTK+

14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
1 /*
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
2 * System tray icon (aka docklet) plugin for Purple
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
3 *
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org>
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
5 * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com>
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
6 * Inspired by a similar plugin by:
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
7 * John (J5) Palmieri <johnp@martianrock.com>
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
8 *
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
9 * This program is free software; you can redistribute it and/or
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
10 * modify it under the terms of the GNU General Public License as
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
11 * published by the Free Software Foundation; either version 2 of the
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
12 * License, or (at your option) any later version.
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
13 *
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
14 * This program is distributed in the hope that it will be useful, but
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
15 * WITHOUT ANY WARRANTY; without even the implied warranty of
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
17 * General Public License for more details.
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
18 *
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
19 * You should have received a copy of the GNU General Public License
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
20 * along with this program; if not, write to the Free Software
19859
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19215
diff changeset
21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
71d37b57eff2 The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents: 19215
diff changeset
22 * 02111-1301, USA.
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
23 */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
24 #include "internal.h"
15577
b8129373f65e More pidgin changes
Sean Egan <seanegan@pidgin.im>
parents: 15570
diff changeset
25 #include "pidgin.h"
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
26
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
27 #include "core.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
28 #include "conversation.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
29 #include "debug.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
30 #include "prefs.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
31 #include "signals.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
32 #include "sound.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
33
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
34 #include "gtkaccount.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
35 #include "gtkblist.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
36 #include "gtkconv.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
37 #include "gtkplugin.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
38 #include "gtkprefs.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
39 #include "gtksavedstatuses.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
40 #include "gtksound.h"
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
41 #include "gtkstatusbox.h"
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
42 #include "gtkutils.h"
15883
969b74a3e27a According to etags, pidgin/ should be completely clean of references to 'gaim' as a client
Sean Egan <seanegan@pidgin.im>
parents: 15882
diff changeset
43 #include "pidginstock.h"
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
44 #include "gtkdocklet.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
45 #include "gtkdialogs.h"
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
46
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
47 #ifndef DOCKLET_TOOLTIP_LINE_LIMIT
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
48 #define DOCKLET_TOOLTIP_LINE_LIMIT 5
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
49 #endif
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
50
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
51 /* globals */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
52 static struct docklet_ui_ops *ui_ops = NULL;
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
53 static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE;
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
54 static gboolean pending = FALSE;
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
55 static gboolean connecting = FALSE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
56 static gboolean enable_join_chat = FALSE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
57 static guint docklet_blinking_timer = 0;
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
58 static gboolean visible = FALSE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
59 static gboolean visibility_manager = FALSE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
60
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
61 /**************************************************************************
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
62 * docklet status and utility functions
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
63 **************************************************************************/
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
64 static gboolean
22108
cb9819851163 Squash some compiler warnings, some from my -Wstrict-prototypes fixing.
Richard Laager <rlaager@pidgin.im>
parents: 22104
diff changeset
65 docklet_blink_icon(gpointer data)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
66 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
67 static gboolean blinked = FALSE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
68 gboolean ret = FALSE; /* by default, don't keep blinking */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
69
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
70 blinked = !blinked;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
71
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
72 if(pending && !connecting) {
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
73 if (blinked) {
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
74 if (ui_ops && ui_ops->blank_icon)
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
75 ui_ops->blank_icon();
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
76 } else {
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
77 pidgin_docklet_update_icon();
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
78 }
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
79 ret = TRUE; /* keep blinking */
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
80 } else {
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
81 docklet_blinking_timer = 0;
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
82 blinked = FALSE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
83 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
84
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
85 return ret;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
86 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
87
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
88 static GList *
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
89 get_pending_list(guint max)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
90 {
25585
694a25f1eaf4 This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents: 25584
diff changeset
91 GList *l_im, *l_chat;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
92
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
93 l_im = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_IM,
15566
ce486027d329 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@pidgin.im>
parents: 15563
diff changeset
94 PIDGIN_UNSEEN_TEXT,
14813
c24dda7fb69e [gaim-migrate @ 17508]
Casey Harkins <charkins@pidgin.im>
parents: 14745
diff changeset
95 FALSE, max);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
96
25585
694a25f1eaf4 This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents: 25584
diff changeset
97 /* Short circuit if we have our information already */
694a25f1eaf4 This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents: 25584
diff changeset
98 if (max == 1 && l_im != NULL)
694a25f1eaf4 This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents: 25584
diff changeset
99 return l_im;
694a25f1eaf4 This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents: 25584
diff changeset
100
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
101 l_chat = pidgin_conversations_find_unseen_list(PURPLE_CONV_TYPE_CHAT,
15566
ce486027d329 GAIM_UNSEEN to PIDGIN_UNSEEN
Sean Egan <seanegan@pidgin.im>
parents: 15563
diff changeset
102 PIDGIN_UNSEEN_NICK,
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
103 FALSE, max);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
104
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
105 if (l_im != NULL && l_chat != NULL)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
106 return g_list_concat(l_im, l_chat);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
107 else if (l_im != NULL)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
108 return l_im;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
109 else
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
110 return l_chat;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
111 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
112
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
113 static gboolean
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21453
diff changeset
114 docklet_update_status(void)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
115 {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
116 GList *convs, *l;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
117 int count;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
118 PurpleSavedStatus *saved_status;
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
119 PurpleStatusPrimitive newstatus = PURPLE_STATUS_OFFLINE;
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
120 gboolean newpending = FALSE, newconnecting = FALSE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
121
16681
c15974a4ff5d Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
122 /* get the current savedstatus */
c15974a4ff5d Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
123 saved_status = purple_savedstatus_get_current();
c15974a4ff5d Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
124
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
125 /* determine if any ims have unseen messages */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
126 convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
127
19215
7a4ee0715da8 reverting the show docklet preference the correct way
Ka-Hing Cheung <khc@pidgin.im>
parents: 19129
diff changeset
128 if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
129 if (convs && ui_ops->create && !visible) {
15075
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
130 g_list_free(convs);
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
131 ui_ops->create();
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
132 return FALSE;
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
133 } else if (!convs && ui_ops->destroy && visible) {
15075
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
134 ui_ops->destroy();
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
135 return FALSE;
14935
9a69bd67236d [gaim-migrate @ 17642]
Sean Egan <seanegan@pidgin.im>
parents: 14875
diff changeset
136 }
9a69bd67236d [gaim-migrate @ 17642]
Sean Egan <seanegan@pidgin.im>
parents: 14875
diff changeset
137 }
9a69bd67236d [gaim-migrate @ 17642]
Sean Egan <seanegan@pidgin.im>
parents: 14875
diff changeset
138
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
139 if (!visible) {
15075
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
140 g_list_free(convs);
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
141 return FALSE;
15075
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
142 }
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
143
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
144 if (convs != NULL) {
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
145 newpending = TRUE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
146
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
147 /* set tooltip if messages are pending */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
148 if (ui_ops->set_tooltip) {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
149 GString *tooltip_text = g_string_new("");
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
150 for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) {
21022
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
151 PurpleConversation *conv = (PurpleConversation *)l->data;
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
152 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
153
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
154 if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) {
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
155 g_string_append(tooltip_text, _("Right-click for more unread messages...\n"));
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
156 } else if(gtkconv) {
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
157 g_string_append_printf(tooltip_text,
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
158 ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count),
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
159 gtkconv->unseen_count,
21056
356b2a5f4d21 Use the conversation title for unread message tooltips. Fixes #3557.
Casey Harkins <charkins@pidgin.im>
parents: 21022
diff changeset
160 purple_conversation_get_title(conv));
21022
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
161 } else {
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
162 g_string_append_printf(tooltip_text,
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
163 ngettext("%d unread message from %s\n", "%d unread messages from %s\n",
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
164 GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))),
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
165 GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")),
21056
356b2a5f4d21 Use the conversation title for unread message tooltips. Fixes #3557.
Casey Harkins <charkins@pidgin.im>
parents: 21022
diff changeset
166 purple_conversation_get_title(conv));
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
167 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
168 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
169
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
170 /* get rid of the last newline */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
171 if (tooltip_text->len > 0)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
172 tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
173
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
174 ui_ops->set_tooltip(tooltip_text->str);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
175
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
176 g_string_free(tooltip_text, TRUE);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
177 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
178
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
179 g_list_free(convs);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
180
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
181 } else if (ui_ops->set_tooltip) {
16977
c9cb49bea66d Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents: 16960
diff changeset
182 char *tooltip_text = g_strconcat(PIDGIN_NAME, " - ",
16681
c15974a4ff5d Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
183 purple_savedstatus_get_title(saved_status), NULL);
c15974a4ff5d Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
184 ui_ops->set_tooltip(tooltip_text);
c15974a4ff5d Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents: 16263
diff changeset
185 g_free(tooltip_text);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
186 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
187
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
188 for(l = purple_accounts_get_all(); l != NULL; l = l->next) {
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
189
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
190 PurpleAccount *account = (PurpleAccount*)l->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
191 PurpleStatus *account_status;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
192
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
193 if (!purple_account_get_enabled(account, PIDGIN_UI))
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
194 continue;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
195
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
196 if (purple_account_is_disconnected(account))
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
197 continue;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
198
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
199 account_status = purple_account_get_active_status(account);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
200 if (purple_account_is_connecting(account))
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
201 newconnecting = TRUE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
202 }
15765
f281403e98cf 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 <datallah@pidgin.im>
parents: 15760
diff changeset
203
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
204 newstatus = purple_savedstatus_get_type(saved_status);
15765
f281403e98cf 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 <datallah@pidgin.im>
parents: 15760
diff changeset
205
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
206 /* update the icon if we changed status */
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
207 if (status != newstatus || pending!=newpending || connecting!=newconnecting) {
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
208 status = newstatus;
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
209 pending = newpending;
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
210 connecting = newconnecting;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
211
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
212 pidgin_docklet_update_icon();
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
213 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
214
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
215 return FALSE; /* for when we're called by the glib idle handler */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
216 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
217
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
218 static gboolean
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21453
diff changeset
219 online_account_supports_chat(void)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
220 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
221 GList *c = NULL;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
222 c = purple_connections_get_all();
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
223
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
224 while(c != NULL) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
225 PurpleConnection *gc = c->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
226 PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
227 if (prpl_info != NULL && prpl_info->chat_info != NULL)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
228 return TRUE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
229 c = c->next;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
230 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
231
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
232 return FALSE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
233 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
234
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
235 /**************************************************************************
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
236 * callbacks and signal handlers
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
237 **************************************************************************/
14745
d43256e1e6fd [gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
238 #if 0
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
239 static void
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
240 pidgin_quit_cb()
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
241 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
242 /* TODO: confirm quit while pending */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
243 }
14745
d43256e1e6fd [gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
244 #endif
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
245
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
246 static void
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
247 docklet_update_status_cb(void *data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
248 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
249 docklet_update_status();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
250 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
251
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
252 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
253 docklet_conv_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
254 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
255 if (type == PURPLE_CONV_UPDATE_UNSEEN)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
256 docklet_update_status();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
257 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
258
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
259 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
260 docklet_signed_on_cb(PurpleConnection *gc)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
261 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
262 if (!enable_join_chat) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
263 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
264 enable_join_chat = TRUE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
265 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
266 docklet_update_status();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
267 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
268
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
269 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
270 docklet_signed_off_cb(PurpleConnection *gc)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
271 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
272 if (enable_join_chat) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
273 if (PURPLE_PLUGIN_PROTOCOL_INFO(gc->prpl)->chat_info != NULL)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
274 enable_join_chat = online_account_supports_chat();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
275 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
276 docklet_update_status();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
277 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
278
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
279 static void
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
280 docklet_show_pref_changed_cb(const char *name, PurplePrefType type,
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
281 gconstpointer value, gpointer data)
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
282 {
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
283 const char *val = value;
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
284 if (!strcmp(val, "always")) {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
285 if (ui_ops->create) {
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
286 if (!visible)
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
287 ui_ops->create();
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
288 else if (!visibility_manager) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
289 pidgin_blist_visibility_manager_add();
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
290 visibility_manager = TRUE;
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
291 }
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
292 }
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
293 } else if (!strcmp(val, "never")) {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
294 if (visible && ui_ops->destroy)
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
295 ui_ops->destroy();
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
296 } else {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
297 if (visibility_manager) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
298 pidgin_blist_visibility_manager_remove();
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
299 visibility_manager = FALSE;
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
300 }
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
301 docklet_update_status();
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
302 }
15075
2bd60dbd8877 [gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents: 14954
diff changeset
303
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
304 }
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
305
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
306 /**************************************************************************
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
307 * docklet pop-up menu
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
308 **************************************************************************/
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
309 static void
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
310 docklet_toggle_mute(GtkWidget *toggle, void *data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
311 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 32386
diff changeset
312 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute",
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 32386
diff changeset
313 gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle)));
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
314 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
315
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
316 static void
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
317 docklet_toggle_blist(GtkWidget *toggle, void *data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
318 {
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 32386
diff changeset
319 purple_blist_set_visible(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle)));
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
320 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
321
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
322 #ifdef _WIN32
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
323 /* This is a workaround for a bug in windows GTK+. Clicking outside of the
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
324 menu does not get rid of it, so instead we get rid of it as soon as the
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
325 pointer leaves the menu. */
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
326 static gboolean
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
327 hide_docklet_menu(gpointer data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
328 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
329 if (data != NULL) {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
330 gtk_menu_popdown(GTK_MENU(data));
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
331 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
332 return FALSE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
333 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
334
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
335 static gboolean
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
336 docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
337 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
338 static guint hide_docklet_timer = 0;
25584
be42c007cce2 Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents: 23848
diff changeset
339
be42c007cce2 Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents: 23848
diff changeset
340 if (event->type == GDK_LEAVE_NOTIFY && (event->detail == GDK_NOTIFY_ANCESTOR ||
be42c007cce2 Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents: 23848
diff changeset
341 event->detail == GDK_NOTIFY_UNKNOWN)) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
342 purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu leave-notify-event\n");
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
343 /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
344 if (hide_docklet_timer == 0) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
345 hide_docklet_timer = purple_timeout_add(500,
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
346 hide_docklet_menu, menu);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
347 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
348 } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
349 purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu enter-notify-event\n");
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
350 if (hide_docklet_timer != 0) {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
351 /* Cancel the hiding if we reenter */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
352
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
353 purple_timeout_remove(hide_docklet_timer);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
354 hide_docklet_timer = 0;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
355 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
356 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
357 return FALSE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
358 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
359 #endif
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
360
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
361 /* There is a lot of code here for handling the status submenu, much of
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
362 * which is duplicated from the gtkstatusbox. It'd be nice to add API
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
363 * somewhere to simplify this (either in the statusbox, or in libpurple).
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
364 */
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
365 static void
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
366 show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
367 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
368 PurpleSavedStatus *saved_status;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
369 saved_status = purple_savedstatus_get_current();
16179
bdf68342e1ce sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents: 16129
diff changeset
370
bdf68342e1ce sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents: 16129
diff changeset
371 if (purple_savedstatus_get_type(saved_status) == PURPLE_STATUS_AVAILABLE)
bdf68342e1ce sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents: 16129
diff changeset
372 saved_status = purple_savedstatus_new(NULL, PURPLE_STATUS_AWAY);
bdf68342e1ce sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents: 16129
diff changeset
373
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
374 pidgin_status_editor_show(FALSE,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
375 purple_savedstatus_is_transient(saved_status) ? saved_status : NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
376 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
377
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
378 static PurpleSavedStatus *
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
379 create_transient_status(PurpleStatusPrimitive primitive, PurpleStatusType *status_type)
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
380 {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
381 PurpleSavedStatus *saved_status = purple_savedstatus_new(NULL, primitive);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
382
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
383 if(status_type != NULL) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
384 GList *tmp, *active_accts = purple_accounts_get_all_active();
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
385 for (tmp = active_accts; tmp != NULL; tmp = tmp->next) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
386 purple_savedstatus_set_substatus(saved_status,
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
387 (PurpleAccount*) tmp->data, status_type, NULL);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
388 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
389 g_list_free(active_accts);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
390 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
391
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
392 return saved_status;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
393 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
394
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
395 static void
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
396 activate_status_account_cb(GtkMenuItem *menuitem, gpointer user_data)
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
397 {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
398 PurpleStatusType *status_type;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
399 PurpleStatusPrimitive primitive;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
400 PurpleSavedStatus *saved_status = NULL;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
401 GList *iter = purple_savedstatuses_get_all();
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
402 GList *tmp, *active_accts = purple_accounts_get_all_active();
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
403
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
404 status_type = (PurpleStatusType *)user_data;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
405 primitive = purple_status_type_get_primitive(status_type);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
406
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
407 for (; iter != NULL; iter = iter->next) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
408 PurpleSavedStatus *ss = iter->data;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
409 if ((purple_savedstatus_get_type(ss) == primitive) && purple_savedstatus_is_transient(ss) &&
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
410 purple_savedstatus_has_substatuses(ss))
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
411 {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
412 gboolean found = FALSE;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
413 /* The currently enabled accounts must have substatuses for all the active accts */
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
414 for(tmp = active_accts; tmp != NULL; tmp = tmp->next) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
415 PurpleAccount *acct = tmp->data;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
416 PurpleSavedStatusSub *sub = purple_savedstatus_get_substatus(ss, acct);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
417 if (sub) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
418 const PurpleStatusType *sub_type = purple_savedstatus_substatus_get_type(sub);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
419 const char *subtype_status_id = purple_status_type_get_id(sub_type);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
420 if (subtype_status_id && !strcmp(subtype_status_id,
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
421 purple_status_type_get_id(status_type)))
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
422 found = TRUE;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
423 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
424 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
425 if (!found)
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
426 continue;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
427 saved_status = ss;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
428 break;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
429 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
430 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
431
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
432 g_list_free(active_accts);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
433
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
434 /* Create a new transient saved status if we weren't able to find one */
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
435 if (saved_status == NULL)
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
436 saved_status = create_transient_status(primitive, status_type);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
437
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
438 /* Set the status for each account */
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
439 purple_savedstatus_activate(saved_status);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
440 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
441
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
442 static void
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
443 activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
444 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
445 PurpleStatusPrimitive primitive;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
446 PurpleSavedStatus *saved_status;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
447
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
448 primitive = GPOINTER_TO_INT(user_data);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
449
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
450 /* Try to lookup an already existing transient saved status */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
451 saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
452
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
453 /* Create a new transient saved status if we weren't able to find one */
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
454 if (saved_status == NULL)
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
455 saved_status = create_transient_status(primitive, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
456
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
457 /* Set the status for each account */
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
458 purple_savedstatus_activate(saved_status);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
459 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
460
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
461 static void
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
462 activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
463 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
464 time_t creation_time;
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
465 PurpleSavedStatus *saved_status;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
466
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
467 creation_time = GPOINTER_TO_INT(user_data);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
468 saved_status = purple_savedstatus_find_by_creation_time(creation_time);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
469 if (saved_status != NULL)
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
470 purple_savedstatus_activate(saved_status);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
471 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
472
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
473 static GtkWidget *
26821
ad2ea323d0f2 Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25585
diff changeset
474 new_menu_item_with_status_icon(GtkWidget *menu, const char *str, PurpleStatusPrimitive primitive, GCallback cb, gpointer data, guint accel_key, guint accel_mods, char *mod)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
475 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
476 GtkWidget *menuitem;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
477 GdkPixbuf *pixbuf;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
478 GtkWidget *image;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
479
20953
e39a56e1b461 Patch from QuLogic to not use underscores in saved-statuses as mnemonics
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20380
diff changeset
480 menuitem = gtk_image_menu_item_new_with_label(str);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
481
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
482 if (menu)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
483 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
484
26821
ad2ea323d0f2 Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25585
diff changeset
485 if (cb)
ad2ea323d0f2 Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 25585
diff changeset
486 g_signal_connect(G_OBJECT(menuitem), "activate", cb, data);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
487
15799
ba7af742a0d1 Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents: 15766
diff changeset
488 pixbuf = pidgin_create_status_icon(primitive, menu, PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
489 image = gtk_image_new_from_pixbuf(pixbuf);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
490 g_object_unref(pixbuf);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
491 gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
492
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
493 gtk_widget_show_all(menuitem);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
494
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
495 return menuitem;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
496 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
497
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
498 static void
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
499 add_account_statuses(GtkWidget *menu, PurpleAccount *account)
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
500 {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
501 GList *l;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
502
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
503 for (l = purple_account_get_status_types(account); l != NULL; l = l->next) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
504 PurpleStatusType *status_type = (PurpleStatusType *)l->data;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
505 PurpleStatusPrimitive prim;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
506
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
507 if (!purple_status_type_is_user_settable(status_type))
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
508 continue;
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
509
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
510 prim = purple_status_type_get_primitive(status_type);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
511
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
512 new_menu_item_with_status_icon(menu,
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
513 purple_status_type_get_name(status_type),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
514 prim, G_CALLBACK(activate_status_account_cb),
32386
b6021cd613c5 Remove all the old GTK_CHECK_VERSION stuff. Of course, this makes this
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 26821
diff changeset
515 GINT_TO_POINTER(status_type), 0, 0, NULL);
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
516 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
517 }
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
518
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
519 static GtkWidget *
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21453
diff changeset
520 docklet_status_submenu(void)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
521 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
522 GtkWidget *submenu, *menuitem;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
523 GList *popular_statuses, *cur;
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
524 PidginStatusBox *statusbox = NULL;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
525
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
526 submenu = gtk_menu_new();
23343
397c4abd815a A patch from Kevin Wu Won to add mnemonics to the docklet menu.
Kevin Wu Won <exclipy@gmail.com>
parents: 22108
diff changeset
527 menuitem = gtk_menu_item_new_with_mnemonic(_("_Change Status"));
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
528 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
529
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
530 if(pidgin_blist_get_default_gtk_blist() != NULL) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
531 statusbox = PIDGIN_STATUS_BOX(pidgin_blist_get_default_gtk_blist()->statusbox);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
532 }
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
533
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
534 if(statusbox && statusbox->account != NULL) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
535 add_account_statuses(submenu, statusbox->account);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
536 } else if(statusbox && statusbox->token_status_account != NULL) {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
537 add_account_statuses(submenu, statusbox->token_status_account);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
538 } else {
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
539 new_menu_item_with_status_icon(submenu, _("Available"),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
540 PURPLE_STATUS_AVAILABLE, G_CALLBACK(activate_status_primitive_cb),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
541 GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE), 0, 0, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
542
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
543 new_menu_item_with_status_icon(submenu, _("Away"),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
544 PURPLE_STATUS_AWAY, G_CALLBACK(activate_status_primitive_cb),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
545 GINT_TO_POINTER(PURPLE_STATUS_AWAY), 0, 0, NULL);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
546
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
547 new_menu_item_with_status_icon(submenu, _("Do not disturb"),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
548 PURPLE_STATUS_UNAVAILABLE, G_CALLBACK(activate_status_primitive_cb),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
549 GINT_TO_POINTER(PURPLE_STATUS_UNAVAILABLE), 0, 0, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
550
21011
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
551 new_menu_item_with_status_icon(submenu, _("Invisible"),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
552 PURPLE_STATUS_INVISIBLE, G_CALLBACK(activate_status_primitive_cb),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
553 GINT_TO_POINTER(PURPLE_STATUS_INVISIBLE), 0, 0, NULL);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
554
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
555 new_menu_item_with_status_icon(submenu, _("Offline"),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
556 PURPLE_STATUS_OFFLINE, G_CALLBACK(activate_status_primitive_cb),
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
557 GINT_TO_POINTER(PURPLE_STATUS_OFFLINE), 0, 0, NULL);
0b21b3224a68 Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents: 20960
diff changeset
558 }
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
559
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
560 popular_statuses = purple_savedstatuses_get_popular(6);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
561 if (popular_statuses != NULL)
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
562 pidgin_separator(submenu);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
563 for (cur = popular_statuses; cur != NULL; cur = cur->next)
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
564 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
565 PurpleSavedStatus *saved_status = cur->data;
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
566 time_t creation_time = purple_savedstatus_get_creation_time(saved_status);
15882
1dbd5756b7bf More Gaim to Pidgin stuff
Sean Egan <seanegan@pidgin.im>
parents: 15799
diff changeset
567 new_menu_item_with_status_icon(submenu,
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
568 purple_savedstatus_get_title(saved_status),
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
569 purple_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb),
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
570 GINT_TO_POINTER(creation_time), 0, 0, NULL);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
571 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
572 g_list_free(popular_statuses);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
573
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
574 pidgin_separator(submenu);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
575
16960
6d97980fed84 Telcontar on #pidgin-win32 pointed out that the "New..." and "Saved..."
Casey Harkins <charkins@pidgin.im>
parents: 16918
diff changeset
576 pidgin_new_item_from_stock(submenu, _("New..."), NULL, G_CALLBACK(show_custom_status_editor_cb), NULL, 0, 0, NULL);
6d97980fed84 Telcontar on #pidgin-win32 pointed out that the "New..." and "Saved..."
Casey Harkins <charkins@pidgin.im>
parents: 16918
diff changeset
577 pidgin_new_item_from_stock(submenu, _("Saved..."), NULL, G_CALLBACK(pidgin_status_window_show), NULL, 0, 0, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
578
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
579 return menuitem;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
580 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
581
20959
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
582
20960
b0c77b970912 merge of 'e39a56e1b46110397f5043f21bb86f8cd920012d'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents: 20953 20959
diff changeset
583
20959
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
584 static void
32394
f883709bdba4 compiles using GTK+ 3 from git, beware it does not yet run, in fact it crashes...
Marcus Lundblad <malu@pidgin.im>
parents: 32386
diff changeset
585 plugin_act(GtkWidget *widget, PurplePluginAction *pam)
20959
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
586 {
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
587 if (pam && pam->callback)
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
588 pam->callback(pam);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
589 }
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
590
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
591 static void
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
592 build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin,
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
593 gpointer context)
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
594 {
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
595 GtkWidget *menuitem;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
596 PurplePluginAction *action = NULL;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
597 GList *actions, *l;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
598
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
599 actions = PURPLE_PLUGIN_ACTIONS(plugin, context);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
600
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
601 for (l = actions; l != NULL; l = l->next)
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
602 {
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
603 if (l->data)
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
604 {
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
605 action = (PurplePluginAction *) l->data;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
606 action->plugin = plugin;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
607 action->context = context;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
608
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
609 menuitem = gtk_menu_item_new_with_label(action->label);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
610 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
611
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
612 g_signal_connect(G_OBJECT(menuitem), "activate",
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
613 G_CALLBACK(plugin_act), action);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
614 g_object_set_data_full(G_OBJECT(menuitem), "plugin_action",
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
615 action,
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
616 (GDestroyNotify)purple_plugin_action_free);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
617 gtk_widget_show(menuitem);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
618 }
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
619 else
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
620 pidgin_separator(menu);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
621 }
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
622
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
623 g_list_free(actions);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
624 }
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
625
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
626
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
627 static void
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
628 docklet_plugin_actions(GtkWidget *menu)
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
629 {
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
630 GtkWidget *menuitem, *submenu;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
631 PurplePlugin *plugin = NULL;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
632 GList *l;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
633 int c = 0;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
634
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
635 g_return_if_fail(menu != NULL);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
636
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
637 /* Add a submenu for each plugin with custom actions */
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
638 for (l = purple_plugins_get_loaded(); l; l = l->next) {
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
639 plugin = (PurplePlugin *) l->data;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
640
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
641 if (PURPLE_IS_PROTOCOL_PLUGIN(plugin))
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
642 continue;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
643
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
644 if (!PURPLE_PLUGIN_HAS_ACTIONS(plugin))
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
645 continue;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
646
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
647 menuitem = gtk_image_menu_item_new_with_label(_(plugin->info->name));
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
648 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
649
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
650 submenu = gtk_menu_new();
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
651 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
652
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
653 build_plugin_actions(submenu, plugin, NULL);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
654
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
655 c++;
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
656 }
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
657 if(c>0)
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
658 pidgin_separator(menu);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
659 }
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
660
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
661 static void
22104
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21453
diff changeset
662 docklet_menu(void)
56970903b8e9 Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents: 21453
diff changeset
663 {
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
664 static GtkWidget *menu = NULL;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
665 GtkWidget *menuitem;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
666
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
667 if (menu) {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
668 gtk_widget_destroy(menu);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
669 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
670
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
671 menu = gtk_menu_new();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
672
23344
edd0045bf715 Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents: 23343
diff changeset
673 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Show Buddy _List"));
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
674 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible"));
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
675 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
676 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
677
23343
397c4abd815a A patch from Kevin Wu Won to add mnemonics to the docklet menu.
Kevin Wu Won <exclipy@gmail.com>
parents: 22108
diff changeset
678 menuitem = gtk_menu_item_new_with_mnemonic(_("_Unread Messages"));
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
679
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
680 if (pending) {
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
681 GtkWidget *submenu = gtk_menu_new();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
682 GList *l = get_pending_list(0);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
683 if (l == NULL) {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
684 gtk_widget_set_sensitive(menuitem, FALSE);
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
685 purple_debug_warning("docklet",
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
686 "status indicates messages pending, but no conversations with unseen messages were found.");
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
687 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
688 pidgin_conversations_fill_menu(submenu, l);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
689 g_list_free(l);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
690 gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
691 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
692 } else {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
693 gtk_widget_set_sensitive(menuitem, FALSE);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
694 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
695 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
696
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
697 pidgin_separator(menu);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
698
23344
edd0045bf715 Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents: 23343
diff changeset
699 menuitem = pidgin_new_item_from_stock(menu, _("New _Message..."), PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, G_CALLBACK(pidgin_dialogs_im), NULL, 0, 0, NULL);
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
700 if (status == PURPLE_STATUS_OFFLINE)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
701 gtk_widget_set_sensitive(menuitem, FALSE);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
702
23848
d017d45e3dcf Add menuitem for 'join chat' in the docklet menu. Closes #3623.
Balwinder S Dheeman <bsd@rubyforge.org>
parents: 23344
diff changeset
703 menuitem = pidgin_new_item_from_stock(menu, _("Join Chat..."), PIDGIN_STOCK_CHAT,
d017d45e3dcf Add menuitem for 'join chat' in the docklet menu. Closes #3623.
Balwinder S Dheeman <bsd@rubyforge.org>
parents: 23344
diff changeset
704 G_CALLBACK(pidgin_blist_joinchat_show), NULL, 0, 0, NULL);
d017d45e3dcf Add menuitem for 'join chat' in the docklet menu. Closes #3623.
Balwinder S Dheeman <bsd@rubyforge.org>
parents: 23344
diff changeset
705 if (status == PURPLE_STATUS_OFFLINE)
d017d45e3dcf Add menuitem for 'join chat' in the docklet menu. Closes #3623.
Balwinder S Dheeman <bsd@rubyforge.org>
parents: 23344
diff changeset
706 gtk_widget_set_sensitive(menuitem, FALSE);
d017d45e3dcf Add menuitem for 'join chat' in the docklet menu. Closes #3623.
Balwinder S Dheeman <bsd@rubyforge.org>
parents: 23344
diff changeset
707
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
708 menuitem = docklet_status_submenu();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
709 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
710
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
711 pidgin_separator(menu);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
712
23343
397c4abd815a A patch from Kevin Wu Won to add mnemonics to the docklet menu.
Kevin Wu Won <exclipy@gmail.com>
parents: 22108
diff changeset
713 pidgin_new_item_from_stock(menu, _("_Accounts"), NULL, G_CALLBACK(pidgin_accounts_window_show), NULL, 0, 0, NULL);
397c4abd815a A patch from Kevin Wu Won to add mnemonics to the docklet menu.
Kevin Wu Won <exclipy@gmail.com>
parents: 22108
diff changeset
714 pidgin_new_item_from_stock(menu, _("Plu_gins"), PIDGIN_STOCK_TOOLBAR_PLUGINS, G_CALLBACK(pidgin_plugin_dialog_show), NULL, 0, 0, NULL);
23344
edd0045bf715 Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents: 23343
diff changeset
715 pidgin_new_item_from_stock(menu, _("Pr_eferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(pidgin_prefs_show), NULL, 0, 0, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
716
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
717 pidgin_separator(menu);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
718
23344
edd0045bf715 Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents: 23343
diff changeset
719 menuitem = gtk_check_menu_item_new_with_mnemonic(_("Mute _Sounds"));
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
720 gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute"));
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
721 if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none"))
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
722 gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
723 g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
724 gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem);
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
725
15568
cd19bb5a51b8 gtkutils changes
Sean Egan <seanegan@pidgin.im>
parents: 15566
diff changeset
726 pidgin_separator(menu);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
727
20959
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
728 /* add plugin actions */
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
729 docklet_plugin_actions(menu);
8ccaaaec1b01 Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents: 20380
diff changeset
730
23343
397c4abd815a A patch from Kevin Wu Won to add mnemonics to the docklet menu.
Kevin Wu Won <exclipy@gmail.com>
parents: 22108
diff changeset
731 pidgin_new_item_from_stock(menu, _("_Quit"), GTK_STOCK_QUIT, G_CALLBACK(purple_core_quit), NULL, 0, 0, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
732
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
733 #ifdef _WIN32
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
734 g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
735 g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
736 #endif
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
737 gtk_widget_show_all(menu);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
738 gtk_menu_popup(GTK_MENU(menu), NULL, NULL,
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
739 ui_ops->position_menu,
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
740 NULL, 0, gtk_get_current_event_time());
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
741 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
742
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
743 /**************************************************************************
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
744 * public api for ui_ops
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
745 **************************************************************************/
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
746 void
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
747 pidgin_docklet_update_icon()
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
748 {
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
749 if (ui_ops && ui_ops->update_icon)
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
750 ui_ops->update_icon(status, connecting, pending);
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
751 }
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
752
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
753 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
754 pidgin_docklet_clicked(int button_type)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
755 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
756 switch (button_type) {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
757 case 1:
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
758 if (pending) {
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
759 GList *l = get_pending_list(1);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
760 if (l != NULL) {
21022
eb7d727949e7 Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents: 21014
diff changeset
761 pidgin_conv_present_conversation((PurpleConversation *)l->data);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
762 g_list_free(l);
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
763 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
764 } else {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
765 pidgin_blist_toggle_visibility();
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
766 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
767 break;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
768 case 3:
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
769 docklet_menu();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
770 break;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
771 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
772 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
773
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
774 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
775 pidgin_docklet_embedded()
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
776 {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
777 if (!visibility_manager
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
778 && strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
779 pidgin_blist_visibility_manager_add();
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
780 visibility_manager = TRUE;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
781 }
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
782 visible = TRUE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
783 docklet_update_status();
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
784 pidgin_docklet_update_icon();
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
785 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
786
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
787 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
788 pidgin_docklet_remove()
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
789 {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
790 if (visible) {
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
791 if (visibility_manager) {
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
792 pidgin_blist_visibility_manager_remove();
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
793 visibility_manager = FALSE;
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
794 }
14935
9a69bd67236d [gaim-migrate @ 17642]
Sean Egan <seanegan@pidgin.im>
parents: 14875
diff changeset
795 if (docklet_blinking_timer) {
9a69bd67236d [gaim-migrate @ 17642]
Sean Egan <seanegan@pidgin.im>
parents: 14875
diff changeset
796 g_source_remove(docklet_blinking_timer);
9a69bd67236d [gaim-migrate @ 17642]
Sean Egan <seanegan@pidgin.im>
parents: 14875
diff changeset
797 docklet_blinking_timer = 0;
9a69bd67236d [gaim-migrate @ 17642]
Sean Egan <seanegan@pidgin.im>
parents: 14875
diff changeset
798 }
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
799 visible = FALSE;
16996
749cb2af2e40 Now that the docklet icon is based on the status from status selector, it
Casey Harkins <charkins@pidgin.im>
parents: 16977
diff changeset
800 status = PURPLE_STATUS_OFFLINE;
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
801 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
802 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
803
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
804 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
805 pidgin_docklet_set_ui_ops(struct docklet_ui_ops *ops)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
806 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
807 ui_ops = ops;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
808 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
809
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
810 void*
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
811 pidgin_docklet_get_handle()
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
812 {
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
813 static int i;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
814 return &i;
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
815 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
816
14745
d43256e1e6fd [gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
817 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
818 pidgin_docklet_init()
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
819 {
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
820 void *conn_handle = purple_connections_get_handle();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
821 void *conv_handle = purple_conversations_get_handle();
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
822 void *accounts_handle = purple_accounts_get_handle();
16918
d395c2be4cb1 Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents: 16808
diff changeset
823 void *status_handle = purple_savedstatuses_get_handle();
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
824 void *docklet_handle = pidgin_docklet_get_handle();
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
825
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
826 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet");
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
827 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/blink", FALSE);
19215
7a4ee0715da8 reverting the show docklet preference the correct way
Ka-Hing Cheung <khc@pidgin.im>
parents: 19129
diff changeset
828 purple_prefs_add_string(PIDGIN_PREFS_ROOT "/docklet/show", "always");
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
829 purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show",
14947
3d4554cea133 [gaim-migrate @ 17654]
Sean Egan <seanegan@pidgin.im>
parents: 14935
diff changeset
830 docklet_show_pref_changed_cb, NULL);
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
831
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
832 docklet_ui_init();
16123
8b98683319e7 Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents: 15884
diff changeset
833 if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always") && ui_ops && ui_ops->create)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
834 ui_ops->create();
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
835
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
836 purple_signal_connect(conn_handle, "signed-on",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
837 docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
838 purple_signal_connect(conn_handle, "signed-off",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
839 docklet_handle, PURPLE_CALLBACK(docklet_signed_off_cb), NULL);
16918
d395c2be4cb1 Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents: 16808
diff changeset
840 purple_signal_connect(accounts_handle, "account-connecting",
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
841 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
842 purple_signal_connect(conv_handle, "received-im-msg",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
843 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
844 purple_signal_connect(conv_handle, "conversation-created",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
845 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
846 purple_signal_connect(conv_handle, "deleting-conversation",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
847 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
848 purple_signal_connect(conv_handle, "conversation-updated",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
849 docklet_handle, PURPLE_CALLBACK(docklet_conv_updated_cb), NULL);
16918
d395c2be4cb1 Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents: 16808
diff changeset
850 purple_signal_connect(status_handle, "savedstatus-changed",
d395c2be4cb1 Docklet icon is now tied to the saved status, so listen to the
Casey Harkins <charkins@pidgin.im>
parents: 16808
diff changeset
851 docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL);
14745
d43256e1e6fd [gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
852 #if 0
15884
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
853 purple_signal_connect(purple_get_core(), "quitting",
4de1981757fc sed -ie 's/gaim/purple/g'
Sean Egan <seanegan@pidgin.im>
parents: 15883
diff changeset
854 docklet_handle, PURPLE_CALLBACK(purple_quit_cb), NULL);
14745
d43256e1e6fd [gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents: 14743
diff changeset
855 #endif
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
856
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
857 enable_join_chat = online_account_supports_chat();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
858 }
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
859
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
860 void
15562
8c8249fe5e3c gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents: 15435
diff changeset
861 pidgin_docklet_uninit()
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
862 {
15077
38a44f14dd35 [gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents: 15075
diff changeset
863 if (visible && ui_ops && ui_ops->destroy)
14743
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
864 ui_ops->destroy();
2324d3eee038 [gaim-migrate @ 17433]
Sean Egan <seanegan@pidgin.im>
parents:
diff changeset
865 }

mercurial