[nautilus-actions] Expand all/Collapse all menu items



commit 95f91f031f8707a841ea9123f91f1409499e84dd
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Sep 28 06:29:44 2009 +0200

    Expand all/Collapse all menu items

 ChangeLog                                     |    9 ++++++
 src/nact/nact-iactions-list.c                 |   38 ++++++++++++++++++++++++-
 src/nact/nact-iactions-list.h                 |    2 +
 src/nact/nact-main-menubar.c                  |   24 +++++++++++++++
 src/nact/nautilus-actions-config-tool.actions |    4 ++
 5 files changed, 76 insertions(+), 1 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 4d172ad..8784bc2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,12 +15,21 @@
 	* src/nact/nact-main-window.c:
 	Now implements the BaseIPrefs interface.
 
+	* src/nact/nact-iactions-list.c:
+	* src/nact/nact-iactions-list.h
+	(nact_iactions_list_collapse_all, nact_iactions_list_expand_all):
+	New functions.
+
 	* src/nact/nact-main-menubar.c (on_duplicate_activated):
 	Takes advantage of new UI preferences.
+	Define new Expand all/Collapse all menu items.
 
 	* src/nact/nact-preferences-editor.c:
 	Edit the new UI preferences.
 
+	* src/nact/nautilus-actions-config-tool.actions:
+	Define new View menu.
+
 	* src/nact/nautilus-actions-config-tool.ui:
 	Edit the user preferences in a notebook.
 
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 48b0246..28b4772 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -483,6 +483,24 @@ nact_iactions_list_dispose( NactIActionsList *instance )
 }
 
 /**
+ * nact_iactions_list_collapse_all:
+ * @instance: this #NactIActionsList implementation.
+ *
+ * Collapse all the tree hierarchy.
+ */
+void
+nact_iactions_list_collapse_all( NactIActionsList *instance )
+{
+	static const gchar *thisfn = "nact_iactions_list_collapse_all";
+	GtkTreeView *treeview;
+
+	g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+
+	treeview = get_actions_list_treeview( instance );
+	gtk_tree_view_collapse_all( treeview );
+}
+
+/**
  * nact_iactions_list_delete:
  * @window: this #NactIActionsList instance.
  * @list: list of #NAObject to be deleted.
@@ -527,8 +545,26 @@ nact_iactions_list_delete( NactIActionsList *instance, GList *items )
 }
 
 /**
+ * nact_iactions_list_expand_all:
+ * @instance: this #NactIActionsList implementation.
+ *
+ * Expand all the tree hierarchy.
+ */
+void
+nact_iactions_list_expand_all( NactIActionsList *instance )
+{
+	static const gchar *thisfn = "nact_iactions_list_expand_all";
+	GtkTreeView *treeview;
+
+	g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
+
+	treeview = get_actions_list_treeview( instance );
+	gtk_tree_view_expand_all( treeview );
+}
+
+/**
  * nact_iactions_list_fill:
- * @window: this #NactIActionsList instance.
+ * @instance: this #NactIActionsList instance.
  *
  * Fill the listbox with the provided list of items.
  *
diff --git a/src/nact/nact-iactions-list.h b/src/nact/nact-iactions-list.h
index accf080..f40140f 100644
--- a/src/nact/nact-iactions-list.h
+++ b/src/nact/nact-iactions-list.h
@@ -94,7 +94,9 @@ void      nact_iactions_list_runtime_init_toplevel( NactIActionsList *instance,
 void      nact_iactions_list_all_widgets_showed( NactIActionsList *instance );
 void      nact_iactions_list_dispose( NactIActionsList *instance );
 
+void      nact_iactions_list_collapse_all( NactIActionsList *instance );
 void      nact_iactions_list_delete( NactIActionsList *instance, GList *items );
+void      nact_iactions_list_expand_all( NactIActionsList *instance );
 void      nact_iactions_list_fill( NactIActionsList *instance, GList *items );
 NAObject *nact_iactions_list_get_item( NactIActionsList *instance, const gchar *uuid );
 GList    *nact_iactions_list_get_items( NactIActionsList *instance );
diff --git a/src/nact/nact-main-menubar.c b/src/nact/nact-main-menubar.c
index b3897d7..52af10f 100644
--- a/src/nact/nact-main-menubar.c
+++ b/src/nact/nact-main-menubar.c
@@ -87,6 +87,9 @@ static void     on_delete_activated( GtkAction *action, NactMainWindow *window )
 static void     on_reload_activated( GtkAction *action, NactMainWindow *window );
 static void     on_preferences_activated( GtkAction *action, NactMainWindow *window );
 
+static void     on_expand_all_activated( GtkAction *action, NactMainWindow *window );
+static void     on_collapse_all_activated( GtkAction *action, NactMainWindow *window );
+
 static void     on_import_activated( GtkAction *action, NactMainWindow *window );
 static void     on_export_activated( GtkAction *action, NactMainWindow *window );
 
@@ -106,6 +109,7 @@ static const GtkActionEntry entries[] = {
 
 		{ "FileMenu", NULL, N_( "_File" ) },
 		{ "EditMenu", NULL, N_( "_Edit" ) },
+		{ "ViewMenu", NULL, N_( "_View" ) },
 		{ "ToolsMenu", NULL, N_( "_Tools" ) },
 		{ "HelpMenu", NULL, N_( "_Help" ) },
 
@@ -157,6 +161,14 @@ static const GtkActionEntry entries[] = {
 				/* i18n: tooltip displayed in the status bar when selecting the 'Preferences' item */
 				N_( "Edit your preferences" ),
 				G_CALLBACK( on_preferences_activated ) },
