[gnome-builder/wip/new-workspace] workspace: add helper to add/remove workspace pane child



commit 856410f45f53d2d957c55a3fe665530efb6ff358
Author: Christian Hergert <christian hergert me>
Date:   Sat Jun 6 15:12:01 2015 -0700

    workspace: add helper to add/remove workspace pane child

 src/workspace/gb-workspace-pane.c |   22 ++++++++++++++++++++++
 src/workspace/gb-workspace-pane.h |   20 ++++++++++----------
 2 files changed, 32 insertions(+), 10 deletions(-)
---
diff --git a/src/workspace/gb-workspace-pane.c b/src/workspace/gb-workspace-pane.c
index 02d86fc..115d49a 100644
--- a/src/workspace/gb-workspace-pane.c
+++ b/src/workspace/gb-workspace-pane.c
@@ -273,3 +273,25 @@ gb_workspace_pane_set_position (GbWorkspacePane *self,
       g_object_notify_by_pspec (G_OBJECT (self), gParamSpecs [PROP_POSITION]);
     }
 }
+
+void
+gb_workspace_pane_add_page (GbWorkspacePane *self,
+                            GtkWidget       *page,
+                            const gchar     *title,
+                            const gchar     *icon_name)
+{
+  gtk_container_add_with_properties (GTK_CONTAINER (self->stack), page,
+                                     "icon-name", icon_name,
+                                     "title", title,
+                                     NULL);
+}
+
+void
+gb_workspace_pane_remove_page (GbWorkspacePane *self,
+                               GtkWidget       *page)
+{
+  g_return_if_fail (GB_IS_WORKSPACE_PANE (self));
+  g_return_if_fail (GTK_IS_WIDGET (page));
+
+  gtk_container_remove (GTK_CONTAINER (self->stack), page);
+}
diff --git a/src/workspace/gb-workspace-pane.h b/src/workspace/gb-workspace-pane.h
index 66e8db8..de46837 100644
--- a/src/workspace/gb-workspace-pane.h
+++ b/src/workspace/gb-workspace-pane.h
@@ -27,16 +27,16 @@ G_BEGIN_DECLS
 
 G_DECLARE_FINAL_TYPE (GbWorkspacePane, gb_workspace_pane, GB, WORKSPACE_PANE, GtkBin)
 
-gboolean         gb_workspace_pane_get_floating            (GbWorkspacePane *self);
-guint            gb_workspace_pane_get_transition_duration (GbWorkspacePane *self);
-GtkWidget       *gb_workspace_pane_new                     (void);
-void             gb_workspace_pane_set_floating            (GbWorkspacePane *self,
-                                                            gboolean         floating);
-void             gb_workspace_pane_set_transition_duration (GbWorkspacePane *self,
-                                                            guint            transition_duration);
-GtkPositionType  gb_workspace_pane_get_position            (GbWorkspacePane *self);
-void             gb_workspace_pane_set_position            (GbWorkspacePane *self,
-                                                            GtkPositionType  position);
+GtkWidget       *gb_workspace_pane_new          (void);
+GtkPositionType  gb_workspace_pane_get_position (GbWorkspacePane *self);
+void             gb_workspace_pane_set_position (GbWorkspacePane *self,
+                                                 GtkPositionType  position);
+void             gb_workspace_pane_add_page     (GbWorkspacePane *self,
+                                                 GtkWidget       *page,
+                                                 const gchar     *title,
+                                                 const gchar     *icon_name);
+void             gb_workspace_pane_remove_page  (GbWorkspacePane *self,
+                                                 GtkWidget       *page);
 
 G_END_DECLS
 


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