pidgin/gtkdocklet-gtk.c

Wed, 22 Jan 2025 20:47:54 -0600

author
Gary Kramlich <grim@reaperworld.com>
date
Wed, 22 Jan 2025 20:47:54 -0600
branch
release-2.x.y
changeset 43156
eb22b625ecad
parent 38824
11ab937b64b9
permissions
-rw-r--r--

Prepare for the 2.14.14 release

Testing Done:
Ran `make distcheck`

Reviewed at https://reviews.imfreedom.org/r/3779/

29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
1 /*
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
2 * System tray icon (aka docklet) plugin for Purple
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
3 *
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
4 * Copyright (C) 2007 Anders Hasselqvist
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31227
diff changeset
5 *
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
6 * This program is free software; you can redistribute it and/or
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
7 * modify it under the terms of the GNU General Public License as
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
8 * published by the Free Software Foundation; either version 2 of the
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
9 * License, or (at your option) any later version.
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
10 *
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
11 * This program is distributed in the hope that it will be useful, but
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
14 * General Public License for more details.
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31227
diff changeset
15 *
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
16 * You should have received a copy of the GNU General Public License
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
17 * along with this program; if not, write to the Free Software
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
18 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
19 * 02111-1307, USA.
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
20 */
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
21
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
22 #include "internal.h"
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
23 #include "pidgin.h"
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
24 #include "debug.h"
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
25 #include "prefs.h"
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
26 #include "pidginstock.h"
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
27 #include "gtkdocklet.h"
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
28
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
29 #define SHORT_EMBED_TIMEOUT 5
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
30 #define LONG_EMBED_TIMEOUT 15
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
31
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
32 /* globals */
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
33 static GtkStatusIcon *docklet = NULL;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
34 static guint embed_timeout = 0;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
35
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
36 /* protos */
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
37 static void docklet_gtk_status_create(gboolean);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
38
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
39 static gboolean
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
40 docklet_gtk_recreate_cb(gpointer data)
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
41 {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
42 docklet_gtk_status_create(TRUE);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
43
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
44 return FALSE;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
45 }
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
46
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
47 static gboolean
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
48 docklet_gtk_embed_timeout_cb(gpointer data)
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
49 {
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
50 #if !GTK_CHECK_VERSION(2,12,0)
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
51 if (gtk_status_icon_is_embedded(docklet)) {
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
52 /* Older GTK+ (<2.12) don't implement the embedded signal, but the
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
53 information is still accessable through the above function. */
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
54 purple_debug_info("docklet", "embedded\n");
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
55
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
56 pidgin_docklet_embedded();
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
57 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE);
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
58 }
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
59 else
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
60 #endif
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
61 {
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
62 /* The docklet was not embedded within the timeout.
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
63 * Remove it as a visibility manager, but leave the plugin
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
64 * loaded so that it can embed automatically if/when a notification
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
65 * area becomes available.
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
66 */
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
67 purple_debug_info("docklet", "failed to embed within timeout\n");
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
68 pidgin_docklet_remove();
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
69 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE);
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
70 }
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
71
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
72 #if GTK_CHECK_VERSION(2,12,0)
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
73 embed_timeout = 0;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
74 return FALSE;
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
75 #else
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
76 return TRUE;
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
77 #endif
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
78 }
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
79
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
80 #if GTK_CHECK_VERSION(2,12,0)
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
81 static gboolean
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
82 docklet_gtk_embedded_cb(GtkWidget *widget, gpointer data)
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
83 {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
84 if (embed_timeout) {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
85 purple_timeout_remove(embed_timeout);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
86 embed_timeout = 0;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
87 }
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
88
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
89 if (gtk_status_icon_is_embedded(docklet)) {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
90 purple_debug_info("docklet", "embedded\n");
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
91
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
92 pidgin_docklet_embedded();
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
93 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
94 } else {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
95 purple_debug_info("docklet", "detached\n");
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
96
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
97 pidgin_docklet_remove();
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
98 purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
99 }
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
100
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
101 return TRUE;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
102 }
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
103 #endif
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
104
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
105 static void
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
106 docklet_gtk_destroyed_cb(GtkWidget *widget, gpointer data)
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
107 {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
108 purple_debug_info("docklet", "destroyed\n");
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
109
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
110 pidgin_docklet_remove();
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
111
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
112 g_object_unref(G_OBJECT(docklet));
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
113 docklet = NULL;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
114
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
115 g_idle_add(docklet_gtk_recreate_cb, NULL);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
116 }
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
117
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
118 static void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
119 docklet_gtk_status_activated_cb(GtkStatusIcon *status_icon, gpointer user_data)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
120 {
31294
73607ab89c6f Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents: 31227
diff changeset
121 pidgin_docklet_clicked(1);
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
122 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
123
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
124 static void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
125 docklet_gtk_status_clicked_cb(GtkStatusIcon *status_icon, guint button, guint activate_time, gpointer user_data)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
126 {
30342
d26c76d8808c GtkStatusIcon only exposes a single button press on a Mac for whatever
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30272
diff changeset
127 purple_debug_info("docklet", "The button is %u\n", button);
d26c76d8808c GtkStatusIcon only exposes a single button press on a Mac for whatever
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30272
diff changeset
128 #ifdef GDK_WINDOWING_QUARTZ
d26c76d8808c GtkStatusIcon only exposes a single button press on a Mac for whatever
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30272
diff changeset
129 /* You can only click left mouse button on MacOSX native GTK. Let that be the menu */
d26c76d8808c GtkStatusIcon only exposes a single button press on a Mac for whatever
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30272
diff changeset
130 pidgin_docklet_clicked(3);
d26c76d8808c GtkStatusIcon only exposes a single button press on a Mac for whatever
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30272
diff changeset
131 #else
d26c76d8808c GtkStatusIcon only exposes a single button press on a Mac for whatever
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30272
diff changeset
132 pidgin_docklet_clicked(button);
d26c76d8808c GtkStatusIcon only exposes a single button press on a Mac for whatever
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30272
diff changeset
133 #endif
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
134 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
135
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
136 static void
38823
0839fbcfb9b4 Use gtk_status_icon_get_icon_name instead of a new boolean variable
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 38821
diff changeset
137 docklet_gtk_status_update_icon(PurpleStatusPrimitive status, gboolean connecting, gboolean pending)
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
138 {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
139 const gchar *icon_name = NULL;
38823
0839fbcfb9b4 Use gtk_status_icon_get_icon_name instead of a new boolean variable
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 38821
diff changeset
140 const gchar *current_icon_name = gtk_status_icon_get_icon_name(docklet);
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
141
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
142 switch (status) {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
143 case PURPLE_STATUS_OFFLINE:
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
144 icon_name = PIDGIN_STOCK_TRAY_OFFLINE;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
145 break;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
146 case PURPLE_STATUS_AWAY:
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
147 icon_name = PIDGIN_STOCK_TRAY_AWAY;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
148 break;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
149 case PURPLE_STATUS_UNAVAILABLE:
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
150 icon_name = PIDGIN_STOCK_TRAY_BUSY;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
151 break;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
152 case PURPLE_STATUS_EXTENDED_AWAY:
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
153 icon_name = PIDGIN_STOCK_TRAY_XA;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
154 break;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
155 case PURPLE_STATUS_INVISIBLE:
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
156 icon_name = PIDGIN_STOCK_TRAY_INVISIBLE;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
157 break;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
158 default:
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
159 icon_name = PIDGIN_STOCK_TRAY_AVAILABLE;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
160 break;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
161 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
162
38824
11ab937b64b9 Use purple_strequal instead of strcmp
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 38823
diff changeset
163 if (connecting && !purple_strequal(current_icon_name, PIDGIN_STOCK_TRAY_CONNECT)) {
38821
329cf2453fb8 Rework tray icon blinking
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 31474
diff changeset
164 icon_name = PIDGIN_STOCK_TRAY_CONNECT;
329cf2453fb8 Rework tray icon blinking
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 31474
diff changeset
165 }
329cf2453fb8 Rework tray icon blinking
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 31474
diff changeset
166
38824
11ab937b64b9 Use purple_strequal instead of strcmp
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 38823
diff changeset
167 if (pending && !purple_strequal(current_icon_name, PIDGIN_STOCK_TRAY_PENDING)) {
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
168 icon_name = PIDGIN_STOCK_TRAY_PENDING;
38821
329cf2453fb8 Rework tray icon blinking
Daniel Kamil Kozar <dkk089@gmail.com>
parents: 31474
diff changeset
169 }
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
170
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
171 if (icon_name) {
29659
140f0c97a939 Change lookup of docklet icons to use an 'icon name' instead of a stock
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29643
diff changeset
172 gtk_status_icon_set_from_icon_name(docklet, icon_name);
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
173 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
174 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
175
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
176 static void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
177 docklet_gtk_status_set_tooltip(gchar *tooltip)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
178 {
31227
c61dee56e1f3 This conditional is redundant, right?
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31226
diff changeset
179 gtk_status_icon_set_tooltip(docklet, tooltip);
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
180 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
181
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
182 static void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
183 docklet_gtk_status_position_menu(GtkMenu *menu,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
184 int *x, int *y, gboolean *push_in,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
185 gpointer user_data)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
186 {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
187 gtk_status_icon_position_menu(menu, x, y, push_in, docklet);
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
188 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
189
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
190 static void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
191 docklet_gtk_status_destroy(void)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
192 {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
193 g_return_if_fail(docklet != NULL);
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
194
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
195 pidgin_docklet_remove();
30272
5c042f4c85b1 Set the GtkTrayIcon invisible before unref'ing it, or else it will leave
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30262
diff changeset
196
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
197 if (embed_timeout) {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
198 purple_timeout_remove(embed_timeout);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
199 embed_timeout = 0;
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
200 }
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
201
30272
5c042f4c85b1 Set the GtkTrayIcon invisible before unref'ing it, or else it will leave
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30262
diff changeset
202 gtk_status_icon_set_visible(docklet, FALSE);
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
203 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_gtk_destroyed_cb), NULL);
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
204 g_object_unref(G_OBJECT(docklet));
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
205 docklet = NULL;
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
206
29706
230f2f5eca1e Make it slightly clearer which docklet is in use.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29659
diff changeset
207 purple_debug_info("docklet", "GTK+ destroyed\n");
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
208 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
209
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
210 static void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
211 docklet_gtk_status_create(gboolean recreate)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
212 {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
213 if (docklet) {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
214 /* if this is being called when a tray icon exists, it's because
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
215 something messed up. try destroying it before we proceed,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
216 although docklet_refcount may be all hosed. hopefully won't happen. */
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
217 purple_debug_warning("docklet", "trying to create icon but it already exists?\n");
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
218 docklet_gtk_status_destroy();
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
219 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
220
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
221 docklet = gtk_status_icon_new();
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
222 g_return_if_fail(docklet != NULL);
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
223
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
224 g_signal_connect(G_OBJECT(docklet), "activate", G_CALLBACK(docklet_gtk_status_activated_cb), NULL);
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
225 g_signal_connect(G_OBJECT(docklet), "popup-menu", G_CALLBACK(docklet_gtk_status_clicked_cb), NULL);
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
226 #if GTK_CHECK_VERSION(2,12,0)
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
227 g_signal_connect(G_OBJECT(docklet), "notify::embedded", G_CALLBACK(docklet_gtk_embedded_cb), NULL);
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
228 #endif
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
229 g_signal_connect(G_OBJECT(docklet), "destroy", G_CALLBACK(docklet_gtk_destroyed_cb), NULL);
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
230
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
231 gtk_status_icon_set_visible(docklet, TRUE);
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
232
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
233 /* This is a hack to avoid a race condition between the docklet getting
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
234 * embedded in the notification area and the gtkblist restoring its
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
235 * previous visibility state. If the docklet does not get embedded within
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
236 * the timeout, it will be removed as a visibility manager until it does
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
237 * get embedded. Ideally, we would only call docklet_embedded() when the
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
238 * icon was actually embedded. This only happens when the docklet is first
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
239 * created, not when being recreated.
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
240 *
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
241 * The gtk docklet tracks whether it successfully embedded in a pref and
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
242 * allows for a longer timeout period if it successfully embedded the last
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
243 * time it was run. This should hopefully solve problems with the buddy
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
244 * list not properly starting hidden when Pidgin is started on login.
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
245 */
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
246 if (!recreate) {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
247 pidgin_docklet_embedded();
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
248 #if GTK_CHECK_VERSION(2,12,0)
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
249 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded")) {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
250 embed_timeout = purple_timeout_add_seconds(LONG_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
251 } else {
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
252 embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL);
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
253 }
31474
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
254 #else
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
255 embed_timeout = purple_timeout_add_seconds(SHORT_EMBED_TIMEOUT, docklet_gtk_embed_timeout_cb, NULL);
2e78685c09e0 Apply the timer-check patch that I supplied in #13139. Should now show
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31308
diff changeset
256 #endif
31226
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
257 }
2f009ef19243 Re-implement the embedding timeout, so that the buddy list doesn't
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 30342
diff changeset
258
29706
230f2f5eca1e Make it slightly clearer which docklet is in use.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29659
diff changeset
259 purple_debug_info("docklet", "GTK+ created\n");
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
260 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
261
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
262 static void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
263 docklet_gtk_status_create_ui_op(void)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
264 {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
265 docklet_gtk_status_create(FALSE);
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
266 }
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
267
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
268 static struct docklet_ui_ops ui_ops =
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
269 {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
270 docklet_gtk_status_create_ui_op,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
271 docklet_gtk_status_destroy,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
272 docklet_gtk_status_update_icon,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
273 NULL,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
274 docklet_gtk_status_set_tooltip,
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
275 docklet_gtk_status_position_menu
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
276 };
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
277
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
278 void
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
279 docklet_ui_init(void)
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
280 {
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
281 pidgin_docklet_set_ui_ops(&ui_ops);
31308
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
282
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
283 purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/gtk");
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
284 if (purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) {
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
285 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", TRUE);
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
286 purple_prefs_remove(PIDGIN_PREFS_ROOT "/docklet/x11/embedded");
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
287 } else {
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
288 purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/gtk/embedded", FALSE);
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
289 }
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
290
29659
140f0c97a939 Change lookup of docklet icons to use an 'icon name' instead of a stock
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29643
diff changeset
291 gtk_icon_theme_append_search_path(gtk_icon_theme_get_default(),
140f0c97a939 Change lookup of docklet icons to use an 'icon name' instead of a stock
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 29643
diff changeset
292 DATADIR G_DIR_SEPARATOR_S "pixmaps" G_DIR_SEPARATOR_S "pidgin" G_DIR_SEPARATOR_S "tray");
29643
d03c32ee4bd5 Apparently, I only just imagined adding this file.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
diff changeset
293 }
31308
35817b8ced65 Correctly set up the prefs for the docklet.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents: 31294
diff changeset
294

mercurial