[nautilus/wip/cdavis/post-port-cleanups: 6/6] general: Use GtkButton:icon-name more




commit ee78134520113e8df1f24a90f16cd4e3b008832a
Author: Christopher Davis <christopherdavis gnome org>
Date:   Sat Jul 16 08:29:39 2022 -0400

    general: Use GtkButton:icon-name more
    
    Instead of packing a GtkImage, we can now set the icon
    name on buttons directly.
    
    GtkButton's API sets the right style classes automatically.

 src/nautilus-progress-info-widget.c               |  6 ++--
 src/resources/ui/nautilus-batch-rename-dialog.ui  | 14 ++------
 src/resources/ui/nautilus-column-chooser.ui       | 12 ++-----
 src/resources/ui/nautilus-progress-info-widget.ui |  7 +---
 src/resources/ui/nautilus-search-popover.ui       |  6 +---
 src/resources/ui/nautilus-toolbar.ui              | 40 +++--------------------
 6 files changed, 12 insertions(+), 73 deletions(-)
---
diff --git a/src/nautilus-progress-info-widget.c b/src/nautilus-progress-info-widget.c
index d2b4a3ff4..b5be930c9 100644
--- a/src/nautilus-progress-info-widget.c
+++ b/src/nautilus-progress-info-widget.c
@@ -32,7 +32,6 @@ struct _NautilusProgressInfoWidgetPrivate
     GtkWidget *details;     /* GtkLabel */
     GtkWidget *progress_bar;
     GtkWidget *button;
-    GtkWidget *image;
 };
 
 enum
@@ -49,7 +48,7 @@ G_DEFINE_TYPE_WITH_PRIVATE (NautilusProgressInfoWidget, nautilus_progress_info_w
 static void
 info_finished (NautilusProgressInfoWidget *self)
 {
-    gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image), "object-select-symbolic");
+    gtk_button_set_icon_name (GTK_BUTTON (self->priv->button), "object-select-symbolic");
     gtk_widget_set_sensitive (self->priv->button, FALSE);
 }
 
@@ -125,7 +124,7 @@ nautilus_progress_info_widget_constructed (GObject *obj)
 
     if (nautilus_progress_info_get_is_finished (self->priv->info))
     {
-        gtk_image_set_from_icon_name (GTK_IMAGE (self->priv->image), "object-select-symbolic");
+        gtk_button_set_icon_name (GTK_BUTTON (self->priv->button), "object-select-symbolic");
     }
 
     gtk_widget_set_sensitive (self->priv->button,
@@ -213,7 +212,6 @@ nautilus_progress_info_widget_class_init (NautilusProgressInfoWidgetClass *klass
     gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, details);
     gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, progress_bar);
     gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, button);
-    gtk_widget_class_bind_template_child_private (widget_class, NautilusProgressInfoWidget, image);
 }
 
 GtkWidget *
diff --git a/src/resources/ui/nautilus-batch-rename-dialog.ui 
b/src/resources/ui/nautilus-batch-rename-dialog.ui
index f9b6e7481..9da1770d6 100644
--- a/src/resources/ui/nautilus-batch-rename-dialog.ui
+++ b/src/resources/ui/nautilus-batch-rename-dialog.ui
@@ -357,13 +357,8 @@
                   <object class="GtkBox">
                     <child>
                       <object class="GtkButton" id="conflict_down">
+                        <property name="icon-name">go-down-symbolic</property>
                         <signal name="clicked" handler="select_next_conflict_down" swapped="yes"/>
-                        <child>
-                          <object class="GtkImage">
-                            <property name="icon-name">go-down-symbolic</property>
-                            <property name="icon-size">1</property>
-                          </object>
-                        </child>
                         <style>
                           <class name="flat"/>
                         </style>
@@ -371,13 +366,8 @@
                     </child>
                     <child>
                       <object class="GtkButton" id="conflict_up">
+                        <property name="icon-name">go-up-symbolic</property>
                         <signal name="clicked" handler="select_next_conflict_up" swapped="yes"/>
-                        <child>
-                          <object class="GtkImage">
-                            <property name="icon-name">go-up-symbolic</property>
-                            <property name="icon-size">1</property>
-                          </object>
-                        </child>
                         <style>
                           <class name="flat"/>
                         </style>
diff --git a/src/resources/ui/nautilus-column-chooser.ui b/src/resources/ui/nautilus-column-chooser.ui
index 27ab39b67..53e9aadb3 100644
--- a/src/resources/ui/nautilus-column-chooser.ui
+++ b/src/resources/ui/nautilus-column-chooser.ui
@@ -67,23 +67,15 @@
             <child>
               <object class="GtkButton" id="move_up_button">
                 <property name="sensitive">False</property>
+                <property name="icon-name">go-up-symbolic</property>
                 <signal name="clicked" handler="move_up_clicked_callback" swapped="no"/>
