Merge lp:~cjcurran/indicator-sound/clearlooks_fix into lp:indicator-sound/0.1

Proposed by Conor Curran
Status: Merged
Merged at revision: not available
Proposed branch: lp:~cjcurran/indicator-sound/clearlooks_fix
Merge into: lp:indicator-sound/0.1
Diff against target: 130 lines (+29/-38)
3 files modified
src/Makefile.am (+0/-2)
src/indicator-sound.c (+29/-35)
src/sound-service-dbus.c (+0/-1)
To merge this branch: bzr merge lp:~cjcurran/indicator-sound/clearlooks_fix
Reviewer Review Type Date Requested Status
David Barth Approve
Kalle Valo (community) Approve
Review via email: mp+21228@code.launchpad.net

Description of the change

Fixes the loading of icons for the mute blocking state so as it uses the libindicator loading code as opposed to its own fixed size approach. Fallbacks gracefully and as a result does not cause a seg fault at start up.

To post a comment you must log in.
47. By Conor Curran

animation will not be used if the theme does not manage to fall back gracefully for mute-blocking icon loading - this should not happen but if it does there is no chance of the nasty seg fault seen with 0.1.3 and clearlooks

48. By Conor Curran

removed test case

Revision history for this message
Kalle Valo (kvalo) wrote :

I didn't find any issues on the code, so approved.

review: Approve
Revision history for this message
David Barth (dbarth) wrote :

