pidgin/gtkdocklet.c

Sat, 29 Jun 2013 22:10:18 +0530

author
Ankit Vani <a@nevitus.org>
date
Sat, 29 Jun 2013 22:10:18 +0530
branch
soc.2013.gobjectification
changeset 34678
40a30f74a7b8
parent 34659
4fc616843cb2
child 34706
02cb08146888
permissions
-rw-r--r--

Removed purple_conversation_[gs]et_data(). Used g_object_[gs]et_data() instead.
Removed data from PurpleConversationPrivate.

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

mercurial