[nautilus-actions] Improve ExecutionMode implementation
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Improve ExecutionMode implementation
- Date: Fri, 25 Feb 2011 01:07:21 +0000 (UTC)
commit 7ddaf3cc81691795c432c5c10bd60ca40f0314d8
Author: Pierre Wieser <pwieser trychlos org>
Date: Thu Feb 24 20:45:04 2011 +0100
Improve ExecutionMode implementation
+ Define a new 'terminal-prefix' runtime user preference which is supposed to prefix the
executed command, in order to run a terminal and keep it opened at the end of execution.
This is needed because:
- Gnome only sets a default for executing a command in a terminal,
- Nautilus (eel-gnome-extensions) has the same limitations.
ChangeLog | 16 ++++
po/POTFILES.in | 1 +
src/core/na-settings.c | 1 +
src/core/na-settings.h | 1 +
src/core/na-tokens.c | 154 +++++++++++++++++++++++++-----------
src/core/na-tokens.h | 5 +-
src/nact/nact-preferences-editor.c | 102 ++++++++++++++++++++----
src/nact/nact-preferences.ui | 129 +++++++++++++++++++++++++++---
src/plugin-menu/nautilus-actions.c | 2 +-
src/utils/nautilus-actions-run.c | 19 +++--
10 files changed, 348 insertions(+), 82 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 55c13d1..43fb013 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,21 @@
2011-02-23 Pierre Wieser <pwieser trychlos org>
+ Improve ExecutionMode implementation by defining a new user preference
+
+ * src/core/na-settings.c:
+ * src/core/na-settings.h: Define new NA_IPREFS_TERMINAL_PREFIX user preference.
+
+ * src/core/na-tokens.c:
+ * src/core/na-tokens.h
+ (na_tokens_command_from_terminal_prefix): New function.
+ (na_tokens_execute_action): New NASettings parameter.
+
+ * src/nact/nact-preferences-editor.c:
+ * src/nact/nact-preferences.ui: Let the user edit the preference.
+
+ * src/utils/nautilus-actions-run.c:
+ * po/POTFILES.in: Updated accordingly.
+
* src/core/na-settings.c:
* src/core/na-settings.h: Define a new NA_IPREFS_PLUGIN_LOG user preference.
diff --git a/po/POTFILES.in b/po/POTFILES.in
index cd3fe60..f423017 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -51,6 +51,7 @@ src/nact/nact-menubar.c
src/nact/nact-menubar-edit.c
src/nact/nact-menubar-file.c
[type: gettext/glade] src/nact/nact-preferences.ui
+src/nact/nact-preferences-editor.c
src/nact/nact-providers-list.c
src/nact/nact-schemes-list.c
src/nact/nact-tree-model-dnd.c
diff --git a/src/core/na-settings.c b/src/core/na-settings.c
index 21e819e..a72da98 100644
--- a/src/core/na-settings.c
+++ b/src/core/na-settings.c
@@ -157,6 +157,7 @@ static const KeyDef st_def_keys[] = {
{ NA_IPREFS_RELABEL_DUPLICATE_PROFILE, GROUP_NACT, NA_DATA_TYPE_BOOLEAN, "false" },
{ NA_IPREFS_SCHEME_ADD_SCHEME_WSP, GROUP_NACT, NA_DATA_TYPE_UINT_LIST, "" },
{ NA_IPREFS_SCHEME_DEFAULT_LIST, GROUP_NACT, NA_DATA_TYPE_STRING_LIST, "" },
+ { NA_IPREFS_TERMINAL_PREFIX, GROUP_RUNTIME, NA_DATA_TYPE_STRING, "" },
{ NA_IPREFS_IO_PROVIDER_READABLE, NA_IPREFS_IO_PROVIDER_GROUP, NA_DATA_TYPE_BOOLEAN, "true" },
{ NA_IPREFS_IO_PROVIDER_WRITABLE, NA_IPREFS_IO_PROVIDER_GROUP, NA_DATA_TYPE_BOOLEAN, "true" },
{ 0 }
diff --git a/src/core/na-settings.h b/src/core/na-settings.h
index f00ea6c..76cc79b 100644
--- a/src/core/na-settings.h
+++ b/src/core/na-settings.h
@@ -147,6 +147,7 @@ GType na_settings_get_type( void );
#define NA_IPREFS_RELABEL_DUPLICATE_PROFILE "relabel-when-duplicate-profile"
#define NA_IPREFS_SCHEME_ADD_SCHEME_WSP "scheme-add-scheme-wsp"
#define NA_IPREFS_SCHEME_DEFAULT_LIST "scheme-default-list"
+#define NA_IPREFS_TERMINAL_PREFIX "terminal-prefix"
#define NA_IPREFS_IO_PROVIDER_GROUP "io-provider"
#define NA_IPREFS_IO_PROVIDER_READABLE "readable"
diff --git a/src/core/na-tokens.c b/src/core/na-tokens.c
index 358163d..6deb0fd 100644
--- a/src/core/na-tokens.c
+++ b/src/core/na-tokens.c
@@ -77,7 +77,11 @@ static void instance_dispose( GObject *object );
static void instance_finalize( GObject *object );
static gchar *display_output_get_content( int fd );
-static void execute_action_command( gchar *command, const NAObjectProfile *profile );
+static void execute_action_command( const NASettings *settings, gchar *command, const NAObjectProfile *profile );
+static gchar *get_command_execution_display_output( const NASettings *settings, const gchar *command );
+static gchar *get_command_execution_embedded( const NASettings *settings, const gchar *command );
+static gchar *get_command_execution_normal( const NASettings *settings, const gchar *command );
+static gchar *get_command_execution_terminal( const NASettings *settings, const gchar *command );
static gboolean is_singular_exec( const NATokens *tokens, const gchar *exec );
static gchar *parse_singular( const NATokens *tokens, const gchar *input, guint i, gboolean utf8, gboolean quoted );
static GString *quote_string( GString *input, const gchar *name, gboolean quoted );
@@ -360,7 +364,7 @@ na_tokens_parse_for_display( const NATokens *tokens, const gchar *string, gboole
* Execute the given action, regarding the context described by @tokens.
*/
void
-na_tokens_execute_action( const NATokens *tokens, const NAObjectProfile *profile )
+na_tokens_execute_action( const NATokens *tokens, const NASettings *settings, const NAObjectProfile *profile )
{
gchar *path, *parameters, *exec;
gboolean singular;
@@ -378,13 +382,13 @@ na_tokens_execute_action( const NATokens *tokens, const NAObjectProfile *profile
if( singular ){
for( i = 0 ; i < tokens->private->count ; ++i ){
command = parse_singular( tokens, exec, i, FALSE, TRUE );
- execute_action_command( command, profile );
+ execute_action_command( settings, command, profile );
g_free( command );
}
} else {
command = parse_singular( tokens, exec, 0, FALSE, TRUE );
- execute_action_command( command, profile );
+ execute_action_command( settings, command, profile );
g_free( command );
}
@@ -453,19 +457,17 @@ display_output_get_content( int fd )
/*
* Execution environment:
- * - preferred terminal
- * GConf: /desktop/gnome/applications/terminal/exec = gnome-terminal
- * /desktop/gnome/applications/terminal/exec_arg = -x
- * DConf: ?
- * - whether the file-manager accept embedded execution ?
+ * - Normal: just execute the specified command
+ * - Terminal: use the user preference to have a terminal which stays openeded
+ * - Embedded: id. Terminal
+ * - DisplayOutput: execute in a shell
*/
static void
-execute_action_command( gchar *command, const NAObjectProfile *profile )
+execute_action_command( const NASettings *settings, gchar *command, const NAObjectProfile *profile )
{
static const gchar *thisfn = "nautilus_actions_execute_action_command";
- static const gchar *bin_sh = "/bin/sh -c ";
GError *error;
- gchar *execution_mode, *run_command, *quoted;
+ gchar *execution_mode, *run_command;
gchar **argv;
gint argc;
gchar *wdir;
@@ -475,58 +477,120 @@ execute_action_command( gchar *command, const NAObjectProfile *profile )
g_debug( "%s: profile=%p", thisfn, ( void * ) profile );
error = NULL;
+ run_command = NULL;
execution_mode = na_object_get_execution_mode( profile );
if( !strcmp( execution_mode, "Normal" )){
- run_command = g_strdup( command );
+ run_command = get_command_execution_normal( settings, command );
- } else if( strncmp( command, bin_sh, strlen( bin_sh ))){
- quoted = g_shell_quote( command );
- run_command = g_strconcat( bin_sh, quoted, NULL );
- g_free( quoted );
+ } else if( !strcmp( execution_mode, "Terminal" )){
+ run_command = get_command_execution_terminal( settings, command );
- } else {
- run_command = g_strdup( command );
- }
+ } else if( !strcmp( execution_mode, "Embedded" )){
+ run_command = get_command_execution_embedded( settings, command );
- if( !g_shell_parse_argv( run_command, &argc, &argv, &error )){
- g_warning( "%s: g_shell_parse_argv: %s", thisfn, error->message );
- g_error_free( error );
+ } else if( !strcmp( execution_mode, "DisplayOutput" )){
+ run_command = get_command_execution_display_output( settings, command );
} else {
- wdir = na_object_get_working_dir( profile );
- g_debug( "%s: run_command=%s, wdir=%s", thisfn, run_command, wdir );
-
- g_spawn_async_with_pipes( wdir,
- argv,
- NULL,
- G_SPAWN_SEARCH_PATH,
- NULL,
- NULL,
- &child_pid,
- NULL,
- &child_stdout,
- &child_stderr,
- &error );
- if( error ){
- g_warning( "%s: g_spawn_async_with_pipes: %s", thisfn, error->message );
+ g_warning( "%s: unknown execution mode: %s", thisfn, execution_mode );
+ }
+
+ if( run_command ){
+ if( !g_shell_parse_argv( run_command, &argc, &argv, &error )){
+ g_warning( "%s: g_shell_parse_argv: %s", thisfn, error->message );
g_error_free( error );
} else {
- g_spawn_close_pid( child_pid );
- if( !strcmp( execution_mode, "DisplayOutput" )){
- display_output( run_command, child_stdout, child_stderr );
+ wdir = na_object_get_working_dir( profile );
+ g_debug( "%s: run_command=%s, wdir=%s", thisfn, run_command, wdir );
+
+ g_spawn_async_with_pipes( wdir,
+ argv,
+ NULL,
+ G_SPAWN_SEARCH_PATH,
+ NULL,
+ NULL,
+ &child_pid,
+ NULL,
+ &child_stdout,
+ &child_stderr,
+ &error );
+ if( error ){
+ g_warning( "%s: g_spawn_async_with_pipes: %s", thisfn, error->message );
+ g_error_free( error );
+
+ } else {
+ g_spawn_close_pid( child_pid );
+
+ if( !strcmp( execution_mode, "DisplayOutput" )){
+ display_output( run_command, child_stdout, child_stderr );
+ }
}
+
+ g_free( wdir );
+ g_strfreev( argv );
}
- g_free( wdir );
- g_strfreev( argv );
+ g_free( run_command );
}
- g_free( run_command );
g_free( execution_mode );
}
+static gchar *
+get_command_execution_display_output( const NASettings *settings, const gchar *command )
+{
+ static const gchar *bin_sh = "/bin/sh -c ";
+ return( na_tokens_command_from_terminal_prefix( bin_sh, command ));
+}
+
+static gchar *
+get_command_execution_embedded( const NASettings *settings, const gchar *command )
+{
+ return( get_command_execution_terminal( settings, command ));
+}
+
+static gchar *
+get_command_execution_normal( const NASettings *settings, const gchar *command )
+{
+ return( g_strdup( command ));
+}
+
+static gchar *
+get_command_execution_terminal( const NASettings *settings, const gchar *command )
+{
+ gchar *run_command;
+ gchar *prefix;
+
+ prefix = na_settings_get_string(( NASettings * ) settings, NA_IPREFS_TERMINAL_PREFIX, NULL, NULL );
+ run_command = na_tokens_command_from_terminal_prefix( prefix, command );
+ g_free( prefix );
+
+ return( run_command );
+}
+
+/**
+ * na_tokens_command_from_terminal_prefix:
+ */
+gchar *
+na_tokens_command_from_terminal_prefix( const gchar *prefix, const gchar *command )
+{
+ gchar *run_command;
+ gchar *quoted;
+
+ if( prefix && strlen( prefix ) && strncmp( command, prefix, strlen( prefix ))){
+ quoted = g_shell_quote( command );
+ run_command = g_strconcat( prefix, " ", quoted, NULL );
+ g_free( quoted );
+
+ } else {
+ run_command = g_strdup( command );
+ }
+
+ return( run_command );
+}
+
/*
* na_tokens_is_singular_exec:
* @tokens: the current #NATokens object.
diff --git a/src/core/na-tokens.h b/src/core/na-tokens.h
index c90a2bc..56ca612 100644
--- a/src/core/na-tokens.h
+++ b/src/core/na-tokens.h
@@ -82,6 +82,8 @@
#include <api/na-object-profile.h>
+#include "na-settings.h"
+
G_BEGIN_DECLS
#define NA_TOKENS_TYPE ( na_tokens_get_type())
@@ -115,8 +117,9 @@ NATokens *na_tokens_new_for_example ( void );
NATokens *na_tokens_new_from_selection( GList *selection );
gchar *na_tokens_parse_for_display ( const NATokens *tokens, const gchar *string, gboolean utf8 );
+void na_tokens_execute_action ( const NATokens *tokens, const NASettings *settings, const NAObjectProfile *profile );
-void na_tokens_execute_action ( const NATokens *tokens, const NAObjectProfile *profile );
+gchar *na_tokens_command_from_terminal_prefix( const gchar *prefix, const gchar *command );
G_END_DECLS
diff --git a/src/nact/nact-preferences-editor.c b/src/nact/nact-preferences-editor.c
index e6108ff..543a4bd 100644
--- a/src/nact/nact-preferences-editor.c
+++ b/src/nact/nact-preferences-editor.c
@@ -32,9 +32,12 @@
#include <config.h>
#endif
+#include <glib/gi18n.h>
+
#include <api/na-iimporter.h>
#include <core/na-iprefs.h>
+#include <core/na-tokens.h>
#include "nact-application.h"
#include "nact-export-format.h"
@@ -63,7 +66,11 @@ struct _NactPreferencesEditorPrivate {
gboolean about_item;
gboolean about_item_mandatory;
- /* second tab: ui preferences */
+ /* second tab: runtime execution */
+ gchar *terminal_prefix;
+ gboolean terminal_prefix_mandatory;
+
+ /* third tab: ui preferences */
gboolean relabel_menu;
gboolean relabel_menu_mandatory;
gboolean relabel_action;
@@ -79,15 +86,15 @@ struct _NactPreferencesEditorPrivate {
guint auto_save_period;
gboolean auto_save_period_mandatory;
- /* third tab: import mode */
+ /* fourth tab: import mode */
guint import_mode;
gboolean import_mode_mandatory;
- /* fourth tab: export format */
+ /* fifth tab: export format */
gboolean export_format_mandatory;
- /* fifth tab: default list of available schemes */
- /* sixth tab: i/o providers */
+ /* sixth tab: default list of available schemes */
+ /* seventh tab: i/o providers */
};
static const gchar *st_xmlui_filename = PKGDATADIR "/nact-preferences.ui";
@@ -115,6 +122,8 @@ static void root_menu_setup( NactPreferencesEditor *editor, NASettings *sett
static void root_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
static void about_item_setup( NactPreferencesEditor *editor, NASettings *settings );
static void about_item_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
+static void terminal_prefix_setup( NactPreferencesEditor *editor, NASettings *settings );
+static void terminal_prefix_on_changed( GtkEntry *entry, NactPreferencesEditor *editor );
static void relabel_menu_setup( NactPreferencesEditor *editor, NASettings *settings );
static void relabel_menu_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor );
static void relabel_action_setup( NactPreferencesEditor *editor, NASettings *settings );
@@ -370,7 +379,11 @@ on_base_initialize_base_window( NactPreferencesEditor *editor )
root_menu_setup( editor, settings );
about_item_setup( editor, settings );
- /* second tab: ui preferences
+ /* second tab: runtime execution
+ */
+ terminal_prefix_setup( editor, settings );
+
+ /* third tab: ui preferences
*/
relabel_menu_setup( editor, settings );
relabel_action_setup( editor, settings );
@@ -379,22 +392,22 @@ on_base_initialize_base_window( NactPreferencesEditor *editor )
esc_confirm_setup( editor, settings );
auto_save_setup( editor, settings );
- /* third tab: import mode
+ /* fourth tab: import mode
*/
import_mode_setup( editor, NA_PIVOT( updater ));
- /* fourth tab: export format
+ /* fifth tab: export format
*/
export_format = na_iprefs_get_export_format( NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, &editor->private->export_format_mandatory );
container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
nact_export_format_select( container, !editor->private->export_format_mandatory, export_format );
- /* fifth tab: default schemes
+ /* sixth tab: default schemes
*/
listview = GTK_TREE_VIEW( base_window_get_widget( BASE_WINDOW( editor ), "SchemesTreeView" ));
nact_schemes_list_init_view( listview, BASE_WINDOW( editor ), NULL, NULL );
- /* sixth tab: I/O providers priorities
+ /* seventh tab: I/O providers priorities
*/
listview = GTK_TREE_VIEW( base_window_get_widget( BASE_WINDOW( editor ), "ProvidersTreeView" ));
nact_providers_list_init_view( BASE_WINDOW( editor ), listview );
@@ -579,7 +592,58 @@ about_item_on_toggled( GtkToggleButton *button, NactPreferencesEditor *editor )
}
/*
- * add an about item
+ * terminal prefix
+ */
+static void
+terminal_prefix_setup( NactPreferencesEditor *editor, NASettings *settings )
+{
+ gboolean editable;
+ GtkWidget *entry;
+
+ editor->private->terminal_prefix = na_settings_get_string( settings, NA_IPREFS_TERMINAL_PREFIX, NULL, &editor->private->terminal_prefix_mandatory );
+ editable = !editor->private->preferences_locked && !editor->private->terminal_prefix_mandatory;
+
+ entry = base_window_get_widget( BASE_WINDOW( editor ), "TerminalPrefixEntry" );
+ gtk_entry_set_text( GTK_ENTRY( entry ), editor->private->terminal_prefix );
+ gtk_widget_set_sensitive( entry, !editor->private->preferences_locked );
+ base_gtk_utils_set_editable( G_OBJECT( entry ), editable );
+
+ terminal_prefix_on_changed( GTK_ENTRY( entry ), editor );
+
+ base_window_signal_connect( BASE_WINDOW( editor ),
+ G_OBJECT( entry ), "changed", G_CALLBACK( terminal_prefix_on_changed ));
+}
+
+static void
+terminal_prefix_on_changed( GtkEntry *entry, NactPreferencesEditor *editor )
+{
+ gboolean editable;
+ gchar *example_label;
+ gchar *example_markup;
+ GtkWidget *example_widget;
+
+ editable = !editor->private->preferences_locked && !editor->private->terminal_prefix_mandatory;
+
+ if( editable ){
+ g_free( editor->private->terminal_prefix );
+ editor->private->terminal_prefix = g_strdup( gtk_entry_get_text( entry ));
+
+ example_widget = base_window_get_widget( BASE_WINDOW( editor ), "TerminalPrefixExample" );
+ example_label = na_tokens_command_from_terminal_prefix( editor->private->terminal_prefix, "ls -l" );
+
+ /* i18n: command-line example: Ex.: gnome-terminal -c "ls -l" */
+ example_markup = g_markup_printf_escaped(
+ "<i><b><span size=\"small\">%s %s</span></b></i>", _( "Ex.:" ), example_label );
+
+ gtk_label_set_label( GTK_LABEL( example_widget ), example_markup );
+
+ g_free( example_label );
+ g_free( example_markup );
+ }
+}
+
+/*
+ * relabel copied/paster menu ?
*/
static void
relabel_menu_setup( NactPreferencesEditor *editor, NASettings *settings )
@@ -941,7 +1005,13 @@ on_dialog_ok( BaseDialog *dialog )
na_settings_set_boolean( settings, NA_IPREFS_ITEMS_ADD_ABOUT_ITEM, editor->private->about_item );
}
- /* second tab: runtime preferences
+ /* second tab: runtime execution
+ */
+ if( !editor->private->terminal_prefix_mandatory ){
+ na_settings_set_string( settings, NA_IPREFS_TERMINAL_PREFIX, editor->private->terminal_prefix );
+ }
+
+ /* third tab: ui preferences
*/
if( !editor->private->relabel_menu_mandatory ){
na_settings_set_boolean( settings, NA_IPREFS_RELABEL_DUPLICATE_MENU, editor->private->relabel_menu );
@@ -965,13 +1035,13 @@ on_dialog_ok( BaseDialog *dialog )
na_settings_set_uint( settings, NA_IPREFS_MAIN_SAVE_PERIOD, editor->private->auto_save_period );
}
- /* third tab: import mode
+ /* fourth tab: import mode
*/
if( !editor->private->import_mode_mandatory ){
na_iprefs_set_import_mode( NA_PIVOT( updater ), NA_IPREFS_IMPORT_PREFERRED_MODE, editor->private->import_mode );
}
- /* fourth tab: export format
+ /* fifth tab: export format
*/
if( !editor->private->export_format_mandatory ){
container = base_window_get_widget( BASE_WINDOW( editor ), "PreferencesExportFormatVBox" );
@@ -980,11 +1050,11 @@ on_dialog_ok( BaseDialog *dialog )
NA_PIVOT( updater ), NA_IPREFS_EXPORT_PREFERRED_FORMAT, na_export_format_get_quark( export_format ));
}
- /* fifth tab: list of default schemes
+ /* sixth tab: list of default schemes
*/
nact_schemes_list_save_defaults( BASE_WINDOW( editor ));
- /* sixth tab: priorities of I/O providers
+ /* seventh tab: priorities of I/O providers
*/
nact_providers_list_save( BASE_WINDOW( editor ));
}
diff --git a/src/nact/nact-preferences.ui b/src/nact/nact-preferences.ui
index 2ddd64f..f1cc0d1 100644
--- a/src/nact/nact-preferences.ui
+++ b/src/nact/nact-preferences.ui
@@ -189,6 +189,115 @@ Note that this item will be displayed only if a unique menu is defined in the Na
</packing>
</child>
<child>
+ <object class="GtkVBox" id="vbox700">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkFrame" id="frame710">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="label_xalign">0</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkAlignment" id="alignment710">
+ <property name="visible">True</property>
+ <property name="left_padding">12</property>
+ <child>
+ <object class="GtkVBox" id="vbox711">
+ <property name="visible">True</property>
+ <property name="border_width">6</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkTable" id="table711">
+ <property name="visible">True</property>
+ <property name="tooltip_text" translatable="yes">Specify here the command to add as a prefix of the action path and parameters when the action is to be executed in a terminal.
+This prefix should be so that the terminal is kept opened after the execution.</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">4</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="label711">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Command prefix :</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="TerminalPrefixEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="invisible_char">●</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="TerminalPrefixExample">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="use_markup">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child type="label">
+ <object class="GtkLabel" id="label710">
+ <property name="visible">True</property>
+ <property name="xpad">5</property>
+ <property name="label" translatable="yes"><b>Execution in a terminal</b></property>
+ <property name="use_markup">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label700">
+ <property name="visible">True</property>
+ <property name="tooltip_text" translatable="yes">This tab lets you specify parameters needed for. some execution modes.</property>
+ <property name="label" translatable="yes">E_xecution</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkVBox" id="vbox34">
<property name="visible">True</property>
<property name="orientation">vertical</property>
@@ -447,7 +556,7 @@ Note that this item will be displayed only if a unique menu is defined in the Na
</child>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<child type="tab">
@@ -458,7 +567,7 @@ Note that this item will be displayed only if a unique menu is defined in the Na
<property name="use_underline">True</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="position">2</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -587,7 +696,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
</child>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
</packing>
</child>
<child type="tab">
@@ -598,7 +707,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<property name="use_underline">True</property>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">3</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -652,7 +761,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
</child>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
</packing>
</child>
<child type="tab">
@@ -663,7 +772,7 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<property name="use_underline">True</property>
</object>
<packing>
- <property name="position">3</property>
+ <property name="position">4</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -782,7 +891,7 @@ You can add a new scheme by clicking on the '+' button.</property>
</child>
</object>
<packing>
- <property name="position">4</property>
+ <property name="position">5</property>
</packing>
</child>
<child type="tab">
@@ -793,7 +902,7 @@ You can add a new scheme by clicking on the '+' button.</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="position">4</property>
+ <property name="position">5</property>
<property name="tab_fill">False</property>
</packing>
</child>
@@ -903,7 +1012,7 @@ You can add a new scheme by clicking on the '+' button.</property>
</child>
</object>
<packing>
- <property name="position">5</property>
+ <property name="position">6</property>
</packing>
</child>
<child type="tab">
@@ -914,7 +1023,7 @@ You can add a new scheme by clicking on the '+' button.</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="position">2</property>
+ <property name="position">5</property>
<property name="tab_fill">False</property>
</packing>
</child>
diff --git a/src/plugin-menu/nautilus-actions.c b/src/plugin-menu/nautilus-actions.c
index 1fe170a..c21cf83 100644
--- a/src/plugin-menu/nautilus-actions.c
+++ b/src/plugin-menu/nautilus-actions.c
@@ -916,7 +916,7 @@ execute_action( NautilusMenuItem *item, NAObjectProfile *profile )
g_debug( "%s: item=%p, profile=%p", thisfn, ( void * ) item, ( void * ) profile );
tokens = NA_TOKENS( g_object_get_data( G_OBJECT( item ), "nautilus-actions-tokens" ));
- na_tokens_execute_action( tokens, profile );
+ na_tokens_execute_action( tokens, na_pivot_get_settings( st_plugin->private->pivot ), profile );
}
/*
diff --git a/src/utils/nautilus-actions-run.c b/src/utils/nautilus-actions-run.c
index 92e7169..08698e0 100644
--- a/src/utils/nautilus-actions-run.c
+++ b/src/utils/nautilus-actions-run.c
@@ -70,13 +70,15 @@ static GOptionEntry misc_entries[] = {
{ NULL }
};
+static NAPivot *st_pivot = NULL;
+
static GOptionContext *init_options( void );
static NAObjectAction *get_action( const gchar *id );
static GList *targets_from_selection( void );
static GList *targets_from_commandline( void );
static GList *get_selection_from_strv( const gchar **strv, gboolean has_mimetype );
static NAObjectProfile *get_profile_for_targets( NAObjectAction *action, GList *targets );
-static void execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets );
+static void execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets, const NASettings *settings );
static void dump_targets( GList *targets );
static void exit_with_usage( void );
@@ -170,7 +172,7 @@ main( int argc, char** argv )
}
g_debug( "%s: profile %p found", thisfn, ( void * ) profile );
- execute_action( action, profile, targets );
+ execute_action( action, profile, targets, na_pivot_get_settings( st_pivot ));
na_selected_info_free_list( targets );
exit( status );
@@ -220,15 +222,14 @@ static NAObjectAction *
get_action( const gchar *id )
{
NAObjectAction *action;
- NAPivot *pivot;
action = NULL;
- pivot = na_pivot_new();
- na_pivot_set_loadable( pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
- na_pivot_load_items( pivot );
+ st_pivot = na_pivot_new();
+ na_pivot_set_loadable( st_pivot, !PIVOT_LOAD_DISABLED & !PIVOT_LOAD_INVALID );
+ na_pivot_load_items( st_pivot );
- action = ( NAObjectAction * ) na_pivot_get_item( pivot, id );
+ action = ( NAObjectAction * ) na_pivot_get_item( st_pivot, id );
if( !action ){
g_printerr( _( "Error: action '%s' doesn't exist.\n" ), id );
@@ -391,13 +392,13 @@ get_profile_for_targets( NAObjectAction *action, GList *targets )
}
static void
-execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets )
+execute_action( NAObjectAction *action, NAObjectProfile *profile, GList *targets, const NASettings *settings )
{
/*static const gchar *thisfn = "nautilus_action_run_execute_action";*/
NATokens *tokens;
tokens = na_tokens_new_from_selection( targets );
- na_tokens_execute_action( tokens, profile );
+ na_tokens_execute_action( tokens, settings, profile );
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]