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
1=== modified file 'src/Makefile.am'
2--- src/Makefile.am 2010-03-05 10:38:57 +0000
3+++ src/Makefile.am 2010-03-12 12:16:26 +0000
4@@ -43,8 +43,6 @@
5 sound-service-dbus.h \
6 sound-service-dbus.c \
7 sound-service-server.h \
8- sound-service-marshal.c \
9- sound-service-marshal.h \
10 slider-menu-item.h \
11 slider-menu-item.c
12 indicator_sound_service_CFLAGS = $(SOUNDSERVICE_CFLAGS) $(GCONF_CFLAGS) -DLIBEXECDIR=\"$(libexecdir)\" -Wall -Werror
13
14=== modified file 'src/indicator-sound.c'
15--- src/indicator-sound.c 2010-03-11 11:50:40 +0000
16+++ src/indicator-sound.c 2010-03-12 12:16:26 +0000
17@@ -40,7 +40,6 @@
18 #include "dbus-shared-names.h"
19 #include "sound-service-client.h"
20 #include "common-defs.h"
21-#include "sound-service-marshal.h"
22
23 // GObject Boiler plate
24 #define INDICATOR_SOUND_TYPE (indicator_sound_get_type ())
25@@ -170,8 +169,12 @@
26 self->service = NULL;
27 }
28 g_hash_table_destroy(volume_states);
29- g_list_foreach (blocked_animation_list, (GFunc)g_object_unref, NULL);
30- g_list_free(blocked_animation_list);
31+
32+ if(blocked_animation_list != NULL){
33+ g_list_foreach (blocked_animation_list, (GFunc)g_object_unref, NULL);
34+ g_list_free(blocked_animation_list);
35+ }
36+
37 G_OBJECT_CLASS (indicator_sound_parent_class)->dispose (object);
38 return;
39 }
40@@ -323,32 +326,22 @@
41 */
42 static void prepare_blocked_animation()
43 {
44- GError* error= NULL;
45- int i;
46-
47 gchar* blocked_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));
48 gchar* muted_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED));
49- GtkIconTheme* theme = gtk_icon_theme_get_default();
50- GdkPixbuf* mute_buf = gtk_icon_theme_load_icon(theme,
51- muted_name,
52- 22,
53- GTK_ICON_LOOKUP_GENERIC_FALLBACK,
54- &error);
55- if(error != NULL){
56- g_error("indicator-sound : prepare_blocked_animation - %s", error->message);
57- g_error_free(error);
58- return;
59- }
60-
61- GdkPixbuf* blocked_buf = gtk_icon_theme_load_icon(theme, blocked_name,
62- 22,
63- GTK_ICON_LOOKUP_GENERIC_FALLBACK,
64- &error);
65- if(error != NULL){
66- g_error("indicator-sound : prepare_blocked_animation - %s", error->message);
67- g_error_free(error);
68- return;
69- }
70+
71+ GtkImage* temp_image = indicator_image_helper(muted_name);
72+ GdkPixbuf* mute_buf = gtk_image_get_pixbuf(temp_image);
73+
74+ temp_image = indicator_image_helper(blocked_name);
75+ GdkPixbuf* blocked_buf = gtk_image_get_pixbuf(temp_image);
76+
77+ int i;
78+
79+ if(mute_buf == NULL || blocked_buf == NULL){
80+ g_debug("Don bother with the animation, the theme aint got the goods");
81+ return;
82+ }
83+
84 // sample 22 snapshots - range : 0-256
85 for(i = 0; i < 23; i++)
86 {
87@@ -356,7 +349,6 @@
88 gdk_pixbuf_get_width(mute_buf),
89 gdk_pixbuf_get_height(mute_buf),
90 0, 0, 1, 1, GDK_INTERP_BILINEAR, MIN(255, i * 11));
91- g_debug("creating blocking animation - alpha value = %i", MIN(255, i * 11));
92 blocked_animation_list = g_list_append(blocked_animation_list, gdk_pixbuf_copy(blocked_buf));
93 }
94 }
95@@ -482,14 +474,16 @@
96 {
97 g_debug("signal caught - sink input while muted with value %i", block_value);
98 if (block_value == 1 && animation_id == 0 ) {
99- // We can assume we are in the muted state !
100- gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));
101- GtkImage * tempimage = indicator_image_helper(image_name);
102- gtk_image_set_from_pixbuf(speaker_image, gtk_image_get_pixbuf(tempimage));
103- g_object_ref_sink(tempimage);
104+ if(blocked_animation_list != NULL)
105+ {
106+ gchar* image_name = g_hash_table_lookup(volume_states, GINT_TO_POINTER(STATE_MUTED_WHILE_INPUT));
107+ GtkImage * tempimage = indicator_image_helper(image_name);
108+ gtk_image_set_from_pixbuf(speaker_image, gtk_image_get_pixbuf(tempimage));
109+ g_object_ref_sink(tempimage);
110
111- blocked_iter = blocked_animation_list;
112- animation_id = g_timeout_add_seconds(1, fade_back_to_mute_image, NULL);
113+ blocked_iter = blocked_animation_list;
114+ animation_id = g_timeout_add_seconds(1, fade_back_to_mute_image, NULL);
115+ }
116 }
117 }
118
119
120=== modified file 'src/sound-service-dbus.c'
121--- src/sound-service-dbus.c 2010-03-08 19:12:18 +0000
122+++ src/sound-service-dbus.c 2010-03-12 12:16:26 +0000
123@@ -26,7 +26,6 @@
124 #include "dbus-shared-names.h"
125 #include "sound-service-dbus.h"
126 #include "common-defs.h"
127-#include "sound-service-marshal.h"
128 #include "pulse-manager.h"
129
130 // DBUS methods

Subscribers

People subscribed via source and target branches