[nautilus-actions] Implement export function
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Subject: [nautilus-actions] Implement export function
- Date: Tue, 14 Jul 2009 18:49:41 +0000 (UTC)
commit 489b3cd8a36d2f55a82dc0b771478bccc5e5f793
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jul 3 17:38:55 2009 +0200
Implement export function
ChangeLog | 60 ++
src/common/Makefile.am | 13 -
src/common/na-action.c | 2 +-
src/common/na-action.h | 7 +
src/common/na-utils.c | 39 +
src/common/na-utils.h | 3 +
src/common/nautilus-actions-config-gconf-private.h | 112 ---
src/common/nautilus-actions-config-gconf-reader.c | 227 -----
src/common/nautilus-actions-config-gconf-reader.h | 68 --
src/common/nautilus-actions-config-gconf-writer.c | 274 ------
src/common/nautilus-actions-config-gconf-writer.h | 66 --
src/common/nautilus-actions-config-gconf.c | 382 --------
src/common/nautilus-actions-config-gconf.h | 71 --
src/common/nautilus-actions-config-schema-reader.c | 948 ------------------
src/common/nautilus-actions-config-schema-reader.h | 74 --
src/common/nautilus-actions-config-schema-writer.c | 396 --------
src/common/nautilus-actions-config-schema-writer.h | 67 --
src/common/nautilus-actions-config.c | 1015 --------------------
src/common/nautilus-actions-config.h | 202 ----
src/nact/Makefile.am | 6 +-
src/nact/base-window.c | 11 -
src/nact/base-window.h | 2 -
src/nact/nact-action-conditions-editor.c | 15 +-
src/nact/nact-gconf-schema-writer.c | 343 +++++++
src/nact/nact-gconf-schema-writer.h | 74 ++
src/nact/nact-gconf-schema.c | 144 +++
src/nact/nact-gconf-schema.h | 91 ++
src/nact/nact-iactions-list.c | 78 ++-
src/nact/nact-iactions-list.h | 2 +
src/nact/nact-import-export.c | 407 --------
src/nact/nact-import-export.h | 36 -
src/nact/nact-iprefs.c | 609 ++----------
src/nact/nact-iprefs.h | 68 +--
src/nact/nact-main-window.c | 258 +++++-
src/nact/nact-window.c | 12 +
src/nact/nact-window.h | 1 +
src/nact/nautilus-actions-config.ui | 252 +++---
37 files changed, 1298 insertions(+), 5137 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index d4cea74..e212049 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,63 @@
+2009-07-03 Pierre Wieser <pwieser trychlos org>
+
+ Export actions.
+
+ * src/common/nautilus-actions-config.c:
+ * src/common/nautilus-actions-config.h:
+ * src/common/nautilus-actions-config-gconf.c:
+ * src/common/nautilus-actions-config-gconf.h:
+ * src/common/nautilus-actions-config-gconf-private.h:
+ * src/common/nautilus-actions-config-gconf-reader.c:
+ * src/common/nautilus-actions-config-gconf-reader.h:
+ * src/common/nautilus-actions-config-gconf-writer.c:
+ * src/common/nautilus-actions-config-gconf-writer.h:
+ * src/common/nautilus-actions-config-schema-writer.c:
+ * src/common/nautilus-actions-config-schema-writer.h:
+ * src/common/nautilus-actions-config-schema-reader.c:
+ * src/common/nautilus-actions-config-schema-reader.h: Removed files.
+
+ * src/common/Makefile.am: Updated accordingly.
+
+ * src/common/na-action.h: Define an export format.
+
+ * src/common/na-utils.c:
+ * src/common/na-utils.h
+ (na_utils_gslist_to_schema, na_utils_boolean_to_schema):
+ New functions.
+
+ * src/nact/nact-import-export.c:
+ * src/nact/nact-import-export.h: Removed files.
+
+ * src/nact/nact-gconf-schema.c:
+ * src/nact/nact-gconf-schema.h:
+ * src/nact/nact-gconf-schema-writer.c:
+ * src/nact/nact-gconf-schema-writer.h: New files.
+
+ * src/nact/Makefile.am: Updated accordingly.
+
+ * src/nact/base-window.c:
+ * src/nact/base-window.h (base_window_connect):
+ Removed function.
+
+ * src/nact/nact-window.c:
+ * src/nact/nact-window.h
+ (nact_window_signal_connect_by_name): New function.
+
+ * src/nact/nact-action-conditions-editor.c
+ (nact_iprofile_conditions_initial_load): Use GtkBuilder size grouping.
+
+ * src/nact/nact-iactions-list.c:
+ * src/nact/nact-iactions-list.h
+ (nact_iactions_list_get_selected_actions,
+ nact_iactions_list_set_multiple_selection): New functions.
+
+ * src/nact/nact-iprefs.c:
+ * src/nact/nact-iprefs.h
+ (nact_iprefs_get_export_folder_uri,
+ nact_iprefs_save_export_folder_uri): New functions.
+
+ * src/nact/nact-main-window.c: Implement export function.
+
2009-07-02 Pierre Wieser <pwieser trychlos org>
* src/common/na-pivot.c (action_changed_handler):
diff --git a/src/common/Makefile.am b/src/common/Makefile.am
index 3a33881..b07e308 100644
--- a/src/common/Makefile.am
+++ b/src/common/Makefile.am
@@ -52,19 +52,6 @@ libnact_la_SOURCES = \
na-pivot.h \
na-utils.c \
na-utils.h \
- nautilus-actions-config.c \
- nautilus-actions-config.h \
- nautilus-actions-config-gconf.c \
- nautilus-actions-config-gconf.h \
- nautilus-actions-config-gconf-private.h \
- nautilus-actions-config-gconf-reader.c \
- nautilus-actions-config-gconf-reader.h \
- nautilus-actions-config-gconf-writer.c \
- nautilus-actions-config-gconf-writer.h \
- nautilus-actions-config-schema-writer.c \
- nautilus-actions-config-schema-writer.h \
- nautilus-actions-config-schema-reader.c \
- nautilus-actions-config-schema-reader.h \
$(NULL)
libnact_la_LIBADD = -lxml2 -luuid
diff --git a/src/common/na-action.c b/src/common/na-action.c
index b83532a..ba69033 100644
--- a/src/common/na-action.c
+++ b/src/common/na-action.c
@@ -841,7 +841,7 @@ free_profiles( NAAction *action )
* @list: a list of NAActionProfile objects.
*/
void
-na_action_free_profiles( GSList * list )
+na_action_free_profiles( GSList *list )
{
GSList *ip;
for( ip = list ; ip ; ip = ip->next ){
diff --git a/src/common/na-action.h b/src/common/na-action.h
index 18d5dcf..aa9abab 100644
--- a/src/common/na-action.h
+++ b/src/common/na-action.h
@@ -77,6 +77,13 @@ typedef struct {
#define PROP_ACTION_READONLY_STR "action-read-only"
#define PROP_ACTION_PROVIDER_STR "action-provider"
+/* export formats
+ * used to be only GConf schemas ('gconfschemafile' XML document)
+ */
+enum {
+ EXPORT_FORMAT_GCONFSCHEMAFILE = 1
+};
+
GType na_action_get_type( void );
NAAction *na_action_new( const gchar *uuid );
diff --git a/src/common/na-utils.c b/src/common/na-utils.c
index 5f5128c..2d4456d 100644
--- a/src/common/na-utils.c
+++ b/src/common/na-utils.c
@@ -202,6 +202,45 @@ na_utils_text_to_string_list( const gchar *text )
}
/**
+ * Converts a list of strings to a comma-separated list of strings,
+ * enclosed by brackets.
+ */
+gchar *
+na_utils_gslist_to_schema( GSList *list )
+{
+ GSList *ib;
+ gchar *tmp;
+ gchar *text = g_strdup( "" );
+
+ for( ib = list ; ib ; ib = ib->next ){
+ if( strlen( text )){
+ tmp = g_strdup_printf( "%s,", text );
+ g_free( text );
+ text = tmp;
+ }
+ tmp = g_strdup_printf( "%s%s", text, ( gchar * ) ib->data );
+ g_free( text );
+ text = tmp;
+ }
+
+ tmp = g_strdup_printf( "[%s]", text );
+ g_free( text );
+ text = tmp;
+
+ return( text );
+}
+
+/**
+ * Converts a boolean to the suitable string for a GConf schema
+ */
+gchar *
+na_utils_boolean_to_schema( gboolean b )
+{
+ gchar *text = g_strdup_printf( "%s", b ? "true" : "false" );
+ return( text );
+}
+
+/**
* Concatenates a gchar **list of strings to a GString.
*/
gchar *
diff --git a/src/common/na-utils.h b/src/common/na-utils.h
index d852ce3..fe13916 100644
--- a/src/common/na-utils.h
+++ b/src/common/na-utils.h
@@ -46,6 +46,9 @@ void na_utils_free_string_list( GSList *list );
gchar *na_utils_string_list_to_text( GSList *list );
GSList *na_utils_text_to_string_list( const gchar *text );
+gchar *na_utils_gslist_to_schema( GSList *list );
+gchar *na_utils_boolean_to_schema( gboolean b );
+
/*
* Some functions for GString manipulations.
*/
diff --git a/src/nact/Makefile.am b/src/nact/Makefile.am
index f1763e2..4df13bb 100644
--- a/src/nact/Makefile.am
+++ b/src/nact/Makefile.am
@@ -50,6 +50,10 @@ nautilus_actions_config_SOURCES = \
nact-action-profiles-editor.h \
nact-application.c \
nact-application.h \
+ nact-gconf-schema.c \
+ nact-gconf-schema.h \
+ nact-gconf-schema-writer.c \
+ nact-gconf-schema-writer.h \
nact-iactions-list.c \
nact-iactions-list.h \
nact-imenu-item.c \
@@ -63,8 +67,6 @@ nautilus_actions_config_SOURCES = \
nact-main-window.h \
nact-profile-conditions-editor.c \
nact-profile-conditions-editor.h \
- nact-import-export.c \
- nact-import-export.h \
nact-window.c \
nact-window.h \
$(NULL)
diff --git a/src/nact/base-window.c b/src/nact/base-window.c
index c0a4259..218090b 100644
--- a/src/nact/base-window.c
+++ b/src/nact/base-window.c
@@ -392,17 +392,6 @@ base_window_get_widget( BaseWindow *window, const gchar *name )
return( BASE_WINDOW_GET_CLASS( window )->get_widget( window, name ));
}
-/**
- * Connects a signal to a handler, assuring that the BaseWindow pointer
- * is passed as user data.
- */
-void
-base_window_connect( BaseWindow *window, const gchar *widget, const gchar *signal, GCallback handler )
-{
- GtkWidget *target = base_window_get_widget( window, widget );
- g_signal_connect( G_OBJECT( target ), signal, handler, window );
-}
-
static gchar *
v_get_toplevel_name( BaseWindow *window )
{
diff --git a/src/nact/base-window.h b/src/nact/base-window.h
index 6552287..66217b4 100644
--- a/src/nact/base-window.h
+++ b/src/nact/base-window.h
@@ -95,8 +95,6 @@ GObject *base_window_get_application( BaseWindow *window );
GtkWindow *base_window_get_dialog( BaseWindow *window, const gchar *name );
GtkWidget *base_window_get_widget( BaseWindow *window, const gchar *name );
-void base_window_connect( BaseWindow *window, const gchar *widget, const gchar *signal, GCallback handler );
-
void base_window_error_dlg( BaseWindow *window, GtkMessageType type, const gchar *primary, const gchar *secondary );
gboolean base_window_yesno_dlg( BaseWindow *window, GtkMessageType type, const gchar *first, const gchar *second );
diff --git a/src/nact/nact-action-conditions-editor.c b/src/nact/nact-action-conditions-editor.c
index c2b9245..6f1b489 100644
--- a/src/nact/nact-action-conditions-editor.c
+++ b/src/nact/nact-action-conditions-editor.c
@@ -263,9 +263,6 @@ action_conditions_editor_new( BaseApplication *application )
*
* @user_data: a pointer to the NAAction to edit, or NULL. If NULL, a
* new NAAction is created.
- *
- * Returns TRUE if the NAAction has been edited and saved, or FALSE if
- * there has been no modification at all.
*/
void
nact_action_conditions_editor_run_editor( NactWindow *parent, gpointer user_data )
@@ -334,12 +331,15 @@ on_initial_load_dialog( BaseWindow *dialog )
nact_iprofile_conditions_initial_load( NACT_WINDOW( window ), profile );
/* label alignements */
- GtkSizeGroup *label_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
+ /*GtkSizeGroup *label_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
nact_imenu_item_size_labels( NACT_WINDOW( window ), G_OBJECT( label_group ));
nact_iprofile_conditions_size_labels( NACT_WINDOW( window ), G_OBJECT( label_group ));
- g_object_unref( label_group );
+ g_object_unref( label_group );*/
- /* buttons size */
+ /* buttons size
+ * nb: while label sizing group works well with Glade 3.3 and GtkBuilder,
+ * it doesn't with button size - so sizing them by code
+ */
GtkSizeGroup *button_group = gtk_size_group_new( GTK_SIZE_GROUP_HORIZONTAL );
nact_imenu_item_size_buttons( NACT_WINDOW( window ), G_OBJECT( button_group ));
nact_iprofile_conditions_size_buttons( NACT_WINDOW( window ), G_OBJECT( button_group ));
@@ -368,8 +368,7 @@ on_runtime_init_dialog( BaseWindow *dialog )
NAActionProfile *profile = NA_ACTION_PROFILE( na_action_get_profiles( window->private->edited )->data );
nact_iprofile_conditions_runtime_init( NACT_WINDOW( window ), profile );
- GtkWidget *close_button = base_window_get_widget( dialog, "CancelButton" );
- nact_window_signal_connect( NACT_WINDOW( window ), G_OBJECT( close_button ), "clicked", G_CALLBACK( on_cancel_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "CancelButton", "clicked", G_CALLBACK( on_cancel_clicked ));
}
static void
diff --git a/src/nact/nact-gconf-schema-writer.c b/src/nact/nact-gconf-schema-writer.c
new file mode 100644
index 0000000..944c70d
--- /dev/null
+++ b/src/nact/nact-gconf-schema-writer.c
@@ -0,0 +1,343 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program 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.
+ *
+ * This Program 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 this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * 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 <libxml/tree.h>
+
+#include "nact-gconf-schema-writer.h"
+
+/* private class data
+ */
+struct NactGConfSchemaWriterClassPrivate {
+};
+
+/* private instance data
+ */
+struct NactGConfSchemaWriterPrivate {
+ gboolean dispose_has_run;
+ gchar *uuid;
+};
+
+static GObjectClass *st_parent_class = NULL;
+
+static GType register_type( void );
+static void class_init( NactGConfSchemaWriterClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *object );
+static void instance_finalize( GObject *object );
+
+static NactGConfSchemaWriter *gconf_schema_writer_new( void );
+static xmlDocPtr create_xml( NactGConfSchemaWriter *writer, NAAction *action );
+static void create_schema_entry(
+ NactGConfSchemaWriter *writer,
+ const gchar *profile_name,
+ const gchar *key,
+ const gchar *value,
+ xmlDocPtr doc,
+ xmlNodePtr list_node,
+ const gchar *type,
+ gboolean is_l10n_value );
+
+GType
+nact_gconf_schema_writer_get_type( void )
+{
+ static GType object_type = 0;
+
+ if( !object_type ){
+ object_type = register_type();
+ }
+
+ return( object_type );
+}
+
+static GType
+register_type( void )
+{
+ static GTypeInfo info = {
+ sizeof( NactGConfSchemaWriterClass ),
+ NULL,
+ NULL,
+ ( GClassInitFunc ) class_init,
+ NULL,
+ NULL,
+ sizeof( NactGConfSchemaWriter ),
+ 0,
+ ( GInstanceInitFunc ) instance_init
+ };
+
+ GType type = g_type_register_static( G_TYPE_OBJECT, "NactGConfSchemaWriter", &info, 0 );
+
+ return( type );
+}
+
+static void
+class_init( NactGConfSchemaWriterClass *klass )
+{
+ static const gchar *thisfn = "nact_gconf_schema_writer_class_init";
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ st_parent_class = g_type_class_peek_parent( klass );
+
+ GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class->dispose = instance_dispose;
+ object_class->finalize = instance_finalize;
+
+ klass->private = g_new0( NactGConfSchemaWriterClassPrivate, 1 );
+}
+
+static void
+instance_init( GTypeInstance *instance, gpointer klass )
+{
+ static const gchar *thisfn = "nact_gconf_schema_writer_instance_init";
+ g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+
+ g_assert( NACT_IS_GCONF_SCHEMA_WRITER( instance ));
+ NactGConfSchemaWriter *self = NACT_GCONF_SCHEMA_WRITER( instance );
+
+ self->private = g_new0( NactGConfSchemaWriterPrivate, 1 );
+
+ self->private->dispose_has_run = FALSE;
+}
+
+static void
+instance_dispose( GObject *object )
+{
+ g_assert( NACT_IS_GCONF_SCHEMA_WRITER( object ));
+ NactGConfSchemaWriter *self = NACT_GCONF_SCHEMA_WRITER( object );
+
+ if( !self->private->dispose_has_run ){
+
+ self->private->dispose_has_run = TRUE;
+
+ /* chain up to the parent class */
+ G_OBJECT_CLASS( st_parent_class )->dispose( object );
+ }
+}
+
+static void
+instance_finalize( GObject *object )
+{
+ g_assert( NACT_IS_GCONF_SCHEMA_WRITER( object ));
+ NactGConfSchemaWriter *self = NACT_GCONF_SCHEMA_WRITER( object );
+
+ g_free( self->private->uuid );
+
+ g_free( self->private );
+
+ /* chain call to parent class */
+ if( st_parent_class->finalize ){
+ G_OBJECT_CLASS( st_parent_class )->finalize( object );
+ }
+}
+
+static NactGConfSchemaWriter *
+gconf_schema_writer_new( void )
+{
+ return( g_object_new( NACT_GCONF_SCHEMA_WRITER_TYPE, NULL ));
+}
+
+static void
+gconf_schema_writer_set_uuid( NactGConfSchemaWriter *writer, const gchar *uuid )
+{
+ g_free( writer->private->uuid );
+ writer->private->uuid = g_strdup( uuid );
+}
+
+/**
+ * Export the specified action as a GConf schema.
+ */
+void
+nact_gconf_schema_writer_export( NAAction *action, const gchar *folder, gchar **msg )
+{
+ NactGConfSchemaWriter *writer = gconf_schema_writer_new();
+
+ gchar *uuid = na_action_get_uuid( action );
+ gconf_schema_writer_set_uuid( writer, uuid );
+ g_free( uuid );
+
+ xmlDocPtr doc = create_xml( writer, action );
+
+ /* generate the filename name and save the schema into it */
+ gchar *filename = g_strdup_printf( "%s/%s.schema", folder, writer->private->uuid );
+ xmlSaveFormatFileEnc( filename, doc, "UTF-8", 1 );
+ g_free( filename );
+
+ xmlFreeDoc (doc);
+ xmlCleanupParser();
+}
+
+static xmlDocPtr
+create_xml( NactGConfSchemaWriter *writer, NAAction *action )
+{
+ xmlDocPtr doc = xmlNewDoc( BAD_CAST( "1.0" ));
+ xmlNodePtr root_node = xmlNewNode( NULL, BAD_CAST( NACT_GCONF_XML_ROOT ));
+ xmlDocSetRootElement( doc, root_node );
+ xmlNodePtr list_node = xmlNewChild( root_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_LIST ), NULL );
+
+ /* version */
+ gchar *version = na_action_get_version( action );
+ create_schema_entry( writer, NULL, ACTION_VERSION_ENTRY, version, doc, list_node, "string", FALSE );
+ g_free( version );
+
+ /* label */
+ gchar *label = na_action_get_label( action );
+ create_schema_entry( writer, NULL, ACTION_LABEL_ENTRY, label, doc, list_node, "string", TRUE );
+ g_free( label );
+
+ /* tooltip */
+ gchar *tooltip = na_action_get_tooltip( action );
+ create_schema_entry( writer, NULL, ACTION_TOOLTIP_ENTRY, tooltip, doc, list_node, "string", TRUE );
+ g_free( tooltip );
+
+ /* icon name */
+ gchar *icon = na_action_get_icon( action );
+ create_schema_entry( writer, NULL, ACTION_ICON_ENTRY, icon, doc, list_node, "string", FALSE );
+ g_free( icon );
+
+ GSList *profiles = na_action_get_profiles( action );
+ GSList *ip;
+
+ for( ip = profiles ; ip ; ip = ip->next ){
+
+ NAActionProfile *profile = NA_ACTION_PROFILE( ip->data );
+ gchar *profile_dir = na_action_profile_get_name( profile );
+
+ /* profile label */
+ gchar *profile_label = na_action_profile_get_label( profile );
+ create_schema_entry( writer, profile_dir, ACTION_PROFILE_LABEL_ENTRY, profile_label, doc, list_node, "string", TRUE );
+ g_free( profile_label );
+
+ /* path */
+ gchar *path = na_action_profile_get_path( profile );
+ create_schema_entry( writer, profile_dir, ACTION_PATH_ENTRY, path, doc, list_node, "string", FALSE );
+ g_free( path );
+
+ /* parameters */
+ gchar *parameters = na_action_profile_get_parameters( profile );
+ create_schema_entry( writer, profile_dir, ACTION_PARAMETERS_ENTRY, parameters, doc, list_node, "string", FALSE );
+ g_free( parameters );
+
+ /* basenames */
+ GSList *basenames = na_action_profile_get_basenames( profile );
+ gchar *text = na_utils_gslist_to_schema( basenames );
+ create_schema_entry( writer, profile_dir, ACTION_BASENAMES_ENTRY, text, doc, list_node, "list", FALSE );
+ g_free( text );
+ na_utils_free_string_list( basenames );
+
+ /* match_case */
+ gboolean match = na_action_profile_get_matchcase( profile );
+ text = na_utils_boolean_to_schema( match );
+ create_schema_entry( writer, profile_dir, ACTION_MATCHCASE_ENTRY, text, doc, list_node, "bool", FALSE );
+ g_free( text );
+
+ /* mimetypes */
+ GSList *mimetypes = na_action_profile_get_mimetypes( profile );
+ text = na_utils_gslist_to_schema( mimetypes );
+ create_schema_entry( writer, profile_dir, ACTION_MIMETYPES_ENTRY, text, doc, list_node, "list", FALSE );
+ g_free( text );
+ na_utils_free_string_list( mimetypes );
+
+ /* is_file */
+ gboolean isfile = na_action_profile_get_is_file( profile );
+ text = na_utils_boolean_to_schema( isfile );
+ create_schema_entry( writer, profile_dir, ACTION_ISFILE_ENTRY, text, doc, list_node, "bool", FALSE );
+ g_free( text );
+
+ /* is_dir */
+ gboolean isdir = na_action_profile_get_is_dir( profile );
+ text = na_utils_boolean_to_schema( isdir );
+ create_schema_entry( writer, profile_dir, ACTION_ISDIR_ENTRY, text, doc, list_node, "bool", FALSE );
+ g_free( text );
+
+ /* accept-multiple-files */
+ gboolean mutiple = na_action_profile_get_multiple( profile );
+ text = na_utils_boolean_to_schema( mutiple );
+ create_schema_entry( writer, profile_dir, ACTION_MULTIPLE_ENTRY, text, doc, list_node, "bool", FALSE );
+ g_free( text );
+
+ /* schemes */
+ GSList *schemes = na_action_profile_get_schemes( profile );
+ text = na_utils_gslist_to_schema( schemes );
+ create_schema_entry( writer, profile_dir, ACTION_SCHEMES_ENTRY, text, doc, list_node, "list", FALSE );
+ g_free( text );
+ na_utils_free_string_list( schemes );
+
+ g_free( profile_dir );
+ }
+
+ return( doc );
+}
+
+static void
+create_schema_entry( NactGConfSchemaWriter *writer,
+ const gchar *profile_name, const gchar *key, const gchar *value,
+ xmlDocPtr doc, xmlNodePtr list_node, const gchar *type, gboolean is_l10n_value )
+{
+ gchar *path = NULL;
+ if( profile_name ){
+ path = g_build_path( "/", NA_GCONF_CONFIG_PATH, writer->private->uuid, profile_name, key, NULL );
+ } else {
+ path = g_build_path( "/", NA_GCONF_CONFIG_PATH, writer->private->uuid, key, NULL );
+ }
+
+ xmlNodePtr schema_node = xmlNewChild( list_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_ENTRY ), NULL );
+
+ xmlChar *content = BAD_CAST( g_build_path( "/", NACT_GCONF_SCHEMA_PREFIX, path, NULL ));
+ xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_KEY ), content );
+ xmlFree( content );
+
+ xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_APPLYTO ), BAD_CAST( path ));
+
+ xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_TYPE ), BAD_CAST( type ));
+
+ if( !g_ascii_strcasecmp( type, "list" )){
+ xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_LIST_TYPE ), BAD_CAST( "string" ));
+ }
+
+ /* if the default value must be localized, put it in the <locale> element
+ */
+ xmlNodePtr value_root_node = schema_node;
+ if( is_l10n_value ){
+ xmlNodePtr locale_node = xmlNewChild( schema_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_LOCALE ), NULL );
+ xmlNewProp( locale_node, BAD_CAST( "name" ), BAD_CAST( "C" ));
+ value_root_node = locale_node;
+ }
+
+ /* encode special chars <, >, &, ...
+ */
+ xmlChar *encoded_content = xmlEncodeSpecialChars( doc, BAD_CAST( value ));
+ xmlNewChild( value_root_node, NULL, BAD_CAST( NACT_GCONF_XML_SCHEMA_DFT ), encoded_content );
+ xmlFree( encoded_content );
+
+ g_free( path );
+}
diff --git a/src/nact/nact-gconf-schema-writer.h b/src/nact/nact-gconf-schema-writer.h
new file mode 100644
index 0000000..7b8cf7b
--- /dev/null
+++ b/src/nact/nact-gconf-schema-writer.h
@@ -0,0 +1,74 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program 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.
+ *
+ * This Program 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 this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __NACT_GCONF_SCHEMA_WRITER_H__
+#define __NACT_GCONF_SCHEMA_WRITER_H__
+
+/*
+ * NactGConfSchemaWriter class definition.
+ *
+ * This is the base class for importing into and exporting from GConf
+ * storage subsystem.
+ */
+
+#include "nact-gconf-schema.h"
+
+G_BEGIN_DECLS
+
+#define NACT_GCONF_SCHEMA_WRITER_TYPE ( nact_gconf_schema_writer_get_type())
+#define NACT_GCONF_SCHEMA_WRITER( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_GCONF_SCHEMA_WRITER_TYPE, NactGConfSchemaWriter ))
+#define NACT_GCONF_SCHEMA_WRITER_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_GCONF_SCHEMA_WRITER_TYPE, NactGConfSchemaWriterClass ))
+#define NACT_IS_GCONF_SCHEMA_WRITER( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_GCONF_SCHEMA_WRITER_TYPE ))
+#define NACT_IS_GCONF_SCHEMA_WRITER_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_GCONF_SCHEMA_WRITER_TYPE ))
+#define NACT_GCONF_SCHEMA_WRITER_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_GCONF_SCHEMA_WRITER_TYPE, NactGConfSchemaWriterClass ))
+
+typedef struct NactGConfSchemaWriterPrivate NactGConfSchemaWriterPrivate;
+
+typedef struct {
+ NactGConfSchema parent;
+ NactGConfSchemaWriterPrivate *private;
+}
+ NactGConfSchemaWriter;
+
+typedef struct NactGConfSchemaWriterClassPrivate NactGConfSchemaWriterClassPrivate;
+
+typedef struct {
+ NactGConfSchemaClass parent;
+ NactGConfSchemaWriterClassPrivate *private;
+}
+ NactGConfSchemaWriterClass;
+
+GType nact_gconf_schema_writer_get_type( void );
+
+void nact_gconf_schema_writer_export( NAAction *action, const gchar *folder, gchar **msg );
+
+G_END_DECLS
+
+#endif /* __NACT_GCONF_SCHEMA_WRITER_H__ */
diff --git a/src/nact/nact-gconf-schema.c b/src/nact/nact-gconf-schema.c
new file mode 100644
index 0000000..9f9e3af
--- /dev/null
+++ b/src/nact/nact-gconf-schema.c
@@ -0,0 +1,144 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program 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.
+ *
+ * This Program 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 this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * 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 "nact-gconf-schema.h"
+
+/* private class data
+ */
+struct NactGConfSchemaClassPrivate {
+};
+
+/* private instance data
+ */
+struct NactGConfSchemaPrivate {
+ gboolean dispose_has_run;
+};
+
+static GObjectClass *st_parent_class = NULL;
+
+static GType register_type( void );
+static void class_init( NactGConfSchemaClass *klass );
+static void instance_init( GTypeInstance *instance, gpointer klass );
+static void instance_dispose( GObject *object );
+static void instance_finalize( GObject *object );
+
+GType
+nact_gconf_schema_get_type( void )
+{
+ static GType object_type = 0;
+
+ if( !object_type ){
+ object_type = register_type();
+ }
+
+ return( object_type );
+}
+
+static GType
+register_type( void )
+{
+ static GTypeInfo info = {
+ sizeof( NactGConfSchemaClass ),
+ NULL,
+ NULL,
+ ( GClassInitFunc ) class_init,
+ NULL,
+ NULL,
+ sizeof( NactGConfSchema ),
+ 0,
+ ( GInstanceInitFunc ) instance_init
+ };
+
+ GType type = g_type_register_static( G_TYPE_OBJECT, "NactGConfSchema", &info, 0 );
+
+ return( type );
+}
+
+static void
+class_init( NactGConfSchemaClass *klass )
+{
+ static const gchar *thisfn = "nact_gconf_schema_class_init";
+ g_debug( "%s: klass=%p", thisfn, klass );
+
+ st_parent_class = g_type_class_peek_parent( klass );
+
+ GObjectClass *object_class = G_OBJECT_CLASS( klass );
+ object_class->dispose = instance_dispose;
+ object_class->finalize = instance_finalize;
+
+ klass->private = g_new0( NactGConfSchemaClassPrivate, 1 );
+}
+
+static void
+instance_init( GTypeInstance *instance, gpointer klass )
+{
+ static const gchar *thisfn = "nact_gconf_schema_instance_init";
+ g_debug( "%s: instance=%p, klass=%p", thisfn, instance, klass );
+
+ g_assert( NACT_IS_GCONF_SCHEMA( instance ));
+ NactGConfSchema *self = NACT_GCONF_SCHEMA( instance );
+
+ self->private = g_new0( NactGConfSchemaPrivate, 1 );
+
+ self->private->dispose_has_run = FALSE;
+}
+
+static void
+instance_dispose( GObject *object )
+{
+ g_assert( NACT_IS_GCONF_SCHEMA( object ));
+ NactGConfSchema *self = NACT_GCONF_SCHEMA( object );
+
+ if( !self->private->dispose_has_run ){
+
+ self->private->dispose_has_run = TRUE;
+
+ /* chain up to the parent class */
+ G_OBJECT_CLASS( st_parent_class )->dispose( object );
+ }
+}
+
+static void
+instance_finalize( GObject *object )
+{
+ g_assert( NACT_IS_GCONF_SCHEMA( object ));
+ NactGConfSchema *self = NACT_GCONF_SCHEMA( object );
+
+ g_free( self->private );
+
+ /* chain call to parent class */
+ if( st_parent_class->finalize ){
+ G_OBJECT_CLASS( st_parent_class )->finalize( object );
+ }
+}
diff --git a/src/nact/nact-gconf-schema.h b/src/nact/nact-gconf-schema.h
new file mode 100644
index 0000000..3cac6db
--- /dev/null
+++ b/src/nact/nact-gconf-schema.h
@@ -0,0 +1,91 @@
+/*
+ * Nautilus Actions
+ * A Nautilus extension which offers configurable context menu actions.
+ *
+ * Copyright (C) 2005 The GNOME Foundation
+ * Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
+ * Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
+ *
+ * This Program 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.
+ *
+ * This Program 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 this Library; see the file COPYING. If not,
+ * write to the Free Software Foundation, Inc., 59 Temple Place,
+ * Suite 330, Boston, MA 02111-1307, USA.
+ *
+ * Authors:
+ * Frederic Ruaudel <grumz grumz net>
+ * Rodrigo Moya <rodrigo gnome-db org>
+ * Pierre Wieser <pwieser trychlos org>
+ * ... and many others (see AUTHORS)
+ */
+
+#ifndef __NACT_GCONF_SCHEMA_H__
+#define __NACT_GCONF_SCHEMA_H__
+
+/*
+ * NactGConfSchema class definition.
+ *
+ * This is the base class for importing into and exporting from GConf
+ * storage subsystem.
+ */
+
+#include <glib-object.h>
+
+#include <common/na-action.h>
+#include <common/na-action-profile.h>
+#include <common/na-gconf-keys.h>
+#include <common/na-utils.h>
+
+G_BEGIN_DECLS
+
+#define NACT_GCONF_SCHEMA_TYPE ( nact_gconf_schema_get_type())
+#define NACT_GCONF_SCHEMA( object ) ( G_TYPE_CHECK_INSTANCE_CAST( object, NACT_GCONF_SCHEMA_TYPE, NactGConfSchema ))
+#define NACT_GCONF_SCHEMA_CLASS( klass ) ( G_TYPE_CHECK_CLASS_CAST( klass, NACT_GCONF_SCHEMA_TYPE, NactGConfSchemaClass ))
+#define NACT_IS_GCONF_SCHEMA( object ) ( G_TYPE_CHECK_INSTANCE_TYPE( object, NACT_GCONF_SCHEMA_TYPE ))
+#define NACT_IS_GCONF_SCHEMA_CLASS( klass ) ( G_TYPE_CHECK_CLASS_TYPE(( klass ), NACT_GCONF_SCHEMA_TYPE ))
+#define NACT_GCONF_SCHEMA_GET_CLASS( object ) ( G_TYPE_INSTANCE_GET_CLASS(( object ), NACT_GCONF_SCHEMA_TYPE, NactGConfSchemaClass ))
+
+typedef struct NactGConfSchemaPrivate NactGConfSchemaPrivate;
+
+typedef struct {
+ GObject parent;
+ NactGConfSchemaPrivate *private;
+}
+ NactGConfSchema;
+
+typedef struct NactGConfSchemaClassPrivate NactGConfSchemaClassPrivate;
+
+typedef struct {
+ GObjectClass parent;
+ NactGConfSchemaClassPrivate *private;
+}
+ NactGConfSchemaClass;
+
+/* GConf XML element names
+ */
+#define NACT_GCONF_XML_ROOT "gconfschemafile"
+#define NACT_GCONF_XML_SCHEMA_LIST "schemalist"
+#define NACT_GCONF_XML_SCHEMA_ENTRY "schema"
+#define NACT_GCONF_XML_SCHEMA_KEY "key"
+#define NACT_GCONF_XML_SCHEMA_APPLYTO "applyto"
+#define NACT_GCONF_XML_SCHEMA_TYPE "type"
+#define NACT_GCONF_XML_SCHEMA_LOCALE "locale"
+#define NACT_GCONF_XML_SCHEMA_DFT "default"
+#define NACT_GCONF_XML_SCHEMA_LIST_TYPE "list_type"
+
+#define NACT_GCONF_SCHEMA_PREFIX "/schemas"
+
+GType nact_gconf_schema_get_type( void );
+
+G_END_DECLS
+
+#endif /* __NACT_GCONF_SCHEMA_H__ */
diff --git a/src/nact/nact-iactions-list.c b/src/nact/nact-iactions-list.c
index 275ac3f..797db99 100644
--- a/src/nact/nact-iactions-list.c
+++ b/src/nact/nact-iactions-list.c
@@ -56,8 +56,9 @@ enum {
/* data set against GObject
*/
-#define SEND_SELECTION_CHANGED_MESSAGE "iactions-list-send-selection-changed-message"
+#define ACCEPT_MULTIPLE_SELECTION "iactions-list-accept-multiple-selection"
#define IS_FILLING_LIST "iactions-list-is-filling-list"
+#define SEND_SELECTION_CHANGED_MESSAGE "iactions-list-send-selection-changed-message"
static GType register_type( void );
static void interface_base_init( NactIActionsListInterface *klass );
@@ -261,23 +262,63 @@ nact_iactions_list_set_focus( NactWindow *window )
GObject *
nact_iactions_list_get_selected_action( NactWindow *window )
{
- GObject *action = NULL;
+ GSList *list = nact_iactions_list_get_selected_actions( window );
- GtkWidget *list = get_actions_list_widget( window );
- GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
+ GObject *action = G_OBJECT( list->data );
+
+ g_slist_free( list );
+
+ return( action );
+}
+
+/**
+ * Returns the currently selected actions when in export mode.
+ *
+ * The returned GSList should be freed by the caller (g_slist_free),
+ * without freing not unref any of the contained objects.
+ */
+GSList *
+nact_iactions_list_get_selected_actions( NactWindow *window )
+{
+ GSList *actions = NULL;
+
+ GtkWidget *treeview = get_actions_list_widget( window );
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( treeview ));
- GtkTreeIter iter;
GtkTreeModel *model;
+ GtkTreeIter iter;
+ gchar *uuid;
+ GList *it;
- if( gtk_tree_selection_get_selected( selection, &model, &iter )){
+ GList *listrows = gtk_tree_selection_get_selected_rows( selection, &model );
+ for( it = listrows ; it ; it = it->next ){
+ GtkTreePath *path = ( GtkTreePath * ) it->data;
+ gtk_tree_model_get_iter( model, &iter, path );
- gchar *uuid;
gtk_tree_model_get( model, &iter, IACTIONS_LIST_UUID_COLUMN, &uuid, -1 );
- action = nact_window_get_action( window, uuid );
+ NAAction *action = NA_ACTION( nact_window_get_action( window, uuid ));
+ actions = g_slist_prepend( actions, action );
g_free (uuid);
}
- return( action );
+ g_list_foreach( listrows, ( GFunc ) gtk_tree_path_free, NULL );
+ g_list_free( listrows );
+
+ return( actions );
+}
+
+/**
+ * Does the IActionsList box support multiple selection ?
+ */
+void
+nact_iactions_list_set_multiple_selection( NactWindow *window, gboolean multiple )
+{
+ g_assert( NACT_IS_IACTIONS_LIST( window ));
+ g_object_set_data( G_OBJECT( window ), ACCEPT_MULTIPLE_SELECTION, GINT_TO_POINTER( multiple ));
+
+ GtkWidget *list = get_actions_list_widget( window );
+ GtkTreeSelection *selection = gtk_tree_view_get_selection( GTK_TREE_VIEW( list ));
+ gtk_tree_selection_set_mode( selection, multiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE );
}
/**
@@ -410,27 +451,28 @@ do_runtime_init_widget( NactWindow *window )
g_assert( BASE_IS_WINDOW( window ));
GtkWidget *widget = get_actions_list_widget( window );
+ g_assert( GTK_IS_WIDGET( widget ));
/* set up selection */
- g_signal_connect(
+ nact_window_signal_connect(
+ window,
G_OBJECT( gtk_tree_view_get_selection( GTK_TREE_VIEW( widget ))),
"changed",
- G_CALLBACK( v_on_selection_changed ),
- window );
+ G_CALLBACK( v_on_selection_changed ));
/* catch press 'Enter' */
- g_signal_connect(
+ nact_window_signal_connect(
+ window,
G_OBJECT( widget ),
"key-press-event",
- G_CALLBACK( v_on_key_press_event ),
- window );
+ G_CALLBACK( v_on_key_press_event ));
/* catch double-click */
- g_signal_connect(
+ nact_window_signal_connect(
+ window,
G_OBJECT( widget ),
"button-press-event",
- G_CALLBACK( v_on_button_press_event ),
- window );
+ G_CALLBACK( v_on_button_press_event ));
}
static void
diff --git a/src/nact/nact-iactions-list.h b/src/nact/nact-iactions-list.h
index 3f53ff6..57a7ee4 100644
--- a/src/nact/nact-iactions-list.h
+++ b/src/nact/nact-iactions-list.h
@@ -76,9 +76,11 @@ void nact_iactions_list_initial_load( NactWindow *window );
void nact_iactions_list_runtime_init( NactWindow *window );
void nact_iactions_list_fill( NactWindow *window );
GObject *nact_iactions_list_get_selected_action( NactWindow *window );
+GSList *nact_iactions_list_get_selected_actions( NactWindow *window );
void nact_iactions_list_set_selection( NactWindow *window, const gchar *uuid, const gchar *label );
void nact_iactions_list_set_focus( NactWindow *window );
+void nact_iactions_list_set_multiple_selection( NactWindow *window, gboolean multiple );
void nact_iactions_list_set_send_selection_changed_on_fill_list( NactWindow *window, gboolean send_message );
void nact_iactions_list_set_is_filling_list( NactWindow *window, gboolean is_filling );
diff --git a/src/nact/nact-iprefs.c b/src/nact/nact-iprefs.c
index 492727a..3a7d719 100644
--- a/src/nact/nact-iprefs.c
+++ b/src/nact/nact-iprefs.c
@@ -33,6 +33,9 @@
#include <config.h>
#endif
+#include <gconf/gconf.h>
+#include <gconf/gconf-client.h>
+
#include "nact-iprefs.h"
/* private interface data
@@ -45,9 +48,11 @@ struct NactIPrefsInterfacePrivate {
*/
#define NA_GCONF_PREFS_PATH NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR "/preferences"
-/* key to read/write the last visited folder when browsing for command
+/* key to read/write the last visited folder when browsing for a file
*/
#define IPREFS_IPROFILE_CONDITION_FOLDER_URI "iprofile-conditions-folder-uri"
+#define IPREFS_IMPORT_ACTIONS_FOLDER_URI "main-window-import-folder-uri"
+#define IPREFS_EXPORT_ACTIONS_FOLDER_URI "main-window-export-folder-uri"
static GType register_type( void );
static void interface_base_init( NactIPrefsInterface *klass );
@@ -60,6 +65,8 @@ static void write_key_listint( NactWindow *window, const gchar *key, GSList *
static void listint_to_position( NactWindow *window, GSList *list, gint *x, gint *y, gint *width, gint *height );
static GSList *position_to_listint( NactWindow *window, gint x, gint y, gint width, gint height );
static void free_listint( GSList *list );
+static gchar *read_key_str( NactWindow *window, const gchar *key );
+static void save_key_str( NactWindow *window, const gchar *key, const gchar *text );
GType
nact_iprefs_get_type( void )
@@ -217,6 +224,67 @@ nact_iprefs_save_named_window_position( NactWindow *window, GtkWindow *toplevel,
}
}
+/**
+ * Save the last visited folder when browsing for command in
+ * IProfileConditions interface.
+ *
+ * @window: this NactWindow-derived window.
+ *
+ * Returns the last visited folder if any, or NULL.
+ * The returned string must be g_free by the caller.
+ */
+gchar *
+nact_iprefs_get_iprofile_conditions_folder_uri( NactWindow *window )
+{
+ return( read_key_str( window, IPREFS_IPROFILE_CONDITION_FOLDER_URI ));
+}
+
+void
+nact_iprefs_save_iprofile_conditions_folder_uri( NactWindow *window, const gchar *uri )
+{
+ save_key_str( window, IPREFS_IPROFILE_CONDITION_FOLDER_URI, uri );
+}
+
+/**
+ * Save the last visited folder when importing an action.
+ *
+ * @window: this NactWindow-derived window.
+ *
+ * Returns the last visited folder if any, or NULL.
+ * The returned string must be g_free by the caller.
+ */
+gchar *
+nact_iprefs_get_import_folder_uri( NactWindow *window )
+{
+ return( read_key_str( window, IPREFS_IMPORT_ACTIONS_FOLDER_URI ));
+}
+
+void
+nact_iprefs_save_import_folder_uri( NactWindow *window, const gchar *uri )
+{
+ save_key_str( window, IPREFS_IMPORT_ACTIONS_FOLDER_URI, uri );
+}
+
+/**
+ * Save the last visited folder when exporting an action.
+ *
+ * @window: this NactWindow-derived window.
+ *
+ * Returns the last visited folder if any, or NULL.
+ * The returned string must be g_free by the caller.
+ */
+gchar *
+nact_iprefs_get_export_folder_uri( NactWindow *window )
+{
+ return( read_key_str( window, IPREFS_EXPORT_ACTIONS_FOLDER_URI ));
+}
+
+void
+nact_iprefs_save_export_folder_uri( NactWindow *window, const gchar *uri )
+{
+ save_key_str( window, IPREFS_EXPORT_ACTIONS_FOLDER_URI, uri );
+}
+
static gchar *
v_get_iprefs_window_id( NactWindow *window )
{
@@ -329,549 +397,38 @@ free_listint( GSList *list )
g_slist_free( list );
}
-/**
- * Save the last visited folder when browsing for command in
- * IProfileConditions interface.
- *
- * @window: this NactWindow-derived window.
- *
- * Returns the last visited folder if any, or NULL.
- * The returned string must be g_free by the caller.
- */
-gchar *
-nact_iprefs_get_iprofile_conditions_folder_uri( NactWindow *window )
+static gchar *
+read_key_str( NactWindow *window, const gchar *key )
{
- static const gchar *thisfn = "nact_iprefs_get_iprofile_conditions_folder_uri";
+ static const gchar *thisfn = "nact_iprefs_read_key_str";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, IPREFS_IPROFILE_CONDITION_FOLDER_URI );
+ gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
- gchar *uri = gconf_client_get_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, &error );
+ gchar *text = gconf_client_get_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, &error );
if( error ){
- g_warning( "%s: %s", thisfn, error->message );
+ g_warning( "%s: key=%s, %s", thisfn, key, error->message );
g_error_free( error );
- uri = NULL;
+ text = NULL;
}
g_free( path );
- return( uri );
+ return( text );
}
-void
-nact_iprefs_save_iprofile_conditions_folder_uri( NactWindow *window, const gchar *uri )
+static void
+save_key_str( NactWindow *window, const gchar *key, const gchar *text )
{
- static const gchar *thisfn = "nact_iprefs_save_iprofile_conditions_folder_uri";
+ static const gchar *thisfn = "nact_iprefs_save_key_str";
GError *error = NULL;
- gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, IPREFS_IPROFILE_CONDITION_FOLDER_URI );
+ gchar *path = g_strdup_printf( "%s/%s", NA_GCONF_PREFS_PATH, key );
- gconf_client_set_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, uri, &error );
+ gconf_client_set_string( NACT_IPREFS_GET_INTERFACE( window )->private->client, path, text, &error );
if( error ){
- g_warning( "%s: %s", thisfn, error->message );
+ g_warning( "%s: key=%s, %s", thisfn, key, error->message );
g_error_free( error );
}
g_free( path );
}
-
-/* ... */
-#include <glib/gi18n.h>
-
-/* List of gconf keys */
-#define PREFS_SCHEMES "nact_schemes_list"
-#define PREFS_MAIN_X "nact_main_dialog_position_x"
-#define PREFS_MAIN_Y "nact_main_dialog_position_y"
-#define PREFS_MAIN_W "nact_main_dialog_size_width"
-#define PREFS_MAIN_H "nact_main_dialog_size_height"
-#define PREFS_EDIT_X "nact_edit_dialog_position_x"
-#define PREFS_EDIT_Y "nact_edit_dialog_position_y"
-#define PREFS_EDIT_W "nact_edit_dialog_size_width"
-#define PREFS_EDIT_H "nact_edit_dialog_size_height"
-#define PREFS_IM_EX_X "nact_im_ex_dialog_position_x"
-#define PREFS_IM_EX_Y "nact_im_ex_dialog_position_y"
-#define PREFS_IM_EX_W "nact_im_ex_dialog_size_width"
-#define PREFS_IM_EX_H "nact_im_ex_dialog_size_height"
-#define PREFS_ICON_PATH "nact_icon_last_browsed_dir"
-#define PREFS_PATH_PATH "nact_path_last_browsed_dir"
-#define PREFS_IMPORT_PATH "nact_import_last_browsed_dir"
-#define PREFS_EXPORT_PATH "nact_export_last_browsed_dir"
-
-static GSList *
-get_prefs_list_key (GConfClient *client, const gchar *key)
-{
- gchar *fullkey;
- GSList *l;
-
- fullkey = g_strdup_printf ("%s/%s", NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, key);
- l = gconf_client_get_list (client, fullkey, GCONF_VALUE_STRING, NULL);
-
- g_free (fullkey);
-
- return l;
-}
-
-static gchar *
-get_prefs_string_key (GConfClient *client, const gchar *key)
-{
- gchar *fullkey, *s;
-
- fullkey = g_strdup_printf ("%s/%s", NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, key);
- s = gconf_client_get_string (client, fullkey, NULL);
-
- g_free (fullkey);
-
- return s;
-}
-
-static int
-get_prefs_int_key (GConfClient *client, const gchar *key)
-{
- gchar *fullkey;
- gint i = -1;
- GConfValue* value;
-
- fullkey = g_strdup_printf ("%s/%s", NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, key);
- value = gconf_client_get (client, fullkey, NULL);
-
- if (value != NULL)
- {
- i = gconf_value_get_int (value);
- }
-
- g_free (fullkey);
-
- return i;
-}
-
-static gboolean
-set_prefs_list_key (GConfClient *client, const gchar *key, GSList* value)
-{
- gchar *fullkey;
- gboolean retv;
-
- fullkey = g_strdup_printf ("%s/%s", NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, key);
- retv = gconf_client_set_list (client, fullkey, GCONF_VALUE_STRING, value, NULL);
-
- g_free (fullkey);
-
- return retv;
-}
-
-static gboolean
-set_prefs_string_key (GConfClient *client, const gchar *key, const gchar* value)
-{
- gchar *fullkey;
- gboolean retv;
-
- fullkey = g_strdup_printf ("%s/%s", NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, key);
- retv = gconf_client_set_string (client, fullkey, value, NULL);
-
- g_free (fullkey);
-
- return retv;
-}
-
-static gboolean
-set_prefs_int_key (GConfClient *client, const gchar *key, gint value)
-{
- gchar *fullkey;
- gboolean retv;
-
- fullkey = g_strdup_printf ("%s/%s", NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, key);
- retv = gconf_client_set_int (client, fullkey, value, NULL);
-
- g_free (fullkey);
-
- return retv;
-}
-
-static void prefs_changed_cb (GConfClient *client,
- guint cnxn_id,
- GConfEntry *entry,
- gpointer user_data)
-{
- /*NactPreferences* prefs = (NactPreferences*)user_data;*/
-
- if (user_data != NULL)
- {
- /*g_print ("Key changed : %s\n", entry->key);*/
- }
-}
-
-static NactPreferences* nact_prefs_get_preferences (void)
-{
- static NactPreferences* prefs = NULL;
- gchar* tmp;
-
- if (!prefs)
- {
- prefs = g_new0 (NactPreferences, 1);
-
- prefs->client = gconf_client_get_default ();
-
- prefs->schemes = get_prefs_list_key (prefs->client, PREFS_SCHEMES);
- if (!prefs->schemes)
- {
- /* initialize the default schemes */
- /* i18n notes : description of 'file' scheme */
- prefs->schemes = g_slist_append (prefs->schemes, g_strdup_printf (_("%sLocal Files"), "file|"));
- /* i18n notes : description of 'sftp' scheme */
- prefs->schemes = g_slist_append (prefs->schemes, g_strdup_printf (_("%sSSH Files"), "sftp|"));
- /* i18n notes : description of 'smb' scheme */
- prefs->schemes = g_slist_append (prefs->schemes, g_strdup_printf (_("%sWindows Files"), "smb|"));
- /* i18n notes : description of 'ftp' scheme */
- prefs->schemes = g_slist_append (prefs->schemes, g_strdup_printf (_("%sFTP Files"), "ftp|"));
- /* i18n notes : description of 'dav' scheme */
- prefs->schemes = g_slist_append (prefs->schemes, g_strdup_printf (_("%sWebdav Files"), "dav|"));
- }
- prefs->main_size_width = get_prefs_int_key (prefs->client, PREFS_MAIN_W);
- prefs->main_size_height = get_prefs_int_key (prefs->client, PREFS_MAIN_H);
- prefs->edit_size_width = get_prefs_int_key (prefs->client, PREFS_EDIT_W);
- prefs->edit_size_height = get_prefs_int_key (prefs->client, PREFS_EDIT_H);
- prefs->im_ex_size_width = get_prefs_int_key (prefs->client, PREFS_IM_EX_W);
- prefs->im_ex_size_height = get_prefs_int_key (prefs->client, PREFS_IM_EX_H);
- prefs->main_position_x = get_prefs_int_key (prefs->client, PREFS_MAIN_X);
- prefs->main_position_y = get_prefs_int_key (prefs->client, PREFS_MAIN_Y);
- prefs->edit_position_x = get_prefs_int_key (prefs->client, PREFS_EDIT_X);
- prefs->edit_position_y = get_prefs_int_key (prefs->client, PREFS_EDIT_Y);
- prefs->im_ex_position_x = get_prefs_int_key (prefs->client, PREFS_IM_EX_X);
- prefs->im_ex_position_y = get_prefs_int_key (prefs->client, PREFS_IM_EX_Y);
- tmp = get_prefs_string_key (prefs->client, PREFS_ICON_PATH);
- if (!tmp)
- {
- tmp = g_strdup ("/usr/share/pixmaps");
- }
- prefs->icon_last_browsed_dir = tmp;
-
- tmp = get_prefs_string_key (prefs->client, PREFS_PATH_PATH);
- if (!tmp)
- {
- tmp = g_strdup ("/usr/bin");
- }
- prefs->path_last_browsed_dir = tmp;
-
- tmp = get_prefs_string_key (prefs->client, PREFS_IMPORT_PATH);
- if (!tmp)
- {
- tmp = g_strdup ("/tmp");
- }
- prefs->import_last_browsed_dir = tmp;
-
- tmp = get_prefs_string_key (prefs->client, PREFS_EXPORT_PATH);
- if (!tmp)
- {
- tmp = g_strdup ("/tmp");
- }
- prefs->export_last_browsed_dir = tmp;
-
- gconf_client_add_dir (prefs->client, NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, GCONF_CLIENT_PRELOAD_NONE, NULL);
- prefs->prefs_notify_id = gconf_client_notify_add (prefs->client, NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR,
- (GConfClientNotifyFunc) prefs_changed_cb, prefs,
- NULL, NULL);
- }
-
- return prefs;
-}
-
-static void
-copy_to_list (gpointer value, gpointer user_data)
-{
- GSList **list = user_data;
-
- (*list) = g_slist_append ((*list), g_strdup ((gchar*)value));
-}
-
-GSList* nact_prefs_get_schemes_list (void)
-{
- GSList* new_list = NULL;
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- g_slist_foreach (prefs->schemes, (GFunc)copy_to_list, &new_list);
-
- return new_list;
-}
-
-void nact_prefs_set_schemes_list (GSList* schemes)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->schemes)
- {
- g_slist_foreach (prefs->schemes, (GFunc) g_free, NULL);
- g_slist_free (prefs->schemes);
- prefs->schemes = NULL;
- }
-
- g_slist_foreach (schemes, (GFunc)copy_to_list, &(prefs->schemes));
-}
-
-gboolean nact_prefs_get_main_dialog_size (gint* width, gint* height)
-{
- gboolean retv = FALSE;
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->main_size_width != -1 && prefs->main_size_height != -1)
- {
- retv = TRUE;
- (*width) = prefs->main_size_width;
- (*height) = prefs->main_size_height;
- }
-
- return retv;
-}
-
-void nact_prefs_set_main_dialog_size (GtkWindow* dialog)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- gtk_window_get_size (dialog, &(prefs->main_size_width), &(prefs->main_size_height));
-}
-
-gboolean nact_prefs_get_edit_dialog_size (gint* width, gint* height)
-{
- gboolean retv = FALSE;
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->edit_size_width != -1 && prefs->edit_size_height != -1)
- {
- retv = TRUE;
- (*width) = prefs->edit_size_width;
- (*height) = prefs->edit_size_height;
- }
-
- return retv;
-
-}
-
-void nact_prefs_set_edit_dialog_size (GtkWindow* dialog)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- gtk_window_get_size (dialog, &(prefs->edit_size_width), &(prefs->edit_size_height));
-}
-
-gboolean nact_prefs_get_im_ex_dialog_size (gint* width, gint* height)
-{
- gboolean retv = FALSE;
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->im_ex_size_width != -1 && prefs->im_ex_size_height != -1)
- {
- retv = TRUE;
- (*width) = prefs->im_ex_size_width;
- (*height) = prefs->im_ex_size_height;
- }
-
- return retv;
-
-}
-
-void nact_prefs_set_im_ex_dialog_size (GtkWindow* dialog)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- gtk_window_get_size (dialog, &(prefs->im_ex_size_width), &(prefs->im_ex_size_height));
-}
-
-gboolean nact_prefs_get_main_dialog_position (gint* x, gint* y)
-{
- gboolean retv = FALSE;
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->main_position_x != -1 && prefs->main_position_y != -1)
- {
- retv = TRUE;
- (*x) = prefs->main_position_x;
- (*y) = prefs->main_position_y;
- }
-
- return retv;
-}
-
-void nact_prefs_set_main_dialog_position (GtkWindow* dialog)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- gtk_window_get_position (dialog, &(prefs->main_position_x), &(prefs->main_position_y));
-}
-
-gboolean nact_prefs_get_edit_dialog_position (gint* x, gint* y)
-{
- gboolean retv = FALSE;
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->edit_position_x != -1 && prefs->edit_position_y != -1)
- {
- retv = TRUE;
- (*x) = prefs->edit_position_x;
- (*y) = prefs->edit_position_y;
- }
-
- return retv;
-}
-
-void nact_prefs_set_edit_dialog_position (GtkWindow* dialog)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- gtk_window_get_position (dialog, &(prefs->edit_position_x), &(prefs->edit_position_y));
-}
-
-gboolean nact_prefs_get_im_ex_dialog_position (gint* x, gint* y)
-{
- gboolean retv = FALSE;
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->im_ex_position_x != -1 && prefs->im_ex_position_y != -1)
- {
- retv = TRUE;
- (*x) = prefs->im_ex_position_x;
- (*y) = prefs->im_ex_position_y;
- }
-
- return retv;
-}
-
-void nact_prefs_set_im_ex_dialog_position (GtkWindow* dialog)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- gtk_window_get_position (dialog, &(prefs->im_ex_position_x), &(prefs->im_ex_position_y));
-}
-
-gchar* nact_prefs_get_icon_last_browsed_dir (void)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- return g_strdup (prefs->icon_last_browsed_dir);
-}
-
-void nact_prefs_set_icon_last_browsed_dir (const gchar* path)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->icon_last_browsed_dir)
- {
- g_free (prefs->icon_last_browsed_dir);
- }
- prefs->icon_last_browsed_dir = g_strdup (path);
-}
-
-gchar* nact_prefs_get_path_last_browsed_dir (void)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- return g_strdup (prefs->path_last_browsed_dir);
-}
-
-void nact_prefs_set_path_last_browsed_dir (const gchar* path)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->path_last_browsed_dir)
- {
- g_free (prefs->path_last_browsed_dir);
- }
- prefs->path_last_browsed_dir = g_strdup (path);
-}
-
-gchar* nact_prefs_get_import_last_browsed_dir (void)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- return g_strdup (prefs->import_last_browsed_dir);
-}
-
-void nact_prefs_set_import_last_browsed_dir (const gchar* path)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->import_last_browsed_dir)
- {
- g_free (prefs->import_last_browsed_dir);
- }
- prefs->import_last_browsed_dir = g_strdup (path);
-}
-
-gchar* nact_prefs_get_export_last_browsed_dir (void)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- return g_strdup (prefs->export_last_browsed_dir);
-}
-
-void nact_prefs_set_export_last_browsed_dir (const gchar* path)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- if (prefs->export_last_browsed_dir)
- {
- g_free (prefs->export_last_browsed_dir);
- }
- prefs->export_last_browsed_dir = g_strdup (path);
-}
-
-static void nact_prefs_free_preferences (NactPreferences* prefs)
-{
- if (prefs)
- {
- if (prefs->schemes)
- {
- g_slist_foreach (prefs->schemes, (GFunc) g_free, NULL);
- g_slist_free (prefs->schemes);
- }
-
- if (prefs->icon_last_browsed_dir)
- {
- g_free (prefs->icon_last_browsed_dir);
- }
-
- if (prefs->path_last_browsed_dir)
- {
- g_free (prefs->path_last_browsed_dir);
- }
-
- if (prefs->import_last_browsed_dir)
- {
- g_free (prefs->import_last_browsed_dir);
- }
-
- if (prefs->export_last_browsed_dir)
- {
- g_free (prefs->export_last_browsed_dir);
- }
-
- gconf_client_remove_dir (prefs->client, NAUTILUS_ACTIONS_CONFIG_GCONF_BASEDIR, NULL);
- gconf_client_notify_remove (prefs->client, prefs->prefs_notify_id);
- g_object_unref (prefs->client);
-
- g_free (prefs);
- prefs = NULL;
- }
-}
-
-void nact_prefs_save_preferences (void)
-{
- NactPreferences* prefs = nact_prefs_get_preferences ();
-
- /* Save preferences in GConf */
- set_prefs_list_key (prefs->client, PREFS_SCHEMES, prefs->schemes);
- set_prefs_int_key (prefs->client, PREFS_MAIN_W, prefs->main_size_width);
- set_prefs_int_key (prefs->client, PREFS_MAIN_H, prefs->main_size_height);
- set_prefs_int_key (prefs->client, PREFS_EDIT_W, prefs->edit_size_width);
- set_prefs_int_key (prefs->client, PREFS_EDIT_H, prefs->edit_size_height);
- set_prefs_int_key (prefs->client, PREFS_IM_EX_W, prefs->im_ex_size_width);
- set_prefs_int_key (prefs->client, PREFS_IM_EX_H, prefs->im_ex_size_height);
- set_prefs_int_key (prefs->client, PREFS_MAIN_X, prefs->main_position_x);
- set_prefs_int_key (prefs->client, PREFS_MAIN_Y, prefs->main_position_y);
- set_prefs_int_key (prefs->client, PREFS_EDIT_X, prefs->edit_position_x);
- set_prefs_int_key (prefs->client, PREFS_EDIT_Y, prefs->edit_position_y);
- set_prefs_int_key (prefs->client, PREFS_IM_EX_X, prefs->im_ex_position_x);
- set_prefs_int_key (prefs->client, PREFS_IM_EX_Y, prefs->im_ex_position_y);
- set_prefs_string_key (prefs->client, PREFS_ICON_PATH, prefs->icon_last_browsed_dir);
- set_prefs_string_key (prefs->client, PREFS_PATH_PATH, prefs->path_last_browsed_dir);
- set_prefs_string_key (prefs->client, PREFS_IMPORT_PATH, prefs->import_last_browsed_dir);
- set_prefs_string_key (prefs->client, PREFS_EXPORT_PATH, prefs->export_last_browsed_dir);
-
- nact_prefs_free_preferences (prefs);
-}
diff --git a/src/nact/nact-iprefs.h b/src/nact/nact-iprefs.h
index 1294ae5..392cf28 100644
--- a/src/nact/nact-iprefs.h
+++ b/src/nact/nact-iprefs.h
@@ -74,71 +74,11 @@ void nact_iprefs_save_named_window_position( NactWindow *window, GtkWindow *to
gchar *nact_iprefs_get_iprofile_conditions_folder_uri( NactWindow *window );
void nact_iprefs_save_iprofile_conditions_folder_uri( NactWindow *window, const gchar *uri );
-/* .. */
-#include <gconf/gconf-client.h>
+gchar *nact_iprefs_get_import_folder_uri( NactWindow *window );
+void nact_iprefs_save_import_folder_uri( NactWindow *window, const gchar *uri );
-typedef struct _NactPreferences NactPreferences;
-
-struct _NactPreferences {
- GSList* schemes;
- gint main_size_width;
- gint main_size_height;
- gint main_position_x;
- gint main_position_y;
- gint edit_size_width;
- gint edit_size_height;
- gint edit_position_x;
- gint edit_position_y;
- gint im_ex_size_width;
- gint im_ex_size_height;
- gint im_ex_position_x;
- gint im_ex_position_y;
- gchar* icon_last_browsed_dir;
- gchar* path_last_browsed_dir;
- gchar* import_last_browsed_dir;
- gchar* export_last_browsed_dir;
- GConfClient* client;
- guint prefs_notify_id;
-};
-
-GSList* nact_prefs_get_schemes_list (void);
-
-void nact_prefs_set_schemes_list (GSList* schemes);
-
-gboolean nact_prefs_get_main_dialog_size (gint* width, gint* height);
-void nact_prefs_set_main_dialog_size (GtkWindow* dialog);
-
-gboolean nact_prefs_get_edit_dialog_size (gint* width, gint* height);
-void nact_prefs_set_edit_dialog_size (GtkWindow* dialog);
-
-gboolean nact_prefs_get_im_ex_dialog_size (gint* width, gint* height);
-void nact_prefs_set_im_ex_dialog_size (GtkWindow* dialog);
-
-
-gboolean nact_prefs_get_main_dialog_position (gint* x, gint* y);
-void nact_prefs_set_main_dialog_position (GtkWindow* dialog);
-
-gboolean nact_prefs_get_edit_dialog_position (gint* x, gint* y);
-void nact_prefs_set_edit_dialog_position (GtkWindow* dialog);
-
-gboolean nact_prefs_get_im_ex_dialog_position (gint* x, gint* y);
-void nact_prefs_set_im_ex_dialog_position (GtkWindow* dialog);
-
-
-gchar* nact_prefs_get_icon_last_browsed_dir (void);
-void nact_prefs_set_icon_last_browsed_dir (const gchar* path);
-
-gchar* nact_prefs_get_path_last_browsed_dir (void);
-void nact_prefs_set_path_last_browsed_dir (const gchar* path);
-
-gchar* nact_prefs_get_import_last_browsed_dir (void);
-void nact_prefs_set_import_last_browsed_dir (const gchar* path);
-
-gchar* nact_prefs_get_export_last_browsed_dir (void);
-void nact_prefs_set_export_last_browsed_dir (const gchar* path);
-
-
-void nact_prefs_save_preferences (void);
+gchar *nact_iprefs_get_export_folder_uri( NactWindow *window );
+void nact_iprefs_save_export_folder_uri( NactWindow *window, const gchar *uri );
G_END_DECLS
diff --git a/src/nact/nact-main-window.c b/src/nact/nact-main-window.c
index afe12f8..b6c54a7 100644
--- a/src/nact/nact-main-window.c
+++ b/src/nact/nact-main-window.c
@@ -46,6 +46,8 @@
#include "nact-application.h"
#include "nact-action-conditions-editor.h"
#include "nact-action-profiles-editor.h"
+#include "nact-action-profiles-editor.h"
+#include "nact-gconf-schema-writer.h"
#include "nact-iactions-list.h"
#include "nact-iprefs.h"
#include "nact-main-window.h"
@@ -59,10 +61,16 @@ struct NactMainWindowClassPrivate {
*/
struct NactMainWindowPrivate {
gboolean dispose_has_run;
+ gboolean export_mode;
gchar *current_uuid;
gchar *current_label;
};
+/* the GConf key used to read/write size and position of auxiliary dialogs
+ */
+#define IPREFS_IMPORT_ACTIONS "main-window-import-actions"
+#define IPREFS_EXPORT_ACTIONS "main-window-export-actions"
+
static GObjectClass *st_parent_class = NULL;
static GType register_type( void );
@@ -83,17 +91,23 @@ static gboolean on_actions_list_double_click( GtkWidget *widget, GdkEventButton
static gboolean on_actions_list_enter_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer data );
static void on_about_button_clicked( GtkButton *button, gpointer user_data );
-static void on_add_button_clicked( GtkButton *button, gpointer user_data );
+static void on_new_button_clicked( GtkButton *button, gpointer user_data );
static void on_edit_button_clicked( GtkButton *button, gpointer user_data );
static void on_duplicate_button_clicked( GtkButton *button, gpointer user_data );
static void on_delete_button_clicked( GtkButton *button, gpointer user_data );
-static void on_import_export_button_clicked( GtkButton *button, gpointer user_data );
+static void on_import_button_clicked( GtkButton *button, gpointer user_data );
+static void on_export_button_clicked( GtkButton *button, gpointer user_data );
+static void on_saveas_button_clicked( GtkButton *button, gpointer user_data );
static gboolean on_dialog_response( GtkDialog *dialog, gint response_id, BaseWindow *window );
static void on_actions_changed( NAIPivotContainer *instance, gpointer user_data );
static void set_current_action( NactMainWindow *window, const NAAction *action );
static void do_set_current_action( NactWindow *window, const gchar *uuid, const gchar *label );
+static void set_export_mode( NactWindow *window, gboolean mode );
+static void setup_buttons( NactWindow *window );
+static void do_import_actions( NactMainWindow *window, const gchar *filename );
+static void do_export_actions( NactMainWindow *window, const gchar *folder );
/*static gint count_actions( BaseWindow *window );*/
@@ -290,6 +304,7 @@ on_initial_load_toplevel( BaseWindow *window )
g_assert( NACT_IS_IACTIONS_LIST( window ));
nact_iactions_list_initial_load( NACT_WINDOW( window ));
+ nact_iactions_list_set_multiple_selection( NACT_WINDOW( window ), FALSE );
nact_iactions_list_set_send_selection_changed_on_fill_list( NACT_WINDOW( window ), FALSE );
}
@@ -309,12 +324,16 @@ on_runtime_init_toplevel( BaseWindow *window )
nact_iactions_list_runtime_init( NACT_WINDOW( window ));
- base_window_connect( window, "AboutButton", "clicked", G_CALLBACK( on_about_button_clicked ));
- base_window_connect( window, "AddActionButton", "clicked", G_CALLBACK( on_add_button_clicked ));
- base_window_connect( window, "EditActionButton", "clicked", G_CALLBACK( on_edit_button_clicked ));
- base_window_connect( window, "DuplicateActionButton", "clicked", G_CALLBACK( on_duplicate_button_clicked ));
- base_window_connect( window, "DeleteActionButton", "clicked", G_CALLBACK( on_delete_button_clicked ));
- base_window_connect( window, "ImExportButton", "clicked", G_CALLBACK( on_import_export_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "AboutButton", "clicked", G_CALLBACK( on_about_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "NewActionButton", "clicked", G_CALLBACK( on_new_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "EditActionButton", "clicked", G_CALLBACK( on_edit_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "DuplicateActionButton", "clicked", G_CALLBACK( on_duplicate_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "DeleteActionButton", "clicked", G_CALLBACK( on_delete_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "ImportButton", "clicked", G_CALLBACK( on_import_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "ExportButton", "clicked", G_CALLBACK( on_export_button_clicked ));
+ nact_window_signal_connect_by_name( NACT_WINDOW( window ), "SaveAsButton", "clicked", G_CALLBACK( on_saveas_button_clicked ));
+
+ setup_buttons( NACT_WINDOW( window ));
}
static void
@@ -326,32 +345,42 @@ on_actions_list_selection_changed( GtkTreeSelection *selection, gpointer user_da
g_assert( NACT_IS_MAIN_WINDOW( user_data ));
BaseWindow *window = BASE_WINDOW( user_data );
- GtkWidget *edit_button = base_window_get_widget( window, "EditActionButton" );
- GtkWidget *delete_button = base_window_get_widget( window, "DeleteActionButton" );
- GtkWidget *duplicate_button = base_window_get_widget( window, "DuplicateActionButton" );
+ if( !NACT_MAIN_WINDOW( window )->private->export_mode ){
+
+ GtkWidget *edit_button = base_window_get_widget( window, "EditActionButton" );
+ GtkWidget *delete_button = base_window_get_widget( window, "DeleteActionButton" );
+ GtkWidget *duplicate_button = base_window_get_widget( window, "DuplicateActionButton" );
- gboolean enabled = ( gtk_tree_selection_count_selected_rows( selection ) > 0 );
+ gboolean enabled = ( gtk_tree_selection_count_selected_rows( selection ) > 0 );
- gtk_widget_set_sensitive( edit_button, enabled );
- gtk_widget_set_sensitive( delete_button, enabled );
- gtk_widget_set_sensitive( duplicate_button, enabled );
+ gtk_widget_set_sensitive( edit_button, enabled );
+ gtk_widget_set_sensitive( delete_button, enabled );
+ gtk_widget_set_sensitive( duplicate_button, enabled );
- NAAction *action = NA_ACTION( nact_iactions_list_get_selected_action( NACT_WINDOW( window )));
- set_current_action( NACT_MAIN_WINDOW( window ), action );
+ NAAction *action = NA_ACTION( nact_iactions_list_get_selected_action( NACT_WINDOW( window )));
+ set_current_action( NACT_MAIN_WINDOW( window ), action );
+ }
}
static gboolean
on_actions_list_double_click( GtkWidget *widget, GdkEventButton *event, gpointer user_data )
{
g_assert( event->type == GDK_2BUTTON_PRESS );
- on_edit_button_clicked( NULL, user_data );
+
+ if( !NACT_MAIN_WINDOW( user_data )->private->export_mode ){
+ on_edit_button_clicked( NULL, user_data );
+ }
+
return( TRUE );
}
static gboolean
on_actions_list_enter_key_pressed( GtkWidget *widget, GdkEventKey *event, gpointer user_data )
{
- on_edit_button_clicked( NULL, user_data );
+ if( !NACT_MAIN_WINDOW( user_data )->private->export_mode ){
+ on_edit_button_clicked( NULL, user_data );
+ }
+
return( TRUE );
}
@@ -433,9 +462,9 @@ on_about_button_clicked( GtkButton *button, gpointer user_data )
* so the new action is silently created with a default profile name
*/
static void
-on_add_button_clicked( GtkButton *button, gpointer user_data )
+on_new_button_clicked( GtkButton *button, gpointer user_data )
{
- static const gchar *thisfn = "nact_main_window_on_add_button_clicked";
+ static const gchar *thisfn = "nact_main_window_on_new_button_clicked";
g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
g_assert( NACT_IS_MAIN_WINDOW( user_data ));
@@ -564,21 +593,103 @@ on_delete_button_clicked( GtkButton *button, gpointer user_data )
}
static void
-on_import_export_button_clicked( GtkButton *button, gpointer user_data )
+on_import_button_clicked( GtkButton *button, gpointer user_data )
+{
+ static const gchar *thisfn = "nact_main_window_on_import_button_clicked";
+ g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
+
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactWindow *wndmain = NACT_WINDOW( user_data );
+
+ GtkWidget *dialog = gtk_file_chooser_dialog_new(
+ _( "Importing new actions" ),
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
+ NULL
+ );
+
+ nact_iprefs_position_named_window( NACT_WINDOW( user_data ), GTK_WINDOW( dialog ), IPREFS_IMPORT_ACTIONS );
+ gchar *uri = nact_iprefs_get_import_folder_uri( NACT_WINDOW( user_data ));
+ gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
+ g_free( uri );
+
+ if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
+ gchar *filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ));
+ do_import_actions( NACT_MAIN_WINDOW( wndmain ), filename );
+ g_free (filename);
+ }
+
+ uri = gtk_file_chooser_get_current_folder_uri( GTK_FILE_CHOOSER( dialog ));
+ nact_iprefs_save_import_folder_uri( NACT_WINDOW( user_data ), uri );
+ g_free( uri );
+
+ nact_iprefs_save_named_window_position( NACT_WINDOW( user_data ), GTK_WINDOW( dialog ), IPREFS_IMPORT_ACTIONS );
+
+ gtk_widget_destroy( dialog );
+
+ nact_iactions_list_set_focus( wndmain );
+}
+
+/*
+ * ExportButton is a toggle button
+ * When activated (selection-for-export mode), all other buttons are
+ * disabled, but 'SaveAs' ; the ActionsList accept multiple selection
+ */
+static void
+on_export_button_clicked( GtkButton *button, gpointer user_data )
+{
+ static const gchar *thisfn = "nact_main_window_on_export_button_clicked";
+ g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
+
+ gboolean export = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON( button ));
+ set_export_mode( NACT_WINDOW( user_data ), export );
+
+ g_assert( NACT_IS_MAIN_WINDOW( user_data ));
+ NactWindow *wndmain = NACT_WINDOW( user_data );
+
+ nact_iactions_list_set_focus( wndmain );
+}
+
+static void
+on_saveas_button_clicked( GtkButton *button, gpointer user_data )
{
- static const gchar *thisfn = "nact_main_window_on_import_export_button_clicked";
+ static const gchar *thisfn = "nact_main_window_on_saveas_button_clicked";
g_debug( "%s: button=%p, user_data=%p", thisfn, button, user_data );
g_assert( NACT_IS_MAIN_WINDOW( user_data ));
NactWindow *wndmain = NACT_WINDOW( user_data );
- /*GtkWidget *nact_actions_list;
+ GtkWidget *dialog = gtk_file_chooser_dialog_new(
+ _( "Exporting actions to a folder" ),
+ NULL,
+ GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK,
+ NULL
+ );
+
+ nact_iprefs_position_named_window( wndmain, GTK_WINDOW( dialog ), IPREFS_EXPORT_ACTIONS );
+ gchar *uri = nact_iprefs_get_export_folder_uri( wndmain );
+ gtk_file_chooser_set_current_folder_uri( GTK_FILE_CHOOSER( dialog ), uri );
+ g_free( uri );
+
+ if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_OK ){
+ uri = gtk_file_chooser_get_uri( GTK_FILE_CHOOSER( dialog ));
+ do_export_actions( NACT_MAIN_WINDOW( wndmain ), uri );
+ }
+
+ nact_iprefs_save_export_folder_uri( wndmain, uri );
+ g_free( uri );
+
+ nact_iprefs_save_named_window_position( wndmain, GTK_WINDOW( dialog ), IPREFS_EXPORT_ACTIONS );
+ gtk_widget_destroy( dialog );
+
+ /*set_export_mode( wndmain, FALSE );*/
+ GtkWidget *export_button = base_window_get_widget( BASE_WINDOW( user_data ), "ExportButton" );
+ gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( export_button ), FALSE );
- if (nact_import_export_actions ())
- {
- nact_actions_list = nact_get_glade_widget ("ActionsList");
- fill_actions_list (nact_actions_list);
- }*/
nact_iactions_list_set_focus( wndmain );
}
@@ -649,6 +760,95 @@ do_set_current_action( NactWindow *window, const gchar *uuid, const gchar *label
NACT_MAIN_WINDOW( window )->private->current_label = g_strdup( label );
}
+static void
+set_export_mode( NactWindow *window, gboolean mode )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+ NactMainWindow *self = NACT_MAIN_WINDOW( window );
+
+ self->private->export_mode = mode;
+ nact_iactions_list_set_multiple_selection( window, mode );
+ setup_buttons( window );
+}
+
+static void
+setup_buttons( NactWindow *window )
+{
+ g_assert( NACT_IS_MAIN_WINDOW( window ));
+ NactMainWindow *self = NACT_MAIN_WINDOW( window );
+
+ GtkWidget *new_button = base_window_get_widget( BASE_WINDOW( window ), "NewActionButton" );
+ GtkWidget *edit_button = base_window_get_widget( BASE_WINDOW( window ), "EditActionButton" );
+ GtkWidget *duplicate_button = base_window_get_widget( BASE_WINDOW( window ), "DuplicateActionButton" );
+ GtkWidget *delete_button = base_window_get_widget( BASE_WINDOW( window ), "DeleteActionButton" );
+ GtkWidget *import_button = base_window_get_widget( BASE_WINDOW( window ), "ImportButton" );
+ GtkWidget *saveas_button = base_window_get_widget( BASE_WINDOW( window ), "SaveAsButton" );
+ GtkWidget *close_button = base_window_get_widget( BASE_WINDOW( window ), "CloseButton" );
+
+ gtk_widget_set_sensitive( new_button, !self->private->export_mode );
+ gtk_widget_set_sensitive( edit_button, !self->private->export_mode );
+ gtk_widget_set_sensitive( delete_button, !self->private->export_mode );
+ gtk_widget_set_sensitive( duplicate_button, !self->private->export_mode );
+ gtk_widget_set_sensitive( import_button, !self->private->export_mode );
+ gtk_widget_set_sensitive( close_button, !self->private->export_mode );
+
+ gtk_widget_set_sensitive( saveas_button, self->private->export_mode );
+
+ GtkWidget *label = base_window_get_widget( BASE_WINDOW( window ), "ExportModeLabel" );
+ gchar *text = g_strdup( "" );
+ if( self->private->export_mode ){
+ g_free( text );
+ text = g_strdup( _( "Export mode toggled.\n"
+ "Please, select actions to be exported (multiple selection is authorized).\n" ));
+ }
+ gtk_label_set_label( GTK_LABEL( label ), text );
+ g_free( text );
+}
+
+static void
+do_import_actions( NactMainWindow *window, const gchar *filename )
+{
+ static const gchar *thisfn = "nact_main_window_do_import_actions";
+ g_debug( "%s: window=%p, filename=%p", thisfn, window, filename );
+}
+
+static void
+do_export_actions( NactMainWindow *window, const gchar *folder )
+{
+ static const gchar *thisfn = "nact_main_window_do_export_actions";
+ g_debug( "%s: window=%p, folder=%p", thisfn, window, folder );
+
+ GSList *actions = nact_iactions_list_get_selected_actions( NACT_WINDOW( window ));
+ GSList *ia;
+ gchar *msg = NULL;
+ gchar *reason = NULL;
+ gchar *tmp;
+
+ for( ia = actions ; ia ; ia = ia->next ){
+ NAAction *action = NA_ACTION( ia->data );
+ nact_gconf_schema_writer_export( action, folder, &msg );
+ if( msg ){
+ if( reason ){
+ tmp = g_strdup_printf( "%s\n", reason );
+ g_free( reason );
+ reason = tmp;
+ }
+ tmp = g_strdup_printf( "%s%s", reason, msg );
+ g_free( reason );
+ reason = tmp;
+ }
+ g_free( msg );
+ }
+
+ if( reason ){
+ base_window_error_dlg( BASE_WINDOW( window ), GTK_MESSAGE_WARNING,
+ _( "One or more errors have been detected when exporting actions." ), reason );
+ g_free( reason );
+ }
+
+ g_slist_free( actions );
+}
+
/*static gint
count_actions( BaseWindow *window )
{
diff --git a/src/nact/nact-window.c b/src/nact/nact-window.c
index 3b61103..7566257 100644
--- a/src/nact/nact-window.c
+++ b/src/nact/nact-window.c
@@ -232,6 +232,9 @@ nact_window_get_pivot( NactWindow *window )
/**
* Returns a pointer to the specified action.
+ *
+ * The returned pointer is owned by NAPivot, and should not be freed
+ * nor unref by the caller.
*/
GObject *
nact_window_get_action( NactWindow *window, const gchar *uuid )
@@ -346,6 +349,15 @@ nact_window_signal_connect( NactWindow *window, GObject *instance, const gchar *
/*g_debug( "%s: connecting signal handler %p:%lu", thisfn, instance, handler_id );*/
}
+void
+nact_window_signal_connect_by_name( NactWindow *window, const gchar *name, const gchar *signal, GCallback fn )
+{
+ GtkWidget *widget = base_window_get_widget( BASE_WINDOW( window ), name );
+ if( GTK_IS_WIDGET( widget )){
+ nact_window_signal_connect( window, G_OBJECT( widget ), signal, fn );
+ }
+}
+
static gchar *
v_get_iprefs_window_id( NactWindow *window )
{
diff --git a/src/nact/nact-window.h b/src/nact/nact-window.h
index 315f727..1542730 100644
--- a/src/nact/nact-window.h
+++ b/src/nact/nact-window.h
@@ -84,6 +84,7 @@ gboolean nact_window_warn_action_modified( NactWindow *window, const NAAction *a
GSList *nact_window_get_actions( NactWindow *window );
void nact_window_signal_connect( NactWindow *window, GObject *instance, const gchar *signal, GCallback fn );
+void nact_window_signal_connect_by_name( NactWindow *window, const gchar *name, const gchar *signal, GCallback fn );
G_END_DECLS
diff --git a/src/nact/nautilus-actions-config.ui b/src/nact/nautilus-actions-config.ui
index bf306c5..84fc077 100644
--- a/src/nact/nautilus-actions-config.ui
+++ b/src/nact/nautilus-actions-config.ui
@@ -38,24 +38,25 @@
</packing>
</child>
<child>
- <object class="GtkVButtonBox" id="vbuttonbox1">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="spacing">3</property>
- <property name="layout_style">start</property>
+ <property name="n_rows">4</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">4</property>
+ <property name="row_spacing">4</property>
+ <property name="homogeneous">True</property>
<child>
- <object class="GtkButton" id="AddActionButton">
- <property name="label">gtk-add</property>
+ <object class="GtkButton" id="NewActionButton">
+ <property name="label">gtk-new</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Create a new action.</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
@@ -65,141 +66,107 @@
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Edit the currently selected action.</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkButton" id="DuplicateActionButton">
+ <object class="GtkButton" id="DeleteActionButton">
+ <property name="label">gtk-delete</property>
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Create a copy of the selected action.</property>
- <child>
- <object class="GtkAlignment" id="alignment14">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox51">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image21">
- <property name="visible">True</property>
- <property name="stock">gtk-copy</property>
- <property name="icon-size">4</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label141">
- <property name="visible">True</property>
- <property name="label" translatable="yes">D_uplicate</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkButton" id="DeleteActionButton">
- <property name="label">gtk-delete</property>
+ <object class="GtkButton" id="ImportButton">
+ <property name="label" translatable="yes">_Import...</property>
<property name="visible">True</property>
- <property name="sensitive">False</property>
<property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Delete the currently selected action.</property>
+ <property name="receives_default">True</property>
+ <property name="image">ImportButtonImage</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToggleButton" id="ExportButton">
+ <property name="label" translatable="yes">E_xport mode</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="image">ExportButtonImage</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="SaveAsButton">
+ <property name="label" translatable="yes">gtk-save-as</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
<property name="use_stock">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">3</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">3</property>
+ <property name="bottom_attach">4</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
</packing>
</child>
<child>
- <object class="GtkButton" id="ImExportButton">
+ <object class="GtkButton" id="DuplicateActionButton">
+ <property name="label" translatable="yes">D_uplicate</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Manage importation of external action configurations and exportation of existing actions.</property>
- <child>
- <object class="GtkAlignment" id="alignment13">
- <property name="visible">True</property>
- <property name="xscale">0</property>
- <property name="yscale">0</property>
- <child>
- <object class="GtkHBox" id="hbox50">
- <property name="visible">True</property>
- <property name="spacing">2</property>
- <child>
- <object class="GtkImage" id="image20">
- <property name="visible">True</property>
- <property name="stock">gtk-convert</property>
- <property name="icon-size">4</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label140">
- <property name="visible">True</property>
- <property name="label" translatable="yes">_Import/Export</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- </child>
+ <property name="receives_default">True</property>
+ <property name="image">DuplicateButtonImage</property>
+ <property name="use_underline">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">4</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options"></property>
+ <property name="y_options"></property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
- <property name="pack_type">end</property>
<property name="position">1</property>
</packing>
</child>
@@ -209,6 +176,19 @@
<property name="position">2</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="ExportModeLabel">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
+ <property name="xpad">10</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
<child internal-child="action_area">
<object class="GtkHButtonBox" id="dialog-action_area3">
<property name="visible">True</property>
@@ -229,7 +209,7 @@
</packing>
</child>
<child>
- <object class="GtkButton" id="closebutton2">
+ <object class="GtkButton" id="CloseButton">
<property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
@@ -254,7 +234,7 @@
</child>
<action-widgets>
<action-widget response="-11">AboutButton</action-widget>
- <action-widget response="-7">closebutton2</action-widget>
+ <action-widget response="-7">CloseButton</action-widget>
</action-widgets>
</object>
<object class="GtkDialog" id="EditActionDialogExt">
@@ -370,8 +350,8 @@
<property name="spacing">6</property>
<child>
<object class="GtkAspectFrame" id="IconFrame">
- <property name="width_request">20</property>
- <property name="height_request">20</property>
+ <property name="width_request">24</property>
+ <property name="height_request">24</property>
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
@@ -537,7 +517,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
- <property name="image">HelpImageButton</property>
+ <property name="image">LegendButtonImage</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -1521,9 +1501,45 @@ file(s)/folder(s)</property>
<action-widget response="-5">okbutton4</action-widget>
</action-widgets>
</object>
- <object class="GtkImage" id="HelpImageButton">
+ <object class="GtkImage" id="LegendButtonImage">
<property name="visible">True</property>
<property name="stock">gtk-help</property>
<property name="icon-size">4</property>
</object>
+ <object class="GtkImage" id="ImportButtonImage">
+ <property name="visible">True</property>
+ <property name="stock">gtk-convert</property>
+ <property name="icon-size">4</property>
+ </object>
+ <object class="GtkImage" id="ExportButtonImage">
+ <property name="visible">True</property>
+ <property name="stock">gtk-execute</property>
+ <property name="icon-size">4</property>
+ </object>
+ <object class="GtkImage" id="DuplicateButtonImage">
+ <property name="visible">True</property>
+ <property name="stock">gtk-copy</property>
+ <property name="icon-size">4</property>
+ </object>
+ <object class="GtkSizeGroup" id="IProfileConditionsLabelSizeGroup">
+ <widgets>
+ <widget name="MenuLabelLabel"/>
+ <widget name="MenuTooltipLabel"/>
+ <widget name="MenuIconLabel"/>
+ <widget name="ActionPathLabel"/>
+ <widget name="ActionParametersLabel"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup" id="MainButtonsSizeGroup">
+ <property name="mode">both</property>
+ <widgets>
+ <widget name="NewActionButton"/>
+ <widget name="EditActionButton"/>
+ <widget name="DeleteActionButton"/>
+ <widget name="ImportButton"/>
+ <widget name="ExportButton"/>
+ <widget name="SaveAsButton"/>
+ <widget name="DuplicateActionButton"/>
+ </widgets>
+ </object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]