[gtk] menu: Remove attach properties
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk] menu: Remove attach properties
- Date: Mon, 15 Apr 2019 12:40:12 +0000 (UTC)
commit b1b12a239f8c708d8f5468479f95820438b5ec8f
Author: Benjamin Otte <otte redhat com>
Date: Sat Apr 13 12:17:57 2019 +0200
menu: Remove attach properties
They're never changed from being -1. So just replace them with -1
everywhere.
gtk/gtkmenu.c | 69 ++++++-----------------------------------------------------
1 file changed, 7 insertions(+), 62 deletions(-)
---
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index ae68e0c666..a11b88fc06 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -157,10 +157,6 @@ struct _GtkMenuPopdownData
typedef struct
{
- gint left_attach;
- gint right_attach;
- gint top_attach;
- gint bottom_attach;
gint effective_left_attach;
gint effective_right_attach;
gint effective_top_attach;
@@ -337,15 +333,6 @@ get_attach_info (GtkWidget *child)
return ai;
}
-static gboolean
-is_grid_attached (AttachInfo *ai)
-{
- return (ai->left_attach >= 0 &&
- ai->right_attach >= 0 &&
- ai->top_attach >= 0 &&
- ai->bottom_attach >= 0);
-}
-
static void
menu_ensure_layout (GtkMenu *menu)
{
@@ -365,35 +352,9 @@ menu_ensure_layout (GtkMenu *menu)
max_right_attach = 1;
max_bottom_attach = 0;
- for (l = menu_shell->priv->children; l; l = l->next)
- {
- GtkWidget *child = l->data;
- AttachInfo *ai = get_attach_info (child);
-
- if (is_grid_attached (ai))
- {
- max_bottom_attach = MAX (max_bottom_attach, ai->bottom_attach);
- max_right_attach = MAX (max_right_attach, ai->right_attach);
- }
- }
-
/* Find empty rows */
row_occupied = g_malloc0 (max_bottom_attach);
- for (l = menu_shell->priv->children; l; l = l->next)
- {
- GtkWidget *child = l->data;
- AttachInfo *ai = get_attach_info (child);
-
- if (is_grid_attached (ai))
- {
- gint i;
-
- for (i = ai->top_attach; i < ai->bottom_attach; i++)
- row_occupied[i] = TRUE;
- }
- }
-
/* Lay non-grid-items out in those rows
*/
current_row = 0;
@@ -402,25 +363,15 @@ menu_ensure_layout (GtkMenu *menu)
GtkWidget *child = l->data;
AttachInfo *ai = get_attach_info (child);
- if (!is_grid_attached (ai))
- {
- while (current_row < max_bottom_attach && row_occupied[current_row])
- current_row++;
+ while (current_row < max_bottom_attach && row_occupied[current_row])
+ current_row++;
- ai->effective_left_attach = 0;
- ai->effective_right_attach = max_right_attach;
- ai->effective_top_attach = current_row;
- ai->effective_bottom_attach = current_row + 1;
+ ai->effective_left_attach = 0;
+ ai->effective_right_attach = max_right_attach;
+ ai->effective_top_attach = current_row;
+ ai->effective_bottom_attach = current_row + 1;
- current_row++;
- }
- else
- {
- ai->effective_left_attach = ai->left_attach;
- ai->effective_right_attach = ai->right_attach;
- ai->effective_top_attach = ai->top_attach;
- ai->effective_bottom_attach = ai->bottom_attach;
- }
+ current_row++;
}
g_free (row_occupied);
@@ -1331,12 +1282,6 @@ gtk_menu_real_insert (GtkMenuShell *menu_shell,
{
GtkMenu *menu = GTK_MENU (menu_shell);
GtkMenuPrivate *priv = menu->priv;
- AttachInfo *ai = get_attach_info (child);
-
- ai->left_attach = -1;
- ai->right_attach = -1;
- ai->top_attach = -1;
- ai->bottom_attach = -1;
gtk_widget_insert_before (child, GTK_WIDGET (menu), priv->bottom_arrow_widget);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]