[gtk/expand-margin-cleanup: 3/4] Drop the expand property



commit a9c05193a7b7366989b75471150b1f6d644e2285
Author: Matthias Clasen <mclasen redhat com>
Date:   Tue Feb 25 18:25:52 2020 -0500

    Drop the expand property
    
    The hexpand and vexpand properties are sufficient.

 demos/gtk-demo/demo.ui                  |  3 ++-
 demos/gtk-demo/main.ui                  |  3 ++-
 demos/icon-browser/window.ui            |  3 ++-
 demos/node-editor/node-editor-window.ui |  6 ++++--
 demos/widget-factory/widget-factory.ui  |  9 ++++++---
 gtk/gtkshortcutswindow.c                |  3 ++-
 gtk/gtkwidget.c                         | 29 -----------------------------
 gtk/inspector/actions.ui                |  3 ++-
 gtk/inspector/css-editor.ui             |  3 ++-
 gtk/inspector/css-node-tree.ui          |  3 ++-
 gtk/inspector/data-list.ui              |  3 ++-
 gtk/inspector/magnifier.ui              |  3 ++-
 gtk/inspector/menu.ui                   |  3 ++-
 gtk/inspector/object-tree.ui            |  3 ++-
 gtk/inspector/prop-editor.c             |  6 ++++--
 gtk/inspector/prop-list.ui              |  3 ++-
 gtk/inspector/recorder.ui               |  3 ++-
 gtk/inspector/resource-list.ui          |  9 ++++++---
 gtk/inspector/statistics.ui             |  3 ++-
 gtk/ui/gtkcolorchooserdialog.ui         |  3 ++-
 gtk/ui/gtkfilechooserdialog.ui          |  3 ++-
 gtk/ui/gtkfilechooserwidget.ui          |  3 ++-
 testsuite/gtk/notify.c                  |  4 +---
 23 files changed, 55 insertions(+), 59 deletions(-)
---
diff --git a/demos/gtk-demo/demo.ui b/demos/gtk-demo/demo.ui
index b020232523..bc829396f5 100644
--- a/demos/gtk-demo/demo.ui
+++ b/demos/gtk-demo/demo.ui
@@ -167,7 +167,8 @@
         <child>
           <object class="GtkScrolledWindow" id="scrolledwindow1">
             <property name="shadow-type">in</property>
-            <property name="expand">1</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
             <child>
               <object class="GtkTreeView" id="treeview1">
                 <property name="model">liststore1</property>
diff --git a/demos/gtk-demo/main.ui b/demos/gtk-demo/main.ui
index f4849a6a08..369660c39b 100644
--- a/demos/gtk-demo/main.ui
+++ b/demos/gtk-demo/main.ui
@@ -103,7 +103,8 @@
             <property name="scrollable">1</property>
             <property name="enable-popup">1</property>
             <property name="show-border">0</property>
-            <property name="expand">1</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
             <child>
               <object class="GtkNotebookPage">
                 <property name="tab-expand">1</property>
diff --git a/demos/icon-browser/window.ui b/demos/icon-browser/window.ui
index 0aa0c48d4f..95b8936f7c 100644
--- a/demos/icon-browser/window.ui
+++ b/demos/icon-browser/window.ui
@@ -77,7 +77,8 @@
             </child>
             <child>
               <object class="GtkScrolledWindow" id="sw">
-                <property name="expand">1</property>
+                <property name="hexpand">1</property>
+                <property name="vexpand">1</property>
                 <property name="hscrollbar-policy">never</property>
                 <child>
                   <object class="GtkIconView" id="list">
diff --git a/demos/node-editor/node-editor-window.ui b/demos/node-editor/node-editor-window.ui
index 337ef5995c..f30532f731 100644
--- a/demos/node-editor/node-editor-window.ui
+++ b/demos/node-editor/node-editor-window.ui
@@ -133,7 +133,8 @@
         <child>
           <object class="GtkScrolledWindow">
             <property name="hscrollbar-policy">never</property>
-            <property name="expand">1</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
             <child>
               <object class="GtkTextView" id="text_view">
                 <property name="wrap-mode">word</property>
@@ -156,7 +157,8 @@
           <object class="GtkBox">
             <child>
               <object class="GtkScrolledWindow">
