[gnome-control-center/bilelmoussaoui/cleanup] panels: Use icon-name property instead




commit 6350784aae3eb0e651c21ec5dec5df84a0a02aac
Author: Bilal Elmoussaoui <belmouss redhat com>
Date:   Wed Jul 20 14:05:11 2022 +0200

    panels: Use icon-name property instead
    
    Don't embed a custom GtkImage as that would lack the appropriate style classes
    that GtkButton/GtkMenuButton would automatically add for us

 panels/printers/printer-entry.ui              |  6 +-----
 panels/printers/printers.ui                   | 12 ++----------
 panels/sound/cc-volume-slider.c               | 13 ++++++-------
 panels/sound/cc-volume-slider.ui              |  7 +------
 panels/thunderbolt/cc-bolt-panel.ui           |  6 +-----
 panels/user-accounts/cc-fingerprint-dialog.ui |  8 +-------
 panels/user-accounts/cc-user-panel.ui         | 12 ++----------
 7 files changed, 14 insertions(+), 50 deletions(-)
---
diff --git a/panels/printers/printer-entry.ui b/panels/printers/printer-entry.ui
index 175f74a67..37fe3e075 100644
--- a/panels/printers/printer-entry.ui
+++ b/panels/printers/printer-entry.ui
@@ -172,11 +172,7 @@
                 <child>
                   <object class="GtkMenuButton">
                     <property name="popover">printer-menu</property>
-                    <child>
-                      <object class="GtkImage">
-                        <property name="icon_name">emblem-system-symbolic</property>
-                      </object>
-                    </child>
+                    <property name="icon_name">emblem-system-symbolic</property>
                   </object>
                 </child>
               </object>
diff --git a/panels/printers/printers.ui b/panels/printers/printers.ui
index accbad7e6..a81d312d1 100644
--- a/panels/printers/printers.ui
+++ b/panels/printers/printers.ui
@@ -16,14 +16,10 @@
     <child>
       <object class="GtkToggleButton" id="search-button">
         <property name="margin-end">6</property> <!-- since we don't have access to the shell header bar -->
+        <property name="icon_name">edit-find-symbolic</property>
         <style>
           <class name="image-button"/>
         </style>
-        <child>
-          <object class="GtkImage">
-            <property name="icon_name">edit-find-symbolic</property>
-          </object>
-        </child>
       </object>
     </child>
   </object>
@@ -54,14 +50,10 @@
           <child>
             <object class="GtkButton" id="notification-dismiss-button">
               <property name="valign">GTK_ALIGN_CENTER</property>
+              <property name="icon_name">window-close-symbolic</property>
               <style>
                 <class name="flat"/>
               </style>
-              <child>
-                <object class="GtkImage">
-                  <property name="icon_name">window-close-symbolic</property>
-                </object>
-              </child>
             </object>
           </child>
         </object>
diff --git a/panels/sound/cc-volume-slider.c b/panels/sound/cc-volume-slider.c
index 1b3f13adc..b53e2f458 100644
--- a/panels/sound/cc-volume-slider.c
+++ b/panels/sound/cc-volume-slider.c
@@ -29,7 +29,6 @@ struct _CcVolumeSlider
   GtkBox           parent_instance;
 
   GtkToggleButton *mute_button;
-  GtkImage        *stream_type_icon;
   GtkAdjustment   *volume_adjustment;
   GtkScale        *volume_scale;
 
@@ -60,7 +59,7 @@ update_volume_icon (CcVolumeSlider *self)
   else
     icon_name = "audio-volume-high-symbolic";
 
-  gtk_image_set_from_icon_name (self->stream_type_icon, icon_name);
+  gtk_button_set_icon_name (GTK_BUTTON (self->mute_button), icon_name);
 }
 
 static void
@@ -168,7 +167,7 @@ cc_volume_slider_class_init (CcVolumeSliderClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/sound/cc-volume-slider.ui");
 
   gtk_widget_class_bind_template_child (widget_class, CcVolumeSlider, mute_button);
-  gtk_widget_class_bind_template_child (widget_class, CcVolumeSlider, stream_type_icon);
+  gtk_widget_class_bind_template_child (widget_class, CcVolumeSlider, mute_button);
   gtk_widget_class_bind_template_child (widget_class, CcVolumeSlider, volume_adjustment);
   gtk_widget_class_bind_template_child (widget_class, CcVolumeSlider, volume_scale);
 
@@ -214,13 +213,13 @@ cc_volume_slider_set_stream (CcVolumeSlider *self,
   switch (type)
     {
     case CC_STREAM_TYPE_INPUT:
-      gtk_image_set_from_icon_name (self->stream_type_icon,
-                                    "microphone-sensitivity-muted-symbolic");
+      gtk_button_set_icon_name (GTK_BUTTON (self->mute_button),
+                                "microphone-sensitivity-muted-symbolic");
       break;
 
     case CC_STREAM_TYPE_OUTPUT:
-      gtk_image_set_from_icon_name (self->stream_type_icon,
-                                    "audio-volume-muted-symbolic");
+      gtk_button_set_icon_name (GTK_BUTTON (self->mute_button),
+                                "audio-volume-muted-symbolic");
       break;
 
     default:
diff --git a/panels/sound/cc-volume-slider.ui b/panels/sound/cc-volume-slider.ui
index f6f0e8eae..a3de46313 100644
--- a/panels/sound/cc-volume-slider.ui
+++ b/panels/sound/cc-volume-slider.ui
@@ -17,6 +17,7 @@
     <child>
       <object class="GtkToggleButton" id="mute_button">
         <property name="visible">True</property>
+        <property name="icon_name">audio-volume-muted-symbolic</property>
         <accessibility>
           <property name="label" translatable="yes">Mute</property>
         </accessibility>
@@ -24,12 +25,6 @@
         <style>
           <class name="flat" />
         </style>
-        <child>
-          <object class="GtkImage" id="stream_type_icon">
-            <property name="visible">True</property>
-            <property name="icon_name">audio-volume-muted-symbolic</property>
-          </object>
-        </child>
       </object>
     </child>
   </template>
diff --git a/panels/thunderbolt/cc-bolt-panel.ui b/panels/thunderbolt/cc-bolt-panel.ui
index 411571917..bb8d96ec0 100644
--- a/panels/thunderbolt/cc-bolt-panel.ui
+++ b/panels/thunderbolt/cc-bolt-panel.ui
@@ -36,6 +36,7 @@
                     <child>
                       <object class="GtkButton">
                         <property name="can_focus">True</property>
+                        <property name="icon-name">window-close-symbolic</property>
                         <accessibility>
                           <property name="label" translatable="yes">Close notification</property>
                         </accessibility>
@@ -46,11 +47,6 @@
                                 handler="on_notification_button_clicked_cb"
                                 object="CcBoltPanel"
                                 swapped="no" />
-                        <child>
-                          <object class="GtkImage">
-                            <property name="icon-name">window-close-symbolic</property>
-                          </object>
-                        </child>
                       </object>
                     </child>
                   </object>
diff --git a/panels/user-accounts/cc-fingerprint-dialog.ui b/panels/user-accounts/cc-fingerprint-dialog.ui
index 839812d07..9c74f84b6 100644
--- a/panels/user-accounts/cc-fingerprint-dialog.ui
+++ b/panels/user-accounts/cc-fingerprint-dialog.ui
@@ -39,6 +39,7 @@
             <property name="receives_default">False</property>
             <property name="valign">center</property>
             <property name="use-underline">True</property>
+            <property name="icon_name">go-previous-symbolic</property>
             <accessibility>
               <property name="label" translatable="yes">Back</property>
             </accessibility>
@@ -46,13 +47,6 @@
             <style>
               <class name="image-button"/>
             </style>
-            <child>
-              <object class="GtkImage">
-                <property name="can_focus">False</property>
-                <property name="icon_name">go-previous-symbolic</property>
-                <property name="icon_size">1</property>
-              </object>
-            </child>
           </object>
         </child>
 
diff --git a/panels/user-accounts/cc-user-panel.ui b/panels/user-accounts/cc-user-panel.ui
index ca65e7f70..4e317da9b 100644
--- a/panels/user-accounts/cc-user-panel.ui
+++ b/panels/user-accounts/cc-user-panel.ui
@@ -74,6 +74,7 @@
                         <child>
                           <object class="GtkButton" id="dismiss_button">
                             <property name="valign">GTK_ALIGN_CENTER</property>
+                            <property name="icon_name">window-close-symbolic</property>
                             <accessibility>
                               <property name="label" translatable="yes">Close</property>
                             </accessibility>
@@ -81,11 +82,6 @@
                             <style>
                               <class name="flat"/>
                             </style>
-                            <child>
-                              <object class="GtkImage">
-                                <property name="icon_name">window-close-symbolic</property>
-                              </object>
-                            </child>
                           </object>
                         </child>
                       </object>
@@ -169,6 +165,7 @@
                             <child>
                               <object class="GtkToggleButton" id="full_name_edit_button">
                                 <signal name="toggled" handler="full_name_edit_button_toggled" 
object="CcUserPanel" swapped="yes"/>
+                                <property name="icon-name">document-edit-symbolic</property>
                                 <property name="valign">GTK_ALIGN_CENTER</property>
                                 <accessibility>
                                   <property name="label" translatable="yes">Edit</property>
@@ -176,11 +173,6 @@
                                 <style>
                                   <class name="flat"/>
                                 </style>
-                                <child>
-                                  <object class="GtkImage">
-                                    <property name="icon-name">document-edit-symbolic</property>
-                                  </object>
-                                </child>
                               </object>
                             </child>
                           </object>


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