diff options
author | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-12 19:52:11 +0200 |
---|---|---|
committer | Sebastien Bacher <seb128@ubuntu.com> | 2012-07-12 19:52:11 +0200 |
commit | 612866753e2b554abb0b448ae6a8c8ce1c2f4d87 (patch) | |
tree | 03ced96344802a4e338eb53d35d1c677f8354460 /src/settings-manager.c | |
parent | 31b5a5a6508535ed1af86919c79d75571f1a65ef (diff) | |
parent | 2900797204c4446a7f46515364c6aa868a5f4fab (diff) | |
download | ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.gz ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.tar.bz2 ayatana-indicator-sound-612866753e2b554abb0b448ae6a8c8ce1c2f4d87.zip |
Import upstream version 12.10.0
Diffstat (limited to 'src/settings-manager.c')
-rw-r--r-- | src/settings-manager.c | 204 |
1 files changed, 151 insertions, 53 deletions
diff --git a/src/settings-manager.c b/src/settings-manager.c index 29e6f13..52d187c 100644 --- a/src/settings-manager.c +++ b/src/settings-manager.c @@ -1,4 +1,4 @@ -/* settings-manager.c generated by valac 0.14.2, the Vala compiler +/* settings-manager.c generated by valac 0.16.1, the Vala compiler * generated from settings-manager.vala, do not modify */ /* @@ -68,15 +68,18 @@ enum { SettingsManager* settings_manager_new (void); SettingsManager* settings_manager_construct (GType object_type); gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_length1); +GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self); GeeArrayList* settings_manager_fetch_interested (SettingsManager* self); static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle); void settings_manager_clear_list (SettingsManager* self); void settings_manager_remove_interested (SettingsManager* self, const gchar* app_desktop_name); void settings_manager_add_interested (SettingsManager* self, const gchar* app_desktop_name); static void settings_manager_on_blacklist_event (SettingsManager* self); +static void settings_manager_on_preferred_event (SettingsManager* self); static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data); static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties); static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self); +static void _settings_manager_on_preferred_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self); static void settings_manager_finalize (GObject* obj); static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func); static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func); @@ -115,6 +118,83 @@ gchar** settings_manager_fetch_blacklist (SettingsManager* self, int* result_len } +GeeArrayList* settings_manager_fetch_preferred (SettingsManager* self) { + GeeArrayList* result = NULL; + GeeArrayList* _tmp0_; + GeeArrayList* list; + GSettings* _tmp1_; + gchar** _tmp2_; + gchar** _tmp3_ = NULL; + gchar** preferred; + gint preferred_length1; + gint _preferred_size_; + GeeArrayList* _tmp4_ = NULL; + GeeArrayList* interested; + gchar** _tmp5_; + gint _tmp5__length1; + g_return_val_if_fail (self != NULL, NULL); + _tmp0_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + list = _tmp0_; + _tmp1_ = self->priv->settings; + _tmp3_ = _tmp2_ = g_settings_get_strv (_tmp1_, "preferred-media-players"); + preferred = _tmp3_; + preferred_length1 = _vala_array_length (_tmp2_); + _preferred_size_ = preferred_length1; + _tmp4_ = settings_manager_fetch_interested (self); + interested = _tmp4_; + _tmp5_ = preferred; + _tmp5__length1 = preferred_length1; + { + gchar** s_collection = NULL; + gint s_collection_length1 = 0; + gint _s_collection_size_ = 0; + gint s_it = 0; + s_collection = _tmp5_; + s_collection_length1 = _tmp5__length1; + for (s_it = 0; s_it < _tmp5__length1; s_it = s_it + 1) { + gchar* _tmp6_; + gchar* s = NULL; + _tmp6_ = g_strdup (s_collection[s_it]); + s = _tmp6_; + { + gboolean _tmp7_ = FALSE; + GeeArrayList* _tmp8_; + const gchar* _tmp9_; + gboolean _tmp10_ = FALSE; + gboolean _tmp14_; + _tmp8_ = list; + _tmp9_ = s; + _tmp10_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp8_, _tmp9_); + if (!_tmp10_) { + GeeArrayList* _tmp11_; + const gchar* _tmp12_; + gboolean _tmp13_ = FALSE; + _tmp11_ = interested; + _tmp12_ = s; + _tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_); + _tmp7_ = _tmp13_; + } else { + _tmp7_ = FALSE; + } + _tmp14_ = _tmp7_; + if (_tmp14_) { + GeeArrayList* _tmp15_; + const gchar* _tmp16_; + _tmp15_ = list; + _tmp16_ = s; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_); + } + _g_free0 (s); + } + } + } + result = list; + _g_object_unref0 (interested); + preferred = (_vala_array_free (preferred, preferred_length1, (GDestroyNotify) g_free), NULL); + return result; +} + + static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gchar* needle) { int i; for (i = 0; i < stack_length; i++) { @@ -128,83 +208,81 @@ static gboolean _vala_string_array_contains (gchar** stack, int stack_length, gc GeeArrayList* settings_manager_fetch_interested (SettingsManager* self) { GeeArrayList* result = NULL; - GSettings* _tmp0_; - gchar** _tmp1_; - gchar** _tmp2_ = NULL; + gint _tmp0_ = 0; + gchar** _tmp1_ = NULL; gchar** blacklisted; gint blacklisted_length1; gint _blacklisted_size_; - GSettings* _tmp3_; - gchar** _tmp4_; - gchar** _tmp5_ = NULL; + GSettings* _tmp2_; + gchar** _tmp3_; + gchar** _tmp4_ = NULL; gchar** interested; gint interested_length1; gint _interested_size_; - GeeArrayList* _tmp6_; + GeeArrayList* _tmp5_; GeeArrayList* list; - gchar** _tmp7_; - gint _tmp7__length1; + gchar** _tmp6_; + gint _tmp6__length1; g_return_val_if_fail (self != NULL, NULL); - _tmp0_ = self->priv->settings; - _tmp2_ = _tmp1_ = g_settings_get_strv (_tmp0_, "blacklisted-media-players"); - blacklisted = _tmp2_; - blacklisted_length1 = _vala_array_length (_tmp1_); + _tmp1_ = settings_manager_fetch_blacklist (self, &_tmp0_); + blacklisted = _tmp1_; + blacklisted_length1 = _tmp0_; _blacklisted_size_ = blacklisted_length1; - _tmp3_ = self->priv->settings; - _tmp5_ = _tmp4_ = g_settings_get_strv (_tmp3_, "interested-media-players"); - interested = _tmp5_; - interested_length1 = _vala_array_length (_tmp4_); + _tmp2_ = self->priv->settings; + _tmp4_ = _tmp3_ = g_settings_get_strv (_tmp2_, "interested-media-players"); + interested = _tmp4_; + interested_length1 = _vala_array_length (_tmp3_); _interested_size_ = interested_length1; - _tmp6_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); - list = _tmp6_; - _tmp7_ = interested; - _tmp7__length1 = interested_length1; + _tmp5_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL); + list = _tmp5_; + _tmp6_ = interested; + _tmp6__length1 = interested_length1; { gchar** s_collection = NULL; gint s_collection_length1 = 0; gint _s_collection_size_ = 0; gint s_it = 0; - s_collection = _tmp7_; - s_collection_length1 = _tmp7__length1; - for (s_it = 0; s_it < _tmp7__length1; s_it = s_it + 1) { - gchar* _tmp8_; + s_collection = _tmp6_; + s_collection_length1 = _tmp6__length1; + for (s_it = 0; s_it < _tmp6__length1; s_it = s_it + 1) { + gchar* _tmp7_; gchar* s = NULL; - _tmp8_ = g_strdup (s_collection[s_it]); - s = _tmp8_; + _tmp7_ = g_strdup (s_collection[s_it]); + s = _tmp7_; { - const gchar* _tmp9_; - GeeArrayList* _tmp11_; - const gchar* _tmp12_; - gboolean _tmp13_ = FALSE; - const gchar* _tmp14_; - gchar** _tmp15_; - gint _tmp15__length1; - GeeArrayList* _tmp16_; - const gchar* _tmp17_; - _tmp9_ = s; - if (g_strcmp0 (_tmp9_, "banshee-1") == 0) { - gchar* _tmp10_; - _tmp10_ = g_strdup ("banshee"); + const gchar* _tmp8_; + GeeArrayList* _tmp10_; + const gchar* _tmp11_; + gboolean _tmp12_ = FALSE; + const gchar* _tmp13_; + gchar** _tmp14_; + gint _tmp14__length1; + GeeArrayList* _tmp15_; + const gchar* _tmp16_; + _tmp8_ = s; + if (g_strcmp0 (_tmp8_, "banshee-1") == 0) { + gchar* _tmp9_; + _tmp9_ = g_strdup ("banshee"); _g_free0 (s); - s = _tmp10_; + s = _tmp9_; } - _tmp11_ = list; - _tmp12_ = s; - _tmp13_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp11_, _tmp12_); - if (_tmp13_) { + _tmp10_ = list; + _tmp11_ = s; + _tmp12_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp10_, _tmp11_); + if (_tmp12_) { _g_free0 (s); continue; } - _tmp14_ = s; - _tmp15_ = blacklisted; - _tmp15__length1 = blacklisted_length1; - if (_vala_string_array_contains (_tmp15_, _tmp15__length1, _tmp14_)) { + _tmp13_ = s; + _tmp14_ = blacklisted; + _tmp14__length1 = blacklisted_length1; + if (_vala_string_array_contains (_tmp14_, _tmp14__length1, _tmp13_)) { _g_free0 (s); continue; } - _tmp16_ = list; - _tmp17_ = s; - gee_abstract_collection_add ((GeeAbstractCollection*) _tmp16_, _tmp17_); + _tmp15_ = list; + _tmp16_ = s; + gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, _tmp16_); _g_free0 (s); } } @@ -381,6 +459,17 @@ static void settings_manager_on_blacklist_event (SettingsManager* self) { } +static void settings_manager_on_preferred_event (SettingsManager* self) { + GeeArrayList* _tmp0_ = NULL; + GeeArrayList* _tmp1_; + g_return_if_fail (self != NULL); + _tmp0_ = settings_manager_fetch_preferred (self); + _tmp1_ = _tmp0_; + g_signal_emit_by_name (self, "preferred-updates", _tmp1_); + _g_object_unref0 (_tmp1_); +} + + static void g_cclosure_user_marshal_VOID__BOXED_INT (GClosure * closure, GValue * return_value, guint n_param_values, const GValue * param_values, gpointer invocation_hint, gpointer marshal_data) { typedef void (*GMarshalFunc_VOID__BOXED_INT) (gpointer data1, gpointer arg_1, gint arg_2, gpointer data2); register GMarshalFunc_VOID__BOXED_INT callback; @@ -406,12 +495,18 @@ static void _settings_manager_on_blacklist_event_g_settings_changed (GSettings* } +static void _settings_manager_on_preferred_event_g_settings_changed (GSettings* _sender, const gchar* key, gpointer self) { + settings_manager_on_preferred_event (self); +} + + static GObject * settings_manager_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) { GObject * obj; GObjectClass * parent_class; SettingsManager * self; GSettings* _tmp0_; GSettings* _tmp1_; + GSettings* _tmp2_; parent_class = G_OBJECT_CLASS (settings_manager_parent_class); obj = parent_class->constructor (type, n_construct_properties, construct_properties); self = SETTINGS_MANAGER (obj); @@ -420,6 +515,8 @@ static GObject * settings_manager_constructor (GType type, guint n_construct_pro self->priv->settings = _tmp0_; _tmp1_ = self->priv->settings; g_signal_connect_object (_tmp1_, "changed::blacklisted-media-players", (GCallback) _settings_manager_on_blacklist_event_g_settings_changed, self, 0); + _tmp2_ = self->priv->settings; + g_signal_connect_object (_tmp2_, "changed::preferred-media-players", (GCallback) _settings_manager_on_preferred_event_g_settings_changed, self, 0); return obj; } @@ -430,6 +527,7 @@ static void settings_manager_class_init (SettingsManagerClass * klass) { G_OBJECT_CLASS (klass)->constructor = settings_manager_constructor; G_OBJECT_CLASS (klass)->finalize = settings_manager_finalize; g_signal_new ("blacklist_updates", TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOXED_INT, G_TYPE_NONE, 2, G_TYPE_STRV, G_TYPE_INT); + g_signal_new ("preferred_updates", TYPE_SETTINGS_MANAGER, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, GEE_TYPE_ARRAY_LIST); } |