Mon, 05 Nov 2012 22:40:10 +0100
Gadu-Gadu: incoming file transfer - response writer
| 14743 | 1 | /* |
| 15884 | 2 | * System tray icon (aka docklet) plugin for Purple |
| 14743 | 3 | * |
| 4 | * Copyright (C) 2002-3 Robert McQueen <robot101@debian.org> | |
| 5 | * Copyright (C) 2003 Herman Bloggs <hermanator12002@yahoo.com> | |
| 6 | * Inspired by a similar plugin by: | |
| 7 | * John (J5) Palmieri <johnp@martianrock.com> | |
| 8 | * | |
| 9 | * This program is free software; you can redistribute it and/or | |
| 10 | * modify it under the terms of the GNU General Public License as | |
| 11 | * published by the Free Software Foundation; either version 2 of the | |
| 12 | * License, or (at your option) any later version. | |
| 13 | * | |
| 14 | * This program is distributed in the hope that it will be useful, but | |
| 15 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 17 | * General Public License for more details. | |
| 18 | * | |
| 19 | * You should have received a copy of the GNU General Public License | |
| 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 | 23 | */ |
| 24 | #include "internal.h" | |
| 15577 | 25 | #include "pidgin.h" |
| 14743 | 26 | |
| 27 | #include "core.h" | |
| 28 | #include "conversation.h" | |
| 29 | #include "debug.h" | |
| 30 | #include "prefs.h" | |
| 31 | #include "signals.h" | |
| 32 | #include "sound.h" | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
33 | #include "status.h" |
| 14743 | 34 | |
| 35 | #include "gtkaccount.h" | |
| 36 | #include "gtkblist.h" | |
| 37 | #include "gtkconv.h" | |
| 38 | #include "gtkplugin.h" | |
| 39 | #include "gtkprefs.h" | |
| 40 | #include "gtksavedstatuses.h" | |
| 41 | #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
|
42 | #include "gtkstatusbox.h" |
| 14743 | 43 | #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
|
44 | #include "pidginstock.h" |
| 14743 | 45 | #include "gtkdocklet.h" |
| 46 | #include "gtkdialogs.h" | |
| 47 | ||
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
48 | #include "gtk3compat.h" |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
49 | |
| 14743 | 50 | #ifndef DOCKLET_TOOLTIP_LINE_LIMIT |
| 51 | #define DOCKLET_TOOLTIP_LINE_LIMIT 5 | |
| 52 | #endif | |
| 53 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
54 | #define SHORT_EMBED_TIMEOUT 5 |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
55 | #define LONG_EMBED_TIMEOUT 15 |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
56 | |
| 14743 | 57 | /* globals */ |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
58 | static GtkStatusIcon *docklet = NULL; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
59 | static guint embed_timeout = 0; |
|
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
|
60 | 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
|
61 | 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
|
62 | static gboolean connecting = FALSE; |
| 14743 | 63 | static gboolean enable_join_chat = FALSE; |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
64 | static gboolean visible = FALSE; |
| 14743 | 65 | static gboolean visibility_manager = FALSE; |
| 66 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
67 | /* protos */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
68 | static void docklet_gtk_status_create(gboolean); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
69 | static void docklet_gtk_status_destroy(void); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
70 | |
| 14743 | 71 | /************************************************************************** |
| 72 | * docklet status and utility functions | |
| 73 | **************************************************************************/ | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
74 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
75 | docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
76 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
77 | const gchar *icon_name = NULL; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
78 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
79 | switch (status) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
80 | case PURPLE_STATUS_OFFLINE: |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
81 | icon_name = PIDGIN_STOCK_TRAY_OFFLINE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
82 | break; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
83 | case PURPLE_STATUS_AWAY: |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
84 | icon_name = PIDGIN_STOCK_TRAY_AWAY; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
85 | break; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
86 | case PURPLE_STATUS_UNAVAILABLE: |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
87 | icon_name = PIDGIN_STOCK_TRAY_BUSY; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
88 | break; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
89 | case PURPLE_STATUS_EXTENDED_AWAY: |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
90 | icon_name = PIDGIN_STOCK_TRAY_XA; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
91 | break; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
92 | case PURPLE_STATUS_INVISIBLE: |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
93 | icon_name = PIDGIN_STOCK_TRAY_INVISIBLE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
94 | break; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
95 | default: |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
96 | icon_name = PIDGIN_STOCK_TRAY_AVAILABLE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
97 | break; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
98 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
99 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
100 | if (pending) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
101 | icon_name = PIDGIN_STOCK_TRAY_PENDING; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
102 | if (connecting) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
103 | icon_name = PIDGIN_STOCK_TRAY_CONNECT; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
104 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
105 | if (icon_name) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
106 | gtk_status_icon_set_from_icon_name(docklet, icon_name); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
107 | } |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
108 | |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
109 | #if !GTK_CHECK_VERSION(3,0,0) |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
110 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")) { |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
111 | gtk_status_icon_set_blinking(docklet, (pending && !connecting)); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
112 | } else if (gtk_status_icon_get_blinking(docklet)) { |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
113 | gtk_status_icon_set_blinking(docklet, FALSE); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
114 | } |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
115 | #endif |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
116 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
117 | |
| 14743 | 118 | static GList * |
| 119 | get_pending_list(guint max) | |
| 120 | { | |
|
25585
694a25f1eaf4
This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents:
25584
diff
changeset
|
121 | GList *l_im, *l_chat; |
| 14743 | 122 | |
| 15884 | 123 | 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
|
124 | PIDGIN_UNSEEN_TEXT, |
|
14813
c24dda7fb69e
[gaim-migrate @ 17508]
Casey Harkins <charkins@pidgin.im>
parents:
14745
diff
changeset
|
125 | FALSE, max); |
| 14743 | 126 | |
|
25585
694a25f1eaf4
This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents:
25584
diff
changeset
|
127 | /* 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
|
128 | 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
|
129 | 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
|
130 | |
| 15884 | 131 | 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
|
132 | PIDGIN_UNSEEN_NICK, |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
133 | FALSE, max); |
| 14743 | 134 | |
| 135 | if (l_im != NULL && l_chat != NULL) | |
| 136 | return g_list_concat(l_im, l_chat); | |
| 137 | else if (l_im != NULL) | |
| 138 | return l_im; | |
| 139 | else | |
| 140 | return l_chat; | |
| 141 | } | |
| 142 | ||
| 143 | 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
|
144 | docklet_update_status(void) |
| 14743 | 145 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
146 | GList *convs, *l; |
| 14743 | 147 | int count; |
| 15884 | 148 | 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
|
149 | 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
|
150 | gboolean newpending = FALSE, newconnecting = FALSE; |
| 14743 | 151 | |
|
16681
c15974a4ff5d
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
152 | /* 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
|
153 | 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
|
154 | |
| 14743 | 155 | /* determine if any ims have unseen messages */ |
| 156 | convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); | |
| 157 | ||
|
19215
7a4ee0715da8
reverting the show docklet preference the correct way
Ka-Hing Cheung <khc@pidgin.im>
parents:
19129
diff
changeset
|
158 | if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "pending")) { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
159 | if (convs && !visible) { |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
160 | g_list_free(convs); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
161 | docklet_gtk_status_create(FALSE); |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
162 | return FALSE; |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
163 | } else if (!convs && visible) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
164 | docklet_gtk_status_destroy(); |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
165 | return FALSE; |
| 14935 | 166 | } |
| 167 | } | |
| 168 | ||
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
169 | if (!visible) { |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
170 | g_list_free(convs); |
| 14947 | 171 | return FALSE; |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
172 | } |
| 14947 | 173 | |
| 14743 | 174 | if (convs != NULL) { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
175 | /* set tooltip if messages are pending */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
176 | GString *tooltip_text = g_string_new(""); |
|
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
|
177 | newpending = TRUE; |
| 14743 | 178 | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
179 | for (l = convs, count = 0 ; l != NULL ; l = l->next, count++) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
180 | PurpleConversation *conv = (PurpleConversation *)l->data; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
181 | PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
|
21022
eb7d727949e7
Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents:
21014
diff
changeset
|
182 | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
183 | if (count == DOCKLET_TOOLTIP_LINE_LIMIT - 1) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
184 | g_string_append(tooltip_text, _("Right-click for more unread messages...\n")); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
185 | } else if(gtkconv) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
186 | g_string_append_printf(tooltip_text, |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
187 | ngettext("%d unread message from %s\n", "%d unread messages from %s\n", gtkconv->unseen_count), |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
188 | gtkconv->unseen_count, |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
189 | purple_conversation_get_title(conv)); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
190 | } else { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
191 | g_string_append_printf(tooltip_text, |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
192 | ngettext("%d unread message from %s\n", "%d unread messages from %s\n", |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
193 | GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count"))), |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
194 | GPOINTER_TO_INT(purple_conversation_get_data(conv, "unseen-count")), |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
195 | purple_conversation_get_title(conv)); |
| 14743 | 196 | } |
| 197 | } | |
| 198 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
199 | /* get rid of the last newline */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
200 | if (tooltip_text->len > 0) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
201 | tooltip_text = g_string_truncate(tooltip_text, tooltip_text->len - 1); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
202 | |
|
33122
40a55fa87823
GtkStatusIcon no longer has a blinking property in GTK+-3.0.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33120
diff
changeset
|
203 | gtk_status_icon_set_tooltip_text(docklet, tooltip_text->str); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
204 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
205 | g_string_free(tooltip_text, TRUE); |
| 14743 | 206 | g_list_free(convs); |
| 207 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
208 | } else { |
|
16977
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16960
diff
changeset
|
209 | 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
|
210 | purple_savedstatus_get_title(saved_status), NULL); |
|
33122
40a55fa87823
GtkStatusIcon no longer has a blinking property in GTK+-3.0.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33120
diff
changeset
|
211 | gtk_status_icon_set_tooltip_text(docklet, tooltip_text); |
|
16681
c15974a4ff5d
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
212 | g_free(tooltip_text); |
| 14743 | 213 | } |
| 214 | ||
| 15884 | 215 | for(l = purple_accounts_get_all(); l != NULL; l = l->next) { |
| 14743 | 216 | |
| 15884 | 217 | PurpleAccount *account = (PurpleAccount*)l->data; |
| 14743 | 218 | |
| 15884 | 219 | if (!purple_account_get_enabled(account, PIDGIN_UI)) |
| 14743 | 220 | continue; |
| 221 | ||
| 15884 | 222 | if (purple_account_is_disconnected(account)) |
| 14743 | 223 | continue; |
| 224 | ||
| 15884 | 225 | 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
|
226 | newconnecting = TRUE; |
| 14743 | 227 | } |
|
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
|
228 | |
|
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
|
229 | 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
|
230 | |
| 14743 | 231 | /* 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
|
232 | if (status != newstatus || pending!=newpending || connecting!=newconnecting) { |
| 14743 | 233 | 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
|
234 | 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
|
235 | connecting = newconnecting; |
| 14743 | 236 | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
237 | docklet_gtk_status_update_icon(status, connecting, pending); |
| 14743 | 238 | } |
| 239 | ||
| 240 | return FALSE; /* for when we're called by the glib idle handler */ | |
| 241 | } | |
| 242 | ||
| 243 | 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
|
244 | online_account_supports_chat(void) |
| 14743 | 245 | { |
| 246 | GList *c = NULL; | |
| 15884 | 247 | c = purple_connections_get_all(); |
| 14743 | 248 | |
| 249 | while(c != NULL) { | |
| 15884 | 250 | PurpleConnection *gc = c->data; |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32341
diff
changeset
|
251 | PurplePluginProtocolInfo *prpl_info = PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc)); |
| 14743 | 252 | if (prpl_info != NULL && prpl_info->chat_info != NULL) |
| 253 | return TRUE; | |
| 254 | c = c->next; | |
| 255 | } | |
| 256 | ||
| 257 | return FALSE; | |
| 258 | } | |
| 259 | ||
| 260 | /************************************************************************** | |
| 261 | * callbacks and signal handlers | |
| 262 | **************************************************************************/ | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
263 | #if 0 |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
264 | static void |
| 15882 | 265 | pidgin_quit_cb() |
| 14743 | 266 | { |
| 267 | /* TODO: confirm quit while pending */ | |
| 268 | } | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
269 | #endif |
| 14743 | 270 | |
| 271 | static void | |
| 272 | docklet_update_status_cb(void *data) | |
| 273 | { | |
| 274 | docklet_update_status(); | |
| 275 | } | |
| 276 | ||
| 277 | static void | |
| 15884 | 278 | docklet_conv_updated_cb(PurpleConversation *conv, PurpleConvUpdateType type) |
| 14743 | 279 | { |
| 15884 | 280 | if (type == PURPLE_CONV_UPDATE_UNSEEN) |
| 14743 | 281 | docklet_update_status(); |
| 282 | } | |
| 283 | ||
| 284 | static void | |
| 15884 | 285 | docklet_signed_on_cb(PurpleConnection *gc) |
| 14743 | 286 | { |
| 287 | if (!enable_join_chat) { | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32341
diff
changeset
|
288 | if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info != NULL) |
| 14743 | 289 | enable_join_chat = TRUE; |
| 290 | } | |
| 291 | docklet_update_status(); | |
| 292 | } | |
| 293 | ||
| 294 | static void | |
| 15884 | 295 | docklet_signed_off_cb(PurpleConnection *gc) |
| 14743 | 296 | { |
| 297 | if (enable_join_chat) { | |
|
32678
01f6312a4a7b
On the way to hiding the PurpleConnection struct.
Andrew Victor <andrew.victor@mxit.com>
parents:
32341
diff
changeset
|
298 | if (PURPLE_PLUGIN_PROTOCOL_INFO(purple_connection_get_prpl(gc))->chat_info != NULL) |
| 14743 | 299 | enable_join_chat = online_account_supports_chat(); |
| 300 | } | |
| 301 | docklet_update_status(); | |
| 302 | } | |
| 303 | ||
| 14947 | 304 | static void |
| 15884 | 305 | docklet_show_pref_changed_cb(const char *name, PurplePrefType type, |
| 14947 | 306 | gconstpointer value, gpointer data) |
| 307 | { | |
| 308 | const char *val = value; | |
| 309 | if (!strcmp(val, "always")) { | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
310 | if (!visible) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
311 | docklet_gtk_status_create(FALSE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
312 | else if (!visibility_manager) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
313 | pidgin_blist_visibility_manager_add(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
314 | visibility_manager = TRUE; |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
315 | } |
| 14947 | 316 | } else if (!strcmp(val, "never")) { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
317 | if (visible) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
318 | docklet_gtk_status_destroy(); |
| 14947 | 319 | } else { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
320 | if (visibility_manager) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
321 | pidgin_blist_visibility_manager_remove(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
322 | visibility_manager = FALSE; |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
323 | } |
| 14947 | 324 | docklet_update_status(); |
| 325 | } | |
| 326 | } | |
| 327 | ||
| 14743 | 328 | /************************************************************************** |
| 329 | * docklet pop-up menu | |
| 330 | **************************************************************************/ | |
| 331 | static void | |
| 332 | docklet_toggle_mute(GtkWidget *toggle, void *data) | |
| 333 | { | |
|
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
|
334 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/sound/mute", |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
335 | gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); |
| 14875 | 336 | } |
| 337 | ||
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
338 | #if !GTK_CHECK_VERSION(3,0,0) |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
339 | static void |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
340 | docklet_toggle_blink(GtkWidget *toggle, void *data) |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
341 | { |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
342 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/blink", |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
343 | gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
344 | } |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
345 | #endif |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
346 | |
| 14875 | 347 | static void |
| 14743 | 348 | docklet_toggle_blist(GtkWidget *toggle, void *data) |
| 349 | { | |
|
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
|
350 | purple_blist_set_visible(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); |
| 14743 | 351 | } |
| 352 | ||
| 353 | #ifdef _WIN32 | |
| 354 | /* This is a workaround for a bug in windows GTK+. Clicking outside of the | |
| 355 | menu does not get rid of it, so instead we get rid of it as soon as the | |
| 356 | pointer leaves the menu. */ | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
357 | static gboolean |
| 14743 | 358 | hide_docklet_menu(gpointer data) |
| 359 | { | |
| 360 | if (data != NULL) { | |
| 361 | gtk_menu_popdown(GTK_MENU(data)); | |
| 362 | } | |
| 363 | return FALSE; | |
| 364 | } | |
| 365 | ||
| 366 | static gboolean | |
| 367 | docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data) | |
| 368 | { | |
| 369 | 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
|
370 | |
|
be42c007cce2
Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents:
23848
diff
changeset
|
371 | 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
|
372 | event->detail == GDK_NOTIFY_UNKNOWN)) { |
| 15884 | 373 | purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu leave-notify-event\n"); |
| 14743 | 374 | /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */ |
| 375 | if (hide_docklet_timer == 0) { | |
| 15884 | 376 | hide_docklet_timer = purple_timeout_add(500, |
| 14743 | 377 | hide_docklet_menu, menu); |
| 378 | } | |
| 379 | } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { | |
| 15884 | 380 | purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu enter-notify-event\n"); |
| 14743 | 381 | if (hide_docklet_timer != 0) { |
| 382 | /* Cancel the hiding if we reenter */ | |
| 383 | ||
| 15884 | 384 | purple_timeout_remove(hide_docklet_timer); |
| 14743 | 385 | hide_docklet_timer = 0; |
| 386 | } | |
| 387 | } | |
| 388 | return FALSE; | |
| 389 | } | |
| 390 | #endif | |
| 391 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
392 | /* 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
|
393 | * 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
|
394 | * 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
|
395 | */ |
| 14743 | 396 | static void |
| 397 | show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 398 | { | |
| 15884 | 399 | PurpleSavedStatus *saved_status; |
| 400 | saved_status = purple_savedstatus_get_current(); | |
|
16179
bdf68342e1ce
sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents:
16129
diff
changeset
|
401 | |
|
bdf68342e1ce
sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents:
16129
diff
changeset
|
402 | 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
|
403 | 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
|
404 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
405 | pidgin_status_editor_show(FALSE, |
| 15884 | 406 | purple_savedstatus_is_transient(saved_status) ? saved_status : NULL); |
| 14743 | 407 | } |
| 408 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
409 | static PurpleSavedStatus * |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
410 | 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
|
411 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
412 | 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
|
413 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
414 | 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
|
415 | 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
|
416 | 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
|
417 | 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
|
418 | (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
|
419 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
420 | 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
|
421 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
422 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
423 | 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
|
424 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
425 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
426 | static void |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
427 | 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
|
428 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
429 | 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
|
430 | PurpleStatusPrimitive primitive; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
431 | 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
|
432 | 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
|
433 | 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
|
434 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
435 | 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
|
436 | 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
|
437 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
438 | 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
|
439 | 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
|
440 | 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
|
441 | 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
|
442 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
443 | 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
|
444 | /* 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
|
445 | 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
|
446 | 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
|
447 | 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
|
448 | if (sub) { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
449 | 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
|
450 | 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
|
451 | 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
|
452 | 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
|
453 | found = TRUE; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
454 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
455 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
456 | if (!found) |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
457 | continue; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
458 | 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
|
459 | break; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
460 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
461 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
462 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
463 | 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
|
464 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
465 | /* 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
|
466 | 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
|
467 | 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
|
468 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
469 | /* 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
|
470 | 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
|
471 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
472 | |
| 14743 | 473 | static void |
| 474 | activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 475 | { | |
| 15884 | 476 | PurpleStatusPrimitive primitive; |
| 477 | PurpleSavedStatus *saved_status; | |
| 14743 | 478 | |
| 479 | primitive = GPOINTER_TO_INT(user_data); | |
| 480 | ||
| 481 | /* Try to lookup an already existing transient saved status */ | |
| 15884 | 482 | saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL); |
| 14743 | 483 | |
| 484 | /* Create a new transient saved status if we weren't able to find one */ | |
| 485 | 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
|
486 | saved_status = create_transient_status(primitive, NULL); |
| 14743 | 487 | |
| 488 | /* Set the status for each account */ | |
| 15884 | 489 | purple_savedstatus_activate(saved_status); |
| 14743 | 490 | } |
| 491 | ||
| 492 | static void | |
| 493 | activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 494 | { | |
| 495 | time_t creation_time; | |
| 15884 | 496 | PurpleSavedStatus *saved_status; |
| 14743 | 497 | |
| 498 | creation_time = GPOINTER_TO_INT(user_data); | |
| 15884 | 499 | saved_status = purple_savedstatus_find_by_creation_time(creation_time); |
| 14743 | 500 | if (saved_status != NULL) |
| 15884 | 501 | purple_savedstatus_activate(saved_status); |
| 14743 | 502 | } |
| 503 | ||
| 504 | 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
|
505 | 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 | 506 | { |
| 507 | GtkWidget *menuitem; | |
| 508 | GdkPixbuf *pixbuf; | |
| 509 | GtkWidget *image; | |
| 510 | ||
|
20953
e39a56e1b461
Patch from QuLogic to not use underscores in saved-statuses as mnemonics
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20380
diff
changeset
|
511 | menuitem = gtk_image_menu_item_new_with_label(str); |
| 14743 | 512 | |
| 513 | if (menu) | |
| 514 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 515 | ||
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25585
diff
changeset
|
516 | 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
|
517 | g_signal_connect(G_OBJECT(menuitem), "activate", cb, data); |
| 14743 | 518 | |
|
15799
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15766
diff
changeset
|
519 | pixbuf = pidgin_create_status_icon(primitive, menu, PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); |
| 14743 | 520 | image = gtk_image_new_from_pixbuf(pixbuf); |
| 521 | g_object_unref(pixbuf); | |
| 522 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); | |
| 523 | ||
| 524 | gtk_widget_show_all(menuitem); | |
| 525 | ||
| 526 | return menuitem; | |
| 527 | } | |
| 528 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
529 | static void |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
530 | 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
|
531 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
532 | GList *l; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
533 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
534 | 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
|
535 | 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
|
536 | PurpleStatusPrimitive prim; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
537 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
538 | 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
|
539 | continue; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
540 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
541 | 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
|
542 | |
|
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(menu, |
|
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_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
|
545 | 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
|
546 | 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
|
547 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
548 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
549 | |
| 14743 | 550 | 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
|
551 | docklet_status_submenu(void) |
| 14743 | 552 | { |
| 553 | GtkWidget *submenu, *menuitem; | |
| 554 | 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
|
555 | PidginStatusBox *statusbox = NULL; |
| 14743 | 556 | |
| 557 | 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
|
558 | menuitem = gtk_menu_item_new_with_mnemonic(_("_Change Status")); |
| 14743 | 559 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
| 560 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
561 | 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
|
562 | 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
|
563 | } |
| 14743 | 564 | |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
565 | 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
|
566 | 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
|
567 | } 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
|
568 | 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
|
569 | } else { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
570 | 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
|
571 | 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
|
572 | GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE), 0, 0, NULL); |
| 14743 | 573 | |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
574 | 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
|
575 | 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
|
576 | 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
|
577 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
578 | 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
|
579 | 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
|
580 | GINT_TO_POINTER(PURPLE_STATUS_UNAVAILABLE), 0, 0, NULL); |
| 14743 | 581 | |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
582 | 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
|
583 | 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
|
584 | 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
|
585 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
586 | 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
|
587 | 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
|
588 | 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
|
589 | } |
| 14743 | 590 | |
| 15884 | 591 | popular_statuses = purple_savedstatuses_get_popular(6); |
| 14743 | 592 | if (popular_statuses != NULL) |
| 15568 | 593 | pidgin_separator(submenu); |
| 14743 | 594 | for (cur = popular_statuses; cur != NULL; cur = cur->next) |
| 595 | { | |
| 15884 | 596 | PurpleSavedStatus *saved_status = cur->data; |
| 597 | time_t creation_time = purple_savedstatus_get_creation_time(saved_status); | |
| 15882 | 598 | new_menu_item_with_status_icon(submenu, |
| 15884 | 599 | purple_savedstatus_get_title(saved_status), |
| 600 | purple_savedstatus_get_type(saved_status), G_CALLBACK(activate_saved_status_cb), | |
| 14743 | 601 | GINT_TO_POINTER(creation_time), 0, 0, NULL); |
| 602 | } | |
| 603 | g_list_free(popular_statuses); | |
| 604 | ||
| 15568 | 605 | pidgin_separator(submenu); |
| 14743 | 606 | |
|
16960
6d97980fed84
Telcontar on #pidgin-win32 pointed out that the "New..." and "Saved..."
Casey Harkins <charkins@pidgin.im>
parents:
16918
diff
changeset
|
607 | 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
|
608 | pidgin_new_item_from_stock(submenu, _("Saved..."), NULL, G_CALLBACK(pidgin_status_window_show), NULL, 0, 0, NULL); |
| 14743 | 609 | |
| 610 | return menuitem; | |
| 611 | } | |
| 612 | ||
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
613 | |
|
20960
b0c77b970912
merge of 'e39a56e1b46110397f5043f21bb86f8cd920012d'
Sadrul Habib Chowdhury <sadrul@pidgin.im>
diff
changeset
|
614 | |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
615 | 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
|
616 | 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
|
617 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
618 | 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
|
619 | 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
|
620 | } |
|
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 | 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
|
623 | 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
|
624 | 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
|
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 | 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
|
627 | 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
|
628 | 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
|
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 | 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
|
631 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
632 | 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
|
633 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
634 | 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
|
635 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
636 | 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
|
637 | 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
|
638 | 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
|
639 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
640 | 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
|
641 | 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
|
642 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
643 | 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
|
644 | 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
|
645 | 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
|
646 | action, |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
647 | (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
|
648 | 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
|
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 | else |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
651 | 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
|
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 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
654 | 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
|
655 | } |
|
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 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
658 | 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
|
659 | 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
|
660 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
661 | 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
|
662 | 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
|
663 | 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
|
664 | 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
|
665 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
666 | 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
|
667 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
668 | /* 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
|
669 | 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
|
670 | 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
|
671 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
672 | 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
|
673 | continue; |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
674 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
675 | 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
|
676 | continue; |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
677 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
678 | 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
|
679 | 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
|
680 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
681 | 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
|
682 | 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
|
683 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
684 | 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
|
685 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
686 | c++; |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
687 | } |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
688 | 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
|
689 | 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
|
690 | } |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
691 | |
| 14743 | 692 | 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
|
693 | 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
|
694 | { |
| 14743 | 695 | static GtkWidget *menu = NULL; |
| 696 | GtkWidget *menuitem; | |
|
32339
8c4f6c2f736b
Improve win32 behavior of the GtkStatusIcon based docklet.
Daniel Atallah <datallah@pidgin.im>
parents:
32325
diff
changeset
|
697 | GtkMenuPositionFunc pos_func = gtk_status_icon_position_menu; |
| 14743 | 698 | |
| 699 | if (menu) { | |
| 700 | gtk_widget_destroy(menu); | |
| 701 | } | |
| 702 | ||
| 703 | menu = gtk_menu_new(); | |
| 704 | ||
|
23344
edd0045bf715
Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents:
23343
diff
changeset
|
705 | 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
|
706 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible")); |
| 14743 | 707 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL); |
| 708 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 709 | ||
|
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
|
710 | menuitem = gtk_menu_item_new_with_mnemonic(_("_Unread Messages")); |
| 14743 | 711 | |
|
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
|
712 | if (pending) { |
| 14743 | 713 | GtkWidget *submenu = gtk_menu_new(); |
| 714 | GList *l = get_pending_list(0); | |
| 715 | if (l == NULL) { | |
| 716 | gtk_widget_set_sensitive(menuitem, FALSE); | |
| 15884 | 717 | purple_debug_warning("docklet", |
| 14743 | 718 | "status indicates messages pending, but no conversations with unseen messages were found."); |
| 719 | } else { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
720 | pidgin_conversations_fill_menu(submenu, l); |
| 14743 | 721 | g_list_free(l); |
| 722 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); | |
| 723 | } | |
| 724 | } else { | |
| 725 | gtk_widget_set_sensitive(menuitem, FALSE); | |
| 726 | } | |
| 727 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 728 | ||
| 15568 | 729 | pidgin_separator(menu); |
| 14743 | 730 | |
|
23344
edd0045bf715
Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents:
23343
diff
changeset
|
731 | 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
|
732 | if (status == PURPLE_STATUS_OFFLINE) |
| 14743 | 733 | gtk_widget_set_sensitive(menuitem, FALSE); |
| 734 | ||
|
23848
d017d45e3dcf
Add menuitem for 'join chat' in the docklet menu. Closes #3623.
Balwinder S Dheeman <bsd@rubyforge.org>
parents:
23344
diff
changeset
|
735 | 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
|
736 | 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
|
737 | 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
|
738 | 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
|
739 | |
| 14743 | 740 | menuitem = docklet_status_submenu(); |
| 741 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 742 | ||
| 15568 | 743 | pidgin_separator(menu); |
| 14743 | 744 | |
|
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
|
745 | 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
|
746 | 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
|
747 | pidgin_new_item_from_stock(menu, _("Pr_eferences"), GTK_STOCK_PREFERENCES, G_CALLBACK(pidgin_prefs_show), NULL, 0, 0, NULL); |
| 14743 | 748 | |
| 15568 | 749 | pidgin_separator(menu); |
| 14743 | 750 | |
|
23344
edd0045bf715
Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents:
23343
diff
changeset
|
751 | 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
|
752 | 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
|
753 | if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) |
| 14743 | 754 | gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE); |
| 755 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); | |
| 756 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
757 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
758 | #if !GTK_CHECK_VERSION(3,0,0) |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
759 | menuitem = gtk_check_menu_item_new_with_mnemonic(_("_Blink on New Message")); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
760 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/blink")); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
761 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blink), NULL); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
762 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
763 | #endif |
|
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
764 | |
| 15568 | 765 | pidgin_separator(menu); |
| 14743 | 766 | |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
767 | /* 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
|
768 | 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
|
769 | |
|
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
|
770 | pidgin_new_item_from_stock(menu, _("_Quit"), GTK_STOCK_QUIT, G_CALLBACK(purple_core_quit), NULL, 0, 0, NULL); |
| 14743 | 771 | |
| 772 | #ifdef _WIN32 | |
| 773 | g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); | |
| 774 | g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); | |
|
32339
8c4f6c2f736b
Improve win32 behavior of the GtkStatusIcon based docklet.
Daniel Atallah <datallah@pidgin.im>
parents:
32325
diff
changeset
|
775 | pos_func = NULL; |
| 14743 | 776 | #endif |
| 777 | gtk_widget_show_all(menu); | |
| 778 | gtk_menu_popup(GTK_MENU(menu), NULL, NULL, | |
|
32339
8c4f6c2f736b
Improve win32 behavior of the GtkStatusIcon based docklet.
Daniel Atallah <datallah@pidgin.im>
parents:
32325
diff
changeset
|
779 | pos_func, |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
780 | docklet, 0, gtk_get_current_event_time()); |
| 14743 | 781 | } |
| 782 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
783 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
784 | pidgin_docklet_clicked(int button_type) |
| 14743 | 785 | { |
| 786 | switch (button_type) { | |
| 787 | 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
|
788 | if (pending) { |
| 14743 | 789 | GList *l = get_pending_list(1); |
| 790 | if (l != NULL) { | |
|
21022
eb7d727949e7
Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents:
21014
diff
changeset
|
791 | pidgin_conv_present_conversation((PurpleConversation *)l->data); |
| 14743 | 792 | g_list_free(l); |
| 793 | } | |
| 794 | } else { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
795 | pidgin_blist_toggle_visibility(); |
| 14743 | 796 | } |
| 797 | break; | |
| 798 | case 3: | |
| 799 | docklet_menu(); | |
| 800 | break; | |
| 801 | } | |
| 802 | } | |
| 803 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
804 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
805 | pidgin_docklet_embedded(void) |
| 14743 | 806 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
807 | 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
|
808 | && 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
|
809 | pidgin_blist_visibility_manager_add(); |
| 14743 | 810 | visibility_manager = TRUE; |
| 811 | } | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
812 | visible = TRUE; |
| 14743 | 813 | docklet_update_status(); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
814 | docklet_gtk_status_update_icon(status, connecting, pending); |
| 14743 | 815 | } |
| 816 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
817 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
818 | pidgin_docklet_remove(void) |
| 14743 | 819 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
820 | if (visible) { |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
821 | if (visibility_manager) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
822 | pidgin_blist_visibility_manager_remove(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
823 | visibility_manager = FALSE; |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
824 | } |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
825 | 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
|
826 | status = PURPLE_STATUS_OFFLINE; |
| 14743 | 827 | } |
| 828 | } | |
| 829 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
830 | static gboolean |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
831 | docklet_gtk_recreate_cb(gpointer data) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
832 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
833 | docklet_gtk_status_create(TRUE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
834 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
835 | return FALSE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
836 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
837 | |
|
32341
6b2256808cad
I assume this check was backwards, since embedding should be used
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32339
diff
changeset
|
838 | #ifndef _WIN32 |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
839 | static gboolean |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
840 | docklet_gtk_embed_timeout_cb(gpointer data) |
| 14743 | 841 | { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
842 | #if !GTK_CHECK_VERSION(2,12,0) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
843 | if (gtk_status_icon_is_embedded(docklet)) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
844 | /* Older GTK+ (<2.12) don't implement the embedded signal, but the |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
845 | information is still accessible through the above function. */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
846 | purple_debug_info("docklet", "embedded\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
847 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
848 | pidgin_docklet_embedded(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
849 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
850 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
851 | else |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
852 | #endif |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
853 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
854 | /* The docklet was not embedded within the timeout. |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
855 | * Remove it as a visibility manager, but leave the plugin |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
856 | * loaded so that it can embed automatically if/when a notification |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
857 | * area becomes available. |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
858 | */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
859 | purple_debug_info("docklet", "failed to embed within timeout\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
860 | pidgin_docklet_remove(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
861 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
862 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
863 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
864 | #if GTK_CHECK_VERSION(2,12,0) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
865 | embed_timeout = 0; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
866 | return FALSE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
867 | #else |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
868 | return TRUE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
869 | #endif |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
870 | } |
|
32341
6b2256808cad
I assume this check was backwards, since embedding should be used
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32339
diff
changeset
|
871 | #endif |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
872 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
873 | #if GTK_CHECK_VERSION(2,12,0) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
874 | static gboolean |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
875 | docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
876 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
877 | if (embed_timeout) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
878 | purple_timeout_remove(embed_timeout); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
879 | embed_timeout = 0; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
880 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
881 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
882 | if (gtk_status_icon_is_embedded(docklet)) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
883 | purple_debug_info("docklet", "embedded\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
884 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
885 | pidgin_docklet_embedded(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
886 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
887 | } else { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
888 | purple_debug_info("docklet", "detached\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
889 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
890 | pidgin_docklet_remove(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
891 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
892 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
893 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
894 | return TRUE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
895 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
896 | #endif |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
897 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
898 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
899 | docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
900 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
901 | purple_debug_info("docklet", "destroyed\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
902 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
903 | pidgin_docklet_remove(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
904 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
905 | g_object_unref(G_OBJECT(docklet)); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
906 | docklet = NULL; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
907 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
908 | g_idle_add(docklet_gtk_recreate_cb, NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
909 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
910 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
911 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
912 | docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
913 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
914 | pidgin_docklet_clicked(1); |
| 14743 | 915 | } |
| 916 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
917 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
918 | docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
919 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
920 | purple_debug_info("docklet", "The button is %u\n", button); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
921 | #ifdef GDK_WINDOWING_QUARTZ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
922 | /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
923 | pidgin_docklet_clicked(3); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
924 | #else |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
925 | pidgin_docklet_clicked(button); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
926 | #endif |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
927 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
928 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
929 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
930 | docklet_gtk_status_destroy(void) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
931 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
932 | g_return_if_fail(docklet != NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
933 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
934 | pidgin_docklet_remove(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
935 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
936 | if (embed_timeout) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
937 | purple_timeout_remove(embed_timeout); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
938 | embed_timeout = 0; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
939 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
940 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
941 | gtk_status_icon_set_visible(docklet, FALSE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
942 | g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
943 | g_object_unref(G_OBJECT(docklet)); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
944 | docklet = NULL; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
945 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
946 | purple_debug_info("docklet", "GTK+ destroyed\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
947 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
948 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
949 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
950 | docklet_gtk_status_create(gboolean recreate) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
951 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
952 | if (docklet) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
953 | /* if this is being called when a tray icon exists, it's because |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
954 | something messed up. try destroying it before we proceed, |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
955 | although docklet_refcount may be all hosed. hopefully won't happen. */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
956 | purple_debug_warning("docklet", "trying to create icon but it already exists?\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
957 | docklet_gtk_status_destroy(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
958 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
959 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
960 | docklet = gtk_status_icon_new(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
961 | g_return_if_fail(docklet != NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
962 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
963 | g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
964 | g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
965 | #if GTK_CHECK_VERSION(2,12,0) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
966 | g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
967 | #endif |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
968 | g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
969 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
970 | gtk_status_icon_set_visible(docklet, TRUE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
971 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
972 | /* This is a hack to avoid a race condition between the docklet getting |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
973 | * embedded in the notification area and the gtkblist restoring its |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
974 | * previous visibility state. If the docklet does not get embedded within |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
975 | * the timeout, it will be removed as a visibility manager until it does |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
976 | * get embedded. Ideally, we would only call docklet_embedded() when the |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
977 | * icon was actually embedded. This only happens when the docklet is first |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
978 | * created, not when being recreated. |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
979 | * |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
980 | * The gtk docklet tracks whether it successfully embedded in a pref and |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
981 | * allows for a longer timeout period if it successfully embedded the last |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
982 | * time it was run. This should hopefully solve problems with the buddy |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
983 | * list not properly starting hidden when Pidgin is started on login. |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
984 | */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
985 | if (!recreate) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
986 | pidgin_docklet_embedded(); |
|
32341
6b2256808cad
I assume this check was backwards, since embedding should be used
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32339
diff
changeset
|
987 | #ifndef _WIN32 |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
988 | #if GTK_CHECK_VERSION(2,12,0) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
989 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
990 | embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
991 | } else { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
992 | embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
993 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
994 | #else |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
995 | embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
996 | #endif |
|
32339
8c4f6c2f736b
Improve win32 behavior of the GtkStatusIcon based docklet.
Daniel Atallah <datallah@pidgin.im>
parents:
32325
diff
changeset
|
997 | #endif |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
998 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
999 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1000 | purple_debug_info("docklet", "GTK+ created\n"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1001 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1002 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1003 | /************************************************************************** |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1004 | * public api |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1005 | **************************************************************************/ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1006 | |
| 14743 | 1007 | void* |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1008 | pidgin_docklet_get_handle() |
| 14743 | 1009 | { |
| 1010 | static int i; | |
| 1011 | return &i; | |
| 1012 | } | |
| 1013 | ||
|
33246
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
1014 | GtkStatusIcon * |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
1015 | pidgin_docklet_get_status_icon(void) |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
1016 | { |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
1017 | return docklet; |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
1018 | } |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
1019 | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
1020 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1021 | pidgin_docklet_init() |
| 14743 | 1022 | { |
| 15884 | 1023 | void *conn_handle = purple_connections_get_handle(); |
| 1024 | void *conv_handle = purple_conversations_get_handle(); | |
| 1025 | 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
|
1026 | void *status_handle = purple_savedstatuses_get_handle(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1027 | void *docklet_handle = pidgin_docklet_get_handle(); |
|
32325
f6980ed6044a
Fix win32 build for gtkdocklet changes.
Daniel Atallah <datallah@pidgin.im>
parents:
32307
diff
changeset
|
1028 | gchar *tmp; |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
1029 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
1030 | 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
|
1031 | 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
|
1032 | 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
|
1033 | purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show", |
| 14947 | 1034 | docklet_show_pref_changed_cb, NULL); |
| 14743 | 1035 | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1036 | purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1037 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1038 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1039 | purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded"); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1040 | } else { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1041 | purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1042 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1043 | |
|
32325
f6980ed6044a
Fix win32 build for gtkdocklet changes.
Daniel Atallah <datallah@pidgin.im>
parents:
32307
diff
changeset
|
1044 | tmp = g_build_path(G_DIR_SEPARATOR_S, DATADIR, "pixmaps", "pidgin", "tray", NULL); |
|
f6980ed6044a
Fix win32 build for gtkdocklet changes.
Daniel Atallah <datallah@pidgin.im>
parents:
32307
diff
changeset
|
1045 | gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(), tmp); |
|
f6980ed6044a
Fix win32 build for gtkdocklet changes.
Daniel Atallah <datallah@pidgin.im>
parents:
32307
diff
changeset
|
1046 | g_free(tmp); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1047 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1048 | if (!strcmp(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always")) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1049 | docklet_gtk_status_create(FALSE); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
1050 | |
| 15884 | 1051 | purple_signal_connect(conn_handle, "signed-on", |
| 1052 | docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL); | |
| 1053 | purple_signal_connect(conn_handle, "signed-off", | |
| 1054 | 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
|
1055 | purple_signal_connect(accounts_handle, "account-connecting", |
| 15884 | 1056 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
| 1057 | purple_signal_connect(conv_handle, "received-im-msg", | |
| 1058 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
| 1059 | purple_signal_connect(conv_handle, "conversation-created", | |
| 1060 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
| 1061 | purple_signal_connect(conv_handle, "deleting-conversation", | |
| 1062 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
| 1063 | purple_signal_connect(conv_handle, "conversation-updated", | |
| 1064 | 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
|
1065 | 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
|
1066 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
1067 | #if 0 |
| 15884 | 1068 | purple_signal_connect(purple_get_core(), "quitting", |
| 1069 | docklet_handle, PURPLE_CALLBACK(purple_quit_cb), NULL); | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
1070 | #endif |
| 14743 | 1071 | |
| 1072 | enable_join_chat = online_account_supports_chat(); | |
| 1073 | } | |
| 1074 | ||
| 1075 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1076 | pidgin_docklet_uninit() |
| 14743 | 1077 | { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1078 | if (visible) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1079 | docklet_gtk_status_destroy(); |
| 14743 | 1080 | } |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1081 |