-                <property name="expand">1</property>
+                <property name="hexpand">1</property>
+                <property name="vexpand">1</property>
                 <property name="min-content-height">100</property>
                 <property name="min-content-width">100</property>
                 <child>
diff --git a/demos/widget-factory/widget-factory.ui b/demos/widget-factory/widget-factory.ui
index b2766d46ee..f323237baf 100644
--- a/demos/widget-factory/widget-factory.ui
+++ b/demos/widget-factory/widget-factory.ui
@@ -1909,10 +1909,12 @@ microphone-sensitivity-medium-symbolic</property>
                                 <child>
                                   <object class="GtkBox">
                                     <property name="spacing">10</property>
-                                    <property name="expand">1</property>
+                                    <property name="hexpand">1</property>
+                                    <property name="vexpand">1</property>
                                     <child>
                                       <object class="GtkFrame" id="panedframe1">
-                                        <property name="expand">1</property>
+                                        <property name="hexpand">1</property>
+                                        <property name="vexpand">1</property>
                                         <child>
                                           <object class="GtkPaned">
                                             <style>
@@ -1934,7 +1936,8 @@ microphone-sensitivity-medium-symbolic</property>
                                     </child>
                                     <child>
                                       <object class="GtkFrame" id="panedframe2">
-                                        <property name="expand">1</property>
+                                        <property name="hexpand">1</property>
+                                        <property name="vexpand">1</property>
                                         <child>
                                           <object class="GtkPaned">
                                             <property name="orientation">vertical</property>
diff --git a/gtk/gtkshortcutswindow.c b/gtk/gtkshortcutswindow.c
index 7f575032e0..2e252054a7 100644
--- a/gtk/gtkshortcutswindow.c
+++ b/gtk/gtkshortcutswindow.c
@@ -905,7 +905,8 @@ gtk_shortcuts_window_init (GtkShortcutsWindow *self)
                                          GTK_WIDGET (self));
 
   priv->stack = g_object_new (GTK_TYPE_STACK,
-                              "expand", TRUE,
+                              "hexpand", TRUE,
+                              "vexpand", TRUE,
                               "homogeneous", TRUE,
                               "transition-type", GTK_STACK_TRANSITION_TYPE_CROSSFADE,
                               NULL);
diff --git a/gtk/gtkwidget.c b/gtk/gtkwidget.c
index 944e6f303c..184c4b617b 100644
--- a/gtk/gtkwidget.c
+++ b/gtk/gtkwidget.c
@@ -555,7 +555,6 @@ enum {
   PROP_VEXPAND,
   PROP_HEXPAND_SET,
   PROP_VEXPAND_SET,
-  PROP_EXPAND,
   PROP_SCALE_FACTOR,
   PROP_CSS_NAME,
   PROP_CSS_CLASSES,
@@ -1254,18 +1253,6 @@ gtk_widget_class_init (GtkWidgetClass *klass)
                             FALSE,
                             GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY);
 
