[gnome-builder/wip/chergert/layout] perspective: remove IdePerspective::get_priority()



commit f564fd755117c3d3c7193d2ab76f4c4daf809db3
Author: Christian Hergert <chergert redhat com>
Date:   Sun Jul 9 19:00:02 2017 -0700

    perspective: remove IdePerspective::get_priority()
    
    This isn't needed anymore now that we use the menus.ui to
    determine placement within the perspective selector.

 libide/buildui/ide-build-perspective.c           |    7 ---
 libide/preferences/ide-preferences-perspective.c |    7 ---
 libide/workbench/ide-perspective.c               |   15 -------
 libide/workbench/ide-perspective.h               |    2 -
 libide/workbench/ide-workbench-private.h         |    5 --
 libide/workbench/ide-workbench.c                 |   48 ----------------------
 plugins/sysprof/gbp-sysprof-perspective.c        |    7 ---
 7 files changed, 0 insertions(+), 91 deletions(-)
---
diff --git a/libide/buildui/ide-build-perspective.c b/libide/buildui/ide-build-perspective.c
index bf552af..039e527 100644
--- a/libide/buildui/ide-build-perspective.c
+++ b/libide/buildui/ide-build-perspective.c
@@ -444,12 +444,6 @@ ide_build_perspective_get_id (IdePerspective *perspective)
   return g_strdup ("buildperspective");
 }
 
-static gint
-ide_build_perspective_get_priority (IdePerspective *perspective)
-{
-  return 80000;
-}
-
 static gchar *
 ide_build_perspective_get_accelerator (IdePerspective *perspective)
 {
@@ -462,6 +456,5 @@ perspective_iface_init (IdePerspectiveInterface *iface)
   iface->get_icon_name = ide_build_perspective_get_icon_name;
   iface->get_title = ide_build_perspective_get_title;
   iface->get_id = ide_build_perspective_get_id;
-  iface->get_priority = ide_build_perspective_get_priority;
   iface->get_accelerator = ide_build_perspective_get_accelerator;
 }
diff --git a/libide/preferences/ide-preferences-perspective.c 
b/libide/preferences/ide-preferences-perspective.c
index 79d6a66..f4f3873 100644
--- a/libide/preferences/ide-preferences-perspective.c
+++ b/libide/preferences/ide-preferences-perspective.c
@@ -130,12 +130,6 @@ ide_preferences_perspective_get_icon_name (IdePerspective *perspective)
   return g_strdup ("preferences-system-symbolic");
 }
 
-static gint
-ide_preferences_perspective_get_priority (IdePerspective *perspective)
-{
-  return IDE_PREFERENCES_PERSPECTIVE_PRIORITY;
-}
-
 static gchar *
 ide_preferences_perspective_get_accelerator (IdePerspective *perspective)
 {
@@ -148,6 +142,5 @@ ide_perspective_iface_init (IdePerspectiveInterface *iface)
   iface->get_id = ide_preferences_perspective_get_id;
   iface->get_icon_name = ide_preferences_perspective_get_icon_name;
   iface->get_title = ide_preferences_perspective_get_title;
-  iface->get_priority = ide_preferences_perspective_get_priority;
   iface->get_accelerator = ide_preferences_perspective_get_accelerator;
 }
diff --git a/libide/workbench/ide-perspective.c b/libide/workbench/ide-perspective.c
index bbfac34..3452114 100644
--- a/libide/workbench/ide-perspective.c
+++ b/libide/workbench/ide-perspective.c
@@ -56,12 +56,6 @@ 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)
@@ -82,7 +76,6 @@ 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;
@@ -251,14 +244,6 @@ ide_perspective_views_foreach (IdePerspective *self,
   IDE_PERSPECTIVE_GET_IFACE (self)->views_foreach (self, callback, user_data);
 }
 
-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);
-}
-
 /**
  * ide_perspective_is_early:
  *
diff --git a/libide/workbench/ide-perspective.h b/libide/workbench/ide-perspective.h
index bcca282..632265b 100644
--- a/libide/workbench/ide-perspective.h
+++ b/libide/workbench/ide-perspective.h
@@ -35,7 +35,6 @@ 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);
   gboolean      (*is_early)            (IdePerspective *self);
@@ -52,7 +51,6 @@ gboolean      ide_perspective_agree_to_shutdown   (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_is_early            (IdePerspective *self);
diff --git a/libide/workbench/ide-workbench-private.h b/libide/workbench/ide-workbench-private.h
index d62e554..7d3a6fb 100644
--- a/libide/workbench/ide-workbench-private.h
+++ b/libide/workbench/ide-workbench-private.h
@@ -40,11 +40,6 @@ struct _IdeWorkbench
   IdeContext                *context;
   GCancellable              *cancellable;
   PeasExtensionSet          *addins;
-  /*
-   * This does not contain all perspectives, just those
-   * that should be visible via the perspective selector.
-   */
-  GListStore                *perspectives;
 
   GtkStack                  *header_stack;
   IdeWorkbenchHeaderBar     *header_bar;
