From 69c96d7e7fa903569073bd87069b2d9f6aeb3fa4 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 22:59:35 -0600 Subject: Update to use new icon helper from libindicator --- src/indicator-sound.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 3a6ae30..0b92af8 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -34,6 +34,7 @@ with this program. If not, see . #include #include #include +#include #include "indicator-sound.h" #include "dbus-shared-names.h" @@ -180,7 +181,7 @@ get_icon (IndicatorObject * io) { gchar* current_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state)); //g_debug("At start-up attempting to set the image to %s", current_name); - speaker_image = GTK_IMAGE(gtk_image_new_from_icon_name(current_name, GTK_ICON_SIZE_MENU)); + speaker_image = indicator_image_helper(current_name); gtk_widget_show(GTK_WIDGET(speaker_image)); return speaker_image; } @@ -327,7 +328,9 @@ static void update_state(const gint state) current_state = state; gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(current_state)); - gtk_image_set_from_icon_name(speaker_image, image_name, GTK_ICON_SIZE_MENU); + GtkImage * tempimage = indicator_image_helper(image_name); + gtk_image_set_from_pixbuf(speaker_image, gtk_image_get_pixbuf(tempimage)); + g_object_ref_sink(tempimage); } -- cgit v1.2.3 From 21d52b5ed3206791d5a0b4adc907be75a9e5f668 Mon Sep 17 00:00:00 2001 From: Ted Gould Date: Wed, 10 Mar 2010 23:07:22 -0600 Subject: Using GIcon for setting the icons on the IDO slider. --- src/indicator-sound.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) (limited to 'src') diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 0b92af8..2dc6bf3 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -225,12 +225,23 @@ static gboolean new_slider_item(DbusmenuMenuitem * newitem, DbusmenuMenuitem * p // alternative callback mechanism which i could use again at some point. /* g_signal_connect(slider, "change-value", G_CALLBACK(user_change_value_event_cb), newitem); */ - // Set images on the ido + /* Get the primary Image */ primary_image = ido_scale_menu_item_get_primary_image((IdoScaleMenuItem*)volume_slider); - gtk_image_set_from_icon_name(GTK_IMAGE(primary_image), g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_ZERO)), GTK_ICON_SIZE_MENU); + + /* Build a GIcon for the theme fallbacks */ + GIcon * primary_gicon = g_themed_icon_new_with_default_fallbacks(g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_ZERO))); + gtk_image_set_from_gicon(GTK_IMAGE(primary_image), primary_gicon, GTK_ICON_SIZE_MENU); + g_object_unref(primary_gicon); + + /* Get the secondary image */ GtkWidget* secondary_image = ido_scale_menu_item_get_secondary_image((IdoScaleMenuItem*)volume_slider); - gtk_image_set_from_icon_name(GTK_IMAGE(secondary_image), g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_HIGH)), GTK_ICON_SIZE_MENU); + /* Build a GIcon for fallbacks */ + GIcon * secondary_gicon = g_themed_icon_new_with_default_fallbacks(g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_HIGH))); + gtk_image_set_from_gicon(GTK_IMAGE(secondary_image), secondary_gicon, GTK_ICON_SIZE_MENU); + g_object_unref(secondary_gicon); + + /* Make the widget visible to users */ gtk_widget_show_all(volume_slider); return TRUE; -- cgit v1.2.3