[gnome-builder] libide: add IdePerspective::get_priority()



commit d5aacb75bcf8c4decd5fc2e4d6d578a33f834df9
Author: Christian Hergert <chergert redhat com>
Date:   Mon Nov 16 23:00:14 2015 -0800

    libide: add IdePerspective::get_priority()
    
    This indicates the priority of the perspective within the stack switcher.

 libide/ide-perspective.c                         |   15 +++++++++++++++
 libide/ide-perspective.h                         |    4 +++-
 libide/preferences/ide-preferences-perspective.c |    7 +++++++
 libide/preferences/ide-preferences-perspective.h |    3 ++-
 4 files changed, 27 insertions(+), 2 deletions(-)
---
diff --git a/libide/ide-perspective.c b/libide/ide-perspective.c
index 43698fa..44c0e12 100644
--- a/libide/ide-perspective.c
+++ b/libide/ide-perspective.c
@@ -62,6 +62,12 @@ ide_perspective_real_get_titlebar (IdePerspective *self)
   return NULL;
 }
 
+static gint
+ide_perspective_real_get_priority (IdePerspective *self)
+{
+  return 0;
+}
+
 static void
 ide_perspective_real_set_fullscreen (IdePerspective *self,
                                      gboolean        fullscreen)
@@ -83,6 +89,7 @@ ide_perspective_default_init (IdePerspectiveInterface *iface)
   iface->get_icon_name = ide_perspective_real_get_icon_name;
   iface->get_id = ide_perspective_real_get_id;
   iface->get_needs_attention = ide_perspective_real_get_needs_attention;
+  iface->get_priority = ide_perspective_real_get_priority;
   iface->get_title = ide_perspective_real_get_title;
   iface->get_titlebar = ide_perspective_real_get_titlebar;
   iface->set_fullscreen = ide_perspective_real_set_fullscreen;
@@ -262,3 +269,11 @@ ide_perspective_get_actions (IdePerspective *self)
 
   return IDE_PERSPECTIVE_GET_IFACE (self)->get_actions (self);
 }
+
+gint
+ide_perspective_get_priority (IdePerspective *self)
+{
+  g_return_val_if_fail (IDE_IS_PERSPECTIVE (self), 0);
+
+  return IDE_PERSPECTIVE_GET_IFACE (self)->get_priority (self);
+}
diff --git a/libide/ide-perspective.h b/libide/ide-perspective.h
index a5aa17f..e7ef628 100644
--- a/libide/ide-perspective.h
+++ b/libide/ide-perspective.h
@@ -36,6 +36,7 @@ struct _IdePerspectiveInterface
   gchar        *(*get_icon_name)       (IdePerspective *self);
   gchar        *(*get_id)              (IdePerspective *self);
   gboolean      (*get_needs_attention) (IdePerspective *self);
+  gint          (*get_priority)        (IdePerspective *self);
   gchar        *(*get_title)           (IdePerspective *self);
   GtkWidget    *(*get_titlebar)        (IdePerspective *self);
   void          (*set_fullscreen)      (IdePerspective *self,
@@ -49,9 +50,10 @@ gboolean      ide_perspective_agree_to_shutdown   (IdePerspective *self);
 GActionGroup *ide_perspective_get_actions         (IdePerspective *self);
 gchar        *ide_perspective_get_icon_name       (IdePerspective *self);
 gchar        *ide_perspective_get_id              (IdePerspective *self);
+gboolean      ide_perspective_get_needs_attention (IdePerspective *self);
+gint          ide_perspective_get_priority        (IdePerspective *self);
 gchar        *ide_perspective_get_title           (IdePerspective *self);
 GtkWidget    *ide_perspective_get_titlebar        (IdePerspective *self);
-gboolean      ide_perspective_get_needs_attention (IdePerspective *self);
 void          ide_perspective_set_fullscreen      (IdePerspective *self,
                                                    gboolean        fullscreen);
 void          ide_perspective_views_foreach       (IdePerspective *self,
diff --git a/libide/preferences/ide-preferences-perspective.c 
b/libide/preferences/ide-preferences-perspective.c
index d734de1..b1e0e7f 100644
--- a/libide/preferences/ide-preferences-perspective.c
+++ b/libide/preferences/ide-preferences-perspective.c
@@ -817,6 +817,12 @@ ide_preferences_perspective_get_actions (IdePerspective *perspective)
   return g_object_ref (self->actions);
 }
 
+static gint
+ide_preferences_perspective_get_priority (IdePerspective *perspective)
+{
+  return IDE_PREFERENCES_PERSPECTIVE_PRIORITY;
+}
+
 static void
 ide_perspective_iface_init (IdePerspectiveInterface *iface)
 {
@@ -825,4 +831,5 @@ ide_perspective_iface_init (IdePerspectiveInterface *iface)
   iface->get_title = ide_preferences_perspective_get_title;
   iface->get_titlebar = ide_preferences_perspective_get_titlebar;
   iface->get_actions = ide_preferences_perspective_get_actions;
+  iface->get_priority = ide_preferences_perspective_get_priority;
 }
diff --git a/libide/preferences/ide-preferences-perspective.h 
b/libide/preferences/ide-preferences-perspective.h
index c5b2a4b..8cb7eba 100644
--- a/libide/preferences/ide-preferences-perspective.h
+++ b/libide/preferences/ide-preferences-perspective.h
@@ -23,7 +23,8 @@
 
 G_BEGIN_DECLS
 
-#define IDE_TYPE_PREFERENCES_PERSPECTIVE (ide_preferences_perspective_get_type())
+#define IDE_TYPE_PREFERENCES_PERSPECTIVE     (ide_preferences_perspective_get_type())
+#define IDE_PREFERENCES_PERSPECTIVE_PRIORITY 10000
 
 G_DECLARE_FINAL_TYPE (IdePreferencesPerspective, ide_preferences_perspective, IDE, PREFERENCES_PERSPECTIVE, 
GtkBin)
 


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