From: <dat...@us...> - 2006-05-12 03:45:51
|
Revision: 16180 Author: datallah Date: 2006-05-11 20:45:47 -0700 (Thu, 11 May 2006) ViewCVS: http://svn.sourceforge.net/gaim/?rev=16180&view=rev Log Message: ----------- Fix a docking bug. When gaim exits while the Buddy List is docked, but minimized to the docklet, the next time gaim is started, the sectionof the screen that would be used by the docked Buddy List will be empty - not any more. Modified Paths: -------------- trunk/plugins/win32/winprefs/winprefs.c Modified: trunk/plugins/win32/winprefs/winprefs.c =================================================================== --- trunk/plugins/win32/winprefs/winprefs.c 2006-05-12 02:50:23 UTC (rev 16179) +++ trunk/plugins/win32/winprefs/winprefs.c 2006-05-12 03:45:47 UTC (rev 16180) @@ -59,6 +59,7 @@ static GaimPlugin *handle = NULL; static GtkAppBar *blist_ab = NULL; static GtkWidget *blist = NULL; +static guint blist_visible_cb_id = 0; /* flash info */ @@ -109,11 +110,11 @@ static void blist_dock_cb(gboolean val) { if(val) { - gaim_debug_info(WINPREFS_PLUGIN_ID, "Blist Docking..\n"); + gaim_debug_info(WINPREFS_PLUGIN_ID, "Blist Docking...\n"); if(gaim_prefs_get_int(PREF_BLIST_ON_TOP) != BLIST_TOP_NEVER) blist_set_ontop(TRUE); } else { - gaim_debug_info(WINPREFS_PLUGIN_ID, "Blist Undocking..\n"); + gaim_debug_info(WINPREFS_PLUGIN_ID, "Blist Undocking...\n"); if(gaim_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_ALWAYS) blist_set_ontop(TRUE); else @@ -150,6 +151,34 @@ blist_set_dockable(FALSE); } +/* Listen for the first time the window stops being withdrawn */ +static void blist_visible_cb(const char *pref, GaimPrefType type, + gconstpointer value, gpointer user_data) { + if(gaim_prefs_get_bool(pref)) { + gtk_appbar_dock(blist_ab, + gaim_prefs_get_int(PREF_DBLIST_SIDE)); + + if(gaim_prefs_get_int(PREF_BLIST_ON_TOP) + == BLIST_TOP_DOCKED) + blist_set_ontop(TRUE); + + /* We only need to be notified about this once */ + gaim_prefs_disconnect_callback(blist_visible_cb_id); + } +} + +/* This needs to be delayed otherwise, when the blist is originally created and + * hidden, it'll trigger the blist_visible_cb */ +static gboolean listen_for_blist_visible_cb(gpointer data) { + if (handle != NULL) + blist_visible_cb_id = + gaim_prefs_connect_callback(handle, + "/gaim/gtk/blist/list_visible", + blist_visible_cb, NULL); + + return FALSE; +} + static void blist_create_cb(GaimBuddyList *gaim_blist, void *data) { gaim_debug_info(WINPREFS_PLUGIN_ID, "buddy list created\n"); @@ -159,10 +188,16 @@ blist_set_dockable(TRUE); if(gaim_prefs_get_bool(PREF_DBLIST_DOCKED)) { blist_ab->undocked_height = gaim_prefs_get_int(PREF_DBLIST_HEIGHT); - gtk_appbar_dock(blist_ab, - gaim_prefs_get_int(PREF_DBLIST_SIDE)); - if(gaim_prefs_get_int(PREF_BLIST_ON_TOP) == BLIST_TOP_DOCKED) - blist_set_ontop(TRUE); + if(!(gdk_window_get_state(blist->window) + & GDK_WINDOW_STATE_WITHDRAWN)) { + gtk_appbar_dock(blist_ab, + gaim_prefs_get_int(PREF_DBLIST_SIDE)); + if(gaim_prefs_get_int(PREF_BLIST_ON_TOP) + == BLIST_TOP_DOCKED) + blist_set_ontop(TRUE); + } else { + g_idle_add(listen_for_blist_visible_cb, NULL); + } } } @@ -374,6 +409,8 @@ blist_set_dockable(FALSE); blist_set_ontop(FALSE); + handle = NULL; + return TRUE; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |