[gnome-control-center/gbsneto/panel-headerbar-cleanup: 10/12] applications: Switch ti AdwWindowTitle




commit 00cace1531f101607a7585af748b939c30ea8252
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Wed Jan 19 22:17:56 2022 -0300

    applications: Switch ti AdwWindowTitle
    
    It's generally a better widget to use in the headerbar, as
    it takes care of styling for us.

 panels/applications/cc-applications-panel.c  | 8 ++++----
 panels/applications/cc-applications-panel.ui | 8 ++------
 2 files changed, 6 insertions(+), 10 deletions(-)
---
diff --git a/panels/applications/cc-applications-panel.c b/panels/applications/cc-applications-panel.c
index 163d55910..3fe73f0bf 100644
--- a/panels/applications/cc-applications-panel.c
+++ b/panels/applications/cc-applications-panel.c
@@ -60,7 +60,7 @@ struct _CcApplicationsPanel
   GtkListBox      *sidebar_listbox;
   GtkEntry        *sidebar_search_entry;
   GtkButton       *header_button;
-  GtkLabel        *title_label;
+  AdwWindowTitle  *header_title;
   GAppInfoMonitor *monitor;
   gulong           monitor_id;
 #ifdef HAVE_MALCONTENT
@@ -1660,7 +1660,7 @@ update_panel (CcApplicationsPanel *self,
 
   if (row == NULL)
     {
-      gtk_label_set_label (self->title_label, _("Applications"));
+      adw_window_title_set_title (self->header_title, _("Applications"));
       gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->empty_box));
       gtk_widget_hide (GTK_WIDGET (GTK_WIDGET (self->header_button)));
       return;
@@ -1668,7 +1668,7 @@ update_panel (CcApplicationsPanel *self,
 
   info = cc_applications_row_get_info (CC_APPLICATIONS_ROW (row));
 
-  gtk_label_set_label (self->title_label, g_app_info_get_display_name (info));
+  adw_window_title_set_title (self->header_title, g_app_info_get_display_name (info));
   gtk_stack_set_visible_child (self->stack, GTK_WIDGET (self->settings_box));
   gtk_widget_set_visible (GTK_WIDGET (self->header_button), gnome_software_is_installed ());
 
@@ -1983,6 +1983,7 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_section);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_reset);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, handler_list);
+  gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, header_title);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, install_button);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_list);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, integration_section);
@@ -2009,7 +2010,6 @@ cc_applications_panel_class_init (CcApplicationsPanelClass *klass)
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_dialog);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, storage_list);
-  gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, title_label);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, total);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_list);
   gtk_widget_class_bind_template_child (widget_class, CcApplicationsPanel, usage_section);
diff --git a/panels/applications/cc-applications-panel.ui b/panels/applications/cc-applications-panel.ui
index 4c7e7979c..6e4530386 100644
--- a/panels/applications/cc-applications-panel.ui
+++ b/panels/applications/cc-applications-panel.ui
@@ -15,12 +15,8 @@
           </object>
         </child>
         <property name="title-widget">
-          <object class="GtkLabel" id="title_label">
-            <property name="label" translatable="yes">Applications</property>
-            <property name="ellipsize">end</property>
-            <style>
-              <class name="title"/>
-            </style>
+          <object class="AdwWindowTitle" id="header_title">
+            <property name="title" translatable="yes">Applications</property>
           </object>
         </property>
         <child type="end">


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