[nautilus-actions] Display again stock icons in NACT
- From: Pierre Wieser <pwieser src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [nautilus-actions] Display again stock icons in NACT
- Date: Sat, 1 Jan 2011 21:37:33 +0000 (UTC)
commit c4fb83cb2ef902ac01658143d3bc9ad27e3844ba
Author: Pierre Wieser <pwieser trychlos org>
Date: Sat Jan 1 20:23:47 2011 +0100
Display again stock icons in NACT
Fix #638461 - Stock icons are no more displayed in NACT reported by Pierre Wieser.
src/core/na-core-utils.c | 3 ++
src/nact/nact-iaction-tab.c | 46 +++++-------------------------------------
2 files changed, 9 insertions(+), 40 deletions(-)
---
diff --git a/src/core/na-core-utils.c b/src/core/na-core-utils.c
index 7113a37..10beabb 100644
--- a/src/core/na-core-utils.c
+++ b/src/core/na-core-utils.c
@@ -117,10 +117,13 @@ na_core_utils_str_collate( const gchar *str1, const gchar *str2 )
if( str1 && str2 ){
res = g_utf8_collate( str1, str2 );
+
} else if( !str1 && !str2 ){
res = 0;
+
} else if( !str1 ){
res = -1;
+
} else {
g_return_val_if_fail( str2 == NULL, 0 );
res = 1;
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 3bce923..1d5c6c9 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -95,22 +95,11 @@ static void on_toolbar_label_changed( GtkEntry *entry, NactIActionTab *
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 );
-
-/* GtkComboBoxEntry is deprecated from Gtk+3
- * see. http://git.gnome.org/browse/gtk+/commit/?id=9612c648176378bf237ad0e1a8c6c995b0ca7c61
- * while 'has_entry' property exists since 2.24
- */
-#if(( GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION >= 3 )
-static void icon_combo_list_set_entry( GtkComboBox* combo );
-#else
-static void icon_combo_list_set_entry( GtkComboBoxEntry* combo );
-#endif
-
static void icon_combo_list_set_layout( GtkComboBox* combo );
static void on_icon_browse( GtkButton *button, NactIActionTab *instance );
static void on_icon_changed( GtkEntry *entry, NactIActionTab *instance );
static void icon_preview_cb( GtkFileChooser *dialog, GtkWidget *preview );
-static gint sort_stock_ids( gconstpointer a, gconstpointer b );
+static gint sort_stock_ids_by_label( gconstpointer a, gconstpointer b );
static gchar *strip_underscore( const gchar *text );
static void release_icon_combobox( NactIActionTab *instance );
static GtkWidget *get_icon_combo_box( NactIActionTab *instance );
@@ -233,19 +222,14 @@ nact_iaction_tab_initial_load_toplevel( NactIActionTab *instance )
model = create_stock_icon_model();
#if(( GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION >= 3 )
icon_combo = gtk_combo_box_new_with_model_and_entry( model );
+ gtk_combo_box_set_entry_text_column( GTK_COMBO_BOX( icon_combo ), ICON_STOCK_COLUMN );
#else
- icon_combo = gtk_combo_box_entry_new_with_model( model, ICON_LABEL_COLUMN );
+ icon_combo = gtk_combo_box_entry_new_with_model( model, ICON_STOCK_COLUMN );
#endif
+ icon_combo_list_set_layout( GTK_COMBO_BOX( icon_combo ));
g_object_unref( model );
container = base_window_get_widget( BASE_WINDOW( instance ), "ActionIconHBox" );
gtk_box_pack_start( GTK_BOX( container ), icon_combo, TRUE, TRUE, 0 );
-
-#if(( GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION >= 3 )
- icon_combo_list_set_entry( GTK_COMBO_BOX( icon_combo ));
-#else
- icon_combo_list_set_entry( GTK_COMBO_BOX_ENTRY( icon_combo ));
-#endif
- icon_combo_list_set_layout( GTK_COMBO_BOX( icon_combo ));
}
}
@@ -864,7 +848,7 @@ create_stock_icon_model( void )
stock_list = gtk_stock_list_ids();
icon_theme = gtk_icon_theme_get_default();
- stock_list = g_slist_sort( stock_list, ( GCompareFunc ) sort_stock_ids );
+ stock_list = g_slist_sort( stock_list, ( GCompareFunc ) sort_stock_ids_by_label );
for( iter = stock_list ; iter ; iter = iter->next ){
icon_info = gtk_icon_theme_lookup_icon( icon_theme, ( gchar * ) iter->data, GTK_ICON_SIZE_MENU, GTK_ICON_LOOKUP_GENERIC_FALLBACK );
@@ -885,24 +869,6 @@ create_stock_icon_model( void )
return( GTK_TREE_MODEL( model ));
}
-#if(( GTK_MAJOR_VERSION >= 2 && GTK_MINOR_VERSION >= 24 ) || GTK_MAJOR_VERSION >= 3 )
-static void
-icon_combo_list_set_entry( GtkComboBox* combo )
-{
- if( gtk_combo_box_get_entry_text_column( combo ) == -1 ){
- gtk_combo_box_set_entry_text_column( combo, ICON_STOCK_COLUMN );
- }
-}
-#else
-static void
-icon_combo_list_set_entry( GtkComboBoxEntry* combo )
-{
- if( gtk_combo_box_entry_get_text_column( combo ) == -1 ){
- gtk_combo_box_entry_set_text_column( combo, ICON_STOCK_COLUMN );
- }
-}
-#endif
-
static void
icon_combo_list_set_layout( GtkComboBox *combo )
{
@@ -987,7 +953,7 @@ icon_preview_cb( GtkFileChooser *dialog, GtkWidget *preview )
}
static gint
-sort_stock_ids( gconstpointer a, gconstpointer b )
+sort_stock_ids_by_label( gconstpointer a, gconstpointer b )
{
GtkStockItem stock_item_a;
GtkStockItem stock_item_b;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]