Mercurial > pidgin
view finch/libgnt/gntwindow.c @ 17148:9a649a04fd74
When the /pidgin/debug/enabled pref is toggled, wait until the next
iteration through the event loop before drawing or hiding the window.
This fixes the bug where we lost the width and height prefs for the
debug window because of the following sequence of event
1. Init gtkdebug window, set default width and height
2. Read in pref for /pidgin/debug/enabled and show debug window using
default width and height
3. Read in pref for /pidgin/debug/width and height, but it's too
late! The window has already been drawn using the default
width and height!
This is a pretty minor thing, but it was bugging me. I don't like
having to always make the debug window bigger when I start Pidgin.
The downside of this change is that we won't see as much debug output
in the window when starting Pidgin.
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Tue, 22 May 2007 07:08:57 +0000 |
parents | 0e3a8505ebbe |
children | 3c3fc1432a01 8410511f4dbb |
line wrap: on
line source
#include "gntstyle.h" #include "gntwindow.h" #include <string.h> enum { SIGS = 1, }; static GntBoxClass *parent_class = NULL; static void (*org_destroy)(GntWidget *widget); static gboolean show_menu(GntBindable *bind, GList *null) { GntWindow *win = GNT_WINDOW(bind); if (win->menu) { gnt_screen_menu_show(win->menu); return TRUE; } return FALSE; } static void gnt_window_destroy(GntWidget *widget) { GntWindow *window = GNT_WINDOW(widget); if (window->menu) gnt_widget_destroy(GNT_WIDGET(window->menu)); org_destroy(widget); } static void gnt_window_class_init(GntWindowClass *klass) { GntBindableClass *bindable = GNT_BINDABLE_CLASS(klass); GntWidgetClass *wid_class = GNT_WIDGET_CLASS(klass); parent_class = GNT_BOX_CLASS(klass); org_destroy = wid_class->destroy; wid_class->destroy = gnt_window_destroy; gnt_bindable_class_register_action(bindable, "show-menu", show_menu, GNT_KEY_CTRL_O, NULL); gnt_bindable_register_binding(bindable, "show-menu", GNT_KEY_F10, NULL); gnt_style_read_actions(G_OBJECT_CLASS_TYPE(klass), bindable); GNTDEBUG; } static void gnt_window_init(GTypeInstance *instance, gpointer class) { GntWidget *widget = GNT_WIDGET(instance); GNT_WIDGET_UNSET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW); GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS); GNTDEBUG; } /****************************************************************************** * GntWindow API *****************************************************************************/ GType gnt_window_get_gtype(void) { static GType type = 0; if(type == 0) { static const GTypeInfo info = { sizeof(GntWindowClass), NULL, /* base_init */ NULL, /* base_finalize */ (GClassInitFunc)gnt_window_class_init, NULL, /* class_finalize */ NULL, /* class_data */ sizeof(GntWindow), 0, /* n_preallocs */ gnt_window_init, /* instance_init */ NULL /* value_table */ }; type = g_type_register_static(GNT_TYPE_BOX, "GntWindow", &info, 0); } return type; } GntWidget *gnt_window_new() { GntWidget *widget = g_object_new(GNT_TYPE_WINDOW, NULL); return widget; } GntWidget *gnt_window_box_new(gboolean homo, gboolean vert) { GntWidget *wid = gnt_window_new(); GntBox *box = GNT_BOX(wid); box->homogeneous = homo; box->vertical = vert; box->alignment = vert ? GNT_ALIGN_LEFT : GNT_ALIGN_MID; return wid; } void gnt_window_set_menu(GntWindow *window, GntMenu *menu) { /* If a menu already existed, then destroy that first. */ if (window->menu) gnt_widget_destroy(GNT_WIDGET(window->menu)); window->menu = menu; }