[evolution/kill-bonobo] Bug 359909 - "New" Button too small



commit 452650a573432a6416f3f31ec0594b888a52b93f
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Aug 24 23:35:46 2009 -0400

    Bug 359909 - "New" Button too small

 widgets/misc/e-menu-tool-button.c |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)
---
diff --git a/widgets/misc/e-menu-tool-button.c b/widgets/misc/e-menu-tool-button.c
index 58c8317..fcf73d6 100644
--- a/widgets/misc/e-menu-tool-button.c
+++ b/widgets/misc/e-menu-tool-button.c
@@ -93,6 +93,27 @@ menu_tool_button_update_button (GtkToolButton *tool_button)
 }
 
 static void
+menu_tool_button_size_request (GtkWidget *widget,
+                               GtkRequisition *requisition)
+{
+	gint minimum_width;
+
+	/* Chain up to parent's size_request() method. */
+	GTK_WIDGET_CLASS (parent_class)->size_request (widget, requisition);
+
+	/* XXX This is a hack.  This widget is only used for the New
+	 *     button in the main window toolbar.  The New button is
+	 *     pretty important, but the word "New" is pretty short
+	 *     (in English, anyway) and this results in a small screen
+	 *     target when using a "text below item" toolbar style.
+	 *
+	 *     We can't go hard-coding a width, but we -can- use a
+	 *     heuristic based on the toolbar button height. */
+	minimum_width = requisition->height * 2;
+	requisition->width = MAX (minimum_width, requisition->width);
+}
+
+static void
 menu_tool_button_clicked (GtkToolButton *tool_button)
 {
 	GtkMenuItem *menu_item;
@@ -108,10 +129,14 @@ menu_tool_button_clicked (GtkToolButton *tool_button)
 static void
 menu_tool_button_class_init (EMenuToolButtonClass *class)
 {
+	GtkWidgetClass *widget_class;
 	GtkToolButtonClass *tool_button_class;
 
 	parent_class = g_type_class_peek_parent (class);
 
+	widget_class = GTK_WIDGET_CLASS (class);
+	widget_class->size_request = menu_tool_button_size_request;
+
 	tool_button_class = GTK_TOOL_BUTTON_CLASS (class);
 	tool_button_class->clicked = menu_tool_button_clicked;
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]