-                <child>
-                  <object class="GtkImage">
-                    <property name="icon-name">go-up-symbolic</property>
-                  </object>
-                </child>
               </object>
             </child>
             <child>
               <object class="GtkButton" id="move_down_button">
                 <property name="sensitive">False</property>
+                <property name="icon-name">go-down-symbolic</property>
                 <signal name="clicked" handler="move_down_clicked_callback" swapped="no"/>
-                <child>
-                  <object class="GtkImage">
-                    <property name="icon-name">go-down-symbolic</property>
-                  </object>
-                </child>
               </object>
             </child>
             <style>
diff --git a/src/resources/ui/nautilus-progress-info-widget.ui 
b/src/resources/ui/nautilus-progress-info-widget.ui
index 09930a560..db18d990b 100644
--- a/src/resources/ui/nautilus-progress-info-widget.ui
+++ b/src/resources/ui/nautilus-progress-info-widget.ui
@@ -41,15 +41,10 @@
       <object class="GtkButton" id="button">
         <property name="valign">center</property>
         <property name="margin_start">20</property>
+        <property name="icon-name">window-close-symbolic</property>
         <style>
-          <class name="image-button"/>
           <class name="circular"/>
         </style>
-        <child>
-          <object class="GtkImage" id="image">
-            <property name="icon-name">window-close-symbolic</property>
-          </object>
-        </child>
         <layout>
           <property name="column">1</property>
           <property name="row">0</property>
diff --git a/src/resources/ui/nautilus-search-popover.ui b/src/resources/ui/nautilus-search-popover.ui
index 6a38f9c48..08ce86ae9 100644
--- a/src/resources/ui/nautilus-search-popover.ui
+++ b/src/resources/ui/nautilus-search-popover.ui
@@ -50,12 +50,8 @@
                       <object class="GtkButton" id="clear_date_button">
                         <property name="visible">False</property>
                         <property name="tooltip_text" translatable="yes">Clear the currently selected 
date</property>
+                        <property name="icon_name">edit-clear-symbolic</property>
                         <signal name="clicked" handler="clear_date_button_clicked" 
object="NautilusSearchPopover" swapped="no"/>
-                        <child>
-                          <object class="GtkImage" id="clear_date_button_image">
-                            <property name="icon_name">edit-clear-symbolic</property>
-                          </object>
-                        </child>
                       </object>
                     </child>
                     <style>
diff --git a/src/resources/ui/nautilus-toolbar.ui b/src/resources/ui/nautilus-toolbar.ui
index b91da2ade..b2b5632dc 100644
--- a/src/resources/ui/nautilus-toolbar.ui
+++ b/src/resources/ui/nautilus-toolbar.ui
@@ -155,15 +155,7 @@
                 <property name="halign">center</property>
                 <property name="valign">center</property>
                 <property name="action_name">slot.search-visible</property>
-                <child>
-                  <object class="GtkImage" id="search_icon">
-                    <property name="icon_name">edit-find-symbolic</property>
-                    <property name="icon_size">1</property>
-                  </object>
-                </child>
-                <style>
-                  <class name="image-button"/>
-                </style>
+                <property name="icon_name">edit-find-symbolic</property>
               </object>
             </child>
           </object>
@@ -182,15 +174,7 @@
             <property name="halign">center</property>
             <property name="valign">center</property>
             <property name="action_name">win.back</property>
-            <child>
-              <object class="GtkImage" id="back_icon">
-                <property name="icon_name">go-previous-symbolic</property>
-                <property name="icon_size">1</property>
-              </object>
-            </child>
-            <style>
-              <class name="image-button"/>
-            </style>
+            <property name="icon_name">go-previous-symbolic</property>
           </object>
         </child>
         <child type="start">
@@ -199,15 +183,7 @@
             <property name="halign">center</property>
             <property name="valign">center</property>
             <property name="action_name">win.forward</property>
-            <child>
-              <object class="GtkImage" id="forward_icon">
-                <property name="icon_name">go-next-symbolic</property>
-                <property name="icon_size">1</property>
-              </object>
-            </child>
-            <style>
-              <class name="image-button"/>
-            </style>
+            <property name="icon_name">go-next-symbolic</property>
           </object>
         </child>
         <child type="start">
@@ -221,6 +197,7 @@
           <object class="GtkMenuButton" id="app_button">
             <property name="halign">center</property>
             <property name="valign">center</property>
+            <property name="icon_name">open-menu-symbolic</property>
             <property name="popover">
               <object class="GtkPopoverMenu">
                 <property name="menu-model">app_menu</property>
@@ -246,15 +223,6 @@
                 </child>
               </object>
             </property>
-            <child>
-              <object class="GtkImage">
-                <property name="icon_name">open-menu-symbolic</property>
-                <property name="icon_size">1</property>
-              </object>
-            </child>
-            <style>
-              <class name="image-button"/>
-            </style>
           </object>
         </child>
         <child type="end">


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