diff console/libgnt/gntbox.c @ 14613:62bb53609a36

[gaim-migrate @ 17341] Menus and windows. I have added a test-app test/menu.c to show how to use it. Pressing Ctrl+o brings up the menu for the window (if it has one). It should now be possible to add menus for account-actions and all that stuff. Patches are very welcome. committer: Tailor Script <tailor@pidgin.im>
author Sadrul Habib Chowdhury <imadil@gmail.com>
date Sun, 24 Sep 2006 07:14:26 +0000
parents 3ac156db9cb6
children bfcdd361357e
line wrap: on
line diff
--- a/console/libgnt/gntbox.c	Sat Sep 23 19:04:03 2006 +0000
+++ b/console/libgnt/gntbox.c	Sun Sep 24 07:14:26 2006 +0000
@@ -504,9 +504,15 @@
 static void
 gnt_box_init(GTypeInstance *instance, gpointer class)
 {
+	GntWidget *widget = GNT_WIDGET(instance);
+	GntBox *box = GNT_BOX(widget);
 	/* Initially make both the height and width resizable.
 	 * Update the flags as necessary when widgets are added to it. */
-	GNT_WIDGET_SET_FLAGS(GNT_WIDGET(instance), GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y);
+	GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_GROW_X | GNT_WIDGET_GROW_Y);
+	GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_CAN_TAKE_FOCUS);
+	GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
+	box->pad = 1;
+	box->fill = TRUE;
 	GNTDEBUG;
 }
 
@@ -547,14 +553,7 @@
 
 	box->homogeneous = homo;
 	box->vertical = vert;
-	box->pad = 1;
-	box->fill = TRUE;
-	gnt_widget_set_take_focus(widget, TRUE);
-	GNT_WIDGET_SET_FLAGS(widget, GNT_WIDGET_NO_BORDER | GNT_WIDGET_NO_SHADOW);
-	if (vert)
-		box->alignment = GNT_ALIGN_LEFT;
-	else
-		box->alignment = GNT_ALIGN_MID;
+	box->alignment = vert ? GNT_ALIGN_LEFT : GNT_ALIGN_MID;
 
 	return widget;
 }