[gnome-control-center] notifications: Move adjustment widget into GtkBuilder file



commit ba80822797622232b9031f8fad7e7b0b0feed42f
Author: Robert Ancell <robert ancell canonical com>
Date:   Fri Dec 4 09:47:42 2020 +1300

    notifications: Move adjustment widget into GtkBuilder file

 panels/notifications/cc-notifications-panel.c  | 6 ++----
 panels/notifications/cc-notifications-panel.ui | 3 +++
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/panels/notifications/cc-notifications-panel.c b/panels/notifications/cc-notifications-panel.c
index 366a59e63..358b87e62 100644
--- a/panels/notifications/cc-notifications-panel.c
+++ b/panels/notifications/cc-notifications-panel.c
@@ -39,6 +39,7 @@ struct _CcNotificationsPanel {
   CcPanel            parent_instance;
 
   GtkListBox        *app_listbox;
+  GtkAdjustment     *focus_adjustment;
   CcListRow         *lock_screen_row;
   GtkScrolledWindow *main_scrolled_window;
   GtkBox            *main_box;
@@ -52,8 +53,6 @@ struct _CcNotificationsPanel {
 
   GHashTable        *known_applications;
 
-  GtkAdjustment     *focus_adjustment;
-
   GList             *sections;
   GList             *sections_reverse;
 
@@ -184,8 +183,6 @@ cc_notifications_panel_init (CcNotificationsPanel *panel)
                    panel->lock_screen_row,
                    "active", G_SETTINGS_BIND_DEFAULT);
 
-  panel->focus_adjustment = gtk_scrolled_window_get_vadjustment (panel->main_scrolled_window);
-
   gtk_container_set_focus_vadjustment (GTK_CONTAINER (panel->main_box), panel->focus_adjustment);
 
   panel->sections = g_list_append (panel->sections, panel->options_listbox);
@@ -238,6 +235,7 @@ cc_notifications_panel_class_init (CcNotificationsPanelClass *klass)
   gtk_widget_class_set_template_from_resource (widget_class, 
"/org/gnome/control-center/notifications/cc-notifications-panel.ui");
 
   gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, app_listbox);
+  gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, focus_adjustment);
   gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, lock_screen_row);
   gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, main_scrolled_window);
   gtk_widget_class_bind_template_child (widget_class, CcNotificationsPanel, main_box);
diff --git a/panels/notifications/cc-notifications-panel.ui b/panels/notifications/cc-notifications-panel.ui
index 31e041c1e..184b7c807 100644
--- a/panels/notifications/cc-notifications-panel.ui
+++ b/panels/notifications/cc-notifications-panel.ui
@@ -9,6 +9,7 @@
         <property name="can_focus">True</property>
         <property name="hscrollbar_policy">never</property>
         <property name="shadow_type">none</property>
+        <property name="vadjustment">focus_adjustment</property>
         <child>
           <object class="GtkViewport">
             <property name="visible">True</property>
@@ -131,4 +132,6 @@
   <object class="GtkSizeGroup" id="sizegroup1">
     <property name="mode">both</property>
   </object>
+  <object class="GtkAdjustment" id="focus_adjustment">
+  </object>
 </interface>


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