Tue, 08 May 2018 21:52:50 -0500
gtkdocklet: Remove GtkIconTheme search path addition for tray icons
The GtkIconTheme search path had the path to tray icons added to it
in gtkdoclet.c. Now that the tray icons are in the same path as the
rest of the icons, this can be removed. This patch does so.
| 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" | |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
47 | #include "gtknotify.h" |
| 14743 | 48 | |
|
33170
ce4447562d64
Add checks for old GTK+2 stuff.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33169
diff
changeset
|
49 | #include "gtk3compat.h" |
| 14743 | 50 | |
| 51 | #ifndef DOCKLET_TOOLTIP_LINE_LIMIT | |
| 52 | #define DOCKLET_TOOLTIP_LINE_LIMIT 5 | |
| 53 | #endif | |
| 54 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
55 | #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
|
56 | #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
|
57 | |
| 14743 | 58 | /* globals */ |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
59 | 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
|
60 | 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
|
61 | static PurpleStatusPrimitive status = PURPLE_STATUS_OFFLINE; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
62 | static PidginDockletFlag flags = 0; |
| 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 |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
75 | docklet_gtk_status_update_icon(PurpleStatusPrimitive status, PidginDockletFlag newflag) |
| 14743 | 76 | { |
|
32307
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; |
| 14743 | 78 | |
|
32307
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; |
| 14743 | 98 | } |
| 99 | ||
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
100 | if (newflag & PIDGIN_DOCKLET_EMAIL_PENDING) |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
101 | icon_name = PIDGIN_STOCK_TRAY_EMAIL; |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
102 | if (newflag & PIDGIN_DOCKLET_CONV_PENDING) |
|
32307
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_PENDING; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
104 | if (newflag & PIDGIN_DOCKLET_CONNECTING) |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
105 | 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
|
106 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
107 | if (icon_name) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
108 | 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
|
109 | } |
| 14743 | 110 | } |
| 111 | ||
| 112 | static GList * | |
| 113 | get_pending_list(guint max) | |
| 114 | { | |
|
25585
694a25f1eaf4
This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents:
25584
diff
changeset
|
115 | GList *l_im, *l_chat; |
| 14743 | 116 | |
|
34659
4fc616843cb2
Removed conversation type argument from pidgin conversation functions.
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
117 | l_im = pidgin_conversations_get_unseen_ims(PIDGIN_UNSEEN_TEXT, FALSE, max); |
| 14743 | 118 | |
|
25585
694a25f1eaf4
This small optimization has been sitting in my tree for a long time.
Daniel Atallah <datallah@pidgin.im>
parents:
25584
diff
changeset
|
119 | /* 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
|
120 | 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
|
121 | 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
|
122 | |
|
34659
4fc616843cb2
Removed conversation type argument from pidgin conversation functions.
Ankit Vani <a@nevitus.org>
parents:
34622
diff
changeset
|
123 | l_chat = pidgin_conversations_get_unseen_chats( |
|
33534
97976e12368d
Add a preference to select the type of message that triggers the docklet notification.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33529
diff
changeset
|
124 | purple_prefs_get_int(PIDGIN_PREFS_ROOT "/conversations/notification_chat"), |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
125 | FALSE, max); |
| 14743 | 126 | |
| 127 | if (l_im != NULL && l_chat != NULL) | |
| 128 | return g_list_concat(l_im, l_chat); | |
| 129 | else if (l_im != NULL) | |
| 130 | return l_im; | |
| 131 | else | |
| 132 | return l_chat; | |
| 133 | } | |
| 134 | ||
| 135 | 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
|
136 | docklet_update_status(void) |
| 14743 | 137 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
138 | GList *convs, *l; |
| 14743 | 139 | int count; |
| 15884 | 140 | 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
|
141 | PurpleStatusPrimitive newstatus = PURPLE_STATUS_OFFLINE; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
142 | PidginDockletFlag newflags = 0; |
| 14743 | 143 | |
|
16681
c15974a4ff5d
Patch from charkins in ticket #198 to fulfill a feature request by hbons:
Richard Laager <rlaager@pidgin.im>
parents:
16263
diff
changeset
|
144 | /* 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
|
145 | 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
|
146 | |
| 14743 | 147 | /* determine if any ims have unseen messages */ |
| 148 | convs = get_pending_list(DOCKLET_TOOLTIP_LINE_LIMIT); | |
| 149 | ||
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
32213
diff
changeset
|
150 | if (purple_strequal(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
|
151 | if (convs && !visible) { |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
152 | 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
|
153 | docklet_gtk_status_create(FALSE); |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
154 | return FALSE; |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
155 | } 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
|
156 | docklet_gtk_status_destroy(); |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
157 | return FALSE; |
| 14935 | 158 | } |
| 159 | } | |
| 160 | ||
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
161 | if (!visible) { |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
162 | g_list_free(convs); |
| 14947 | 163 | return FALSE; |
|
15075
2bd60dbd8877
[gaim-migrate @ 17794]
Daniel Atallah <datallah@pidgin.im>
parents:
14954
diff
changeset
|
164 | } |
| 14947 | 165 | |
| 14743 | 166 | 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
|
167 | /* 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
|
168 | GString *tooltip_text = g_string_new(""); |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
169 | newflags |= PIDGIN_DOCKLET_CONV_PENDING; |
| 14743 | 170 | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
171 | 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
|
172 | 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
|
173 | PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
|
21022
eb7d727949e7
Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents:
21014
diff
changeset
|
174 | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
175 | 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
|
176 | 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
|
177 | } else if(gtkconv) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
178 | 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
|
179 | 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
|
180 | gtkconv->unseen_count, |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
181 | 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
|
182 | } else { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
183 | 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
|
184 | ngettext("%d unread message from %s\n", "%d unread messages from %s\n", |
|
34678
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34659
diff
changeset
|
185 | GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "unseen-count"))), |
|
40a30f74a7b8
Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Ankit Vani <a@nevitus.org>
parents:
34659
diff
changeset
|
186 | GPOINTER_TO_INT(g_object_get_data(G_OBJECT(conv), "unseen-count")), |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
187 | purple_conversation_get_title(conv)); |
| 14743 | 188 | } |
| 189 | } | |
| 190 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
191 | /* 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
|
192 | 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
|
193 | 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
|
194 | |
|
33122
40a55fa87823
GtkStatusIcon no longer has a blinking property in GTK+-3.0.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33120
diff
changeset
|
195 | 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
|
196 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
197 | g_string_free(tooltip_text, TRUE); |
| 14743 | 198 | g_list_free(convs); |
| 199 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
200 | } else { |
|
16977
c9cb49bea66d
Change the PIDGIN_NAME stuff to allow translators to transliterate the
Richard Laager <rlaager@pidgin.im>
parents:
16960
diff
changeset
|
201 | 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
|
202 | 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
|
203 | 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
|
204 | g_free(tooltip_text); |
| 14743 | 205 | } |
| 206 | ||
| 15884 | 207 | for(l = purple_accounts_get_all(); l != NULL; l = l->next) { |
| 14743 | 208 | |
| 15884 | 209 | PurpleAccount *account = (PurpleAccount*)l->data; |
| 14743 | 210 | |
| 15884 | 211 | if (!purple_account_get_enabled(account, PIDGIN_UI)) |
| 14743 | 212 | continue; |
| 213 | ||
| 15884 | 214 | if (purple_account_is_disconnected(account)) |
| 14743 | 215 | continue; |
| 216 | ||
| 15884 | 217 | if (purple_account_is_connecting(account)) |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
218 | newflags |= PIDGIN_DOCKLET_CONNECTING; |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
219 | |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
220 | if (pidgin_notify_emails_pending()) |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
221 | newflags |= PIDGIN_DOCKLET_EMAIL_PENDING; |
| 14743 | 222 | } |
|
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
|
223 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
224 | newstatus = purple_savedstatus_get_primitive_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
|
225 | |
| 14743 | 226 | /* update the icon if we changed status */ |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
227 | if (status != newstatus || flags != newflags) { |
| 14743 | 228 | status = newstatus; |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
229 | flags = newflags; |
| 14743 | 230 | |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
231 | docklet_gtk_status_update_icon(status, flags); |
| 14743 | 232 | } |
| 233 | ||
| 234 | return FALSE; /* for when we're called by the glib idle handler */ | |
| 235 | } | |
| 236 | ||
| 237 | 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
|
238 | online_account_supports_chat(void) |
| 14743 | 239 | { |
| 240 | GList *c = NULL; | |
| 15884 | 241 | c = purple_connections_get_all(); |
| 14743 | 242 | |
| 243 | while(c != NULL) { | |
| 15884 | 244 | PurpleConnection *gc = c->data; |
|
36623
caaadef03507
Renamed purple_connection_get_protocol_info() to purple_connection_get_protocol()
Ankit Vani <a@nevitus.org>
parents:
36544
diff
changeset
|
245 | PurpleProtocol *protocol = purple_connection_get_protocol(gc); |
|
36725
f17f9d4e710e
Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36633
diff
changeset
|
246 | if (protocol != NULL && PURPLE_PROTOCOL_IMPLEMENTS(protocol, CHAT_IFACE, info)) |
| 14743 | 247 | return TRUE; |
| 248 | c = c->next; | |
| 249 | } | |
| 250 | ||
| 251 | return FALSE; | |
| 252 | } | |
| 253 | ||
| 254 | /************************************************************************** | |
| 255 | * callbacks and signal handlers | |
| 256 | **************************************************************************/ | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
257 | #if 0 |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
258 | static void |
| 15882 | 259 | pidgin_quit_cb() |
| 14743 | 260 | { |
| 261 | /* TODO: confirm quit while pending */ | |
| 262 | } | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
263 | #endif |
| 14743 | 264 | |
| 265 | static void | |
| 266 | docklet_update_status_cb(void *data) | |
| 267 | { | |
| 268 | docklet_update_status(); | |
| 269 | } | |
| 270 | ||
| 271 | static void | |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
33683
diff
changeset
|
272 | docklet_conv_updated_cb(PurpleConversation *conv, PurpleConversationUpdateType type) |
| 14743 | 273 | { |
|
34622
753f46dd000f
Global replace - renamed functions and types according to GObject-based PurpleConversation API
Ankit Vani <a@nevitus.org>
parents:
33683
diff
changeset
|
274 | if (type == PURPLE_CONVERSATION_UPDATE_UNSEEN) |
| 14743 | 275 | docklet_update_status(); |
| 276 | } | |
| 277 | ||
| 278 | static void | |
| 15884 | 279 | docklet_signed_on_cb(PurpleConnection *gc) |
| 14743 | 280 | { |
| 281 | if (!enable_join_chat) { | |
|
36725
f17f9d4e710e
Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36633
diff
changeset
|
282 | if (PURPLE_PROTOCOL_IMPLEMENTS(purple_connection_get_protocol(gc), CHAT_IFACE, info)) |
| 14743 | 283 | enable_join_chat = TRUE; |
| 284 | } | |
| 285 | docklet_update_status(); | |
| 286 | } | |
| 287 | ||
| 288 | static void | |
| 15884 | 289 | docklet_signed_off_cb(PurpleConnection *gc) |
| 14743 | 290 | { |
| 291 | if (enable_join_chat) { | |
|
36725
f17f9d4e710e
Refactored pidgin to use the new protocol API
Ankit Vani <a@nevitus.org>
parents:
36633
diff
changeset
|
292 | if (PURPLE_PROTOCOL_IMPLEMENTS(purple_connection_get_protocol(gc), CHAT_IFACE, info)) |
| 14743 | 293 | enable_join_chat = online_account_supports_chat(); |
| 294 | } | |
| 295 | docklet_update_status(); | |
| 296 | } | |
| 297 | ||
| 14947 | 298 | static void |
| 15884 | 299 | docklet_show_pref_changed_cb(const char *name, PurplePrefType type, |
| 14947 | 300 | gconstpointer value, gpointer data) |
| 301 | { | |
| 302 | const char *val = value; | |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
32213
diff
changeset
|
303 | if (purple_strequal(val, "always")) { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
304 | if (!visible) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
305 | 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
|
306 | 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
|
307 | 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
|
308 | visibility_manager = TRUE; |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
309 | } |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
32213
diff
changeset
|
310 | } else if (purple_strequal(val, "never")) { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
311 | if (visible) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
312 | docklet_gtk_status_destroy(); |
| 14947 | 313 | } else { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
314 | if (visibility_manager) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
315 | pidgin_blist_visibility_manager_remove(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
316 | visibility_manager = FALSE; |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
317 | } |
| 14947 | 318 | docklet_update_status(); |
| 319 | } | |
| 320 | } | |
| 321 | ||
| 14743 | 322 | /************************************************************************** |
| 323 | * docklet pop-up menu | |
| 324 | **************************************************************************/ | |
| 325 | static void | |
| 326 | docklet_toggle_mute(GtkWidget *toggle, void *data) | |
| 327 | { | |
|
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
|
328 | 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
|
329 | gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); |
| 14875 | 330 | } |
| 331 | ||
| 332 | static void | |
| 14743 | 333 | docklet_toggle_blist(GtkWidget *toggle, void *data) |
| 334 | { | |
|
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
|
335 | purple_blist_set_visible(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(toggle))); |
| 14743 | 336 | } |
| 337 | ||
| 338 | #ifdef _WIN32 | |
| 339 | /* This is a workaround for a bug in windows GTK+. Clicking outside of the | |
| 340 | menu does not get rid of it, so instead we get rid of it as soon as the | |
| 341 | pointer leaves the menu. */ | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
342 | static gboolean |
| 14743 | 343 | hide_docklet_menu(gpointer data) |
| 344 | { | |
| 345 | if (data != NULL) { | |
| 346 | gtk_menu_popdown(GTK_MENU(data)); | |
| 347 | } | |
| 348 | return FALSE; | |
| 349 | } | |
| 350 | ||
| 351 | static gboolean | |
| 352 | docklet_menu_leave_enter(GtkWidget *menu, GdkEventCrossing *event, void *data) | |
| 353 | { | |
| 354 | 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
|
355 | |
|
be42c007cce2
Fix from "oopepe" to make menus more reliably responsive.
Daniel Atallah <datallah@pidgin.im>
parents:
23848
diff
changeset
|
356 | 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
|
357 | event->detail == GDK_NOTIFY_UNKNOWN)) { |
| 15884 | 358 | purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu leave-notify-event\n"); |
| 14743 | 359 | /* Add some slop so that the menu doesn't annoyingly disappear when mousing around */ |
| 360 | if (hide_docklet_timer == 0) { | |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
361 | hide_docklet_timer = g_timeout_add(500, |
| 14743 | 362 | hide_docklet_menu, menu); |
| 363 | } | |
| 364 | } else if (event->type == GDK_ENTER_NOTIFY && event->detail == GDK_NOTIFY_ANCESTOR) { | |
| 15884 | 365 | purple_debug(PURPLE_DEBUG_INFO, "docklet", "menu enter-notify-event\n"); |
| 14743 | 366 | if (hide_docklet_timer != 0) { |
| 367 | /* Cancel the hiding if we reenter */ | |
| 368 | ||
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
369 | g_source_remove(hide_docklet_timer); |
| 14743 | 370 | hide_docklet_timer = 0; |
| 371 | } | |
| 372 | } | |
| 373 | return FALSE; | |
| 374 | } | |
| 375 | #endif | |
| 376 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
377 | /* 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
|
378 | * 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
|
379 | * 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
|
380 | */ |
| 14743 | 381 | static void |
| 382 | show_custom_status_editor_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 383 | { | |
| 15884 | 384 | PurpleSavedStatus *saved_status; |
| 385 | saved_status = purple_savedstatus_get_current(); | |
|
16179
bdf68342e1ce
sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents:
16129
diff
changeset
|
386 | |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
387 | if (purple_savedstatus_get_primitive_type(saved_status) == PURPLE_STATUS_AVAILABLE) |
|
16179
bdf68342e1ce
sf patch #1622581, from Greg Taeger
Mark Doliner <markdoliner@pidgin.im>
parents:
16129
diff
changeset
|
388 | 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
|
389 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
390 | pidgin_status_editor_show(FALSE, |
| 15884 | 391 | purple_savedstatus_is_transient(saved_status) ? saved_status : NULL); |
| 14743 | 392 | } |
| 393 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
394 | static PurpleSavedStatus * |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
395 | 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
|
396 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
397 | 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
|
398 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
399 | 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
|
400 | 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
|
401 | 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
|
402 | 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
|
403 | (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
|
404 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
405 | 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
|
406 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
407 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
408 | 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
|
409 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
410 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
411 | static void |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
412 | 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
|
413 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
414 | 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
|
415 | PurpleStatusPrimitive primitive; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
416 | 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
|
417 | 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
|
418 | 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
|
419 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
420 | 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
|
421 | 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
|
422 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
423 | 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
|
424 | PurpleSavedStatus *ss = iter->data; |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
425 | if ((purple_savedstatus_get_primitive_type(ss) == primitive) && purple_savedstatus_is_transient(ss) && |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
426 | 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
|
427 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
428 | 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
|
429 | /* 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
|
430 | 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
|
431 | 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
|
432 | 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
|
433 | if (sub) { |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
434 | const PurpleStatusType *sub_type = purple_savedstatus_substatus_get_status_type(sub); |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
435 | const char *subtype_status_id = purple_status_type_get_id(sub_type); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
32213
diff
changeset
|
436 | if (subtype_status_id && purple_strequal(subtype_status_id, |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
437 | 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
|
438 | found = TRUE; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
439 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
440 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
441 | if (!found) |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
442 | continue; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
443 | 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
|
444 | break; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
445 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
446 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
447 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
448 | 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
|
449 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
450 | /* 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
|
451 | 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
|
452 | 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
|
453 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
454 | /* 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
|
455 | 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
|
456 | } |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
457 | |
| 14743 | 458 | static void |
| 459 | activate_status_primitive_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 460 | { | |
| 15884 | 461 | PurpleStatusPrimitive primitive; |
| 462 | PurpleSavedStatus *saved_status; | |
| 14743 | 463 | |
| 464 | primitive = GPOINTER_TO_INT(user_data); | |
| 465 | ||
| 466 | /* Try to lookup an already existing transient saved status */ | |
| 15884 | 467 | saved_status = purple_savedstatus_find_transient_by_type_and_message(primitive, NULL); |
| 14743 | 468 | |
| 469 | /* Create a new transient saved status if we weren't able to find one */ | |
| 470 | 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
|
471 | saved_status = create_transient_status(primitive, NULL); |
| 14743 | 472 | |
| 473 | /* Set the status for each account */ | |
| 15884 | 474 | purple_savedstatus_activate(saved_status); |
| 14743 | 475 | } |
| 476 | ||
| 477 | static void | |
| 478 | activate_saved_status_cb(GtkMenuItem *menuitem, gpointer user_data) | |
| 479 | { | |
| 480 | time_t creation_time; | |
| 15884 | 481 | PurpleSavedStatus *saved_status; |
| 14743 | 482 | |
| 483 | creation_time = GPOINTER_TO_INT(user_data); | |
| 15884 | 484 | saved_status = purple_savedstatus_find_by_creation_time(creation_time); |
| 14743 | 485 | if (saved_status != NULL) |
| 15884 | 486 | purple_savedstatus_activate(saved_status); |
| 14743 | 487 | } |
| 488 | ||
| 489 | 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
|
490 | 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 | 491 | { |
| 492 | GtkWidget *menuitem; | |
| 493 | GdkPixbuf *pixbuf; | |
| 494 | GtkWidget *image; | |
| 495 | ||
|
20953
e39a56e1b461
Patch from QuLogic to not use underscores in saved-statuses as mnemonics
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
20380
diff
changeset
|
496 | menuitem = gtk_image_menu_item_new_with_label(str); |
| 14743 | 497 | |
| 498 | if (menu) | |
| 499 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 500 | ||
|
26821
ad2ea323d0f2
Replace the deprecated GtkSignalFunc and GTK_SIGNAL_FUNC with GCallback and
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
25585
diff
changeset
|
501 | 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
|
502 | g_signal_connect(G_OBJECT(menuitem), "activate", cb, data); |
| 14743 | 503 | |
|
15799
ba7af742a0d1
Change some old, busted status icon stuff to use the new hotness
Sean Egan <seanegan@pidgin.im>
parents:
15766
diff
changeset
|
504 | pixbuf = pidgin_create_status_icon(primitive, menu, PIDGIN_ICON_SIZE_TANGO_EXTRA_SMALL); |
| 14743 | 505 | image = gtk_image_new_from_pixbuf(pixbuf); |
| 506 | g_object_unref(pixbuf); | |
| 507 | gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(menuitem), image); | |
| 508 | ||
| 509 | gtk_widget_show_all(menuitem); | |
| 510 | ||
| 511 | return menuitem; | |
| 512 | } | |
| 513 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
514 | static void |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
515 | 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
|
516 | { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
517 | GList *l; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
518 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
519 | 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
|
520 | 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
|
521 | PurpleStatusPrimitive prim; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
522 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
523 | 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
|
524 | continue; |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
525 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
526 | 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
|
527 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
528 | 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
|
529 | 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
|
530 | 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
|
531 | 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
|
532 | } |
|
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 | |
| 14743 | 535 | 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
|
536 | docklet_status_submenu(void) |
| 14743 | 537 | { |
| 538 | GtkWidget *submenu, *menuitem; | |
| 539 | 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
|
540 | PidginStatusBox *statusbox = NULL; |
| 14743 | 541 | |
| 542 | 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
|
543 | menuitem = gtk_menu_item_new_with_mnemonic(_("_Change Status")); |
| 14743 | 544 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); |
| 545 | ||
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
546 | 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
|
547 | 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
|
548 | } |
| 14743 | 549 | |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
550 | 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
|
551 | 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
|
552 | } 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
|
553 | 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
|
554 | } else { |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
555 | new_menu_item_with_status_icon(submenu, _("Available"), |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
556 | PURPLE_STATUS_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
|
557 | GINT_TO_POINTER(PURPLE_STATUS_AVAILABLE), 0, 0, NULL); |
| 14743 | 558 | |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
559 | 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
|
560 | 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
|
561 | 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
|
562 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
563 | 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
|
564 | 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
|
565 | GINT_TO_POINTER(PURPLE_STATUS_UNAVAILABLE), 0, 0, NULL); |
| 14743 | 566 | |
|
21011
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
567 | 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
|
568 | 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
|
569 | 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
|
570 | |
|
0b21b3224a68
Make sure that the "Change Status" submenu in the docklet context menu
Casey Harkins <charkins@pidgin.im>
parents:
20960
diff
changeset
|
571 | 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
|
572 | 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
|
573 | 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
|
574 | } |
| 14743 | 575 | |
| 15884 | 576 | popular_statuses = purple_savedstatuses_get_popular(6); |
| 14743 | 577 | if (popular_statuses != NULL) |
| 15568 | 578 | pidgin_separator(submenu); |
| 14743 | 579 | for (cur = popular_statuses; cur != NULL; cur = cur->next) |
| 580 | { | |
| 15884 | 581 | PurpleSavedStatus *saved_status = cur->data; |
| 582 | time_t creation_time = purple_savedstatus_get_creation_time(saved_status); | |
| 15882 | 583 | new_menu_item_with_status_icon(submenu, |
| 15884 | 584 | purple_savedstatus_get_title(saved_status), |
|
35378
5d9e2581005b
gtk-doc prep: *_get_type() functions are hidden as standard GType-returning funcs, so rename them.
Ankit Vani <a@nevitus.org>
parents:
34708
diff
changeset
|
585 | purple_savedstatus_get_primitive_type(saved_status), G_CALLBACK(activate_saved_status_cb), |
| 14743 | 586 | GINT_TO_POINTER(creation_time), 0, 0, NULL); |
| 587 | } | |
| 588 | g_list_free(popular_statuses); | |
| 589 | ||
| 15568 | 590 | pidgin_separator(submenu); |
| 14743 | 591 | |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
592 | pidgin_new_menu_item(submenu, _("New..."), NULL, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
593 | G_CALLBACK(show_custom_status_editor_cb), NULL); |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
594 | pidgin_new_menu_item(submenu, _("Saved..."), NULL, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
595 | G_CALLBACK(pidgin_status_window_show), NULL); |
| 14743 | 596 | |
| 597 | return menuitem; | |
| 598 | } | |
| 599 | ||
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
600 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
601 | 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
|
602 | 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
|
603 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
604 | 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
|
605 | 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
|
606 | } |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
607 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
608 | static void |
|
36492
4918c33856be
Refactored gtkdocklet to use the actions callback
Ankit Vani <a@nevitus.org>
parents:
36488
diff
changeset
|
609 | build_plugin_actions(GtkWidget *menu, PurplePlugin *plugin) |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
610 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
611 | GtkWidget *menuitem; |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36725
diff
changeset
|
612 | PurplePluginActionsCb actions_cb; |
|
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 | 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
|
614 | 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
|
615 | |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36725
diff
changeset
|
616 | actions_cb = |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36725
diff
changeset
|
617 | purple_plugin_info_get_actions_cb(purple_plugin_get_info(plugin)); |
|
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36725
diff
changeset
|
618 | actions = actions_cb(plugin); |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
619 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
620 | 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
|
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 | 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
|
623 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
624 | 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
|
625 | 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
|
626 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
627 | 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
|
628 | 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
|
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 | 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
|
631 | 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
|
632 | 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
|
633 | action, |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
634 | (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
|
635 | 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
|
636 | } |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
637 | else |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
638 | 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
|
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 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
641 | 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
|
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 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
644 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
645 | 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
|
646 | 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
|
647 | { |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
648 | 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
|
649 | PurplePlugin *plugin = NULL; |
|
36492
4918c33856be
Refactored gtkdocklet to use the actions callback
Ankit Vani <a@nevitus.org>
parents:
36488
diff
changeset
|
650 | PurplePluginInfo *info; |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
651 | 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
|
652 | 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
|
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_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
|
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 | /* 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
|
657 | for (l = purple_plugins_get_loaded(); l; l = l->next) { |
|
36492
4918c33856be
Refactored gtkdocklet to use the actions callback
Ankit Vani <a@nevitus.org>
parents:
36488
diff
changeset
|
658 | plugin = PURPLE_PLUGIN(l->data); |
|
4918c33856be
Refactored gtkdocklet to use the actions callback
Ankit Vani <a@nevitus.org>
parents:
36488
diff
changeset
|
659 | info = purple_plugin_get_info(plugin); |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
660 | |
|
36934
e7268aeb3b89
Renamed plugin info callback properties to end with "-cb", and their respective symbols.
Ankit Vani <a@nevitus.org>
parents:
36725
diff
changeset
|
661 | if (!purple_plugin_info_get_actions_cb(info)) |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
662 | continue; |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
663 | |
|
36492
4918c33856be
Refactored gtkdocklet to use the actions callback
Ankit Vani <a@nevitus.org>
parents:
36488
diff
changeset
|
664 | menuitem = |
|
4918c33856be
Refactored gtkdocklet to use the actions callback
Ankit Vani <a@nevitus.org>
parents:
36488
diff
changeset
|
665 | gtk_image_menu_item_new_with_label(_(purple_plugin_info_get_name(info))); |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
666 | 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
|
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 | 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
|
669 | 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
|
670 | |
|
36492
4918c33856be
Refactored gtkdocklet to use the actions callback
Ankit Vani <a@nevitus.org>
parents:
36488
diff
changeset
|
671 | build_plugin_actions(submenu, plugin); |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
672 | |
|
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
673 | c++; |
|
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(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
|
676 | 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
|
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 | |
| 14743 | 679 | 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
|
680 | 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
|
681 | { |
| 14743 | 682 | static GtkWidget *menu = NULL; |
| 683 | GtkWidget *menuitem; | |
| 684 | ||
| 685 | if (menu) { | |
| 686 | gtk_widget_destroy(menu); | |
| 687 | } | |
| 688 | ||
| 689 | menu = gtk_menu_new(); | |
| 690 | ||
|
23344
edd0045bf715
Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents:
23343
diff
changeset
|
691 | 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
|
692 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/blist/list_visible")); |
| 14743 | 693 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_blist), NULL); |
| 694 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 695 | ||
|
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
|
696 | menuitem = gtk_menu_item_new_with_mnemonic(_("_Unread Messages")); |
| 14743 | 697 | |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
698 | if (flags & PIDGIN_DOCKLET_CONV_PENDING) { |
| 14743 | 699 | GtkWidget *submenu = gtk_menu_new(); |
| 700 | GList *l = get_pending_list(0); | |
| 701 | if (l == NULL) { | |
| 702 | gtk_widget_set_sensitive(menuitem, FALSE); | |
| 15884 | 703 | purple_debug_warning("docklet", |
| 14743 | 704 | "status indicates messages pending, but no conversations with unseen messages were found."); |
| 705 | } else { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
706 | pidgin_conversations_fill_menu(submenu, l); |
| 14743 | 707 | g_list_free(l); |
| 708 | gtk_menu_item_set_submenu(GTK_MENU_ITEM(menuitem), submenu); | |
| 709 | } | |
| 710 | } else { | |
| 711 | gtk_widget_set_sensitive(menuitem, FALSE); | |
| 712 | } | |
| 713 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 714 | ||
| 15568 | 715 | pidgin_separator(menu); |
| 14743 | 716 | |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
717 | menuitem = pidgin_new_menu_item(menu, _("New _Message..."), |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
718 | PIDGIN_STOCK_TOOLBAR_MESSAGE_NEW, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
719 | G_CALLBACK(pidgin_dialogs_im), 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
|
720 | if (status == PURPLE_STATUS_OFFLINE) |
| 14743 | 721 | gtk_widget_set_sensitive(menuitem, FALSE); |
| 722 | ||
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
723 | menuitem = pidgin_new_menu_item(menu, _("Join Chat..."), |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
724 | PIDGIN_STOCK_CHAT, G_CALLBACK(pidgin_blist_joinchat_show), |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
725 | NULL); |
|
23848
d017d45e3dcf
Add menuitem for 'join chat' in the docklet menu. Closes #3623.
Balwinder S Dheeman <bsd@rubyforge.org>
parents:
23344
diff
changeset
|
726 | 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
|
727 | 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
|
728 | |
| 14743 | 729 | menuitem = docklet_status_submenu(); |
| 730 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
| 731 | ||
| 15568 | 732 | pidgin_separator(menu); |
| 14743 | 733 | |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
734 | pidgin_new_menu_item(menu, _("_Accounts"), NULL, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
735 | G_CALLBACK(pidgin_accounts_window_show), NULL); |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
736 | pidgin_new_menu_item(menu, _("Plu_gins"), |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
737 | PIDGIN_STOCK_TOOLBAR_PLUGINS, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
738 | G_CALLBACK(pidgin_plugin_dialog_show), NULL); |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
739 | pidgin_new_menu_item(menu, _("Pr_eferences"), |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
740 | GTK_STOCK_PREFERENCES, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
741 | G_CALLBACK(pidgin_prefs_show), NULL); |
| 14743 | 742 | |
| 15568 | 743 | pidgin_separator(menu); |
| 14743 | 744 | |
|
23344
edd0045bf715
Changes to the docklet mnemonics patch to make them more consistent with
Richard Laager <rlaager@pidgin.im>
parents:
23343
diff
changeset
|
745 | 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
|
746 | gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(menuitem), purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/sound/mute")); |
|
38258
9a6551eba09c
Replace !strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
32213
diff
changeset
|
747 | if (purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/sound/method"), "none")) |
| 14743 | 748 | gtk_widget_set_sensitive(GTK_WIDGET(menuitem), FALSE); |
| 749 | g_signal_connect(G_OBJECT(menuitem), "toggled", G_CALLBACK(docklet_toggle_mute), NULL); | |
| 750 | gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
751 | |
| 15568 | 752 | pidgin_separator(menu); |
| 14743 | 753 | |
|
20959
8ccaaaec1b01
Add plugin actions to the docklet context menu. These are the same actions
Casey Harkins <charkins@pidgin.im>
parents:
20380
diff
changeset
|
754 | /* 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
|
755 | 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
|
756 | |
|
37879
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
757 | pidgin_new_menu_item(menu, _("_Quit"), GTK_STOCK_QUIT, |
|
38eebb7c9019
Simplify our menuitem creation util function
Jorge Villaseñor <salinasv@pidgin.im>
parents:
37422
diff
changeset
|
758 | G_CALLBACK(purple_core_quit), NULL); |
| 14743 | 759 | |
| 760 | #ifdef _WIN32 | |
| 761 | g_signal_connect(menu, "leave-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); | |
| 762 | g_signal_connect(menu, "enter-notify-event", G_CALLBACK(docklet_menu_leave_enter), NULL); | |
| 763 | #endif | |
| 764 | gtk_widget_show_all(menu); | |
|
38710
32c5e0e741e1
Use gtk_menu_popup_at_pointer for docklet instead of _at_widget.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
38708
diff
changeset
|
765 | gtk_menu_popup_at_pointer(GTK_MENU(menu), NULL); |
| 14743 | 766 | } |
| 767 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
768 | static void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
769 | pidgin_docklet_clicked(int button_type) |
| 14743 | 770 | { |
| 771 | switch (button_type) { | |
| 772 | case 1: | |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
773 | if (flags & PIDGIN_DOCKLET_EMAIL_PENDING) { |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
774 | pidgin_notify_emails_present(NULL); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
775 | } else if (flags & PIDGIN_DOCKLET_CONV_PENDING) { |
| 14743 | 776 | GList *l = get_pending_list(1); |
| 777 | if (l != NULL) { | |
|
21022
eb7d727949e7
Handle unattached conversations appropriately when drawing tooltip for
Casey Harkins <charkins@pidgin.im>
parents:
21014
diff
changeset
|
778 | pidgin_conv_present_conversation((PurpleConversation *)l->data); |
| 14743 | 779 | g_list_free(l); |
| 780 | } | |
| 781 | } else { | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
782 | pidgin_blist_toggle_visibility(); |
| 14743 | 783 | } |
| 784 | break; | |
| 785 | case 3: | |
| 786 | docklet_menu(); | |
| 787 | break; | |
| 788 | } | |
| 789 | } | |
| 790 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
791 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
792 | pidgin_docklet_embedded(void) |
| 14743 | 793 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
794 | if (!visibility_manager |
|
38259
c593fc9f5438
Replace strcmp() with purple_strequal()
qarkai <qarkai@gmail.com>
parents:
38258
diff
changeset
|
795 | && !purple_strequal(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
|
796 | pidgin_blist_visibility_manager_add(); |
| 14743 | 797 | visibility_manager = TRUE; |
| 798 | } | |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
799 | visible = TRUE; |
| 14743 | 800 | docklet_update_status(); |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
801 | docklet_gtk_status_update_icon(status, flags); |
| 14743 | 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_remove(void) |
| 14743 | 806 | { |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
807 | if (visible) { |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
808 | if (visibility_manager) { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
809 | pidgin_blist_visibility_manager_remove(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
810 | visibility_manager = FALSE; |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
811 | } |
|
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
812 | 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
|
813 | status = PURPLE_STATUS_OFFLINE; |
| 14743 | 814 | } |
| 815 | } | |
| 816 | ||
|
32341
6b2256808cad
I assume this check was backwards, since embedding should be used
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32339
diff
changeset
|
817 | #ifndef _WIN32 |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
818 | static gboolean |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
819 | docklet_gtk_embed_timeout_cb(gpointer data) |
| 14743 | 820 | { |
|
33683
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
821 | /* The docklet was not embedded within the timeout. |
|
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
822 | * Remove it as a visibility manager, but leave the plugin |
|
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
823 | * loaded so that it can embed automatically if/when a notification |
|
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
824 | * area becomes available. |
|
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
825 | */ |
|
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
826 | purple_debug_info("docklet", "failed to embed within timeout\n"); |
|
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
827 | pidgin_docklet_remove(); |
|
bf243e3394a7
Remove all unnecessary GTK_CHECK_VERSION calls.
Mark Doliner <mark@kingant.net>
parents:
33534
diff
changeset
|
828 | purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
829 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
830 | embed_timeout = 0; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
831 | return FALSE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
832 | } |
|
32341
6b2256808cad
I assume this check was backwards, since embedding should be used
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32339
diff
changeset
|
833 | #endif |
|
32307
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 | static gboolean |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
836 | docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data) |
| 14743 | 837 | { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
838 | if (embed_timeout) { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
839 | g_source_remove(embed_timeout); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
840 | embed_timeout = 0; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
841 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
842 | |
|
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 | 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
|
845 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
846 | pidgin_docklet_embedded(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
847 | 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
|
848 | } else { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
849 | 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
|
850 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
851 | pidgin_docklet_remove(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
852 | 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
|
853 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
854 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
855 | return TRUE; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
856 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
857 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
858 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
859 | 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
|
860 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
861 | pidgin_docklet_clicked(1); |
| 14743 | 862 | } |
| 863 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
864 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
865 | 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
|
866 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
867 | 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
|
868 | #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
|
869 | /* 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
|
870 | 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
|
871 | #else |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
872 | 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
|
873 | #endif |
| 14743 | 874 | } |
| 875 | ||
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
876 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
877 | 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
|
878 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
879 | 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
|
880 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
881 | pidgin_docklet_remove(); |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
882 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
883 | if (embed_timeout) { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
884 | g_source_remove(embed_timeout); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
885 | embed_timeout = 0; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
886 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
887 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
888 | 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
|
889 | 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
|
890 | docklet = NULL; |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
891 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
892 | 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
|
893 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
894 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
895 | static void |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
896 | 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
|
897 | { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
898 | if (docklet) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
899 | /* 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
|
900 | 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
|
901 | 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
|
902 | 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
|
903 | 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
|
904 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
905 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
906 | 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
|
907 | 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
|
908 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
909 | 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
|
910 | 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
|
911 | 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
|
912 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
913 | 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
|
914 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
915 | /* 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
|
916 | * 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
|
917 | * 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
|
918 | * 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
|
919 | * 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
|
920 | * 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
|
921 | * 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
|
922 | * |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
923 | * 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
|
924 | * 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
|
925 | * 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
|
926 | * 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
|
927 | */ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
928 | if (!recreate) { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
929 | 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
|
930 | #ifndef _WIN32 |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
931 | if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
932 | embed_timeout = g_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
933 | } else { |
|
38433
361c801c4536
Remove purple_timeout_* function usage
Mike Ruprecht <cmaiku@gmail.com>
parents:
38358
diff
changeset
|
934 | embed_timeout = g_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL); |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
935 | } |
|
32339
8c4f6c2f736b
Improve win32 behavior of the GtkStatusIcon based docklet.
Daniel Atallah <datallah@pidgin.im>
parents:
32325
diff
changeset
|
936 | #endif |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
937 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
938 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
939 | 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
|
940 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
941 | |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
942 | /************************************************************************** |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
943 | * public api |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
944 | **************************************************************************/ |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
945 | |
| 14743 | 946 | void* |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
947 | pidgin_docklet_get_handle() |
| 14743 | 948 | { |
| 949 | static int i; | |
| 950 | return &i; | |
| 951 | } | |
| 952 | ||
|
33246
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
953 | GtkStatusIcon * |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
954 | 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
|
955 | { |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
956 | return docklet; |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
957 | } |
|
b9a5b8ddf92c
Add API to access the underlying GtkStatusIcon for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
33170
diff
changeset
|
958 | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
959 | void |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
960 | pidgin_docklet_init() |
| 14743 | 961 | { |
| 15884 | 962 | void *conn_handle = purple_connections_get_handle(); |
| 963 | void *conv_handle = purple_conversations_get_handle(); | |
| 964 | 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
|
965 | void *status_handle = purple_savedstatuses_get_handle(); |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
966 | void *docklet_handle = pidgin_docklet_get_handle(); |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
967 | void *notify_handle = purple_notify_get_handle(); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
968 | |
|
16123
8b98683319e7
Rename /purple/gtk preferences back to /gaim/gtk to allow for smooth upgrades
Stu Tomlinson <nosnilmot@pidgin.im>
parents:
15884
diff
changeset
|
969 | 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
|
970 | 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
|
971 | 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
|
972 | purple_prefs_connect_callback(docklet_handle, PIDGIN_PREFS_ROOT "/docklet/show", |
| 14947 | 973 | docklet_show_pref_changed_cb, NULL); |
|
33534
97976e12368d
Add a preference to select the type of message that triggers the docklet notification.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33529
diff
changeset
|
974 | purple_prefs_add_int(PIDGIN_PREFS_ROOT "/conversations/notification_chat", PIDGIN_UNSEEN_TEXT); |
| 14743 | 975 | |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
976 | 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
|
977 | 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
|
978 | 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
|
979 | 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
|
980 | } else { |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
981 | 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
|
982 | } |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
983 | |
| 38358 | 984 | if (purple_strequal(purple_prefs_get_string(PIDGIN_PREFS_ROOT "/docklet/show"), "always")) |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
985 | docklet_gtk_status_create(FALSE); |
|
15077
38a44f14dd35
[gaim-migrate @ 17797]
Daniel Atallah <datallah@pidgin.im>
parents:
15075
diff
changeset
|
986 | |
| 15884 | 987 | purple_signal_connect(conn_handle, "signed-on", |
| 988 | docklet_handle, PURPLE_CALLBACK(docklet_signed_on_cb), NULL); | |
| 989 | purple_signal_connect(conn_handle, "signed-off", | |
| 990 | 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
|
991 | purple_signal_connect(accounts_handle, "account-connecting", |
| 15884 | 992 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
| 993 | purple_signal_connect(conv_handle, "received-im-msg", | |
| 994 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
| 995 | purple_signal_connect(conv_handle, "conversation-created", | |
| 996 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
| 997 | purple_signal_connect(conv_handle, "deleting-conversation", | |
| 998 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); | |
| 999 | purple_signal_connect(conv_handle, "conversation-updated", | |
| 1000 | 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
|
1001 | 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
|
1002 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
|
33527
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
1003 | purple_signal_connect(notify_handle, "displaying-email-notification", |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
1004 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
1005 | purple_signal_connect(notify_handle, "displaying-emails-notification", |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
1006 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
1007 | purple_signal_connect(notify_handle, "displaying-emails-clear", |
|
c51c70f5545a
Add email notification in the docklet area.
Jorge Villaseñor <salinasv@pidgin.im>
parents:
33496
diff
changeset
|
1008 | docklet_handle, PURPLE_CALLBACK(docklet_update_status_cb), NULL); |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
1009 | #if 0 |
| 15884 | 1010 | purple_signal_connect(purple_get_core(), "quitting", |
| 1011 | docklet_handle, PURPLE_CALLBACK(purple_quit_cb), NULL); | |
|
14745
d43256e1e6fd
[gaim-migrate @ 17435]
Daniel Atallah <datallah@pidgin.im>
parents:
14743
diff
changeset
|
1012 | #endif |
| 14743 | 1013 | |
| 1014 | enable_join_chat = online_account_supports_chat(); | |
| 1015 | } | |
| 1016 | ||
| 1017 | void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
1018 | pidgin_docklet_uninit() |
| 14743 | 1019 | { |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1020 | if (visible) |
|
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1021 | docklet_gtk_status_destroy(); |
| 14743 | 1022 | } |
|
32307
bef14ba3eda1
Remove GtkDocklet abstraction and merge GtkStatusIcon code into it.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32213
diff
changeset
|
1023 |