[nautilus-actions/file-manager-actions] FmaMenuMaintainer: restore maintainer menu
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions/file-manager-actions] FmaMenuMaintainer: restore maintainer menu
- Date: Tue, 14 Feb 2017 16:49:30 +0000 (UTC)
commit 24d28cc6116af7d68c89dfc5effc533c78b6389b
Author: Pierre Wieser <pwieser trychlos org>
Date: Tue Feb 14 16:35:28 2017 +0100
FmaMenuMaintainer: restore maintainer menu
TODO | 10 +++-
src/ui/Makefile.am | 2 +
src/ui/fma-menu-file.c | 12 +++--
src/ui/fma-menu-maintainer.c | 124 ++++++++++++++++++++++++++++++++++++++++++
src/ui/fma-menu-maintainer.h | 51 +++++++++++++++++
src/ui/fma-menu-tools.h | 2 -
src/ui/fma-menu.c | 34 ++++++++----
7 files changed, 216 insertions(+), 19 deletions(-)
---
diff --git a/TODO b/TODO
index edaf8d4..7f85baf 100644
--- a/TODO
+++ b/TODO
@@ -241,10 +241,16 @@ xxxx 2017- 2-14 FMA-Message: base_gtk_utils_widget_set_color: to be written
xxxx 2017- 2-14 implement maintainer menu
-xxxx 2017- 2-14 implement help menu
-
xxxx 2017- 2-14 desktop file should be named fma-config-tool (same than the program)
+xxxx 2017- 2-14 fma-menu::on_app_help() help file should be named fma-config-tool (same than the program)
+
+xxxx 2017- 2-14 export assistant does not allow multiple selection
+
+xxxx 2017- 2-14 fma-ui.actions should be renamed fma-config-tool
+
+xxxx 2017- 2-14 does the 'tree-context' menu id still is useful ?
+
-----------------------------------------------------------------------
DONE
====
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 1973306..707614b 100644
--- a/src/ui/Makefile.am
+++ b/src/ui/Makefile.am
@@ -121,6 +121,8 @@ fma_config_tool_SOURCES = \
fma-menu-edit.h \
fma-menu-file.c \
fma-menu-file.h \
+ fma-menu-maintainer.c \
+ fma-menu-maintainer.h \
fma-menu-tools.c \
fma-menu-tools.h \
fma-menu-view.c \
diff --git a/src/ui/fma-menu-file.c b/src/ui/fma-menu-file.c
index a514b57..3ea1313 100644
--- a/src/ui/fma-menu-file.c
+++ b/src/ui/fma-menu-file.c
@@ -94,11 +94,13 @@ fma_menu_file_update_sensitivities( FMAMainWindow *main_window )
* we must have at least one writable provider
*/
new_item_enabled = sdata->is_parent_writable && sdata->has_writable_providers;
- g_debug( "%s: is_parent_writable=%s, has_writable_providers=%s, new_item_enabled=%s",
- thisfn,
- sdata->is_parent_writable ? "True":"False",
- sdata->has_writable_providers ? "True":"False",
- new_item_enabled ? "True":"False" );
+ if( 0 ){
+ g_debug( "%s: is_parent_writable=%s, has_writable_providers=%s, new_item_enabled=%s",
+ thisfn,
+ sdata->is_parent_writable ? "True":"False",
+ sdata->has_writable_providers ? "True":"False",
+ new_item_enabled ? "True":"False" );
+ }
fma_menu_enable_item( main_window, "new-menu", new_item_enabled );
fma_menu_enable_item( main_window, "new-action", new_item_enabled );
diff --git a/src/ui/fma-menu-maintainer.c b/src/ui/fma-menu-maintainer.c
new file mode 100644
index 0000000..055ee68
--- /dev/null
+++ b/src/ui/fma-menu-maintainer.c
@@ -0,0 +1,124 @@
+/*
+ * FileManager-Actions
+ * A file-manager extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
+ *
+ * FileManager-Actions is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * FileManager-Actions is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FileManager-Actions; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include "api/fma-object-api.h"
+
+#include "fma-clipboard.h"
+#include "fma-main-window.h"
+#include "fma-menu.h"
+#include "fma-menu-maintainer.h"
+#include "fma-tree-ieditable.h"
+
+/**
+ * fma_menu_maintainer_update_sensitivities:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Update sensitivities on the Maintainer menu.
+ */
+void
+fma_menu_maintainer_update_sensitivities( FMAMainWindow *main_window )
+{
+}
+
+/**
+ * fma_menu_maintainer_dump_selection:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Triggers the "Maintainer/Dump selection" item.
+ */
+void
+fma_menu_maintainer_dump_selection( FMAMainWindow *main_window )
+{
+ sMenuData *sdata;
+
+ sdata = fma_menu_get_data( main_window );
+
+ fma_object_dump_tree( sdata->selected_items );
+}
+
+/**
+ * fma_menu_maintainer_brief_tree_store_dump:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Triggers the "Maintainer/Brief treestore dump" item.
+ */
+void
+fma_menu_maintainer_brief_tree_store_dump( FMAMainWindow *main_window )
+{
+ FMATreeView *items_view;
+ GList *items;
+
+ items_view = fma_main_window_get_items_view( main_window );
+ items = fma_tree_view_get_items( items_view );
+ fma_object_dump_tree( items );
+ fma_object_free_items( items );
+}
+
+/**
+ * fma_menu_maintainer_list_modified_items:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Triggers the "Maintainer/List modified items" item.
+ */
+void
+fma_menu_maintainer_list_modified_items( FMAMainWindow *main_window )
+{
+ FMATreeView *items_view;
+
+ items_view = fma_main_window_get_items_view( main_window );
+ fma_tree_ieditable_dump_modified( FMA_TREE_IEDITABLE( items_view ));
+}
+
+/**
+ * fma_menu_maintainer_dump_clipboard:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Triggers the "Maintainer/Dump clipboard" item.
+ */
+void
+fma_menu_maintainer_dump_clipboard( FMAMainWindow *main_window )
+{
+ fma_clipboard_dump( fma_main_window_get_clipboard( main_window ));
+}
+
+/**
+ * fma_menu_maintainer_test_function:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Test a miscellaneous function.
+ */
+void
+fma_menu_maintainer_test_function( FMAMainWindow *main_window )
+{
+}
+
diff --git a/src/ui/fma-menu-maintainer.h b/src/ui/fma-menu-maintainer.h
new file mode 100644
index 0000000..ad49c2b
--- /dev/null
+++ b/src/ui/fma-menu-maintainer.h
@@ -0,0 +1,51 @@
+/*
+ * FileManager-Actions
+ * A file-manager extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006-2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009-2015 Pierre Wieser and others (see AUTHORS)
+ *
+ * FileManager-Actions is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * FileManager-Actions is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with FileManager-Actions; see the file COPYING. If not, see
+ * <http://www.gnu.org/licenses/>.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __UI_FMA_MENU_MAINTAINER_H__
+#define __UI_FMA_MENU_MAINTAINER_H__
+
+#include "fma-main-window-def.h"
+
+G_BEGIN_DECLS
+
+void fma_menu_maintainer_update_sensitivities ( FMAMainWindow *main_window );
+
+void fma_menu_maintainer_dump_selection ( FMAMainWindow *main_window );
+
+void fma_menu_maintainer_brief_tree_store_dump( FMAMainWindow *main_window );
+
+void fma_menu_maintainer_list_modified_items ( FMAMainWindow *main_window );
+
+void fma_menu_maintainer_dump_clipboard ( FMAMainWindow *main_window );
+
+void fma_menu_maintainer_test_function ( FMAMainWindow *main_window );
+
+G_END_DECLS
+
+#endif /* __UI_FMA_MENU_MAINTAINER_H__ */
diff --git a/src/ui/fma-menu-tools.h b/src/ui/fma-menu-tools.h
index 744aaa3..66a6db6 100644
--- a/src/ui/fma-menu-tools.h
+++ b/src/ui/fma-menu-tools.h
@@ -34,8 +34,6 @@
G_BEGIN_DECLS
-void fma_menu_tools_init ( FMAMainWindow *main_window );
-
void fma_menu_tools_update_sensitivities( FMAMainWindow *main_window );
void fma_menu_tools_import ( FMAMainWindow *main_window );
diff --git a/src/ui/fma-menu.c b/src/ui/fma-menu.c
index 80fe046..b706a89 100644
--- a/src/ui/fma-menu.c
+++ b/src/ui/fma-menu.c
@@ -40,18 +40,17 @@
#include "fma-menu.h"
#include "fma-menu-edit.h"
#include "fma-menu-file.h"
+#include "fma-menu-maintainer.h"
#include "fma-menu-tools.h"
#include "fma-menu-view.h"
-/*
-#include "fma-menu-help.h"
-#include "fma-menu-maintainer.h"
-*/
+
#include "fma-preferences-editor.h"
#include "fma-tree-view.h"
-static const gchar *st_uixml_actions = PKGUIDIR "/fma-ui.actions";
-static const gchar *st_ui_app_menu = "app-menu";
-static const gchar *st_ui_menubar = "menubar";
+static const gchar *st_uixml_actions = PKGUIDIR "/fma-ui.actions";
+static const gchar *st_ui_app_menu = "app-menu";
+static const gchar *st_ui_menubar = "menubar";
+static const gchar *st_ui_maintainer_menu = "maintainer";
static void on_app_about( GSimpleAction *action, GVariant *parameter, gpointer user_data );
static void on_app_help( GSimpleAction *action, GVariant *parameter, gpointer user_data );
@@ -229,6 +228,17 @@ fma_menu_app( FMAApplication *application )
gtk_application_set_menubar( GTK_APPLICATION( application ), menubar );
}
+#ifdef FMA_MAINTAINER_MODE
+ GMenuModel *maintainer_mm = G_MENU_MODEL( gtk_builder_get_object( builder,
st_ui_maintainer_menu ));
+ if( !maintainer_mm ){
+ g_warning( "%s: unable to find '%s' object in '%s' file",
+ thisfn, st_ui_maintainer_menu, st_uixml_actions );
+ } else {
+ gint count = g_menu_model_get_n_items( menubar );
+ g_menu_insert_submenu( G_MENU( menubar ), count-1, _( "_Maintainer" ), maintainer_mm
);
+ }
+#endif
+
} else {
g_warning( "%s: %s", thisfn, error->message );
g_error_free( error );
@@ -662,10 +672,9 @@ on_update_sensitivities( FMAMainWindow *window, void *empty )
fma_menu_file_update_sensitivities( window );
fma_menu_edit_update_sensitivities( window );
- fma_menu_view_update_sensitivities( window );
+ fma_menu_maintainer_update_sensitivities( window );
fma_menu_tools_update_sensitivities( window );
- /*fma_menu_maintainer_update_sensitivities( window );
- fma_menu_help_update_sensitivities( window );*/
+ fma_menu_view_update_sensitivities( window );
}
}
@@ -673,6 +682,7 @@ static void
on_win_brief_tree_store_dump( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
g_return_if_fail( user_data && FMA_IS_MAIN_WINDOW( user_data ));
+ fma_menu_maintainer_brief_tree_store_dump( FMA_MAIN_WINDOW( user_data ));
}
static void
@@ -711,12 +721,14 @@ static void
on_win_dump_clipboard( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
g_return_if_fail( user_data && FMA_IS_MAIN_WINDOW( user_data ));
+ fma_menu_maintainer_dump_clipboard( FMA_MAIN_WINDOW( user_data ));
}
static void
on_win_dump_selection( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
g_return_if_fail( user_data && FMA_IS_MAIN_WINDOW( user_data ));
+ fma_menu_maintainer_dump_selection( FMA_MAIN_WINDOW( user_data ));
}
static void
@@ -755,6 +767,7 @@ static void
on_win_list_modified_items( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
g_return_if_fail( user_data && FMA_IS_MAIN_WINDOW( user_data ));
+ fma_menu_maintainer_list_modified_items( FMA_MAIN_WINDOW( user_data ));
}
static void
@@ -810,6 +823,7 @@ static void
on_win_test_function( GSimpleAction *action, GVariant *parameter, gpointer user_data )
{
g_return_if_fail( user_data && FMA_IS_MAIN_WINDOW( user_data ));
+ fma_menu_maintainer_test_function( FMA_MAIN_WINDOW( user_data ));
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]