[sysprof/wip/chergert/sysprof-3] libsysprof-ui: hook up zoom-manager to visualizers



commit 0780267bd8af2ba110119e324c96dea27877a49b
Author: Christian Hergert <chergert redhat com>
Date:   Mon May 13 22:19:32 2019 -0700

    libsysprof-ui: hook up zoom-manager to visualizers

 src/libsysprof-ui/sysprof-capture-view.c     | 25 +++++++++-
 src/libsysprof-ui/sysprof-capture-view.h     | 26 +++++-----
 src/libsysprof-ui/ui/sysprof-capture-view.ui | 72 +++++++++++++++++++++++++---
 3 files changed, 104 insertions(+), 19 deletions(-)
---
diff --git a/src/libsysprof-ui/sysprof-capture-view.c b/src/libsysprof-ui/sysprof-capture-view.c
index 6239086..85d8629 100644
--- a/src/libsysprof-ui/sysprof-capture-view.c
+++ b/src/libsysprof-ui/sysprof-capture-view.c
@@ -26,7 +26,6 @@
 #include "sysprof-capture-view.h"
 #include "sysprof-marks-view.h"
 #include "sysprof-visualizer-view.h"
-#include "sysprof-zoom-manager.h"
 
 typedef struct
 {
@@ -516,7 +515,13 @@ sysprof_capture_view_class_init (SysprofCaptureViewClass *klass)
 static void
 sysprof_capture_view_init (SysprofCaptureView *self)
 {
+  SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
+
   gtk_widget_init_template (GTK_WIDGET (self));
+
+  gtk_widget_insert_action_group (GTK_WIDGET (self),
+                                  "zoom",
+                                  G_ACTION_GROUP (priv->zoom_manager));
 }
 
 /**
@@ -585,3 +590,21 @@ sysprof_capture_view_reset (SysprofCaptureView *self)
 
   /* TODO: reset */
 }
+
+/**
+ * sysprof_capture_view_get_zoom_manager:
+ * @self: a #SysprofCaptureView
+ *
+ * Returns: (transfer none): a #SysprofZoomManager
+ *
+ * Since: 3.34
+ */
+SysprofZoomManager *
+sysprof_capture_view_get_zoom_manager (SysprofCaptureView *self)
+{
+  SysprofCaptureViewPrivate *priv = sysprof_capture_view_get_instance_private (self);
+
+  g_return_val_if_fail (SYSPROF_IS_CAPTURE_VIEW (self), NULL);
+
+  return priv->zoom_manager;
+}
diff --git a/src/libsysprof-ui/sysprof-capture-view.h b/src/libsysprof-ui/sysprof-capture-view.h
index 49c34c5..82358a4 100644
--- a/src/libsysprof-ui/sysprof-capture-view.h
+++ b/src/libsysprof-ui/sysprof-capture-view.h
@@ -23,6 +23,8 @@
 #include <gtk/gtk.h>
 #include <sysprof-capture.h>
 
+#include "sysprof-zoom-manager.h"
+
 G_BEGIN_DECLS
 
 #define SYSPROF_TYPE_CAPTURE_VIEW (sysprof_capture_view_get_type())
@@ -48,20 +50,22 @@ struct _SysprofCaptureViewClass
 };
 
 SYSPROF_AVAILABLE_IN_ALL
-GtkWidget            *sysprof_capture_view_new         (void);
+GtkWidget            *sysprof_capture_view_new              (void);
+SYSPROF_AVAILABLE_IN_ALL
+SysprofZoomManager   *sysprof_capture_view_get_zoom_manager (SysprofCaptureView *self);
 SYSPROF_AVAILABLE_IN_ALL
-SysprofCaptureReader *sysprof_capture_view_get_reader  (SysprofCaptureView    *self);
+SysprofCaptureReader *sysprof_capture_view_get_reader       (SysprofCaptureView    *self);
 SYSPROF_AVAILABLE_IN_ALL
