diff options
author | Conor Curran <conor.curran@canonical.com> | 2011-01-24 17:29:31 -0600 |
---|---|---|
committer | Conor Curran <conor.curran@canonical.com> | 2011-01-24 17:29:31 -0600 |
commit | 729ff587783dcf571b4a94132b57bce695a5e30f (patch) | |
tree | db454dd51efa8d226389e00a42f1d189751f89ba /src | |
parent | eb2c1d7fc7ba7f8d2ae35141b2bf13ef69795b1d (diff) | |
download | ayatana-indicator-sound-729ff587783dcf571b4a94132b57bce695a5e30f.tar.gz ayatana-indicator-sound-729ff587783dcf571b4a94132b57bce695a5e30f.tar.bz2 ayatana-indicator-sound-729ff587783dcf571b4a94132b57bce695a5e30f.zip |
compiling ...
Diffstat (limited to 'src')
-rw-r--r-- | src/Makefile.am | 6 | ||||
-rw-r--r-- | src/indicator-sound.c | 23 | ||||
-rw-r--r-- | src/pulse-manager.c | 1 | ||||
-rw-r--r-- | src/sound-service-dbus.c | 4 | ||||
-rw-r--r-- | src/sound-state-manager.c | 61 | ||||
-rw-r--r-- | src/sound-state-manager.h | 4 |
6 files changed, 51 insertions, 48 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 667293f..b5c9fc3 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -9,11 +9,13 @@ soundmenulib_LTLIBRARIES = libsoundmenu.la libsoundmenu_la_SOURCES = \ common-defs.h \ indicator-sound.h \ + indicator-sound.c \ + sound-state-manager.c \ + sound-state-manager.h \ transport-widget.c \ transport-widget.h \ metadata-widget.c \ metadata-widget.h \ - indicator-sound.c \ title-widget.c \ title-widget.h \ volume-widget.c \ @@ -22,7 +24,7 @@ libsoundmenu_la_SOURCES = \ gen-sound-service.xml.c \ dbus-shared-names.h -libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -Werror -DG_LOG_DOMAIN=\"Indicator-Sound\" +libsoundmenu_la_CFLAGS = $(APPLET_CFLAGS) -Wall -DG_LOG_DOMAIN=\"Indicator-Sound\" libsoundmenu_la_LIBADD = $(APPLET_LIBS) libsoundmenu_la_LDFLAGS = -module -avoid-version diff --git a/src/indicator-sound.c b/src/indicator-sound.c index 97a4c07..b3f19bc 100644 --- a/src/indicator-sound.c +++ b/src/indicator-sound.c @@ -98,12 +98,6 @@ static void create_connection_to_service (GObject *source_object, static void connection_changed (IndicatorServiceManager * sm, gboolean connected, gpointer userdata); -static void g_signal_cb ( GDBusProxy* proxy, - gchar* sender_name, - gchar* signal_name, - GVariant* parameters, - gpointer user_data); - static void @@ -148,16 +142,12 @@ static void indicator_sound_dispose (GObject *object) { IndicatorSound * self = INDICATOR_SOUND(object); + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(self); if (self->service != NULL) { g_object_unref(G_OBJECT(self->service)); self->service = NULL; } - g_hash_table_destroy(volume_states); - - free_the_animation_list(); - - IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (self)); g_list_free ( priv->transport_widgets_list ); @@ -182,10 +172,10 @@ static GtkImage * get_icon (IndicatorObject * io) { IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); - speaker_image = sound_state_manager_get_current_icon (priv->state_manager)); - gtk_widget_show(GTK_WIDGET(speaker_image)); + //speaker_image = sound_state_manager_get_current_icon (priv->state_manager)); + gtk_widget_show( GTK_WIDGET(sound_state_manager_get_current_icon (priv->state_manager)) ); - return speaker_image; + return sound_state_manager_get_current_icon (priv->state_manager); } /* Indicator based function to get the menu for the whole @@ -742,10 +732,11 @@ indicator_sound_scroll (IndicatorObject *io, gint delta, IndicatorScrollDirection direction) { //g_debug("indicator-sound-scroll - current slider value"); + IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); + SoundState current_state = sound_state_manager_get_current_state (priv->state_manager); - if (device_available == FALSE || current_state == STATE_MUTED) + if (current_state == UNAVAILABLE || current_state == MUTED) return; - IndicatorSoundPrivate* priv = INDICATOR_SOUND_GET_PRIVATE(INDICATOR_SOUND (io)); GtkWidget* slider_widget = volume_widget_get_ido_slider(VOLUME_WIDGET(priv->volume_widget)); GtkWidget* slider = ido_scale_menu_item_get_scale((IdoScaleMenuItem*)slider_widget); diff --git a/src/pulse-manager.c b/src/pulse-manager.c index 40bfc13..ca008a7 100644 --- a/src/pulse-manager.c +++ b/src/pulse-manager.c @@ -25,7 +25,6 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #include <pulse/gccmacro.h> #include "pulse-manager.h" -#include "dbus-menu-manager.h" #define RECONNECT_DELAY 5 diff --git a/src/sound-service-dbus.c b/src/sound-service-dbus.c index 176ea87..ad4ac71 100644 --- a/src/sound-service-dbus.c +++ b/src/sound-service-dbus.c @@ -331,8 +331,8 @@ void sound_service_dbus_update_sound_state (SoundServiceDbus* self, static SoundState sound_service_dbus_get_state_from_volume (SoundServiceDbus* self) { SoundServiceDbusPrivate *priv = SOUND_SERVICE_DBUS_GET_PRIVATE (self); - GVariant* v = dbusmenu_menuitem_get_variant (DBUSMENU_MENUITEM(priv->volume_menuitem), - DBUSMENU_VOLUME_MENUITEM_LEVEL); + GVariant* v = dbusmenu_menuitem_property_get_variant (DBUSMENU_MENUITEM(priv->volume_slider_menuitem), + DBUSMENU_VOLUME_MENUITEM_LEVEL); gdouble volume_percent = g_variant_get_double (v); SoundState state = LOW_LEVEL; diff --git a/src/sound-state-manager.c b/src/sound-state-manager.c index 1eecaf0..bd2140a 100644 --- a/src/sound-state-manager.c +++ b/src/sound-state-manager.c @@ -18,10 +18,8 @@ with this program. If not, see <http://www.gnu.org/licenses/>. */ #include <libindicator/indicator-image-helper.h> - #include "sound-state-manager.h" - typedef struct _SoundStateManagerPrivate SoundStateManagerPrivate; // TODO ensure all the relevant below are initialized to null in init @@ -35,6 +33,7 @@ struct _SoundStateManagerPrivate }; #define SOUND_STATE_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), SOUND_TYPE_STATE_MANAGER, SoundStateManagerPrivate)) +G_DEFINE_TYPE (SoundStateManager, sound_state_manager, G_TYPE_OBJECT); static GtkIconSize design_team_size; static gint blocked_id; @@ -42,13 +41,12 @@ static gint animation_id; static GList* blocked_iter = NULL; static void sound_state_manager_prepare_blocked_animation(SoundStateManager* self); -static gboolean sound_state_manager_start_animation (SoundStateManager* self) -static gboolean sound_state_manager_fade_back_to_mute_image (gpointer user_data) +static gboolean sound_state_manager_start_animation (SoundStateManager* self); +static gboolean sound_state_manager_fade_back_to_mute_image (gpointer user_data); static void sound_state_manager_reset_mute_blocking_animation (SoundStateManager* self); -static void sound_state_mananger_free_the_animation_list (SoundStateManager* self); +static void sound_state_manager_free_the_animation_list (SoundStateManager* self); static void sound_state_manager_prepare_state_image_names (SoundStateManager* self); -G_DEFINE_TYPE (SoundStateManager, sound_state_manager, G_TYPE_OBJECT); static void sound_state_manager_init (SoundStateManager* self) @@ -59,8 +57,8 @@ sound_state_manager_init (SoundStateManager* self) sound_state_manager_prepare_blocked_animation (self); priv->current_state = UNAVAILABLE; - priv->speaker_image = indicator_image_helper(g_hash_table_lookup (priv->volume_states, - GINT_TO_POINTER(priv->current_state)); + priv->speaker_image = indicator_image_helper (g_hash_table_lookup (priv->volume_states, + GINT_TO_POINTER(priv->current_state))); } static void @@ -72,12 +70,26 @@ sound_state_manager_finalize (GObject *object) } static void +sound_state_manager_dispose (GObject *object) +{ + SoundStateManager* self = SOUND_STATE_MANAGER (object); + SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self); + + g_hash_table_destroy (priv->volume_states); + + sound_state_manager_free_the_animation_list (self); + G_OBJECT_CLASS (sound_state_manager_parent_class)->dispose (object); +} + + +static void sound_state_manager_class_init (SoundStateManagerClass *klass) { GObjectClass* object_class = G_OBJECT_CLASS (klass); - GObjectClass* parent_class = G_OBJECT_CLASS (klass); + //GObjectClass* parent_class = G_OBJECT_CLASS (klass); object_class->finalize = sound_state_manager_finalize; + object_class->dispose = sound_state_manager_dispose; design_team_size = gtk_icon_size_register("design-team-size", 22, 22); } @@ -88,14 +100,14 @@ static void sound_state_manager_prepare_state_image_names (SoundStateManager* self) { SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self); - priv->volume_states = g_hash_table_new_full(g_direct_hash, g_direct_equal, NULL, g_free); - g_hash_table_insert(priv->volume_states, GINT_TO_POINTER(MUTED), g_strdup("audio-volume-muted-panel")); - g_hash_table_insert(priv->volume_states, GINT_TO_POINTER(ZERO_LEVEL), g_strdup("audio-volume-low-zero-panel")); - g_hash_table_insert(priv->volume_states, GINT_TO_POINTER(LOW_LEVEL), g_strdup("audio-volume-low-panel")); - g_hash_table_insert(priv->volume_states, GINT_TO_POINTER(MEDIUM_LEVEL), g_strdup("audio-volume-medium-panel")); - g_hash_table_insert(priv->volume_states, GINT_TO_POINTER(HIGH_LEVEL), g_strdup("audio-volume-high-panel")); - g_hash_table_insert(priv->volume_states, GINT_TO_POINTER(BLOCKED), g_strdup("audio-volume-muted-blocking-panel")); - g_hash_table_insert(priv->volume_states, GINT_TO_POINTER(UNAVAILABLE), g_strdup("audio-output-none-panel")); + priv->volume_states = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free); + g_hash_table_insert (priv->volume_states, GINT_TO_POINTER(MUTED), g_strdup("audio-volume-muted-panel")); + g_hash_table_insert (priv->volume_states, GINT_TO_POINTER(ZERO_LEVEL), g_strdup("audio-volume-low-zero-panel")); + g_hash_table_insert (priv->volume_states, GINT_TO_POINTER(LOW_LEVEL), g_strdup("audio-volume-low-panel")); + g_hash_table_insert (priv->volume_states, GINT_TO_POINTER(MEDIUM_LEVEL), g_strdup("audio-volume-medium-panel")); + g_hash_table_insert (priv->volume_states, GINT_TO_POINTER(HIGH_LEVEL), g_strdup("audio-volume-high-panel")); + g_hash_table_insert (priv->volume_states, GINT_TO_POINTER(BLOCKED), g_strdup("audio-volume-muted-blocking-panel")); + g_hash_table_insert (priv->volume_states, GINT_TO_POINTER(UNAVAILABLE), g_strdup("audio-output-none-panel")); } /* @@ -169,7 +181,7 @@ sound_state_signal_cb ( GDBusProxy* proxy, g_variant_ref (parameters); GVariant *value = g_variant_get_child_value (parameters, 0); - gint update = g_variant_get_int (value); + gint update = g_variant_get_int32 (value); g_debug ( "!!! signal_cb with value %i", update); @@ -196,9 +208,8 @@ sound_state_manager_style_changed_cb(GtkWidget *widget, gpointer user_data) //g_debug("Just caught a style change event"); g_return_if_fail (SOUND_IS_STATE_MANAGER (user_data)); SoundStateManager* self = SOUND_STATE_MANAGER (user_data); - SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self); - sound_state_manager_reset_mute_blocking_animation (self) - sound_state_mananger_free_the_animation_list (self); + sound_state_manager_reset_mute_blocking_animation (self); + sound_state_manager_free_the_animation_list (self); sound_state_manager_prepare_blocked_animation (self); } @@ -218,14 +229,14 @@ sound_state_manager_reset_mute_blocking_animation (SoundStateManager* self) } static void -sound_state_mananger_free_the_animation_list (SoundStateManager* self) +sound_state_manager_free_the_animation_list (SoundStateManager* self) { SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self); if (priv->blocked_animation_list != NULL) { g_list_foreach (priv->blocked_animation_list, (GFunc)g_object_unref, NULL); g_list_free (priv->blocked_animation_list); - blocked_animation_list = NULL; + priv->blocked_animation_list = NULL; } } @@ -254,7 +265,7 @@ sound_state_manager_start_animation (SoundStateManager* self) static gboolean sound_state_manager_fade_back_to_mute_image (gpointer user_data) { - g_return_if_fail (SOUND_IS_STATE_MANAGER (user_data)); + g_return_val_if_fail (SOUND_IS_STATE_MANAGER (user_data), FALSE); SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE( SOUND_STATE_MANAGER (user_data) ); if (blocked_iter != NULL) { @@ -275,7 +286,7 @@ sound_state_manager_fade_back_to_mute_image (gpointer user_data) * between the indicator and the service. **/ void -sound_state_manager_connect_to_dbus (SoundStateManager* self, GDProxy* proxy) +sound_state_manager_connect_to_dbus (SoundStateManager* self, GDBusProxy* proxy) { SoundStateManagerPrivate* priv = SOUND_STATE_MANAGER_GET_PRIVATE(self); priv->dbus_proxy = proxy; diff --git a/src/sound-state-manager.h b/src/sound-state-manager.h index 1799822..ef8fc40 100644 --- a/src/sound-state-manager.h +++ b/src/sound-state-manager.h @@ -20,7 +20,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>. #ifndef _SOUND_STATE_MANAGER_H_ #define _SOUND_STATE_MANAGER_H_ -#include <glib-object.h> +#include <glib.h> #include "common-defs.h" G_BEGIN_DECLS @@ -51,7 +51,7 @@ void sound_state_manager_style_changed_cb (GtkWidget *widget, gpointer user_data GtkImage* sound_state_manager_get_current_icon (SoundStateManager* self); SoundState sound_state_manager_get_current_state (SoundStateManager* self); void sound_state_manager_connect_to_dbus (SoundStateManager* self, - GDProxy* proxy); + GDBusProxy* proxy); G_END_DECLS |