[nautilus-actions] Fix invalid cast of NAObjectMenu to NAObjectAction
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Fix invalid cast of NAObjectMenu to NAObjectAction
- Date: Thu, 17 Jun 2010 23:52:17 +0000 (UTC)
commit 84c39bba95f64d07e41b71b2af425ad82d7dc2a6
Author: Pierre Wieser <pwieser trychlos org>
Date: Fri Jun 18 01:51:13 2010 +0200
Fix invalid cast of NAObjectMenu to NAObjectAction
ChangeLog | 3 +
TODO | 4 -
src/nact/nact-iaction-tab.c | 139 +++++++++++-------------------
src/nact/nautilus-actions-config-tool.ui | 31 ++++---
4 files changed, 71 insertions(+), 106 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index f476d54..71405e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2010-06-17 Pierre Wieser <pwieser trychlos org>
+ * src/nact/nact-iaction-tab.c:
+ Fix invalid cast of NAObjectMenu to NAObjectAction.
+
* src/nact/nact-sort-buttons.c:
* src/nact/nact-sort-buttons.h (nact_sort_buttons_enable_buttons):
New function.
diff --git a/TODO b/TODO
index e23492f..506b2a3 100644
--- a/TODO
+++ b/TODO
@@ -484,8 +484,4 @@ Parameter Description
- ui.enhancement: let the user edit the current default schemes
when adding from defaults for a #NAIContext
-- bug: when expanding/collapsing a tree in IActionsList with the left/right arrows, we get
- NA-core-CRITICAL **: na_ifactory_object_get_as_void: assertion `NA_IS_IFACTORY_OBJECT( object )' failed
- we do not get this same message when using the menu or just the Enter key
-
- 2010-06-17: ui.enhancement: implement shortcut button in NactIPropertiesTab page
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 168f787..a2de698 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -409,31 +409,28 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
TAB_UPDATABLE_PROP_EDITABLE, &editable,
NULL );
- target_selection = ( item && (
- ( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_selection( item )) ||
- ( NA_IS_OBJECT_MENU( item ))));
+ target_selection =
+ NA_IS_OBJECT_ACTION( item ) && na_object_is_target_selection( item );
- target_location = ( item && (
- ( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_location( item )) ||
- ( NA_IS_OBJECT_MENU( item ))));
-
- target_toolbar = ( item && (
- ( NA_IS_OBJECT_ACTION( item ) && na_object_is_target_toolbar( NA_OBJECT_ACTION( item )))));
+ target_location =
+ NA_IS_OBJECT_ACTION( item ) && na_object_is_target_location( item );
+ target_toolbar =
+ NA_IS_OBJECT_ACTION( item ) && na_object_is_target_toolbar( 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 ));
+ gtk_toggle_button_set_active( toggle, target_selection || NA_IS_OBJECT_MENU( item ));
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), NA_IS_OBJECT_ACTION( item ));
nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ActionTargetLocationButton" ));
- gtk_toggle_button_set_active( toggle, target_location );
- gtk_widget_set_sensitive( GTK_WIDGET( toggle ), item && NA_IS_OBJECT_ACTION( item ));
+ gtk_toggle_button_set_active( toggle, target_location || NA_IS_OBJECT_MENU( item ));
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), NA_IS_OBJECT_ACTION( item ));
nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
- enable_label = ( item && ( NA_IS_OBJECT_MENU( item ) || target_selection || target_location ));
+ enable_label = target_selection || target_location || NA_IS_OBJECT_MENU( item );
label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionMenuLabelEntry" );
- label = item ? na_object_get_label( item ) : g_strdup( "" );
+ label = na_object_get_label( item );
label = label ? label : g_strdup( "" );
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
if( item ){
@@ -445,21 +442,27 @@ on_tab_updatable_selection_changed( NactIActionTab *instance, gint count_selecte
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 ));
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), NA_IS_OBJECT_ACTION( item ));
nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
toggle = GTK_TOGGLE_BUTTON( base_window_get_widget( BASE_WINDOW( instance ), "ToolbarSameLabelButton" ));
- same_label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_is_toolbar_same_label( NA_OBJECT_ACTION( item )) : FALSE;
+ same_label = NA_IS_OBJECT_ACTION( item ) ? na_object_is_toolbar_same_label( item ) : FALSE;
gtk_toggle_button_set_active( toggle, same_label );
+ gtk_widget_set_sensitive( GTK_WIDGET( toggle ), target_toolbar );
nact_gtk_utils_set_editable( GTK_OBJECT( toggle ), editable );
label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionToolbarLabelEntry" );
- label = item && NA_IS_OBJECT_ACTION( item ) ? na_object_get_toolbar_label( item ) : g_strdup( "" );
- label = label ? label : g_strdup( "" );
+ label = NA_IS_OBJECT_ACTION( item ) ? na_object_get_toolbar_label( item ) : g_strdup( "" );
+ /* .. */
gtk_entry_set_text( GTK_ENTRY( label_widget ), label );
+ /* .. */
g_free( label );
+ gtk_widget_set_sensitive( label_widget, target_toolbar && !same_label );
nact_gtk_utils_set_editable( GTK_OBJECT( label_widget ), editable );
+ label_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionToolbarLabelLabel" );
+ gtk_widget_set_sensitive( label_widget, target_toolbar && !same_label );
+
tooltip_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionTooltipEntry" );
tooltip = item ? na_object_get_tooltip( item ) : g_strdup( "" );
tooltip = tooltip ? tooltip : g_strdup( "" );
@@ -504,9 +507,9 @@ on_target_selection_toggled( GtkToggleButton *button, NactIActionTab *instance )
thisfn, ( void * ) item, item ? G_OBJECT_TYPE_NAME( item ) : "null",
editable ? "True":"False" );
- g_return_if_fail( item || NA_IS_OBJECT_ACTION( item ));
+ g_return_if_fail( item );
- if( item ){
+ if( NA_IS_OBJECT_ACTION( item )){
is_target = gtk_toggle_button_get_active( button );
if( editable ){
@@ -544,9 +547,9 @@ on_target_location_toggled( GtkToggleButton *button, NactIActionTab *instance )
thisfn, ( void * ) item, item ? G_OBJECT_TYPE_NAME( item ) : "null",
editable ? "True":"False" );
- g_return_if_fail( item || NA_IS_OBJECT_ACTION( item ));
+ g_return_if_fail( item );
- if( item ){
+ if( NA_IS_OBJECT_ACTION( item )){
is_target = gtk_toggle_button_get_active( button );
if( editable ){
@@ -607,17 +610,17 @@ on_label_changed( GtkEntry *entry, NactIActionTab *instance )
TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
NULL );
- if( item ){
- label = gtk_entry_get_text( entry );
- na_object_set_label( item, label );
- check_for_label( instance, entry, label );
+ g_return_if_fail( item );
- if( NA_IS_OBJECT_ACTION( item )){
- setup_toolbar_label( instance, item, label );
- }
+ label = gtk_entry_get_text( entry );
+ na_object_set_label( item, label );
+ check_for_label( instance, entry, label );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, TRUE );
+ if( NA_IS_OBJECT_ACTION( item )){
+ setup_toolbar_label( instance, item, label );
}
+
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, TRUE );
}
static void
@@ -653,9 +656,9 @@ on_target_toolbar_toggled( GtkToggleButton *button, NactIActionTab *instance )
thisfn, ( void * ) item, item ? G_OBJECT_TYPE_NAME( item ) : "null",
editable ? "True":"False" );
- g_return_if_fail( item || NA_IS_OBJECT_ACTION( item ));
+ g_return_if_fail( item );
- if( item ){
+ if( NA_IS_OBJECT_ACTION( item )){
is_target = gtk_toggle_button_get_active( button );
if( editable ){
@@ -696,9 +699,9 @@ on_toolbar_same_label_toggled( GtkToggleButton *button, NactIActionTab *instance
thisfn, ( void * ) item, item ? G_OBJECT_TYPE_NAME( item ) : "null",
editable ? "True":"False" );
- g_return_if_fail( item || NA_IS_OBJECT_ACTION( item ));
+ g_return_if_fail( item );
- if( item ){
+ if( NA_IS_OBJECT_ACTION( item )){
same_label = gtk_toggle_button_get_active( button );
if( editable ){
@@ -764,9 +767,9 @@ on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *instance )
TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
NULL );
- g_return_if_fail( item || NA_IS_OBJECT_ACTION( item ));
+ g_return_if_fail( item );
- if( item ){
+ if( NA_IS_OBJECT_ACTION( item )){
label = gtk_entry_get_text( entry );
na_object_set_toolbar_label( NA_OBJECT_ACTION( item ), label );
@@ -797,10 +800,10 @@ on_tooltip_changed( GtkEntry *entry, NactIActionTab *instance )
TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
NULL );
- if( item ){
- na_object_set_tooltip( item, gtk_entry_get_text( entry ));
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, FALSE );
- }
+ g_return_if_fail( item );
+
+ na_object_set_tooltip( item, gtk_entry_get_text( entry ));
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, FALSE );
}
static GtkTreeModel *
@@ -869,50 +872,14 @@ icon_combo_list_fill( GtkComboBoxEntry* combo )
static void
on_icon_browse( GtkButton *button, NactIActionTab *instance )
{
- GtkWidget *dialog;
- GtkWindow *toplevel;
- gchar *filename;
GtkWidget *icon_widget;
- NactApplication *application;
- NAUpdater *updater;
- gchar *path;
-
- toplevel = base_window_get_toplevel( BASE_WINDOW( instance ));
-
- dialog = gtk_file_chooser_dialog_new(
- _( "Choosing an icon" ),
- toplevel,
- GTK_FILE_CHOOSER_ACTION_OPEN,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
- NULL
- );
-
- base_iprefs_position_named_window( BASE_WINDOW( instance ), GTK_WINDOW( dialog ), IPREFS_ICONS_DIALOG );
-
- application = NACT_APPLICATION( base_window_get_application( BASE_WINDOW( instance )));
- updater = nact_application_get_updater( application );
- path = na_iprefs_read_string( NA_IPREFS( updater ), IPREFS_ICONS_PATH, "" );
- if( path && g_utf8_strlen( path, -1 )){
- gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER( dialog ), path );
- }
- g_free( path );
-
- if( gtk_dialog_run( GTK_DIALOG( dialog )) == GTK_RESPONSE_ACCEPT ){
- filename = gtk_file_chooser_get_filename( GTK_FILE_CHOOSER( dialog ));
- icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
- gtk_entry_set_text( GTK_ENTRY( gtk_bin_get_child( GTK_BIN( icon_widget ))), filename );
- g_free (filename);
+ icon_widget = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconComboBoxEntry" );
- path = gtk_file_chooser_get_current_folder( GTK_FILE_CHOOSER( dialog ));
- nact_iprefs_write_string( BASE_WINDOW( instance ), IPREFS_ICONS_PATH, path );
- g_free( path );
- }
-
- base_iprefs_save_named_window_position( BASE_WINDOW( instance ), GTK_WINDOW( dialog ), IPREFS_ICONS_DIALOG );
-
- gtk_widget_destroy( dialog );
+ nact_gtk_utils_select_file(
+ BASE_WINDOW( instance ),
+ _( "Choosing an icon" ), IPREFS_ICONS_DIALOG,
+ gtk_bin_get_child( GTK_BIN( icon_widget )), IPREFS_ICONS_DIALOG, "" );
}
static void
@@ -932,11 +899,9 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
TAB_UPDATABLE_PROP_SELECTED_ITEM, &item,
NULL );
- if( item ){
- icon_name = gtk_entry_get_text( icon_entry );
- na_object_set_icon( item, icon_name );
- g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, TRUE );
- }
+ icon_name = gtk_entry_get_text( icon_entry );
+ na_object_set_icon( item, icon_name );
+ g_signal_emit_by_name( G_OBJECT( instance ), TAB_UPDATABLE_SIGNAL_ITEM_UPDATED, item, TRUE );
image = GTK_IMAGE( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconImage" ));
nact_gtk_utils_render( icon_name, image, GTK_ICON_SIZE_MENU );
diff --git a/src/nact/nautilus-actions-config-tool.ui b/src/nact/nautilus-actions-config-tool.ui
index 6416a84..552b7ff 100644
--- a/src/nact/nautilus-actions-config-tool.ui
+++ b/src/nact/nautilus-actions-config-tool.ui
@@ -306,7 +306,6 @@ Menus are never displayed in the toolbar.</property>
<property name="visible">True</property>
<property name="can_focus">True</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>
@@ -314,7 +313,6 @@ Menus are never displayed in the toolbar.</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>
@@ -2661,6 +2659,9 @@ Defining several profiles lets you have several commands, each applying with a d
<placeholder/>
</child>
<child>
+ <placeholder/>
+ </child>
+ <child>
<object class="GtkLabel" id="label3">
<property name="visible">True</property>
<property name="label" translatable="yes">This assistant will guide you through the process of importing items, actions or menus.</property>
@@ -2676,10 +2677,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="local_only">False</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>
</object>
<packing>
<property name="position">0</property>
@@ -3649,39 +3650,39 @@ Be warned: this mode may be dangerous. You will not be prompted another time.</p
</object>
<object class="GtkSizeGroup" id="CommandLabelSizeGroup">
<widgets>
- <widget name="label4"/>
- <widget name="CommandParametersLabel"/>
- <widget name="CommandPathLabel"/>
<widget name="ProfileLabelLabel"/>
+ <widget name="CommandPathLabel"/>
+ <widget name="CommandParametersLabel"/>
+ <widget name="label4"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="CommandButtonSizeGroup">
<widgets>
- <widget name="CommandLegendButton"/>
<widget name="CommandPathButton"/>
+ <widget name="CommandLegendButton"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="ActionLabelSizeGroup">
<widgets>
- <widget name="ActionMenuLabelLabel"/>
- <widget name="ActionToolbarLabelLabel"/>
- <widget name="ActionTooltipLabel"/>
<widget name="ActionIconLabel"/>
+ <widget name="ActionTooltipLabel"/>
+ <widget name="ActionToolbarLabelLabel"/>
+ <widget name="ActionMenuLabelLabel"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="ExecutionModeSizeGroup">
<widgets>
- <widget name="label43"/>
- <widget name="label44"/>
<widget name="label45"/>
+ <widget name="label44"/>
+ <widget name="label43"/>
</widgets>
</object>
<object class="GtkSizeGroup" id="PropertiesLabelSizeGroup">
<widgets>
- <widget name="label18"/>
- <widget name="label39"/>
- <widget name="label49"/>
<widget name="label19"/>
+ <widget name="label49"/>
+ <widget name="label39"/>
+ <widget name="label18"/>
</widgets>
</object>
</interface>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]