[nautilus-actions] Fix NACT Action tab layout
- From: Pierre Wieser <pwieser src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Fix NACT Action tab layout
- Date: Sun, 25 Oct 2009 15:19:11 +0000 (UTC)
commit 53e6e6630b5110ab5e9dab6b5b25e0514a57fa66
Author: Pierre Wieser <pwieser trychlos org>
Date: Sun Oct 25 10:48:35 2009 +0100
Fix NACT Action tab layout
TODO | 2 +
src/nact/nact-iaction-tab.c | 407 +++++++++++++--------
src/nact/nact-iadvanced-tab.c | 2 +-
src/nact/nact-ibackground-tab.c | 115 +------
src/nact/nact-icommand-tab.c | 6 +-
src/nact/nact-iconditions-tab.c | 12 +-
src/nact/nautilus-actions-config-tool.ui | 580 +++++++++++++++---------------
src/plugin/nautilus-actions.c | 28 +-
src/runtime/na-gconf-provider.c | 8 +
src/runtime/na-object-action-fn.h | 1 +
src/runtime/na-object-action.c | 25 ++
11 files changed, 612 insertions(+), 574 deletions(-)
---
diff --git a/TODO b/TODO
index 82b5343..5063ae4 100644
--- a/TODO
+++ b/TODO
@@ -40,6 +40,8 @@
- make toolbars detachable
+- make tabs moveable and detachable
+
- have a visual indication of the sort order in the tree
- use eggsmclient
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index bbf172f..b65e193 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -72,10 +72,21 @@ static void interface_base_finalize( NactIActionTabInterface *klass );
static void on_iactions_list_column_edited( NactIActionTab *instance, NAObject *object, gchar *text, gint column );
static void on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selected );
+static void on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance );
+
static void check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label );
static void on_label_changed( GtkEntry *entry, NactIActionTab *instance );
static void set_label_label( NactIActionTab *instance, const gchar *color );
+static void on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance );
+
+static void on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance );
+static void toolbar_same_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
+
+static void on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance );
+static void toolbar_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item );
+
static void on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance );
static GtkTreeModel *create_stock_icon_model( void );
@@ -86,10 +97,6 @@ static void on_icon_changed( GtkEntry *entry, NactIActionTab *instance
static gint sort_stock_ids( gconstpointer a, gconstpointer b );
static gchar *strip_underscore( const gchar *text );
-static void on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance );
-static void on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance );
-static void on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance );
-
static GtkButton *get_enabled_button( NactIActionTab *instance );
static void on_enabled_toggled( GtkToggleButton *button, NactIActionTab *instance );
@@ -190,72 +197,86 @@ nact_iaction_tab_runtime_init_toplevel( NactIActionTab *instance )
if( st_initialized && !st_finalized ){
- label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelEntry" );
g_signal_connect(
- G_OBJECT( label_widget ),
- "changed",
- G_CALLBACK( on_label_changed ),
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_SIGNAL_SELECTION_CHANGED,
+ G_CALLBACK( on_tab_updatable_selection_changed ),
instance );
- tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
g_signal_connect(
- G_OBJECT( tooltip_widget ),
- "changed",
- G_CALLBACK( on_tooltip_changed ),
+ G_OBJECT( instance ),
+ IACTIONS_LIST_SIGNAL_COLUMN_EDITED,
+ G_CALLBACK( on_iactions_list_column_edited ),
instance );
- icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" );
g_signal_connect(
- G_OBJECT( GTK_BIN( icon_widget )->child ),
+ G_OBJECT( button ),
+ "toggled",
+ G_CALLBACK( on_target_selection_toggled ),
+ instance );
+
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetBackgroundButton" );
+ g_signal_connect(
+ G_OBJECT( button ),
+ "toggled",
+ G_CALLBACK( on_target_background_toggled ),
+ instance );
+
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
+ g_signal_connect(
+ G_OBJECT( label_widget ),
"changed",
- G_CALLBACK( on_icon_changed ),
+ G_CALLBACK( on_label_changed ),
instance );
- button = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconBrowseButton" );
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" );
g_signal_connect(
G_OBJECT( button ),
- "clicked",
- G_CALLBACK( on_icon_browse ),
+ "toggled",
+ G_CALLBACK( on_target_toolbar_toggled ),
instance );
- enabled_button = get_enabled_button( instance );
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" );
g_signal_connect(
- G_OBJECT( enabled_button ),
+ G_OBJECT( button ),
"toggled",
- G_CALLBACK( on_enabled_toggled ),
+ G_CALLBACK( on_toolbar_same_label_toggled ),
instance );
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconLabelEntry" );
g_signal_connect(
- G_OBJECT( instance ),
- TAB_UPDATABLE_SIGNAL_SELECTION_CHANGED,
- G_CALLBACK( on_tab_updatable_selection_changed ),
+ G_OBJECT( label_widget ),
+ "changed",
+ G_CALLBACK( on_toolbar_label_changed ),
instance );
+ tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
g_signal_connect(
- G_OBJECT( instance ),
- IACTIONS_LIST_SIGNAL_COLUMN_EDITED,
- G_CALLBACK( on_iactions_list_column_edited ),
+ G_OBJECT( tooltip_widget ),
+ "changed",
+ G_CALLBACK( on_tooltip_changed ),
instance );
- button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" );
+ icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
g_signal_connect(
- G_OBJECT( button ),
- "toggled",
- G_CALLBACK( on_target_selection_toggled ),
+ G_OBJECT( GTK_BIN( icon_widget )->child ),
+ "changed",
+ G_CALLBACK( on_icon_changed ),
instance );
- button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetBackgroundButton" );
+ button = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconBrowseButton" );
g_signal_connect(
G_OBJECT( button ),
- "toggled",
- G_CALLBACK( on_target_background_toggled ),
+ "clicked",
+ G_CALLBACK( on_icon_browse ),
instance );
- button = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" );
+ enabled_button = get_enabled_button( instance );
g_signal_connect(
- G_OBJECT( button ),
+ G_OBJECT( enabled_button ),
"toggled",
- G_CALLBACK( on_target_toolbar_toggled ),
+ G_CALLBACK( on_enabled_toggled ),
instance );
}
}
@@ -303,7 +324,7 @@ nact_iaction_tab_has_label( NactIActionTab *instance )
if( st_initialized && !st_finalized ){
- label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelEntry" );
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
label = gtk_entry_get_text( GTK_ENTRY( label_widget ));
has_label = ( g_utf8_strlen( label, -1 ) > 0 );
}
@@ -321,7 +342,7 @@ on_iactions_list_column_edited( NactIActionTab *instance, NAObject *object, gcha
if( st_initialized && !st_finalized ){
if( NA_IS_OBJECT_ACTION( object )){
- label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelEntry" );
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
gtk_entry_set_text( GTK_ENTRY( label_widget ), text );
}
}
@@ -333,14 +354,14 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
static const gchar *thisfn = "nact_iaction_tab_on_tab_updatable_selection_changed";
NAObjectItem *item;
gboolean enable_tab;
+ gboolean target_selection, target_background, target_toolbar;
+ gboolean enable_label;
+ gboolean same_label;
GtkWidget *label_widget, *tooltip_widget, *icon_widget, *title_widget;
gchar *label, *tooltip, *icon;
GtkButton *enabled_button;
gboolean enabled_item;
- gboolean target_background_active;
- gboolean target_toolbar_active;
GtkToggleButton *toggle;
- GtkWidget *frame;
g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
g_return_if_fail( BASE_IS_WINDOW( instance ));
@@ -358,18 +379,49 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
enable_tab = ( count_selected == 1 );
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_ACTION, enable_tab );
- label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionItemID" );
- label = item ? na_object_get_id( item ) : g_strdup( "" );
- gtk_label_set_text( GTK_LABEL( label_widget ), label );
- g_free( label );
+ target_selection = ( item && (
+ ( NA_IS_OBJECT_ACTION( item ) && na_object_action_is_target_selection( NA_OBJECT_ACTION( item ))) ||
+ ( NA_IS_OBJECT_MENU( item ))));
- label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelEntry" );
- label = item ? na_object_get_label( item ) : g_strdup( "" );
+ target_background = ( item && (
+ ( NA_IS_OBJECT_ACTION( item ) && na_object_action_is_target_background( NA_OBJECT_ACTION( item ))) ||
+ ( NA_IS_OBJECT_MENU( item ))));
+
+ target_toolbar = (item && (
+ ( NA_IS_OBJECT_ACTION( item ) && na_object_action_is_target_toolbar( NA_OBJECT_ACTION( item )))));
+
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" ));
+ gtk_toggle_button_set_active( toggle, target_selection );
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetBackgroundButton" ));
+ gtk_toggle_button_set_active( toggle, target_background );
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+
+ enable_label = ( item && ( NA_IS_OBJECT_MENU( item ) || target_selection || target_background ));
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
+ label = enable_label ? na_object_get_label( item ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
if( item ){
check_for_label( instance, GTK_ENTRY( label_widget ), label );
}
g_free( label );
+ gtk_widget_set_sensitive( label_widget, enable_label );
+
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" ));
+ gtk_toggle_button_set_active( toggle, target_toolbar );
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" ));
+ same_label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( item )) : FALSE;
+ gtk_toggle_button_set_active( toggle, same_label );
+ toolbar_same_label_set_sensitive( instance, item );
+
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconLabelEntry" );
+ label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_get_label( NA_OBJECT_ACTION( item )) : g_strdup( "" );
+ gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
+ g_free( label );
+ toolbar_label_set_sensitive( instance, item );
tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
tooltip = item ? na_object_get_tooltip( item ) : g_strdup( "" );
@@ -381,37 +433,6 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
gtk_entry_set_text( GTK_ENTRY( GTK_BIN( icon_widget )->child ), icon );
g_free( icon );
- title_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetsTitle" );
- if( item && NA_IS_OBJECT_MENU( item )){
- gtk_label_set_markup( GTK_LABEL( title_widget ), _( "<b>Menu targets</b>" ));
- } else {
- gtk_label_set_markup( GTK_LABEL( title_widget ), _( "<b>Action targets</b>" ));
- }
-
- frame = base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetFrame" );
- gtk_widget_set_sensitive( frame, item && NA_IS_OBJECT_ACTION( item ));
-
- toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetSelectionButton" ));
- gtk_toggle_button_set_active( toggle,
- item && NA_IS_OBJECT_ACTION( item )
- ? na_object_action_is_target_selection( NA_OBJECT_ACTION( item ))
- : FALSE );
-
- toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetBackgroundButton" ));
- target_background_active = (
- item && NA_IS_OBJECT_ACTION( item )
- ? na_object_action_is_target_background( NA_OBJECT_ACTION( item ))
- : FALSE );
- gtk_toggle_button_set_active( toggle, target_background_active );
-
- toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetToolbarButton" ));
- target_toolbar_active = (
- item && NA_IS_OBJECT_ACTION( item )
- ? na_object_action_is_target_toolbar( NA_OBJECT_ACTION( item ))
- : FALSE );
- gtk_toggle_button_set_active( toggle, target_toolbar_active );
- gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
-
title_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionPropertiesTitle" );
if( item && NA_IS_OBJECT_MENU( item )){
gtk_label_set_markup( GTK_LABEL( title_widget ), _( "<b>Menu properties</b>" ));
@@ -423,11 +444,66 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
enabled_item = item ? na_object_is_enabled( NA_OBJECT_ITEM( item )) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( enabled_button ), enabled_item );
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionItemID" );
+ label = item ? na_object_get_id( item ) : g_strdup( "" );
+ gtk_label_set_text( GTK_LABEL( label_widget ), label );
+ g_free( label );
+
/* TODO: manage read-only flag */
}
}
static void
+on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_target_selection_toggled";
+ NAObjectAction *action;
+ gboolean is_target;
+
+ g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
+ NULL );
+
+ if( action ){
+ g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
+
+ is_target = gtk_toggle_button_get_active( button );
+ na_object_action_set_target_selection( action, is_target );
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, action );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
+ }
+}
+
+static void
+on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_target_background_toggled";
+ NAObjectAction *action;
+ gboolean is_target;
+
+ g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
+ NULL );
+
+ if( action ){
+ g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
+
+ is_target = gtk_toggle_button_get_active( button );
+ na_object_action_set_target_background( action, is_target );
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, action );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
+ }
+}
+
+static void
check_for_label( NactIActionTab *instance, GtkEntry *entry, const gchar *label )
{
NAObjectItem *edited;
@@ -499,13 +575,107 @@ set_label_label( NactIActionTab *instance, const gchar *color )
GtkWidget *label;
gchar *text;
- label = base_window_get_widget( BASE_WINDOW( instance ), "ActionLabelLabel" );
+ label = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelLabel" );
/* i18n: label in front of the GtkEntry where user enters the action label */
- text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Label :" ));
+ text = g_markup_printf_escaped( "<span color=\"%s\">%s</span>", color, _( "_Menu label :" ));
gtk_label_set_markup_with_mnemonic( GTK_LABEL( label ), text );
}
static void
+on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ static const gchar *thisfn = "nact_iaction_tab_on_target_toolbar_toggled";
+ NAObjectAction *action;
+ gboolean is_target;
+
+ g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
+ NULL );
+
+ if( action ){
+ g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
+
+ is_target = gtk_toggle_button_get_active( button );
+ na_object_action_set_target_toolbar( action, is_target );
+
+ toolbar_same_label_set_sensitive( instance, NA_OBJECT_ITEM( action ));
+ toolbar_label_set_sensitive( instance, NA_OBJECT_ITEM( action ));
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, action );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
+ }
+}
+
+static void
+on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance )
+{
+ NAObjectItem *edited;
+ gboolean same_label;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+ NULL );
+
+ if( edited ){
+ g_return_if_fail( NA_IS_OBJECT_ACTION( edited ));
+
+ same_label = gtk_toggle_button_get_active( button );
+ na_object_action_toolbar_set_same_label( NA_OBJECT_ACTION( edited ), same_label );
+
+ toolbar_label_set_sensitive( instance, edited );
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ }
+}
+
+static void
+toolbar_same_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item )
+{
+ GtkToggleButton *toggle;
+ gboolean target_toolbar;
+
+ toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" ));
+ target_toolbar = item && NA_IS_OBJECT_ACTION( item ) ? na_object_action_is_target_toolbar( NA_OBJECT_ACTION( item )) : FALSE;
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), target_toolbar );
+}
+
+static void
+on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance )
+{
+ NAObjectItem *edited;
+ const gchar *label;
+
+ g_object_get(
+ G_OBJECT( instance ),
+ TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
+ NULL );
+
+ if( edited ){
+ g_return_if_fail( NA_IS_OBJECT_ACTION( edited ));
+
+ label = gtk_entry_get_text( entry );
+ na_object_action_toolbar_set_label( NA_OBJECT_ACTION( edited ), label );
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
+ }
+}
+
+static void
+toolbar_label_set_sensitive( NactIActionTab *instance, NAObjectItem *item )
+{
+ gboolean same_label;
+ GtkWidget *label_widget;
+
+ same_label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( item )) : FALSE;
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconLabelEntry" );
+ gtk_widget_set_sensitive( label_widget, !same_label );
+}
+
+static void
on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance )
{
NAObjectItem *edited;
@@ -711,81 +881,6 @@ strip_underscore( const gchar *text )
return( result );
}
-static void
-on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance )
-{
- static const gchar *thisfn = "nact_iaction_tab_on_target_selection_toggled";
- NAObjectAction *action;
- gboolean is_target;
-
- g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
- NULL );
-
- g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
-
- if( action ){
- is_target = gtk_toggle_button_get_active( button );
- na_object_action_set_target_selection( action, is_target );
-
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, action );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
- }
-}
-
-static void
-on_target_background_toggled( GtkToggleButton *button, NactIActionTab *instance )
-{
- static const gchar *thisfn = "nact_iaction_tab_on_target_background_toggled";
- NAObjectAction *action;
- gboolean is_target;
-
- g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
- NULL );
-
- g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
-
- if( action ){
- is_target = gtk_toggle_button_get_active( button );
- na_object_action_set_target_background( action, is_target );
-
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, action );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
- }
-}
-
-static void
-on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance )
-{
- static const gchar *thisfn = "nact_iaction_tab_on_target_toolbar_toggled";
- NAObjectAction *action;
- gboolean is_target;
-
- g_debug( "%s: button=%p, instance=%p", thisfn, ( void * ) button, ( void * ) instance );
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &action,
- NULL );
-
- g_return_if_fail( !action || NA_IS_OBJECT_ACTION( action ));
-
- if( action ){
- is_target = gtk_toggle_button_get_active( button );
- na_object_action_set_target_toolbar( action, is_target );
-
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ENABLE_TAB, action );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
- }
-}
-
static GtkButton *
get_enabled_button( NactIActionTab *instance )
{
diff --git a/src/nact/nact-iadvanced-tab.c b/src/nact/nact-iadvanced-tab.c
index b4f69e6..73d00ac 100644
--- a/src/nact/nact-iadvanced-tab.c
+++ b/src/nact/nact-iadvanced-tab.c
@@ -417,7 +417,7 @@ on_tab_updatable_selection_changed( NactIAdvancedTab *instance, gint count_selec
enable_tab = tab_set_sensitive( instance );
- if( enable_tab ){
+ if( profile ){
schemes = na_object_profile_get_schemes( profile );
g_slist_foreach( schemes, ( GFunc ) set_action_schemes, scheme_model );
}
diff --git a/src/nact/nact-ibackground-tab.c b/src/nact/nact-ibackground-tab.c
index 83aca76..1aeffd4 100644
--- a/src/nact/nact-ibackground-tab.c
+++ b/src/nact/nact-ibackground-tab.c
@@ -85,10 +85,6 @@ static void reset_folders( NactIBackgroundTab *instance );
static void setup_folders( NactIBackgroundTab *instance );
static void treeview_cell_edited( NactIBackgroundTab *instance, const gchar *path_string, const gchar *text, gint column, gboolean *state, gchar **old_text );
-static void on_toolbar_same_label_toggled( GtkToggleButton *button, NactIBackgroundTab *instance );
-
-static void on_toolbar_label_changed( GtkEntry *entry, NactIBackgroundTab *instance );
-
GType
nact_ibackground_tab_get_type( void )
{
@@ -197,8 +193,6 @@ nact_ibackground_tab_runtime_init_toplevel( NactIBackgroundTab *instance )
GtkTreeViewColumn *column;
GList *renderers;
GtkWidget *add_button, *remove_button;
- GtkWidget *label_widget;
- GtkWidget *toolbar_same_label_button;
g_debug( "%s: instance=%p", thisfn, ( void * ) instance );
g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
@@ -245,20 +239,6 @@ nact_ibackground_tab_runtime_init_toplevel( NactIBackgroundTab *instance )
"changed",
G_CALLBACK( on_folders_selection_changed ),
instance );
-
- toolbar_same_label_button = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" );
- g_signal_connect(
- G_OBJECT( toolbar_same_label_button ),
- "toggled",
- G_CALLBACK( on_toolbar_same_label_toggled ),
- instance );
-
- label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
- g_signal_connect(
- G_OBJECT( label_widget ),
- "changed",
- G_CALLBACK( on_toolbar_label_changed ),
- instance );
}
}
@@ -294,10 +274,6 @@ on_tab_updatable_selection_changed( NactIBackgroundTab *instance, gint count_sel
static const gchar *thisfn = "nact_ibackground_tab_on_tab_updatable_selection_changed";
NAObjectItem *item;
gboolean enable_tab;
- GtkToggleButton *same_label_button;
- gboolean same_label;
- GtkWidget *short_label_widget;
- gchar *short_label;
g_debug( "%s: instance=%p, count_selected=%d", thisfn, ( void * ) instance, count_selected );
g_return_if_fail( NACT_IS_IBACKGROUND_TAB( instance ));
@@ -315,19 +291,9 @@ on_tab_updatable_selection_changed( NactIBackgroundTab *instance, gint count_sel
enable_tab = tab_set_sensitive( instance );
- if( enable_tab ){
+ if( item && NA_IS_OBJECT_ACTION( item )){
setup_folders( instance );
}
-
- /* only actions go to toolbar */
- same_label_button = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" ));
- same_label = enable_tab && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_use_same_label( NA_OBJECT_ACTION( item )) : FALSE;
- gtk_toggle_button_set_active( same_label_button, same_label );
-
- short_label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
- short_label = enable_tab && NA_IS_OBJECT_ACTION( item ) ? na_object_action_toolbar_get_label( NA_OBJECT_ACTION( item )) : g_strdup( "" );
- gtk_entry_set_text( GTK_ENTRY( short_label_widget ), short_label );
- g_free( short_label );
}
}
@@ -350,11 +316,7 @@ tab_set_sensitive( NactIBackgroundTab *instance )
{
NAObjectAction *action;
NAObjectProfile *profile;
- gboolean is_action;
- gboolean enable_tab, enable_folders_frame, enable_toolbar_frame;
- GtkWidget *toolbar_frame_widget;
- gboolean enable_toolbar_label_entry;
- GtkWidget *toolbar_label_entry;
+ gboolean enable_tab;
g_object_get(
G_OBJECT( instance ),
@@ -362,21 +324,11 @@ tab_set_sensitive( NactIBackgroundTab *instance )
TAB_UPDATABLE_PROP_EDITED_PROFILE, &profile,
NULL );
- is_action = ( action && NA_IS_OBJECT_ACTION( action ));
- enable_toolbar_frame = ( is_action && na_object_action_is_target_toolbar( action ));
- enable_folders_frame = ( profile != NULL &&
- ( na_object_action_is_target_background( action ) || enable_toolbar_frame ));
- enable_tab = enable_folders_frame || enable_toolbar_frame;
+ enable_tab = ( profile != NULL &&
+ ( na_object_action_is_target_background( action ) || na_object_action_is_target_toolbar( action )));
nact_main_tab_enable_page( NACT_MAIN_WINDOW( instance ), TAB_BACKGROUND, enable_tab );
- toolbar_frame_widget = base_window_get_widget( BASE_WINDOW( instance ), "BackgroundToolbarFrame" );
- gtk_widget_set_sensitive( toolbar_frame_widget, enable_toolbar_frame );
-
- enable_toolbar_label_entry = ( enable_toolbar_frame && !na_object_action_toolbar_use_same_label( action ));
- toolbar_label_entry = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
- gtk_widget_set_sensitive( toolbar_label_entry, enable_toolbar_label_entry );
-
return( enable_tab );
}
@@ -417,7 +369,7 @@ add_uri_to_folders( NactIBackgroundTab *instance, const gchar *uri )
na_object_profile_set_folders( edited, folders );
na_utils_free_string_list( folders );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
}
static GtkTreeView *
@@ -533,7 +485,7 @@ on_remove_folder_clicked( GtkButton *button, NactIBackgroundTab *instance )
na_utils_free_string_list( folders );
g_free( uri );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
}
g_list_foreach( selected_path, ( GFunc ) gtk_tree_path_free, NULL );
@@ -602,58 +554,5 @@ treeview_cell_edited( NactIBackgroundTab *instance, const gchar *path_string, co
na_object_profile_replace_folder_uri( edited, *old_text, text );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, action, FALSE );
-}
-
-static void
-on_toolbar_same_label_toggled( GtkToggleButton *button, NactIBackgroundTab *instance )
-{
- NAObjectItem *edited;
- gboolean same_label;
- GtkWidget *label_widget;
- gchar *text;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
- NULL );
-
- if( edited ){
- g_return_if_fail( NA_IS_OBJECT_ACTION( edited ));
-
- same_label = gtk_toggle_button_get_active( button );
- na_object_action_toolbar_set_same_label( NA_OBJECT_ACTION( edited ), same_label );
-
- tab_set_sensitive( instance );
-
- if( same_label ){
- label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ToolbarLabelEntry" );
- text = na_object_get_label( edited );
- gtk_entry_set_text( GTK_ENTRY( label_widget ), text );
- g_free( text );
- }
-
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
-}
-
-static void
-on_toolbar_label_changed( GtkEntry *entry, NactIBackgroundTab *instance )
-{
- NAObjectItem *edited;
- const gchar *label;
-
- g_object_get(
- G_OBJECT( instance ),
- TAB_UPDATABLE_PROP_EDITED_ACTION, &edited,
- NULL );
-
- if( edited ){
- g_return_if_fail( NA_IS_OBJECT_ACTION( edited ));
-
- label = gtk_entry_get_text( entry );
- na_object_action_toolbar_set_label( NA_OBJECT_ACTION( edited ), label );
-
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
- }
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, edited, FALSE );
}
diff --git a/src/nact/nact-icommand-tab.c b/src/nact/nact-icommand-tab.c
index 0520e95..78be6d0 100644
--- a/src/nact/nact-icommand-tab.c
+++ b/src/nact/nact-icommand-tab.c
@@ -355,18 +355,18 @@ on_tab_updatable_selection_changed( NactICommandTab *instance, gint count_select
enable_tab = tab_set_sensitive( instance );
label_entry = get_label_entry( instance );
- label = enable_tab ? na_object_get_label( profile ) : g_strdup( "" );
+ label = profile ? na_object_get_label( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_entry ), label );
check_for_label( instance, GTK_ENTRY( label_entry ), label );
g_free( label );
path_entry = get_path_entry( instance );
- path = enable_tab ? na_object_profile_get_path( profile ) : g_strdup( "" );
+ path = profile ? na_object_profile_get_path( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( path_entry ), path );
g_free( path );
parameters_entry = get_parameters_entry( instance );
- parameters = enable_tab ? na_object_profile_get_parameters( profile ) : g_strdup( "" );
+ parameters = profile ? na_object_profile_get_parameters( profile ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( parameters_entry ), parameters );
g_free( parameters );
}
diff --git a/src/nact/nact-iconditions-tab.c b/src/nact/nact-iconditions-tab.c
index e728fc9..87e2c77 100644
--- a/src/nact/nact-iconditions-tab.c
+++ b/src/nact/nact-iconditions-tab.c
@@ -321,29 +321,29 @@ on_tab_updatable_selection_changed( NactIConditionsTab *instance, gint count_sel
enable_tab = tab_set_sensitive( instance );
basenames_widget = get_basenames_entry( instance );
- basenames = enable_tab ? na_object_profile_get_basenames( profile ) : NULL;
+ basenames = profile ? na_object_profile_get_basenames( profile ) : NULL;
basenames_text = profile ? na_utils_string_list_to_text( basenames ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( basenames_widget ), basenames_text );
g_free( basenames_text );
na_utils_free_string_list( basenames );
matchcase_button = get_matchcase_button( instance );
- matchcase = enable_tab ? na_object_profile_get_matchcase( profile ) : FALSE;
+ matchcase = profile ? na_object_profile_get_matchcase( profile ) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( matchcase_button ), matchcase );
mimetypes_widget = get_mimetypes_entry( instance );
- mimetypes = enable_tab ? na_object_profile_get_mimetypes( profile ) : NULL;
+ mimetypes = profile ? na_object_profile_get_mimetypes( profile ) : NULL;
mimetypes_text = profile ? na_utils_string_list_to_text( mimetypes ) : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( mimetypes_widget ), mimetypes_text );
g_free( mimetypes_text );
na_utils_free_string_list( mimetypes );
- isfile = enable_tab ? na_object_profile_get_is_file( profile ) : FALSE;
- isdir = enable_tab ? na_object_profile_get_is_dir( profile ) : FALSE;
+ isfile = profile ? na_object_profile_get_is_file( profile ) : FALSE;
+ isdir = profile ? na_object_profile_get_is_dir( profile ) : FALSE;
set_isfiledir( instance, isfile, isdir );
multiple_button = get_multiple_button( instance );
- multiple = enable_tab ? na_object_profile_get_multiple( profile ) : FALSE;
+ multiple = profile ? na_object_profile_get_multiple( profile ) : FALSE;
gtk_toggle_button_set_active( GTK_TOGGLE_BUTTON( multiple_button ), multiple );
}
}
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index f3a2944..7c9808f 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -102,161 +102,283 @@
<property name="left_padding">12</property>
<property name="right_padding">6</property>
<child>
- <object class="GtkTable" id="table1">
+ <object class="GtkVBox" id="vbox7">
<property name="visible">True</property>
- <property name="n_rows">4</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <property name="row_spacing">6</property>
- <child>
- <object class="GtkLabel" id="ActionLabelLabel">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Label :</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">ActionLabelEntry</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="ActionTooltipLabel">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Tooltip :</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">ActionTooltipEntry</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="ActionIconLabel">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">_Icon :</property>
- <property name="use_underline">True</property>
- <property name="mnemonic_widget">ActionIconComboBoxEntry</property>
- </object>
- <packing>
- <property name="top_attach">3</property>
- <property name="bottom_attach">4</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
+ <property name="spacing">10</property>
<child>
- <object class="GtkEntry" id="ActionLabelEntry">
+ <object class="GtkTable" id="table7">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Label of the menu item in the Nautilus popup menu.</property>
- <property name="invisible_char">●</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <child>
+ <object class="GtkCheckButton" id="ActionTargetSelectionButton">
+ <property name="label" translatable="yes">Display item in selection context menu</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">When checked, the action will be candidate to be displayed in Nautilus context menus when there is a selection. It thus applies to selected objects. The item will also appear in Nautilus Edit menu.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="ActionTargetBackgroundButton">
+ <property name="label" translatable="yes">Display item in background folder context menu</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">When checked, the item will be candidate to be displayed in Nautilus context menu when there is no selection. It thus applies to current folder. The item will also appear in Nautilus File menu.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">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>
+ <object class="GtkEntry" id="ActionMenuLabelEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Label of the menu item in the Nautilus popup menu.</property>
+ <property name="invisible_char">●</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>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ActionMenuLabelLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Menu label :</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ActionMenuLabelEntry</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</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>
+ <property name="position">0</property>
</packing>
</child>
<child>
- <object class="GtkEntry" id="ActionTooltipEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="tooltip_text" translatable="yes">Tooltip of the menu item that will appear in the Nautilus statusbar.</property>
- <property name="invisible_char">●</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>
- </packing>
+ <placeholder/>
</child>
<child>
- <object class="GtkHBox" id="hbox2">
+ <object class="GtkTable" id="table6">
<property name="visible">True</property>
- <property name="spacing">6</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
<child>
- <object class="GtkAspectFrame" id="ActionIconFrame">
- <property name="width_request">24</property>
- <property name="height_request">24</property>
+ <object class="GtkCheckButton" id="ActionTargetToolbarButton">
+ <property name="label" translatable="yes">Display item as an icon in toolbar</property>
<property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <property name="obey_child">False</property>
- <child>
- <object class="GtkImage" id="ActionIconImage">
- <property name="stock">gnome-stock-blank</property>
- <property name="icon-size">4</property>
- </object>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">When checked, the action will be displayed in Nautilus toolbar. It applies to current folder when there is no selection.</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="fill">False</property>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkComboBoxEntry" id="ActionIconComboBoxEntry">
+ <object class="GtkCheckButton" id="ToolbarSameLabelButton">
+ <property name="label" translatable="yes">Use _same label for icon in the toolbar</property>
<property name="visible">True</property>
- <property name="tooltip_text" translatable="yes">Select the icon which will appear in the Nautilus context menu.</property>
- <child>
- <object class="GtkCellRendererText" id="cellrenderertext1"/>
- <attributes>
- <attribute name="text">0</attribute>
- </attributes>
- </child>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="tooltip_text" translatable="yes">Does the icon use the same label that the menu ?</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">1</property>
+ <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>
- <object class="GtkButton" id="ActionIconBrowseButton">
- <property name="label" translatable="yes">_Browse...</property>
+ <object class="GtkEntry" id="ActionIconLabelEntry">
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="receives_default">True</property>
- <property name="tooltip_text" translatable="yes">Click to choose a custom icon from a file instead of a predefined icon from the drop-down list.</property>
- <property name="image">image3</property>
+ <property name="tooltip_text" translatable="yes">Label of the icon item in the Nautilus toolbar.</property>
+ <property name="max_length">32</property>
+ <property name="invisible_char">●</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">GTK_FILL</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ActionIconLabelLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Icon label :</property>
<property name="use_underline">True</property>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">2</property>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
</object>
<packing>
- <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="position">2</property>
</packing>
</child>
<child>
- <object class="GtkLabel" id="ActionItemID">
+ <object class="GtkTable" id="table1">
<property name="visible">True</property>
- <property name="xalign">0</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
+ <property name="row_spacing">4</property>
+ <child>
+ <object class="GtkLabel" id="ActionTooltipLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Tooltip :</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ActionTooltipEntry</property>
+ </object>
+ <packing>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="ActionIconLabel">
+ <property name="visible">True</property>
+ <property name="xalign">1</property>
+ <property name="label" translatable="yes">_Icon :</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">ActionIconComboBoxEntry</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">GTK_FILL</property>
+ <property name="y_options"></property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkEntry" id="ActionTooltipEntry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="tooltip_text" translatable="yes">Tooltip of the menu item that will appear in the Nautilus statusbar.</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="GtkHBox" id="hbox2">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkAspectFrame" id="ActionIconFrame">
+ <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>
+ <property name="obey_child">False</property>
+ <child>
+ <object class="GtkImage" id="ActionIconImage">
+ <property name="stock">gnome-stock-blank</property>
+ <property name="icon-size">4</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkComboBoxEntry" id="ActionIconComboBoxEntry">
+ <property name="visible">True</property>
+ <property name="tooltip_text" translatable="yes">Select the icon which will appear in the Nautilus menus and in the toolbar.</property>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ActionIconBrowseButton">
+ <property name="label" translatable="yes">_Browse...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Click to choose a custom icon from a file instead of a predefined icon from the drop-down list.</property>
+ <property name="image">image3</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </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>
</object>
<packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
+ <property name="position">3</property>
</packing>
</child>
- <child>
- <placeholder/>
- </child>
</object>
</child>
</object>
@@ -265,7 +387,7 @@
<object class="GtkLabel" id="label52">
<property name="visible">True</property>
<property name="xpad">5</property>
- <property name="label" translatable="yes"><b>Nautilus Menu Item</b></property>
+ <property name="label" translatable="yes"><b>Nautilus Item</b></property>
<property name="use_markup">True</property>
</object>
</child>
@@ -280,124 +402,84 @@
<property name="visible">True</property>
<property name="spacing">10</property>
<child>
- <object class="GtkFrame" id="ActionTargetFrame">
+ <object class="GtkFrame" id="frame8">
<property name="visible">True</property>
<property name="label_xalign">0</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkAlignment" id="alignment13">
+ <object class="GtkAlignment" id="alignment8">
<property name="visible">True</property>
<property name="top_padding">6</property>
<property name="bottom_padding">6</property>
<property name="left_padding">12</property>
<property name="right_padding">6</property>
<child>
- <object class="GtkVBox" id="vbox7">
+ <object class="GtkTable" id="table4">
<property name="visible">True</property>
+ <property name="n_rows">3</property>
+ <property name="n_columns">2</property>
+ <property name="column_spacing">5</property>
<child>
- <object class="GtkCheckButton" id="ActionTargetSelectionButton">
- <property name="label" translatable="yes">Targets _selection menus</property>
+ <object class="GtkCheckButton" id="ActionEnabledButton">
+ <property name="label" translatable="yes">E_nabled</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">When checked, the action or menu will be candidate to be displayed in Nautilus context menus when there is a selection. The item will also appear in Nautilus Edit menu.</property>
+ <property name="tooltip_text" translatable="yes">When the action is disabled, it will never appear in the Nautilus context menu. If a menu is disabled, none of the embedded subitems will appear.</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">0</property>
+ <property name="left_attach">1</property>
+ <property name="right_attach">2</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="ActionTargetBackgroundButton">
- <property name="label" translatable="yes">Targets _background menus</property>
+ <object class="GtkCheckButton" id="ActionReadonlyButton">
+ <property name="label" translatable="yes">_Read-only</property>
<property name="visible">True</property>
+ <property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">When checked, the item will be candidate to be displayed in Nautilus context menu when there is no selection. The item will also appear in Nautilus File menu.</property>
+ <property name="tooltip_text" translatable="yes">If only readable, the action or the menu cannot be edited.</property>
<property name="use_underline">True</property>
<property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">1</property>
+ <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>
- <object class="GtkCheckButton" id="ActionTargetToolbarButton">
- <property name="label" translatable="yes">Targets _toolbar display</property>
+ <object class="GtkLabel" id="ActionItemID">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">When checked, the action will be displayed in Nautilus toolbar.
-Note that this only applies for now to actions which target background menus.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
+ <property name="xalign">0</property>
+ <property name="yalign">1</property>
+ <property name="ypad">6</property>
</object>
<packing>
- <property name="position">2</property>
+ <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="y_options">GTK_FILL</property>
</packing>
</child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="ActionTargetsTitle">
- <property name="visible">True</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes"><b>Action targets</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>
- <object class="GtkFrame" id="frame8">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkAlignment" id="alignment8">
- <property name="visible">True</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">6</property>
- <property name="left_padding">12</property>
- <property name="right_padding">6</property>
- <child>
- <object class="GtkVBox" id="vbox43">
- <property name="visible">True</property>
<child>
- <object class="GtkCheckButton" id="ActionEnabledButton">
- <property name="label" translatable="yes">E_nabled</property>
+ <object class="GtkLabel" id="label4">
<property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">When the action is disabled, it will never appear in the Nautilus context menu.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
</object>
<packing>
- <property name="position">1</property>
+ <property name="x_options">GTK_FILL</property>
</packing>
</child>
<child>
- <object class="GtkCheckButton" id="ActionReadonlyButton">
- <property name="label" translatable="yes">_Read-only</property>
- <property name="visible">True</property>
- <property name="sensitive">False</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">If only readable, the action cannot be edited.</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="position">2</property>
- </packing>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
</child>
</object>
</child>
@@ -413,8 +495,7 @@ Note that this only applies for now to actions which target background menus.</p
</child>
</object>
<packing>
- <property name="expand">False</property>
- <property name="position">1</property>
+ <property name="position">0</property>
</packing>
</child>
</object>
@@ -646,6 +727,8 @@ Note that this only applies for now to actions which target background menus.</p
</object>
<packing>
<property name="position">1</property>
+ <property name="reorderable">True</property>
+ <property name="detachable">True</property>
</packing>
</child>
<child type="tab">
@@ -674,7 +757,7 @@ Defining several profiles lets you have several commands, each applying with a d
<property name="visible">True</property>
<property name="xalign">0</property>
<property name="ypad">10</property>
- <property name="label" translatable="yes"><b>Appears if URI is one or inside one of these :</b></property>
+ <property name="label" translatable="yes"><b>Appears if URI is one or inside one of these</b></property>
<property name="use_markup">True</property>
</object>
<packing>
@@ -710,87 +793,6 @@ Defining several profiles lets you have several commands, each applying with a d
<property name="position">0</property>
</packing>
</child>
- <child>
- <object class="GtkFrame" id="BackgroundToolbarFrame">
- <property name="visible">True</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">in</property>
- <child>
- <object class="GtkAlignment" id="alignment6">
- <property name="visible">True</property>
- <property name="top_padding">6</property>
- <property name="bottom_padding">6</property>
- <property name="left_padding">12</property>
- <property name="right_padding">6</property>
- <child>
- <object class="GtkTable" id="table4">
- <property name="visible">True</property>
- <property name="n_rows">2</property>
- <property name="n_columns">2</property>
- <property name="column_spacing">6</property>
- <child>
- <object class="GtkCheckButton" id="ToolbarSameLabelButton">
- <property name="label" translatable="yes">Use _same label for icon in the toolbar</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- <property name="use_underline">True</property>
- <property name="draw_indicator">True</property>
- </object>
- <packing>
- <property name="left_attach">1</property>
- <property name="right_attach">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="ActionShortLabelLabel">
- <property name="visible">True</property>
- <property name="xalign">1</property>
- <property name="label" translatable="yes">S_hort label :</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <object class="GtkEntry" id="ToolbarLabelEntry">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="max_length">32</property>
- <property name="invisible_char">●</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>
- <property name="x_options">GTK_FILL</property>
- </packing>
- </child>
- <child>
- <placeholder/>
- </child>
- </object>
- </child>
- </object>
- </child>
- <child type="label">
- <object class="GtkLabel" id="label51">
- <property name="visible">True</property>
- <property name="xpad">5</property>
- <property name="label" translatable="yes"><b>Nautilus toolbar</b></property>
- <property name="use_markup">True</property>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="position">1</property>
- </packing>
- </child>
</object>
<packing>
<property name="position">0</property>
@@ -867,7 +869,7 @@ Defining several profiles lets you have several commands, each applying with a d
<object class="GtkLabel" id="label15">
<property name="visible">True</property>
<property name="tooltip_text" translatable="yes">This advanced tab lets you precisely choose on which schemes the selection will apply.</property>
- <property name="label" translatable="yes">_Background</property>
+ <property name="label" translatable="yes">_Folder</property>
<property name="use_underline">True</property>
</object>
<packing>
@@ -1287,10 +1289,10 @@ Defining several profiles lets you have several commands, each applying with a d
<child>
<object class="GtkFileChooserWidget" id="ImportFileChooser">
<property name="visible">True</property>
+ <property name="use_preview_label">False</property>
+ <property name="preview_widget_active">False</property>
<property name="select_multiple">True</property>
<property name="local_only">False</property>
- <property name="preview_widget_active">False</property>
- <property name="use_preview_label">False</property>
</object>
<packing>
<property name="position">0</property>
@@ -2676,11 +2678,6 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<action-widget response="0">OKButton1</action-widget>
</action-widgets>
</object>
- <object class="GtkImage" id="image3">
- <property name="visible">True</property>
- <property name="stock">gtk-find-and-replace</property>
- <property name="icon-size">4</property>
- </object>
<object class="GtkImage" id="image2">
<property name="visible">True</property>
<property name="stock">gtk-find-and-replace</property>
@@ -2691,17 +2688,32 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
<property name="stock">gtk-help</property>
<property name="icon-size">4</property>
</object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="stock">gtk-find-and-replace</property>
+ <property name="icon-size">4</property>
+ </object>
<object class="GtkSizeGroup" id="CommandLabelSizeGroup">
<widgets>
- <widget name="ProfileLabelLabel"/>
- <widget name="CommandPathLabel"/>
<widget name="CommandParametersLabel"/>
+ <widget name="CommandPathLabel"/>
+ <widget name="ProfileLabelLabel"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="CommandButtonSizeGroup">
<widgets>
- <widget name="CommandPathButton"/>
<widget name="CommandLegendButton"/>
+ <widget name="CommandPathButton"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup" id="ActionLabelSizeGroup">
+ <widgets>
+ <widget name="label4"/>
+ <widget name="ActionIconLabel"/>
+ <widget name="ActionTooltipLabel"/>
+ <widget name="label4"/>
+ <widget name="ActionMenuLabelLabel"/>
+ <widget name="ActionIconLabelLabel"/>
</widgets>
</object>
</interface>
diff --git a/src/plugin/nautilus-actions.c b/src/plugin/nautilus-actions.c
index 0fe336b..fd16dfb 100644
--- a/src/plugin/nautilus-actions.c
+++ b/src/plugin/nautilus-actions.c
@@ -458,30 +458,26 @@ is_action_candidate( NautilusActions *plugin, NAObjectAction *action, gint targe
{
static const gchar *thisfn = "nautilus_actions_is_action_candidate";
NAObjectProfile *candidate = NULL;
- gchar *action_label, *uuid;
+ gchar *action_label;
gchar *profile_label;
GList *profiles, *ip;
- action_label = na_object_get_label( action );
+ if( na_object_action_is_candidate( action, target )){
- if( !action_label || !g_utf8_strlen( action_label, -1 )){
- uuid = na_object_get_id( action );
- g_warning( "%s: label null or empty for uuid=%s", thisfn, uuid );
- g_free( uuid );
- return( NULL );
- }
+ action_label = na_object_get_label( action );
- profiles = na_object_get_items_list( action );
- for( ip = profiles ; ip && !candidate ; ip = ip->next ){
+ profiles = na_object_get_items_list( action );
+ for( ip = profiles ; ip && !candidate ; ip = ip->next ){
- NAObjectProfile *profile = NA_OBJECT_PROFILE( ip->data );
- if( na_object_profile_is_candidate( profile, target, files )){
+ NAObjectProfile *profile = NA_OBJECT_PROFILE( ip->data );
+ if( na_object_profile_is_candidate( profile, target, files )){
- profile_label = na_object_get_label( profile );
- g_debug( "%s: selecting %s - %s", thisfn, action_label, profile_label );
- g_free( profile_label );
+ profile_label = na_object_get_label( profile );
+ g_debug( "%s: selecting %s - %s", thisfn, action_label, profile_label );
+ g_free( profile_label );
- candidate = profile;
+ candidate = profile;
+ }
}
}
diff --git a/src/runtime/na-gconf-provider.c b/src/runtime/na-gconf-provider.c
index 60ad27f..4a5e69c 100644
--- a/src/runtime/na-gconf-provider.c
+++ b/src/runtime/na-gconf-provider.c
@@ -610,11 +610,19 @@ read_item_action_properties( NAGConfProvider *provider, GSList *entries, NAObjec
if( na_gconf_utils_get_bool_from_entries( entries, OBJECT_ITEM_TOOLBAR_SAME_LABEL_ENTRY, &toolbar_same_label )){
na_object_action_toolbar_set_same_label( action, toolbar_same_label );
+
+ } else {
+ toolbar_same_label = na_object_action_toolbar_use_same_label( action );
}
if( na_gconf_utils_get_string_from_entries( entries, OBJECT_ITEM_TOOLBAR_LABEL_ENTRY, &toolbar_label )){
na_object_action_toolbar_set_label( action, toolbar_label );
g_free( toolbar_label );
+
+ } else if( toolbar_same_label ){
+ toolbar_label = na_object_get_label( action );
+ na_object_action_toolbar_set_label( action, toolbar_label );
+ g_free( toolbar_label );
}
}
diff --git a/src/runtime/na-object-action-fn.h b/src/runtime/na-object-action-fn.h
index 6de1b35..31fd59b 100644
--- a/src/runtime/na-object-action-fn.h
+++ b/src/runtime/na-object-action-fn.h
@@ -87,6 +87,7 @@ void na_object_action_toolbar_set_label( NAObjectAction *action, cons
gchar *na_object_action_get_new_profile_name( const NAObjectAction *action );
void na_object_action_attach_profile( NAObjectAction *action, NAObjectProfile *profile );
+gboolean na_object_action_is_candidate( const NAObjectAction *action, gint target );
G_END_DECLS
diff --git a/src/runtime/na-object-action.c b/src/runtime/na-object-action.c
index eb4a20e..73498bd 100644
--- a/src/runtime/na-object-action.c
+++ b/src/runtime/na-object-action.c
@@ -757,6 +757,31 @@ na_object_action_attach_profile( NAObjectAction *action, NAObjectProfile *profil
}
}
+/**
+ * na_object_action_is_candidate:
+ * @action: the #NAObjectAction to be tested.
+ * @target: the current target.
+ *
+ * Returns: %TRUE if the @action may be candidate for this @target.
+ */
+gboolean
+na_object_action_is_candidate( const NAObjectAction *action, gint target )
+{
+ gboolean is_candidate = FALSE;
+
+ g_return_val_if_fail( NA_IS_OBJECT_ACTION( action ), is_candidate );
+
+ if( !action->private->dispose_has_run ){
+
+ is_candidate =
+ ( action->private->target_selection && target == ITEM_TARGET_SELECTION ) ||
+ ( action->private->target_background && target == ITEM_TARGET_BACKGROUND ) ||
+ ( action->private->target_toolbar && target == ITEM_TARGET_TOOLBAR );
+ }
+
+ return( is_candidate );
+}
+
static void
object_dump( const NAObject *action )
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]