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




commit bba30d32d1e88e40f69f1e34d1cea1c1b6851878
Author: Alexander Mikhaylenko <alexm gnome org>
Date:   Tue Aug 9 14:24:01 2022 +0400

    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 6b163633..e891b98a 100644
--- a/src/adw-tab-bar.c
+++ b/src/adw-tab-bar.c
@@ -573,12 +573,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 7ff04e59..d2f0606f 100644
--- a/src/adw-tab-box.c
+++ b/src/adw-tab-box.c
@@ -1010,6 +1010,28 @@ scroll_animation_done_cb (AdwTabBox *self)
   gtk_widget_queue_resize (GTK_WIDGET (self));
 }
 
+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
@@ -3513,7 +3535,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_clear_object (&self->resize_animation);
   g_clear_object (&self->scroll_animation);
@@ -3595,7 +3617,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:
@@ -3855,31 +3877,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]