+		{ "ExpandAllItem" , NULL, N_( "_Expand all" ), NULL,
+				/* i18n: tooltip displayed in the status bar when selecting the Expand all item */
+				N_( "Entirely expand the items hierarchy" ),
+				G_CALLBACK( on_expand_all_activated ) },
+		{ "CollapseAllItem" , NULL, N_( "_Collapse all" ), NULL,
+				/* i18n: tooltip displayed in the status bar when selecting the Collapse all item */
+				N_( "Entirely collapse the items hierarchy" ),
+				G_CALLBACK( on_collapse_all_activated ) },
 		{ "ImportItem" , GTK_STOCK_CONVERT, N_( "_Import assistant.." ), "",
 				/* i18n: tooltip displayed in the status bar when selecting the Import item */
 				N_( "Import one or more actions from external (XML) files into your configuration" ),
@@ -649,6 +661,18 @@ on_preferences_activated( GtkAction *gtk_action, NactMainWindow *window )
 }
 
 static void
+on_expand_all_activated( GtkAction *gtk_action, NactMainWindow *window )
+{
+	nact_iactions_list_expand_all( NACT_IACTIONS_LIST( window ));
+}
+
+static void
+on_collapse_all_activated( GtkAction *gtk_action, NactMainWindow *window )
+{
+	nact_iactions_list_collapse_all( NACT_IACTIONS_LIST( window ));
+}
+
+static void
 on_import_activated( GtkAction *gtk_action, NactMainWindow *window )
 {
 	nact_assistant_import_run( BASE_WINDOW( window ));
diff --git a/src/nact/nautilus-actions-config-tool.actions b/src/nact/nautilus-actions-config-tool.actions
index b1c1228..2ef3596 100644
--- a/src/nact/nautilus-actions-config-tool.actions
+++ b/src/nact/nautilus-actions-config-tool.actions
@@ -20,6 +20,10 @@
             <separator />
             <menuitem action="PreferencesItem" />
         </menu>
+        <menu action="ViewMenu">
+            <menuitem action="ExpandAllItem" />
+            <menuitem action="CollapseAllItem" />
+        </menu>
         <menu action="ToolsMenu">
             <menuitem action="ImportItem" />
             <menuitem action="ExportItem" />



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