[gnome-builder] perspective: add hooks to restore state



commit 6402956745ab959280e6c4abb845f962600f6577
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jun 18 03:33:49 2017 -0700

    perspective: add hooks to restore state
    
    These should be used to restore state like panels. It is called after the
    perspectives have been added and it should be relatively stable to cleanly
    restore settings state. By stable, I mean widgets aren't still being added.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=783920

 libide/workbench/ide-perspective.c |    9 +++++++++
 libide/workbench/ide-perspective.h |    2 ++
 2 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/libide/workbench/ide-perspective.c b/libide/workbench/ide-perspective.c
index 4cec2ba..66fa694 100644
--- a/libide/workbench/ide-perspective.c
+++ b/libide/workbench/ide-perspective.c
@@ -319,3 +319,12 @@ ide_perspective_get_accelerator (IdePerspective *self)
 
   return NULL;
 }
+
+void
+ide_perspective_restore_state (IdePerspective *self)
+{
+  g_return_if_fail (IDE_IS_PERSPECTIVE (self));
+
+  if (IDE_PERSPECTIVE_GET_IFACE (self)->restore_state)
+    IDE_PERSPECTIVE_GET_IFACE (self)->restore_state (self);
+}
diff --git a/libide/workbench/ide-perspective.h b/libide/workbench/ide-perspective.h
index 519aea8..7f15c40 100644
--- a/libide/workbench/ide-perspective.h
+++ b/libide/workbench/ide-perspective.h
@@ -46,6 +46,7 @@ struct _IdePerspectiveInterface
                                         GtkCallback     callback,
                                         gpointer        user_data);
   gchar        *(*get_accelerator)     (IdePerspective *self);
+  void          (*restore_state)       (IdePerspective *self);
 };
 
 gboolean      ide_perspective_agree_to_shutdown   (IdePerspective *self);
@@ -63,6 +64,7 @@ void          ide_perspective_views_foreach       (IdePerspective *self,
                                                    GtkCallback     callback,
                                                    gpointer        user_data);
 gchar        *ide_perspective_get_accelerator     (IdePerspective *self);
+void          ide_perspective_restore_state       (IdePerspective *self);
 
 G_END_DECLS
 


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