+1 the latest fixes look good to me

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'src/Makefile.am'
--- src/Makefile.am 2010-03-05 10:38:57 +0000
+++ src/Makefile.am 2010-03-12 12:16:26 +0000
@@ -43,8 +43,6 @@
43 sound-service-dbus.h \43 sound-service-dbus.h \
44 sound-service-dbus.c \44 sound-service-dbus.c \
45 sound-service-server.h \45 sound-service-server.h \
46 sound-service-marshal.c \
47 sound-service-marshal.h \
48 slider-menu-item.h \46 slider-menu-item.h \
49 slider-menu-item.c47 slider-menu-item.c
50indicator_sound_service_CFLAGS = $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror48indicator_sound_service_CFLAGS = $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
5149
=== modified file 'src/indicator-sound.c'
--- src/indicator-sound.c 2010-03-11 11:50:40 +0000
+++ src/indicator-sound.c 2010-03-12 12:16:26 +0000
@@ -40,7 +40,6 @@
40#include "dbus-shared-names.h"40#include "dbus-shared-names.h"
41#include "sound-service-client.h"41#include "sound-service-client.h"
42#include "common-defs.h"42#include "common-defs.h"
43#include "sound-service-marshal.h"
4443
45// GObject Boiler plate44// GObject Boiler plate
46#define INDICATOR_SOUND_TYPE (indicator_sound_get_type ())45#define INDICATOR_SOUND_TYPE (indicator_sound_get_type ())
@@ -170,8 +169,12 @@
170 self->service = NULL;169 self->service = NULL;
171 }170 }
172 g_hash_table_destroy(volume_states);171 g_hash_table_destroy(volume_states);
173 g_list_foreach (blocked_animation_list, (GFunc)g_object_unref, NULL);172
174 g_list_free(blocked_animation_list);173 if(blocked_animation_list != NULL){
174 g_list_foreach (blocked_animation_list, (GFunc)g_object_unref, NULL);
175 g_list_free(blocked_animation_list);
176 }
177
175 G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object);178 G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object);
176 return;179 return;
177}180}
@@ -323,32 +326,22 @@
323*/326*/
324static void prepare_blocked_animation()327static void prepare_blocked_animation()
325{328{
326 GError* error= NULL;
327 int i;
328
329 gchar* blocked_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));329 gchar* blocked_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));
330 gchar* muted_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED));330 gchar* muted_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED));
331 GtkIconTheme* theme = gtk_icon_theme_get_default(); 331
332 GdkPixbuf* mute_buf = gtk_icon_theme_load_icon(theme, 332 GtkImage* temp_image = indicator_image_helper(muted_name);
333 muted_name,333 GdkPixbuf* mute_buf = gtk_image_get_pixbuf(temp_image);
334 22,334
335 GTK_ICON_LOOKUP_GENERIC_FALLBACK,335 temp_image = indicator_image_helper(blocked_name);
336 &error);336 GdkPixbuf* blocked_buf = gtk_image_get_pixbuf(temp_image);
337 if(error != NULL){337
338 g_error("indicator-sound : prepare_blocked_animation - %s", error->message);338 int i;
339 g_error_free(error);339
340 return;340 if(mute_buf == NULL || blocked_buf == NULL){
341 } 341 g_debug("Don bother with the animation, the theme aint got the goods");
342342 return;
343 GdkPixbuf* blocked_buf = gtk_icon_theme_load_icon(theme, blocked_name,343 }
344 22,344
345 GTK_ICON_LOOKUP_GENERIC_FALLBACK,
346 &error);
347 if(error != NULL){
348 g_error("indicator-sound : prepare_blocked_animation - %s", error->message);
349 g_error_free(error);
350 return;
351 }
352 // sample 22 snapshots - range : 0-256345 // sample 22 snapshots - range : 0-256
353 for(i = 0; i < 23; i++)346 for(i = 0; i < 23; i++)
354 { 347 {
@@ -356,7 +349,6 @@
356 gdk_pixbuf_get_width(mute_buf),349 gdk_pixbuf_get_width(mute_buf),
357 gdk_pixbuf_get_height(mute_buf), 350 gdk_pixbuf_get_height(mute_buf),
358 0, 0, 1, 1, GDK_INTERP_BILINEAR, MIN(255, i * 11));351 0, 0, 1, 1, GDK_INTERP_BILINEAR, MIN(255, i * 11));
359 g_debug("creating blocking animation - alpha value = %i", MIN(255, i * 11));
360 blocked_animation_list = g_list_append(blocked_animation_list, gdk_pixbuf_copy(blocked_buf));352 blocked_animation_list = g_list_append(blocked_animation_list, gdk_pixbuf_copy(blocked_buf));
361 } 353 }
362}354}
@@ -482,14 +474,16 @@
482{474{
483 g_debug("signal caught - sink input while muted with value %i", block_value);475 g_debug("signal caught - sink input while muted with value %i", block_value);
484 if (block_value == 1 && animation_id == 0 ) {476 if (block_value == 1 && animation_id == 0 ) {
485 // We can assume we are in the muted state !477 if(blocked_animation_list != NULL)
486 gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));478 {
487 GtkImage * tempimage = indicator_image_helper(image_name);479 gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));
488 gtk_image_set_from_pixbuf(speaker_image, gtk_image_get_pixbuf(tempimage));480 GtkImage * tempimage = indicator_image_helper(image_name);
489 g_object_ref_sink(tempimage);481 gtk_image_set_from_pixbuf(speaker_image, gtk_image_get_pixbuf(tempimage));
482 g_object_ref_sink(tempimage);
490483
491 blocked_iter = blocked_animation_list;484 blocked_iter = blocked_animation_list;
492 animation_id = g_timeout_add_seconds(1, fade_back_to_mute_image, NULL);485 animation_id = g_timeout_add_seconds(1, fade_back_to_mute_image, NULL);
486 }
493 } 487 }
494}488}
495 489
496490
=== modified file 'src/sound-service-dbus.c'
--- src/sound-service-dbus.c 2010-03-08 19:12:18 +0000
+++ src/sound-service-dbus.c 2010-03-12 12:16:26 +0000
@@ -26,7 +26,6 @@
26#include "dbus-shared-names.h"26#include "dbus-shared-names.h"
27#include "sound-service-dbus.h"27#include "sound-service-dbus.h"
28#include "common-defs.h"28#include "common-defs.h"
29#include "sound-service-marshal.h"
30#include "pulse-manager.h"29#include "pulse-manager.h"
3130
32// DBUS methods 31// DBUS methods

Subscribers

People subscribed via source and target branches