Mercurial > pidgin
comparison plugins/docklet/docklet-x11.c @ 10491:9655389f4b81
[gaim-migrate @ 11781]
This allows the blist to be hidden in the docklet on start. It adds a
three second timeout after attempting to embed. If it doesn't embed within
this time, it will assume there's no manager and give show the buddy list.
Robot101 is looking into less hacky ways to do this. I doubt one exists.
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Sat, 08 Jan 2005 23:40:24 +0000 |
parents | ec140184437b |
children | 1a97d5e88d12 |
comparison
equal
deleted
inserted
replaced
10490:a3a540ed2518 | 10491:9655389f4b81 |
---|---|
31 #include "gtkdialogs.h" | 31 #include "gtkdialogs.h" |
32 | 32 |
33 #include "eggtrayicon.h" | 33 #include "eggtrayicon.h" |
34 #include "docklet.h" | 34 #include "docklet.h" |
35 | 35 |
36 #define EMBED_TIMEOUT 3000 | |
37 | |
36 /* globals */ | 38 /* globals */ |
37 static EggTrayIcon *docklet = NULL; | 39 static EggTrayIcon *docklet = NULL; |
38 static GtkWidget *image = NULL; | 40 static GtkWidget *image = NULL; |
39 static GdkPixbuf *blank_icon = NULL; | 41 static GdkPixbuf *blank_icon = NULL; |
42 static int embed_timeout = 0; | |
40 | 43 |
41 /* protos */ | 44 /* protos */ |
42 static void docklet_x11_create(); | 45 static void docklet_x11_create(); |
43 | 46 |
44 static gboolean | 47 static gboolean |
51 | 54 |
52 static void | 55 static void |
53 docklet_x11_embedded_cb(GtkWidget *widget, void *data) | 56 docklet_x11_embedded_cb(GtkWidget *widget, void *data) |
54 { | 57 { |
55 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "embedded\n"); | 58 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "embedded\n"); |
56 | 59 |
57 docklet_embedded(); | 60 g_source_remove(embed_timeout); |
61 embed_timeout = 0; | |
58 } | 62 } |
59 | 63 |
60 static void | 64 static void |
61 docklet_x11_destroyed_cb(GtkWidget *widget, void *data) | 65 docklet_x11_destroyed_cb(GtkWidget *widget, void *data) |
62 { | 66 { |
146 *y = menu_ypos; | 150 *y = menu_ypos; |
147 | 151 |
148 *push_in = TRUE; | 152 *push_in = TRUE; |
149 } | 153 } |
150 | 154 |
151 static void | 155 static gboolean |
152 docklet_x11_destroy() | 156 docklet_x11_destroy() |
153 { | 157 { |
154 docklet_remove(GTK_WIDGET_VISIBLE(docklet)); | 158 docklet_remove(GTK_WIDGET_VISIBLE(docklet)); |
155 | 159 |
156 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_x11_destroyed_cb), NULL); | 160 g_signal_handlers_disconnect_by_func(G_OBJECT(docklet), G_CALLBACK(docklet_x11_destroyed_cb), NULL); |
162 if (blank_icon) | 166 if (blank_icon) |
163 g_object_unref(G_OBJECT(blank_icon)); | 167 g_object_unref(G_OBJECT(blank_icon)); |
164 blank_icon = NULL; | 168 blank_icon = NULL; |
165 | 169 |
166 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "destroyed\n"); | 170 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "destroyed\n"); |
171 return FALSE; | |
167 } | 172 } |
168 | 173 |
169 static void | 174 static void |
170 docklet_x11_create() | 175 docklet_x11_create() |
171 { | 176 { |
195 | 200 |
196 gtk_widget_show_all(GTK_WIDGET(docklet)); | 201 gtk_widget_show_all(GTK_WIDGET(docklet)); |
197 | 202 |
198 /* ref the docklet before we bandy it about the place */ | 203 /* ref the docklet before we bandy it about the place */ |
199 g_object_ref(G_OBJECT(docklet)); | 204 g_object_ref(G_OBJECT(docklet)); |
205 docklet_embedded(); | |
206 embed_timeout = g_timeout_add(EMBED_TIMEOUT, docklet_x11_destroy, NULL); | |
200 | 207 |
201 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "created\n"); | 208 gaim_debug(GAIM_DEBUG_INFO, "tray icon", "created\n"); |
202 } | 209 } |
203 | 210 |
204 static struct docklet_ui_ops ui_ops = | 211 static struct docklet_ui_ops ui_ops = |