[nautilus-actions] FmaImportAssistant: restore menu tools



commit 69c5a48e426cfddedf55f80c3d9026115acc29ab
Author: Pierre Wieser <pwieser trychlos org>
Date:   Tue Feb 14 14:56:36 2017 +0100

    FmaImportAssistant: restore menu tools

 src/ui/Makefile.am            |    2 +
 src/ui/fma-assistant-import.c |    7 +++-
 src/ui/fma-menu-tools.c       |   82 +++++++++++++++++++++++++++++++++++++++++
 src/ui/fma-menu-tools.h       |   47 +++++++++++++++++++++++
 src/ui/fma-menu.c             |    9 +++-
 5 files changed, 143 insertions(+), 4 deletions(-)
---
diff --git a/src/ui/Makefile.am b/src/ui/Makefile.am
index 33446c1..1973306 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-tools.c                                                                        \
+       fma-menu-tools.h                                                                        \
        fma-menu-view.c                                                                         \
        fma-menu-view.h                                                                         \
        fma-preferences-editor.c                                                        \
diff --git a/src/ui/fma-assistant-import.c b/src/ui/fma-assistant-import.c
index fe5f8ee..44913d4 100644
--- a/src/ui/fma-assistant-import.c
+++ b/src/ui/fma-assistant-import.c
@@ -655,9 +655,14 @@ assistant_apply( BaseAssistant *wnd, GtkAssistant *assistant )
        g_return_if_fail( FMA_IS_ASSISTANT_IMPORT( wnd ));
 
        g_debug( "%s: window=%p, assistant=%p", thisfn, ( void * ) wnd, ( void * ) assistant );
+
        window = FMA_ASSISTANT_IMPORT( wnd );
        g_object_get( G_OBJECT( window ), BASE_PROP_MAIN_WINDOW, &main_window, NULL );
-       application = FMA_APPLICATION( base_window_get_application( main_window ));
+       application = FMA_APPLICATION( base_window_get_application( BASE_WINDOW( wnd )));
+       g_debug( "%s: main_window=%p (%s), application=%p (%s)",
+                       thisfn, main_window, main_window ? G_OBJECT_TYPE_NAME( main_window ) : "null",
+                       application, application ? G_OBJECT_TYPE_NAME( application ) : "null" );
+
        updater = fma_application_get_updater( application );
 
        memset( &importer_parms, '\0', sizeof( FMAImporterParms ));
diff --git a/src/ui/fma-menu-tools.c b/src/ui/fma-menu-tools.c
new file mode 100644
index 0000000..ba138f3
--- /dev/null
+++ b/src/ui/fma-menu-tools.c
@@ -0,0 +1,82 @@
+/*
+ * 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 "fma-assistant-export.h"
+#include "fma-assistant-import.h"
+#include "fma-menu.h"
+#include "fma-menu-tools.h"
+
+/**
+ * fma_menu_tools_update_sensitivities:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Update sensitivities on the Tools menu.
+ */
+void
+fma_menu_tools_update_sensitivities( FMAMainWindow *main_window )
+{
+       sMenuData *sdata;
+
+       sdata = fma_menu_get_data( main_window );
+
+       /* import item enabled if at least one writable provider */
+       fma_menu_enable_item( main_window, "import", sdata->has_writable_providers );
+
+       /* export item enabled if IActionsList store contains actions */
+       fma_menu_enable_item( main_window, "export", sdata->have_exportables );
+}
+
+/**
+ * fma_menu_tools_import:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Triggers the "Tools/Import assitant" item.
+ */
+void
+fma_menu_tools_import( FMAMainWindow *main_window )
+{
+       fma_assistant_import_run( main_window );
+}
+
+/**
+ * fma_menu_tools_export:
+ * @main_window: the #FMAMainWindow main window.
+ *
+ * Triggers the "Tools/Export assistant" item.
+ */
+void
+fma_menu_tools_export( FMAMainWindow *main_window )
+{
+       fma_assistant_export_run( main_window );
+}
+
diff --git a/src/ui/fma-menu-tools.h b/src/ui/fma-menu-tools.h
new file mode 100644
index 0000000..744aaa3
--- /dev/null
+++ b/src/ui/fma-menu-tools.h
@@ -0,0 +1,47 @@
+/*
+ * 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_TOOLS_H__
+#define __UI_FMA_MENU_TOOLS_H__
+
+#include "fma-main-window-def.h"
+
+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 );
+
+void fma_menu_tools_export              ( FMAMainWindow *main_window );
+
+G_END_DECLS
+
+#endif /* __UI_FMA_MENU_TOOLS_H__ */
diff --git a/src/ui/fma-menu.c b/src/ui/fma-menu.c
index 68bac0d..80fe046 100644
--- a/src/ui/fma-menu.c
+++ b/src/ui/fma-menu.c
@@ -40,10 +40,11 @@
 #include "fma-menu.h"
 #include "fma-menu-edit.h"
 #include "fma-menu-file.h"
+#include "fma-menu-tools.h"
 #include "fma-menu-view.h"
 /*
+#include "fma-menu-help.h"
 #include "fma-menu-maintainer.h"
-#include "fma-menu-tools.h"
 */
 #include "fma-preferences-editor.h"
 #include "fma-tree-view.h"
@@ -662,8 +663,8 @@ 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_tools_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 );*/
        }
 }
@@ -740,12 +741,14 @@ static void
 on_win_export( GSimpleAction *action, GVariant *parameter, gpointer user_data )
 {
        g_return_if_fail( user_data && FMA_IS_MAIN_WINDOW( user_data ));
+       fma_menu_tools_export( FMA_MAIN_WINDOW( user_data ));
 }
 
 static void
 on_win_import( GSimpleAction *action, GVariant *parameter, gpointer user_data )
 {
        g_return_if_fail( user_data && FMA_IS_MAIN_WINDOW( user_data ));
+       fma_menu_tools_import( FMA_MAIN_WINDOW( user_data ));
 }
 
 static void


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