[sysprof/wip/chergert/sysprof-3] libsysprof-ui: link up horizontal scrolling



commit 480abf6371c0cf9db80c021506f93860de9c1285
Author: Christian Hergert <chergert redhat com>
Date:   Wed May 15 18:26:42 2019 -0700

    libsysprof-ui: link up horizontal scrolling

 src/libsysprof-ui/sysprof-capture-view.c     | 20 +++++-----------
 src/libsysprof-ui/sysprof-marks-view.c       | 14 ++++++++++++
 src/libsysprof-ui/sysprof-ui-private.h       | 34 ++++++++++++++++++++++++++++
 src/libsysprof-ui/sysprof-visualizer-view.c  | 12 ++++++++++
 src/libsysprof-ui/ui/sysprof-capture-view.ui | 16 +++++--------
 5 files changed, 72 insertions(+), 24 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c
index dc18376..9bc4097 100644
--- a/src/libsysprof-ui/sysprof-capture-view.c
+++ b/src/libsysprof-ui/sysprof-capture-view.c
@@ -26,6 +26,7 @@
 #include "sysprof-capture-view.h"
 #include "sysprof-details-view.h"
 #include "sysprof-marks-view.h"
+#include "sysprof-ui-private.h"
 #include "sysprof-visualizer-view.h"
 
 typedef struct
@@ -45,6 +46,7 @@ typedef struct
   SysprofCaptureFeatures  features;
 
   /* Template Objects */
+  GtkAdjustment          *time_adj;
   GtkStack               *stack;
   SysprofCallgraphView   *callgraph_view;
   SysprofDetailsView     *details_view;
@@ -597,19 +599,6 @@ sysprof_capture_view_get_property (GObject    *object,
     }
 }
 
-static void
-sysprof_capture_view_set_property (GObject      *object,
-                                   guint         prop_id,
-                                   const GValue *value,
-                                   GParamSpec   *pspec)
-{
-  switch (prop_id)
-    {
-    default:
-      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
-    }
-}
-
 static void
 sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
 {
@@ -618,7 +607,6 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
 
   object_class->finalize = sysprof_capture_view_finalize;
   object_class->get_property = sysprof_capture_view_get_property;
-  object_class->set_property = sysprof_capture_view_set_property;
 
   klass->load_async = sysprof_capture_view_real_load_async;
   klass->load_finish = sysprof_capture_view_real_load_finish;
@@ -629,6 +617,7 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, marks_view);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, stack_switcher);
+  gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, time_adj);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, visualizer_view);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofCaptureView, zoom_manager);
 
@@ -679,6 +668,9 @@ sysprof_capture_view_init (SysprofCaptureView *self)
   gtk_widget_insert_action_group (GTK_WIDGET (self),
                                   "capture-view",
                                   G_ACTION_GROUP (group));
+
+  _sysprof_marks_view_set_hadjustment (priv->marks_view, priv->time_adj);
+  _sysprof_visualizer_view_set_hadjustment (priv->visualizer_view, priv->time_adj);
 }
 
 /**
diff --git a/src/libsysprof-ui/sysprof-marks-view.c b/src/libsysprof-ui/sysprof-marks-view.c
index d2c9ab5..dda7acd 100644
--- a/src/libsysprof-ui/sysprof-marks-view.c
+++ b/src/libsysprof-ui/sysprof-marks-view.c
@@ -32,6 +32,7 @@ typedef struct
   SysprofZoomManager          *zoom_manager;
 
   /* Template objects */
+  GtkScrolledWindow           *scroller;
   GtkTreeView                 *tree_view;
   GtkTreeViewColumn           *duration_column;
   SysprofCellRendererDuration *duration_cell;
@@ -120,6 +121,7 @@ sysprof_marks_view_class_init (SysprofMarksViewClass *klass)
   object_class->set_property = sysprof_marks_view_set_property;
 
   gtk_widget_class_set_template_from_resource (widget_class, "/org/gnome/sysprof/ui/sysprof-marks-view.ui");
