[gtk+/combo-refactor: 39/201] Removed GtkMenuItem->show_submenu_indicator flag



commit 81a50f711a77451a9105f772917fcf0273acf70d
Author: Tristan Van Berkom <tristan van berkom gmail com>
Date:   Wed Nov 17 16:00:34 2010 +0900

    Removed GtkMenuItem->show_submenu_indicator flag
    
    The show_submenu_indicator flag was explicitly set in various
    places from GtkMenu/GtkMenuBar at request times, since the
    GtkMenuItem already checks the parent type for GTK_IS_MENU_BAR()
    in various places, removed this flag in favor of just checking
    the parent type (only in the interest of better readable code).

 gtk/gtkmenu.c     |    2 --
 gtk/gtkmenubar.c  |    1 -
 gtk/gtkmenuitem.c |   16 ++++++++--------
 gtk/gtkmenuitem.h |    1 -
 4 files changed, 8 insertions(+), 12 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index e678198..6d28137 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -3075,8 +3075,6 @@ gtk_menu_get_preferred_width (GtkWidget *widget,
        * case the toggle size request depends on the size
        * request of a child of the child (e.g. for ImageMenuItem)
        */
-
-       GTK_MENU_ITEM (child)->show_submenu_indicator = TRUE;
        gtk_widget_get_preferred_width (child, &child_min, &child_nat);
 
        gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child), &toggle_size);
diff --git a/gtk/gtkmenubar.c b/gtk/gtkmenubar.c
index bb48284..e03b0f7 100644
--- a/gtk/gtkmenubar.c
+++ b/gtk/gtkmenubar.c
@@ -312,7 +312,6 @@ gtk_menu_bar_size_request (GtkWidget      *widget,
 	    {
               gint toggle_size;
 
-	      GTK_MENU_ITEM (child)->show_submenu_indicator = FALSE;
               gtk_widget_get_preferred_size (child, &child_requisition, NULL);
               gtk_menu_item_toggle_size_request (GTK_MENU_ITEM (child),
                                                  &toggle_size);
diff --git a/gtk/gtkmenuitem.c b/gtk/gtkmenuitem.c
index 7a94bed..beef0fb 100644
--- a/gtk/gtkmenuitem.c
+++ b/gtk/gtkmenuitem.c
@@ -426,7 +426,6 @@ gtk_menu_item_init (GtkMenuItem *menu_item)
   menu_item->submenu = NULL;
   menu_item->toggle_size = 0;
   menu_item->accelerator_width = 0;
-  menu_item->show_submenu_indicator = FALSE;
   if (gtk_widget_get_direction (GTK_WIDGET (menu_item)) == GTK_TEXT_DIR_RTL)
     menu_item->submenu_direction = GTK_DIRECTION_LEFT;
   else
@@ -709,7 +708,7 @@ gtk_menu_item_get_preferred_width (GtkWidget *request,
 
       gtk_widget_get_preferred_width (child, &child_min, &child_nat);
 
-      if (menu_item->submenu && menu_item->show_submenu_indicator)
+      if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
 	{
 	  guint arrow_spacing;
 	  gint  arrow_size;
@@ -808,7 +807,7 @@ gtk_menu_item_get_preferred_height (GtkWidget *request,
       min_height += child_min;
       nat_height += child_nat;
 
-      if (menu_item->submenu && menu_item->show_submenu_indicator)
+      if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
 	{
 	  gint  arrow_size;
 
@@ -913,7 +912,7 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *request,
       gint child_min, child_nat;
       gint arrow_size = 0;
       
-      if (menu_item->submenu && menu_item->show_submenu_indicator)
+      if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
 	{
 
 	  guint arrow_spacing;
@@ -936,7 +935,7 @@ gtk_menu_item_get_preferred_height_for_width (GtkWidget *request,
       min_height += child_min;
       nat_height += child_nat;
 
-      if (menu_item->submenu && menu_item->show_submenu_indicator)
+      if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
 	{
 	  min_height = MAX (min_height, arrow_size);
 	  nat_height = MAX (nat_height, arrow_size);
@@ -1386,7 +1385,7 @@ gtk_menu_item_size_allocate (GtkWidget     *widget,
       child_allocation.y += allocation->y;
 
       gtk_widget_get_preferred_size (child, &child_requisition, NULL);
-      if (menu_item->submenu && menu_item->show_submenu_indicator) 
+      if (menu_item->submenu && !GTK_IS_MENU_BAR (parent)) 
 	{
 	  if (direction == GTK_TEXT_DIR_RTL)
 	    child_allocation.x += child_requisition.height;
@@ -1505,7 +1504,7 @@ gtk_menu_item_draw (GtkWidget *widget,
   GtkStateType state_type;
   GtkShadowType shadow_type, selected_shadow_type;
   GtkStyle *style;
-  GtkWidget *child;
+  GtkWidget *child, *parent;
   GdkWindow *window;
   gint x, y, w, h, width, height;
   guint border_width = gtk_container_get_border_width (GTK_CONTAINER (widget));
@@ -1522,6 +1521,7 @@ gtk_menu_item_draw (GtkWidget *widget,
   h = height - border_width * 2;
 
   child = gtk_bin_get_child (GTK_BIN (menu_item));
+  parent = gtk_widget_get_parent (widget);
   
   if (child && state_type == GTK_STATE_PRELIGHT)
     {
@@ -1536,7 +1536,7 @@ gtk_menu_item_draw (GtkWidget *widget,
                      x, y, w, h);
     }
 
-  if (menu_item->submenu && menu_item->show_submenu_indicator)
+  if (menu_item->submenu && !GTK_IS_MENU_BAR (parent))
     {
       gint arrow_x, arrow_y;
       gint arrow_size;
diff --git a/gtk/gtkmenuitem.h b/gtk/gtkmenuitem.h
index cadccc0..ef62c77 100644
--- a/gtk/gtkmenuitem.h
+++ b/gtk/gtkmenuitem.h
@@ -58,7 +58,6 @@ struct _GtkMenuItem
   guint16 GSEAL (accelerator_width);
   gchar  *GSEAL (accel_path);
 
-  guint GSEAL (show_submenu_indicator) : 1;
   guint GSEAL (submenu_placement) : 1;
   guint GSEAL (submenu_direction) : 1;
   guint GSEAL (right_justify): 1;



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