diff --git a/libide/workbench/ide-workbench.c b/libide/workbench/ide-workbench.c
index 2fb0b5c..15efe5a 100644
--- a/libide/workbench/ide-workbench.c
+++ b/libide/workbench/ide-workbench.c
@@ -91,18 +91,6 @@ ide_workbench_notify_visible_child (IdeWorkbench *self,
   dzl_gtk_widget_mux_action_groups (GTK_WIDGET (self), perspective, "IDE_PERSPECTIVE_ACTIONS");
 }
 
-static gint
-ide_workbench_compare_perspective (gconstpointer a,
-                                   gconstpointer b,
-                                   gpointer      data_unused)
-{
-  IdePerspective *perspective_a = (IdePerspective *)a;
-  IdePerspective *perspective_b = (IdePerspective *)b;
-
-  return (ide_perspective_get_priority (perspective_a) -
-          ide_perspective_get_priority (perspective_b));
-}
-
 static void
 ide_workbench_unload_cb (GObject      *object,
                          GAsyncResult *result,
@@ -270,7 +258,6 @@ ide_workbench_finalize (GObject *object)
 
   g_clear_object (&self->context);
   g_clear_object (&self->cancellable);
-  g_clear_object (&self->perspectives);
 
   G_OBJECT_CLASS (ide_workbench_parent_class)->finalize (object);
 }
@@ -470,8 +457,6 @@ ide_workbench_init (IdeWorkbench *self)
 
   gtk_widget_init_template (GTK_WIDGET (self));
 
-  self->perspectives = g_list_store_new (IDE_TYPE_PERSPECTIVE);
-
   ide_window_settings_register (GTK_WINDOW (self));
 
   g_signal_connect_object (self->perspectives_stack,
@@ -749,21 +734,6 @@ ide_workbench_add_perspective (IdeWorkbench   *self,
                                        "name", id,
                                        NULL);
 
-  if (!IDE_IS_GREETER_PERSPECTIVE (perspective))
-    {
-      guint position = 0;
-
-      gtk_container_child_get (GTK_CONTAINER (self->perspectives_stack),
-                               GTK_WIDGET (perspective),
-                               "position", &position,
-                               NULL);
-
-      g_list_store_append (self->perspectives, perspective);
-      g_list_store_sort (self->perspectives,
-                         ide_workbench_compare_perspective,
-                         NULL);
-    }
-
   accel = ide_perspective_get_accelerator (perspective);
 
   if (accel != NULL)
@@ -782,29 +752,11 @@ void
 ide_workbench_remove_perspective (IdeWorkbench   *self,
                                   IdePerspective *perspective)
 {
-  guint n_items;
-  guint i;
-
   g_assert (IDE_IS_WORKBENCH (self));
   g_assert (IDE_IS_PERSPECTIVE (perspective));
   g_assert (gtk_widget_get_parent (GTK_WIDGET (perspective)) ==
             GTK_WIDGET (self->perspectives_stack));
 
-  n_items = g_list_model_get_n_items (G_LIST_MODEL (self->perspectives));
-
-  for (i = 0; i < n_items; i++)
-    {
-      g_autoptr(IdePerspective) item = NULL;
-
-      item = g_list_model_get_item (G_LIST_MODEL (self->perspectives), i);
-
-      if (item == perspective)
-        {
-          g_list_store_remove (self->perspectives, i);
-          break;
-        }
-    }
-
   gtk_container_remove (GTK_CONTAINER (self->perspectives_stack),
                         GTK_WIDGET (perspective));
 }
diff --git a/plugins/sysprof/gbp-sysprof-perspective.c b/plugins/sysprof/gbp-sysprof-perspective.c
index aab10e5..5f594ca 100644
--- a/plugins/sysprof/gbp-sysprof-perspective.c
+++ b/plugins/sysprof/gbp-sysprof-perspective.c
@@ -141,12 +141,6 @@ gbp_sysprof_perspective_get_id (IdePerspective *perspective)
   return g_strdup ("profiler");
 }
 
-static gint
-gbp_sysprof_perspective_get_priority (IdePerspective *perspective)
-{
-  return 70000;
-}
-
 static gchar *
 gbp_sysprof_perspective_get_accelerator (IdePerspective *perspective)
 {
@@ -159,7 +153,6 @@ perspective_iface_init (IdePerspectiveInterface *iface)
   iface->get_icon_name = gbp_sysprof_perspective_get_icon_name;
   iface->get_title = gbp_sysprof_perspective_get_title;
   iface->get_id = gbp_sysprof_perspective_get_id;
-  iface->get_priority = gbp_sysprof_perspective_get_priority;
   iface->get_accelerator = gbp_sysprof_perspective_get_accelerator;
 }
 


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