[nautilus-actions] Fix bad reinitialization of the icon item



commit be3aefbe9546bbb083d1b6ddd9e4cce50ff4d838
Author: Pierre Wieser <pwieser trychlos org>
Date:   Mon Aug 2 23:33:42 2010 +0200

    Fix bad reinitialization of the icon item

 ChangeLog                   |    4 ++++
 TODO                        |    2 --
 src/nact/nact-gtk-utils.c   |    8 ++++++--
 src/nact/nact-iaction-tab.c |    9 ++++++---
 4 files changed, 16 insertions(+), 7 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 550a48b..b7a06ed 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,9 @@
 2010-08-02 Pierre Wieser <pwieser trychlos org>
 
+	* src/nact/nact-gtk-utils.c (nact_gtk_utils_get_pixbuf):
+	* src/nact/nact-iaction-tab.c (on_icon_changed):
+	Fix bad reinitialization of the icon item.
+
 	* doc/nact/C/figures/nact-basenames-tab.png:
 	* doc/nact/C/figures/nact-capabilities-tab.png:
 	* doc/nact/C/figures/nact-command-tab.png:
diff --git a/TODO b/TODO
index 860bcbf..38ddcce 100644
--- a/TODO
+++ b/TODO
@@ -493,5 +493,3 @@ Parameter 	Description
   instead of terminating the edition and letting the old value
 
 - 2010-06-20: TODO: is_candidate_for_show_in: get current environment
-
-- 2010-08-02: icon is not reset when last action is removed
diff --git a/src/nact/nact-gtk-utils.c b/src/nact/nact-gtk-utils.c
index be9c09c..95eae55 100644
--- a/src/nact/nact-gtk-utils.c
+++ b/src/nact/nact-gtk-utils.c
@@ -148,7 +148,7 @@ nact_gtk_utils_get_pixbuf( const gchar *name, GtkWidget *widget, gint size )
 
 /**
  * nact_utils_render:
- * @name: the name of the file or an icon.
+ * @name: the name of the file or an icon, or %NULL.
  * widget: the widget on which the image should be rendered.
  * size: the desired size.
  *
@@ -159,7 +159,11 @@ nact_gtk_utils_render( const gchar *name, GtkImage *widget, gint size )
 {
 	GdkPixbuf* pixbuf;
 
-	pixbuf = nact_gtk_utils_get_pixbuf( name, GTK_WIDGET( widget ), size );
+	if( name ){
+		pixbuf = nact_gtk_utils_get_pixbuf( name, GTK_WIDGET( widget ), size );
+	} else {
+		pixbuf = gdk_pixbuf_new_from_file_at_size( PKGDATADIR "/transparent.png", size, size, NULL );
+	}
 
 	if( pixbuf ){
 		gtk_image_set_from_pixbuf( widget, pixbuf );
diff --git a/src/nact/nact-iaction-tab.c b/src/nact/nact-iaction-tab.c
index 0ccde5a..a636a79 100644
--- a/src/nact/nact-iaction-tab.c
+++ b/src/nact/nact-iaction-tab.c
@@ -898,10 +898,13 @@ on_icon_changed( GtkEntry *icon_entry, NactIActionTab *instance )
 		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 );
 	}
+
+	/* icon_name may be null if there is no current item
+	 * in such a case, we blank the image
+	 */
+	image = GTK_IMAGE( base_window_get_widget( BASE_WINDOW( instance ), "ActionIconImage" ));
+	nact_gtk_utils_render( icon_name, image, GTK_ICON_SIZE_MENU );
 }
 
 static gint



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