[balsa] Use gtk_scrolled_window_get_{h,v}adjustment()



commit 99ff4602807f4447634746cfdaa6913cb00060f3
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Thu Jul 5 17:32:58 2018 -0400

      Use gtk_scrolled_window_get_{h,v}adjustment()
    
    * src/balsa-message.c (bm_find_scroll_to_rectangle), (select_part):
      Use gtk_scrolled_window_get_{h,v}adjustment() instead of
      GObject properties (and consequently, do not leak the
      adjustments).

 ChangeLog           |  7 +++++++
 src/balsa-message.c | 22 ++++++++++++----------
 2 files changed, 19 insertions(+), 10 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 937fd7eba..103c15557 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2018-07-05  Peter Bloomfield  <pbloomfield bellsouth net>
+
+       * src/balsa-message.c (bm_find_scroll_to_rectangle), (select_part):
+         Use gtk_scrolled_window_get_{h,v}adjustment() instead of
+         GObject properties (and consequently, do not leak the
+         adjustments).
+
 2018-07-03  Albrecht DreƟ <albrecht dress arcor de>
 
        libnetclient private data fixes
diff --git a/src/balsa-message.c b/src/balsa-message.c
index b7af6cabb..101ed9c09 100644
--- a/src/balsa-message.c
+++ b/src/balsa-message.c
@@ -393,16 +393,17 @@ bm_find_scroll_to_rectangle(BalsaMessage * bm,
                             GdkRectangle * rectangle)
 {
     gint x, y;
-    GtkAdjustment *hadj, *vadj;
+    GtkAdjustment *adj;
+    GtkScrolledWindow *scroll = GTK_SCROLLED_WINDOW(bm->scroll);
 
     gtk_widget_translate_coordinates(widget, bm->bm_widget->widget,
                                      rectangle->x, rectangle->y,
                                      &x, &y);
 
-    g_object_get(G_OBJECT(bm->scroll), "hadjustment", &hadj,
-                                       "vadjustment", &vadj, NULL);
-    gtk_adjustment_clamp_page(hadj, x, x + rectangle->width);
-    gtk_adjustment_clamp_page(vadj, y, y + rectangle->height);
+    adj = gtk_scrolled_window_get_hadjustment(scroll);
+    gtk_adjustment_clamp_page(adj, x, x + rectangle->width);
+    adj = gtk_scrolled_window_get_vadjustment(scroll);
+    gtk_adjustment_clamp_page(adj, y, y + rectangle->height);
 }
 
 static void
@@ -2300,12 +2301,13 @@ select_part(BalsaMessage * bm, BalsaPartInfo *info)
     g_signal_emit(G_OBJECT(bm), balsa_message_signals[SELECT_PART], 0);
 
     if (body != NULL) {
-        GtkAdjustment *hadj, *vadj;
+        GtkScrolledWindow *scroll = GTK_SCROLLED_WINDOW(bm->scroll);
+        GtkAdjustment *adj;
 
-        g_object_get(G_OBJECT(bm->scroll), "hadjustment", &hadj,
-                                           "vadjustment", &vadj, NULL);
-        gtk_adjustment_set_value(hadj, 0);
-        gtk_adjustment_set_value(vadj, 0);
+        adj = gtk_scrolled_window_get_hadjustment(scroll);
+        gtk_adjustment_set_value(adj, 0);
+        adj = gtk_scrolled_window_get_vadjustment(scroll);
+        gtk_adjustment_set_value(adj, 0);
     }
 }
 


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