[nautilus-actions] Display a 'no shortcut' label in the push button



commit cb21a4e30798ab23a3f640f22f771d3cb72b4168
Author: Pierre Wieser <pwieser trychlos org>
Date:   Thu Jun 17 23:43:53 2010 +0200

    Display a 'no shortcut' label in the push button

 src/nact/nact-iproperties-tab.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/src/nact/nact-iproperties-tab.c b/src/nact/nact-iproperties-tab.c
index 3d59cc9..bc6f90b 100644
--- a/src/nact/nact-iproperties-tab.c
+++ b/src/nact/nact-iproperties-tab.c
@@ -33,6 +33,7 @@
 #endif
 
 #include <glib/gi18n.h>
+#include <string.h>
 
 #include <api/na-object-api.h>
 
@@ -48,6 +49,9 @@ struct NactIPropertiesTabInterfacePrivate {
 	void *empty;						/* so that gcc -pedantic is happy */
 };
 
+/* i18n: label of the push button when there is not yet any shortcut */
+#define NO_SHORTCUT						N_( "None" )
+
 static gboolean st_initialized = FALSE;
 static gboolean st_finalized   = FALSE;
 static gboolean st_on_selection_change = FALSE;
@@ -292,6 +296,10 @@ on_tab_updatable_selection_changed( NactIPropertiesTab *instance, gint count_sel
 
 			shortcut_button = base_window_get_widget( BASE_WINDOW( instance ), "SuggestedShortcutButton" );
 			shortcut = na_object_get_shortcut( item );
+			if( !shortcut || !strlen( shortcut )){
+				g_free( shortcut );
+				shortcut = g_strdup( NO_SHORTCUT );
+			}
 			gtk_button_set_label( GTK_BUTTON( shortcut_button ), shortcut );
 			g_free( shortcut );
 			nact_gtk_utils_set_editable( GTK_OBJECT( shortcut_button ), editable );



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