+  gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, scroller);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, tree_view);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, duration_cell);
   gtk_widget_class_bind_template_child_private (widget_class, SysprofMarksView, duration_column);
@@ -227,3 +229,15 @@ sysprof_marks_view_load_finish (SysprofMarksView  *self,
 
   return g_task_propagate_boolean (G_TASK (result), error);
 }
+
+void
+_sysprof_marks_view_set_hadjustment (SysprofMarksView *self,
+                                     GtkAdjustment    *hadjustment)
+{
+  SysprofMarksViewPrivate *priv = sysprof_marks_view_get_instance_private (self);
+
+  g_return_if_fail (SYSPROF_IS_MARKS_VIEW (self));
+  g_return_if_fail (GTK_IS_ADJUSTMENT (hadjustment));
+
+  gtk_scrolled_window_set_hadjustment (priv->scroller, hadjustment);
+}
diff --git a/src/libsysprof-ui/sysprof-ui-private.h b/src/libsysprof-ui/sysprof-ui-private.h
new file mode 100644
index 0000000..8aae79f
--- /dev/null
+++ b/src/libsysprof-ui/sysprof-ui-private.h
@@ -0,0 +1,34 @@
+/* sysprof-ui-private.h
+ *
+ * Copyright 2019 Christian Hergert <chergert redhat com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: GPL-3.0-or-later
+ */
+
+#pragma once
+
+#include "sysprof-marks-view.h"
+#include "sysprof-visualizer-view.h"
+
+G_BEGIN_DECLS
+
+void _sysprof_marks_view_set_hadjustment      (SysprofMarksView      *self,
+                                               GtkAdjustment         *hadjustment);
+void _sysprof_visualizer_view_set_hadjustment (SysprofVisualizerView *self,
+                                               GtkAdjustment         *hadjustment);
+
+
+G_END_DECLS
diff --git a/src/libsysprof-ui/sysprof-visualizer-view.c b/src/libsysprof-ui/sysprof-visualizer-view.c
index fba677e..15c461d 100644
--- a/src/libsysprof-ui/sysprof-visualizer-view.c
+++ b/src/libsysprof-ui/sysprof-visualizer-view.c
@@ -748,3 +748,15 @@ sysprof_visualizer_view_get_selection (SysprofVisualizerView *self)
 
   return priv->selection;
 }
+
+void
+_sysprof_visualizer_view_set_hadjustment (SysprofVisualizerView *self,
+                                          GtkAdjustment         *hadjustment)
+{
+  SysprofVisualizerViewPrivate *priv = sysprof_visualizer_view_get_instance_private (self);
+
+  g_return_if_fail (SYSPROF_IS_VISUALIZER_VIEW (self));
+  g_return_if_fail (GTK_IS_ADJUSTMENT (hadjustment));
+
+  gtk_scrolled_window_set_hadjustment (priv->scroller, hadjustment);
+}
diff --git a/src/libsysprof-ui/ui/sysprof-capture-view.ui b/src/libsysprof-ui/ui/sysprof-capture-view.ui
index 2e1e54d..09c7cb8 100644
--- a/src/libsysprof-ui/ui/sysprof-capture-view.ui
+++ b/src/libsysprof-ui/ui/sysprof-capture-view.ui
@@ -79,11 +79,6 @@
             </child>
           </object>
         </child>
-        <child>
-          <object class="GtkSeparator">
-            <property name="visible">true</property>
-          </object>
-        </child>
         <child>
           <object class="SysprofMultiPaned">
             <property name="visible">true</property>
@@ -97,11 +92,11 @@
                     <property name="visible">true</property>
                   </object>
                 </child>
-                <child>
-                  <object class="GtkSeparator">
-                    <property name="visible">true</property>
-                  </object>
-                </child>
+              </object>
+            </child>
+            <child>
+              <object class="GtkSeparator">
+                <property name="visible">true</property>
               </object>
             </child>
             <child>
@@ -149,4 +144,5 @@
     </child>
   </template>
   <object class="SysprofZoomManager" id="zoom_manager"/>
+  <object class="GtkAdjustment" id="time_adj"/>
 </interface>


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