-void                  sysprof_capture_view_load_async  (SysprofCaptureView    *self,
-                                                        SysprofCaptureReader  *reader,
-                                                        GCancellable          *cancellable,
-                                                        GAsyncReadyCallback    callback,
-                                                        gpointer               user_data);
+void                  sysprof_capture_view_load_async       (SysprofCaptureView    *self,
+                                                             SysprofCaptureReader  *reader,
+                                                             GCancellable          *cancellable,
+                                                             GAsyncReadyCallback    callback,
+                                                             gpointer               user_data);
 SYSPROF_AVAILABLE_IN_ALL
-gboolean              sysprof_capture_view_load_finish (SysprofCaptureView    *self,
-                                                        GAsyncResult          *result,
-                                                        GError               **error);
+gboolean              sysprof_capture_view_load_finish      (SysprofCaptureView    *self,
+                                                             GAsyncResult          *result,
+                                                             GError               **error);
 SYSPROF_AVAILABLE_IN_ALL
-gboolean              sysprof_capture_view_get_busy    (SysprofCaptureView    *self);
+gboolean              sysprof_capture_view_get_busy         (SysprofCaptureView    *self);
 
 G_END_DECLS
diff --git a/src/libsysprof-ui/ui/sysprof-capture-view.ui b/src/libsysprof-ui/ui/sysprof-capture-view.ui
index 6becc13..d2f33c8 100644
--- a/src/libsysprof-ui/ui/sysprof-capture-view.ui
+++ b/src/libsysprof-ui/ui/sysprof-capture-view.ui
@@ -6,12 +6,70 @@
         <property name="orientation">vertical</property>
         <property name="visible">true</property>
         <child>
-          <object class="GtkStackSwitcher">
-            <property name="stack">sections_stack</property>
-            <property name="halign">center</property>
+          <object class="GtkBox">
+            <property name="orientation">horizontal</property>
             <property name="visible">true</property>
-            <property name="margin-top">6</property>
-            <property name="margin-bottom">6</property>
+            <child>
+              <object class="GtkBox">
+                <property name="margin-start">12</property>
+                <property name="margin-end">12</property>
+                <property name="orientation">horizontal</property>
+                <property name="valign">center</property>
+                <property name="visible">true</property>
+                <child>
+                  <object class="GtkButton">
+                    <property name="action-name">zoom.zoom-out</property>
+                    <property name="focus-on-click">false</property>
+                    <property name="visible">true</property>
+                    <style>
+                      <class name="flat"/>
+                    </style>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="icon-name">zoom-out-symbolic</property>
+                        <property name="visible">true</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton">
+                    <property name="action-name">zoom.zoom-one</property>
+                    <property name="focus-on-click">false</property>
+                    <property name="label" bind-source="zoom_manager" bind-property="zoom-label" 
bind-flags="sync-create"/>
+                    <property name="visible">true</property>
+                    <style>
+                      <class name="flat"/>
+                    </style>
+                  </object>
+                </child>
+                <child>
+                  <object class="GtkButton">
+                    <property name="action-name">zoom.zoom-in</property>
+                    <property name="focus-on-click">false</property>
+                    <property name="visible">true</property>
+                    <style>
+                      <class name="flat"/>
+                    </style>
+                    <child>
+                      <object class="GtkImage">
+                        <property name="icon-name">zoom-in-symbolic</property>
+                        <property name="visible">true</property>
+                      </object>
+                    </child>
+                  </object>
+                </child>
+              </object>
+            </child>
+            <child type="center">
+              <object class="GtkStackSwitcher">
+                <property name="stack">sections_stack</property>
+                <property name="halign">center</property>
+                <property name="visible">true</property>
+                <property name="margin-top">6</property>
+                <property name="margin-bottom">6</property>
+              </object>
+            </child>
           </object>
         </child>
         <child>
@@ -28,6 +86,7 @@
                 <property name="visible">true</property>
                 <child>
                   <object class="SysprofVisualizerView" id="visualizer_view">
+                    <property name="zoom-manager">zoom_manager</property>
                     <property name="visible">true</property>
                   </object>
                 </child>
@@ -66,6 +125,5 @@
       </object>
     </child>
   </template>
-  <object class="SysprofZoomManager" id="zoom_manager">
-  </object>
+  <object class="SysprofZoomManager" id="zoom_manager"/>
 </interface>


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