[vinagre] Added new function vinagre_notebook_get_tabs().



commit b841b9fd729595a30e6d3da718c1482971a75101
Author: Jonh Wendell <jwendell gnome org>
Date:   Thu Aug 13 11:06:51 2009 -0300

    Added new function vinagre_notebook_get_tabs().
    
    It returns a list of all VinagreTabs in the notebook.

 vinagre/vinagre-notebook.c |   29 ++++++++++++++++++++++++++++-
 vinagre/vinagre-notebook.h |    2 ++
 2 files changed, 30 insertions(+), 1 deletions(-)
---
diff --git a/vinagre/vinagre-notebook.c b/vinagre/vinagre-notebook.c
index 4c10138..0d86698 100644
--- a/vinagre/vinagre-notebook.c
+++ b/vinagre/vinagre-notebook.c
@@ -38,6 +38,7 @@ struct _VinagreNotebookPrivate
   GtkUIManager  *manager;
   guint         ui_merge_id;
   VinagreTab    *active_tab;
+  GSList        *tabs;
 };
 
 /* Properties */
@@ -96,12 +97,27 @@ vinagre_notebook_set_property (GObject      *object,
 }
 
 static void
+vinagre_notebook_finalize (GObject *object)
+{
+  VinagreNotebook *nb = VINAGRE_NOTEBOOK (object);
+
+  if (nb->priv->tabs)
+    {
+      g_slist_free (nb->priv->tabs);
+      nb->priv->tabs = NULL;
+    }
+
+  G_OBJECT_CLASS (vinagre_notebook_parent_class)->finalize (object);
+}
+
+static void
 vinagre_notebook_class_init (VinagreNotebookClass *klass)
 {
   GObjectClass *object_class = G_OBJECT_CLASS (klass);
 
   object_class->get_property = vinagre_notebook_get_property;
   object_class->set_property = vinagre_notebook_set_property;
+  object_class->finalize = vinagre_notebook_finalize;
 
   g_object_class_install_property (object_class,
 				   PROP_WINDOW,
@@ -381,6 +397,7 @@ vinagre_notebook_init (VinagreNotebook *nb)
 {
   nb->priv = VINAGRE_NOTEBOOK_GET_PRIVATE (nb);
   nb->priv->active_tab = NULL;
+  nb->priv->tabs = NULL;
 
   gtk_notebook_set_scrollable (GTK_NOTEBOOK (nb), TRUE);
 
@@ -605,7 +622,8 @@ vinagre_notebook_add_tab (VinagreNotebook *nb,
   /* Unmerge the UI for the current tab */
   unmerge_tab_ui (nb);
 
-  nb->priv->active_tab = tab;  
+  nb->priv->active_tab = tab;
+  nb->priv->tabs = g_slist_append (nb->priv->tabs, tab);
   
   /* Merge the UI for the new tab */
   merge_tab_ui (nb);
@@ -678,6 +696,7 @@ vinagre_notebook_close_tab (VinagreNotebook *nb,
   position = gtk_notebook_get_current_page (notebook);
   nb->priv->active_tab = VINAGRE_TAB (gtk_notebook_get_nth_page (notebook,
 								 position));
+  nb->priv->tabs = g_slist_remove (nb->priv->tabs, tab);
 
   /* Merge the UI for the new tab (if one exists) */
   if (nb->priv->active_tab != previous_active_tab)
@@ -722,4 +741,12 @@ vinagre_notebook_get_active_tab (VinagreNotebook *nb)
   return nb->priv->active_tab;
 }
 
+GSList *
+vinagre_notebook_get_tabs (VinagreNotebook *nb)
+{
+  g_return_val_if_fail (VINAGRE_IS_NOTEBOOK (nb), NULL);
+
+  return nb->priv->tabs;
+}
+
 /* vim: set ts=8: */
diff --git a/vinagre/vinagre-notebook.h b/vinagre/vinagre-notebook.h
index afa52c6..314a6aa 100644
--- a/vinagre/vinagre-notebook.h
+++ b/vinagre/vinagre-notebook.h
@@ -64,6 +64,8 @@ void			vinagre_notebook_close_active_tab	(VinagreNotebook *nb);
 void			vinagre_notebook_show_hide_tabs		(VinagreNotebook *nb);
 
 VinagreTab *		vinagre_notebook_get_active_tab		(VinagreNotebook *nb);
+GSList *		vinagre_notebook_get_tabs		(VinagreNotebook *nb);
+
 G_END_DECLS
 
 #endif /* __VINAGRE_NOTEBOOK_H__ */



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