# HG changeset patch # User Stu Tomlinson # Date 1177729167 0 # Node ID f0d399f91756e96ca35bc8c7b63ee01c5ac9d226 # Parent 17ac25319a77659bb73c2651a7b023df0b573c48# Parent 992da01baad176ea563932ad7879518a17cb373e merge of '63b5e088eb09bf2c2b2a72602ad8dc5ee2a17cf6' and 'e138b70790851dc5f40d14aa75cba3ab9369a968' diff -r 992da01baad1 -r f0d399f91756 pidgin/gtkdocklet-x11.c --- a/pidgin/gtkdocklet-x11.c Sat Apr 28 02:00:48 2007 +0000 +++ b/pidgin/gtkdocklet-x11.c Sat Apr 28 02:59:27 2007 +0000 @@ -25,6 +25,7 @@ #include "internal.h" #include "pidgin.h" #include "debug.h" +#include "prefs.h" #include "pidginstock.h" #include "gtkdialogs.h" @@ -32,7 +33,8 @@ #include "eggtrayicon.h" #include "gtkdocklet.h" -#define EMBED_TIMEOUT 5000 +#define SHORT_EMBED_TIMEOUT 5000 +#define LONG_EMBED_TIMEOUT 15000 /* globals */ static EggTrayIcon *docklet = NULL; @@ -44,12 +46,12 @@ static int docklet_height = 0; /* protos */ -static void docklet_x11_create(void); +static void docklet_x11_create(gboolean); static gboolean -docklet_x11_create_cb() +docklet_x11_recreate_cb() { - docklet_x11_create(); + docklet_x11_create(TRUE); return FALSE; /* for when we're called by the glib idle handler */ } @@ -62,6 +64,7 @@ g_source_remove(embed_timeout); embed_timeout = 0; pidgin_docklet_embedded(); + purple_prefs_set_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded", FALSE); } static void @@ -236,7 +239,7 @@ } static void -docklet_x11_create() +docklet_x11_create(gboolean recreate) { GtkWidget *box; @@ -272,17 +275,35 @@ * previous visibility state. If the docklet does not get embedded within * the timeout, it will be removed as a visibility manager until it does * get embedded. Ideally, we would only call docklet_embedded() when the - * icon was actually embedded. + * icon was actually embedded. This only happens when the docklet is first + * created, not when being recreated. + * + * The x11 docklet tracks whether it successfully embedded in a pref and + * allows for a longer timeout period if it successfully embedded the last + * time it was run. This should hopefully solve problems with the buddy + * list not properly starting hidden when gaim is started on login. */ - pidgin_docklet_embedded(); - embed_timeout = g_timeout_add(EMBED_TIMEOUT, docklet_x11_embed_timeout_cb, NULL); + if(!recreate) { + pidgin_docklet_embedded(); + if(purple_prefs_get_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded")) { + embed_timeout = g_timeout_add(LONG_EMBED_TIMEOUT, docklet_x11_embed_timeout_cb, NULL); + } else { + embed_timeout = g_timeout_add(SHORT_EMBED_TIMEOUT, docklet_x11_embed_timeout_cb, NULL); + } + } purple_debug(PURPLE_DEBUG_INFO, "docklet", "created\n"); } +static void +docklet_x11_create_ui_op() +{ + docklet_x11_create(FALSE); +} + static struct docklet_ui_ops ui_ops = { - docklet_x11_create, + docklet_x11_create_ui_op, docklet_x11_destroy, docklet_x11_update_icon, docklet_x11_blank_icon, @@ -298,4 +319,6 @@ docklet_ui_init() { pidgin_docklet_set_ui_ops(&ui_ops); + purple_prefs_add_none(PIDGIN_PREFS_ROOT "/docklet/x11"); + purple_prefs_add_bool(PIDGIN_PREFS_ROOT "/docklet/x11/embedded", FALSE); }