[libadwaita/wip/exalm/tab-overview: 2/15] tab-box: Make set_adjustment() private




commit 492a7ac113a07a0796c310d798d109dd9f4e9294
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Fri Aug 20 22:13:41 2021 +0500

    tab-box: Make set_adjustment() private
    
    Since it's a GtkScrollable now, it doesn't need this.

 src/adw-tab-bar.c         |  2 --
 src/adw-tab-box-private.h |  3 ---
 src/adw-tab-box.c         | 51 ++++++++++++++++++++++-------------------------
 3 files changed, 24 insertions(+), 32 deletions(-)
---
diff --git a/src/adw-tab-bar.c b/src/adw-tab-bar.c
index 6f033dee..7c9d5f44 100644
--- a/src/adw-tab-bar.c
+++ b/src/adw-tab-bar.c
@@ -626,12 +626,10 @@ adw_tab_bar_init (AdwTabBar *self)
   gtk_widget_init_template (GTK_WIDGET (self));
 
   adj = gtk_scrolled_window_get_hadjustment (self->scrolled_window);
-  adw_tab_box_set_adjustment (self->box, adj);
   g_signal_connect_object (adj, "changed", G_CALLBACK (update_is_overflowing),
                            self, G_CONNECT_SWAPPED);
 
   adj = gtk_scrolled_window_get_hadjustment (self->pinned_scrolled_window);
-  adw_tab_box_set_adjustment (self->pinned_box, adj);
   g_signal_connect_object (adj, "changed", G_CALLBACK (update_is_overflowing),
                            self, G_CONNECT_SWAPPED);
 }
diff --git a/src/adw-tab-box-private.h b/src/adw-tab-box-private.h
index 59b83501..043d762b 100644
--- a/src/adw-tab-box-private.h
+++ b/src/adw-tab-box-private.h
@@ -24,9 +24,6 @@ G_DECLARE_FINAL_TYPE (AdwTabBox, adw_tab_box, ADW, TAB_BOX, GtkWidget)
 void adw_tab_box_set_view (AdwTabBox  *self,
                            AdwTabView *view);
 
-void adw_tab_box_set_adjustment (AdwTabBox     *self,
-                                 GtkAdjustment *adjustment);
-
 void adw_tab_box_attach_page (AdwTabBox  *self,
                               AdwTabPage *page,
                               int         position);
diff --git a/src/adw-tab-box.c b/src/adw-tab-box.c
index af6fc84f..4f070de1 100644
--- a/src/adw-tab-box.c
+++ b/src/adw-tab-box.c
@@ -922,6 +922,28 @@ scroll_cb (AdwTabBox          *self,
   return GDK_EVENT_STOP;
 }
 
+static void
+set_hadjustment (AdwTabBox     *self,
+                 GtkAdjustment *adjustment)
+{
+  if (adjustment == self->adjustment)
+    return;
+
+  if (self->adjustment) {
+    g_signal_handlers_disconnect_by_func (self->adjustment, adjustment_value_changed_cb, self);
+    g_signal_handlers_disconnect_by_func (self->adjustment, update_visible, self);
+  }
+
+  g_set_object (&self->adjustment, adjustment);
+
+  if (self->adjustment) {
+    g_signal_connect_object (self->adjustment, "value-changed", G_CALLBACK (adjustment_value_changed_cb), 
self, G_CONNECT_SWAPPED);
+    g_signal_connect_object (self->adjustment, "notify::page-size", G_CALLBACK (update_visible), self, 
G_CONNECT_SWAPPED);
+  }
+
+  g_object_notify (G_OBJECT (self), "hadjustment");
+}
+
 /* Reordering */
 
 static void
@@ -3193,7 +3215,7 @@ adw_tab_box_dispose (GObject *object)
   self->drag_gesture = NULL;
   self->tab_bar = NULL;
   adw_tab_box_set_view (self, NULL);
-  adw_tab_box_set_adjustment (self, NULL);
+  set_hadjustment (self, NULL);
 
   G_OBJECT_CLASS (adw_tab_box_parent_class)->dispose (object);
 }
@@ -3277,7 +3299,7 @@ adw_tab_box_set_property (GObject      *object,
     break;
 
   case PROP_HADJUSTMENT:
-    adw_tab_box_set_adjustment (self, g_value_get_object (value));
+    set_hadjustment (self, g_value_get_object (value));
     break;
 
   case PROP_VADJUSTMENT:
@@ -3513,31 +3535,6 @@ adw_tab_box_set_view (AdwTabBox  *self,
   g_object_notify_by_pspec (G_OBJECT (self), props[PROP_VIEW]);
 }
 
-void
-adw_tab_box_set_adjustment (AdwTabBox     *self,
-                            GtkAdjustment *adjustment)
-{
-  g_return_if_fail (ADW_IS_TAB_BOX (self));
-  g_return_if_fail (adjustment == NULL || GTK_IS_ADJUSTMENT (adjustment));
-
-  if (adjustment == self->adjustment)
-    return;
-
-  if (self->adjustment) {
-    g_signal_handlers_disconnect_by_func (self->adjustment, adjustment_value_changed_cb, self);
-    g_signal_handlers_disconnect_by_func (self->adjustment, update_visible, self);
-  }
-
-  g_set_object (&self->adjustment, adjustment);
-
-  if (self->adjustment) {
-    g_signal_connect_object (self->adjustment, "value-changed", G_CALLBACK (adjustment_value_changed_cb), 
self, G_CONNECT_SWAPPED);
-    g_signal_connect_object (self->adjustment, "notify::page-size", G_CALLBACK (update_visible), self, 
G_CONNECT_SWAPPED);
-  }
-
-  g_object_notify (G_OBJECT (self), "hadjustment");
-}
-
 void
 adw_tab_box_attach_page (AdwTabBox  *self,
                          AdwTabPage *page,


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