-  /**
-   * GtkWidget:expand:
-   *
-   * Whether to expand in both directions. Setting this sets both #GtkWidget:hexpand and #GtkWidget:vexpand
-   */
-  widget_props[PROP_EXPAND] =
-      g_param_spec_boolean ("expand",
-                            P_("Expand Both"),
-                            P_("Whether widget wants to expand in both directions"),
-                            FALSE,
-                            GTK_PARAM_READWRITE);
-
   /**
    * GtkWidget:opacity:
    *
@@ -1878,12 +1865,6 @@ gtk_widget_set_property (GObject         *object,
     case PROP_VEXPAND_SET:
       gtk_widget_set_vexpand_set (widget, g_value_get_boolean (value));
       break;
-    case PROP_EXPAND:
-      g_object_freeze_notify (G_OBJECT (widget));
-      gtk_widget_set_hexpand (widget, g_value_get_boolean (value));
-      gtk_widget_set_vexpand (widget, g_value_get_boolean (value));
-      g_object_thaw_notify (G_OBJECT (widget));
-      break;
     case PROP_OPACITY:
       gtk_widget_set_opacity (widget, g_value_get_double (value));
       break;
@@ -2026,11 +2007,6 @@ gtk_widget_get_property (GObject         *object,
     case PROP_VEXPAND_SET:
       g_value_set_boolean (value, gtk_widget_get_vexpand_set (widget));
       break;
-    case PROP_EXPAND:
-      g_value_set_boolean (value,
-                           gtk_widget_get_hexpand (widget) &&
-                           gtk_widget_get_vexpand (widget));
-      break;
     case PROP_OPACITY:
       g_value_set_double (value, gtk_widget_get_opacity (widget));
       break;
@@ -8442,14 +8418,11 @@ gtk_widget_set_expand (GtkWidget     *widget,
   GtkWidgetPrivate *priv = gtk_widget_get_instance_private (widget);
   gint expand_prop;
   gint expand_set_prop;
-  gboolean was_both;
 
   g_return_if_fail (GTK_IS_WIDGET (widget));
 
   expand = expand != FALSE;
 
-  was_both = priv->hexpand && priv->vexpand;
-
   if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
       if (priv->hexpand_set &&
@@ -8480,8 +8453,6 @@ gtk_widget_set_expand (GtkWidget     *widget,
   g_object_freeze_notify (G_OBJECT (widget));
   g_object_notify_by_pspec (G_OBJECT (widget), widget_props[expand_prop]);
   g_object_notify_by_pspec (G_OBJECT (widget), widget_props[expand_set_prop]);
-  if (was_both != (priv->hexpand && priv->vexpand))
-    g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_EXPAND]);
   g_object_thaw_notify (G_OBJECT (widget));
 }
 
diff --git a/gtk/inspector/actions.ui b/gtk/inspector/actions.ui
index 7ec69d18f2..6ca81771ed 100644
--- a/gtk/inspector/actions.ui
+++ b/gtk/inspector/actions.ui
@@ -54,7 +54,8 @@
     </child>
     <child>
       <object class="GtkScrolledWindow">
-        <property name="expand">1</property>
+        <property name="hexpand">1</property>
+        <property name="vexpand">1</property>
         <property name="hscrollbar-policy">never</property>
         <child>
           <object class="GtkListBox" id="list">
diff --git a/gtk/inspector/css-editor.ui b/gtk/inspector/css-editor.ui
index 1425e9f447..5996ece5db 100644
--- a/gtk/inspector/css-editor.ui
+++ b/gtk/inspector/css-editor.ui
@@ -45,7 +45,8 @@
     <child>
       <object class="GtkScrolledWindow">
         <property name="hscrollbar-policy">never</property>
-        <property name="expand">1</property>
+        <property name="hexpand">1</property>
+        <property name="vexpand">1</property>
         <child>
           <object class="GtkTextView" id="view">
             <property name="buffer">text</property>
diff --git a/gtk/inspector/css-node-tree.ui b/gtk/inspector/css-node-tree.ui
index f05edfc5d6..7c311f3d62 100644
--- a/gtk/inspector/css-node-tree.ui
+++ b/gtk/inspector/css-node-tree.ui
@@ -15,7 +15,8 @@
         <property name="position">400</property>
         <child>
           <object class="GtkScrolledWindow">
-            <property name="expand">1</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
             <property name="min-content-height">100</property>
             <child>
               <object class="GtkTreeView" id="node_tree">
diff --git a/gtk/inspector/data-list.ui b/gtk/inspector/data-list.ui
index fe2fe2d53b..081bbb1fc9 100644
--- a/gtk/inspector/data-list.ui
+++ b/gtk/inspector/data-list.ui
@@ -23,7 +23,8 @@
     </child>
     <child>
       <object class="GtkScrolledWindow">
-        <property name="expand">1</property>
+        <property name="hexpand">1</property>
+        <property name="vexpand">1</property>
         <property name="vscrollbar-policy">always</property>
         <child>
           <object class="GtkTreeView" id="view"/>
diff --git a/gtk/inspector/magnifier.ui b/gtk/inspector/magnifier.ui
index 27d72e9ba1..b60e5e7af1 100644
--- a/gtk/inspector/magnifier.ui
+++ b/gtk/inspector/magnifier.ui
@@ -3,7 +3,8 @@
     <property name="orientation">vertical</property>
     <child>
       <object class="GtkScrolledWindow">
-        <property name="expand">1</property>
+        <property name="hexpand">1</property>
+        <property name="vexpand">1</property>
         <child>
           <object class="GtkMagnifier" id="magnifier">
             <property name="visible">True</property>
diff --git a/gtk/inspector/menu.ui b/gtk/inspector/menu.ui
index 42351b1368..2546256e84 100644
--- a/gtk/inspector/menu.ui
+++ b/gtk/inspector/menu.ui
@@ -12,7 +12,8 @@
     <property name="orientation">vertical</property>
     <child>
       <object class="GtkScrolledWindow">
-        <property name="expand">1</property>
+        <property name="hexpand">1</property>
+        <property name="vexpand">1</property>
         <property name="vscrollbar-policy">always</property>
         <child>
           <object class="GtkTreeView">
diff --git a/gtk/inspector/object-tree.ui b/gtk/inspector/object-tree.ui
index 530e2b52d2..afe97821fa 100644
--- a/gtk/inspector/object-tree.ui
+++ b/gtk/inspector/object-tree.ui
@@ -37,7 +37,8 @@
     <child>
       <object class="GtkScrolledWindow">
         <property name="hscrollbar-policy">never</property>
-        <property name="expand">1</property>
+        <property name="hexpand">1</property>
+        <property name="vexpand">1</property>
         <child>
           <object class="GtkListBox" id="list">
             <signal name="row-activated" handler="on_row_activated"/>
diff --git a/gtk/inspector/prop-editor.c b/gtk/inspector/prop-editor.c
index 1a88b38dbe..438d719948 100644
--- a/gtk/inspector/prop-editor.c
+++ b/gtk/inspector/prop-editor.c
@@ -950,7 +950,8 @@ property_editor (GObject                *object,
         sw = gtk_scrolled_window_new (NULL, NULL);
         gtk_container_add (GTK_CONTAINER (popover), sw);
         g_object_set (sw,
-                      "expand", TRUE,
+                      "hexpand", TRUE,
+                      "vexpand", TRUE,
                       "hscrollbar-policy", GTK_POLICY_NEVER,
                       "vscrollbar-policy", GTK_POLICY_NEVER,
                       NULL);
@@ -1017,7 +1018,8 @@ property_editor (GObject                *object,
       sw = gtk_scrolled_window_new (NULL, NULL);
       gtk_container_add (GTK_CONTAINER (popover), sw);
       g_object_set (sw,
-                    "expand", TRUE,
+                    "hexpand", TRUE,
+                    "vexpand", TRUE,
                     "hscrollbar-policy", GTK_POLICY_NEVER,
                     "vscrollbar-policy", GTK_POLICY_NEVER,
                       NULL);
diff --git a/gtk/inspector/prop-list.ui b/gtk/inspector/prop-list.ui
index f1898cf5b5..73ed60f5eb 100644
--- a/gtk/inspector/prop-list.ui
+++ b/gtk/inspector/prop-list.ui
@@ -80,7 +80,8 @@
         </child>
         <child>
           <object class="GtkScrolledWindow">
-            <property name="expand">1</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
             <property name="hscrollbar-policy">never</property>
             <child>
               <object class="GtkListBox" id="list2">
diff --git a/gtk/inspector/recorder.ui b/gtk/inspector/recorder.ui
index cd48428a02..e9bd32c659 100644
--- a/gtk/inspector/recorder.ui
+++ b/gtk/inspector/recorder.ui
@@ -137,7 +137,8 @@
                 </child>
                 <child>
                   <object class="GtkPicture" id="render_node_view">
-                    <property name="expand">1</property>
+                    <property name="hexpand">1</property>
+                    <property name="vexpand">1</property>
                   </object>
                 </child>
               </object>
diff --git a/gtk/inspector/resource-list.ui b/gtk/inspector/resource-list.ui
index 7493d98f3a..dabe1cae78 100644
--- a/gtk/inspector/resource-list.ui
+++ b/gtk/inspector/resource-list.ui
@@ -50,7 +50,8 @@
                 </child>
                 <child>
                   <object class="GtkScrolledWindow">
-                    <property name="expand">1</property>
+                    <property name="hexpand">1</property>
+                    <property name="vexpand">1</property>
                     <property name="hscrollbar-policy">never</property>
                     <child>
                       <object class="GtkTreeView" id="tree">
@@ -198,7 +199,8 @@
                         <property name="name">text</property>
                         <property name="child">
                           <object class="GtkScrolledWindow">
-                            <property name="expand">1</property>
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
                             <property name="shadow-type">in</property>
                             <style>
                               <class name="view"/>
@@ -218,7 +220,8 @@
                         <property name="name">image</property>
                         <property name="child">
                           <object class="GtkScrolledWindow">
-                            <property name="expand">1</property>
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
                             <property name="shadow-type">in</property>
                             <style>
                               <class name="view"/>
diff --git a/gtk/inspector/statistics.ui b/gtk/inspector/statistics.ui
index e29917950d..c835f14d62 100644
--- a/gtk/inspector/statistics.ui
+++ b/gtk/inspector/statistics.ui
@@ -33,7 +33,8 @@
                 </child>
                 <child>
                   <object class="GtkScrolledWindow">
-                    <property name="expand">1</property>
+                    <property name="hexpand">1</property>
+                    <property name="vexpand">1</property>
                     <property name="vscrollbar-policy">always</property>
                     <child>
                       <object class="GtkTreeView" id="view">
diff --git a/gtk/ui/gtkcolorchooserdialog.ui b/gtk/ui/gtkcolorchooserdialog.ui
index 403775db40..8daa0d11c0 100644
--- a/gtk/ui/gtkcolorchooserdialog.ui
+++ b/gtk/ui/gtkcolorchooserdialog.ui
@@ -13,7 +13,8 @@
           <object class="GtkColorChooserWidget" id="chooser">
             <property name="margin">5</property>
             <property name="rgba">rgb(255,255,255)</property>
-            <property name="expand">1</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
             <signal name="color-activated" handler="color_activated_cb" swapped="no"/>
             <signal name="notify::rgba" handler="propagate_notify" swapped="no"/>
             <signal name="notify::show-editor" handler="propagate_notify" swapped="no"/>
diff --git a/gtk/ui/gtkfilechooserdialog.ui b/gtk/ui/gtkfilechooserdialog.ui
index 425dab20e6..010e725bc9 100644
--- a/gtk/ui/gtkfilechooserdialog.ui
+++ b/gtk/ui/gtkfilechooserdialog.ui
@@ -16,7 +16,8 @@
         </child>
         <child>
           <object class="GtkFileChooserWidget" id="widget">
-            <property name="expand">1</property>
+            <property name="hexpand">1</property>
+            <property name="vexpand">1</property>
             <signal name="file-activated" handler="file_chooser_widget_file_activated" swapped="no"/>
             <signal name="response-requested" handler="file_chooser_widget_response_requested" swapped="no"/>
             <signal name="selection-changed" handler="file_chooser_widget_selection_changed" swapped="no"/>
diff --git a/gtk/ui/gtkfilechooserwidget.ui b/gtk/ui/gtkfilechooserwidget.ui
index 4253c819a3..a713c09693 100644
--- a/gtk/ui/gtkfilechooserwidget.ui
+++ b/gtk/ui/gtkfilechooserwidget.ui
@@ -115,7 +115,8 @@
                         <child>
                           <object class="GtkStack" id="browse_files_stack">
                             <property name="transition-type">crossfade</property>
-                            <property name="expand">1</property>
+                            <property name="hexpand">1</property>
+                            <property name="vexpand">1</property>
                             <style>
                               <class name="view"/>
                             </style>
diff --git a/testsuite/gtk/notify.c b/testsuite/gtk/notify.c
index 9fb04fb89f..9b6dabac93 100644
--- a/testsuite/gtk/notify.c
+++ b/testsuite/gtk/notify.c
@@ -497,9 +497,7 @@ test_type (gconstpointer data)
            g_str_equal (pspec->name, "is-focus") ||
            g_str_equal (pspec->name, "margin") ||
            g_str_equal (pspec->name, "hexpand") ||
-           g_str_equal (pspec->name, "vexpand") ||
-           g_str_equal (pspec->name, "expand")
-            ))
+           g_str_equal (pspec->name, "vexpand")))
        continue;
 
       if (pspec->owner_type == GTK_TYPE_ENTRY &&


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