Back to index

unity-lens-music  6.0.0
filter-parser-genre.c
Go to the documentation of this file.
00001 /* filter-parser-genre.c generated by valac 0.14.2, the Vala compiler
00002  * generated from filter-parser-genre.vala, do not modify */
00003 
00004 /*
00005  * Copyright (C) 2011 Canonical Ltd
00006  *
00007  * This program is free software: you can redistribute it and/or modify
00008  * it under the terms of the GNU General Public License version 3 as
00009  * published by the Free Software Foundation.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018  *
00019  * Authored by Alex Launi <alex.launi@canonical.com>
00020  *
00021  */
00022 
00023 #include <glib.h>
00024 #include <glib-object.h>
00025 #include <stdlib.h>
00026 #include <string.h>
00027 #include <unity.h>
00028 
00029 
00030 #define UNITY_MUSIC_LENS_TYPE_FILTER_PARSER (unity_music_lens_filter_parser_get_type ())
00031 #define UNITY_MUSIC_LENS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParser))
00032 #define UNITY_MUSIC_LENS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
00033 #define UNITY_MUSIC_LENS_IS_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
00034 #define UNITY_MUSIC_LENS_IS_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER))
00035 #define UNITY_MUSIC_LENS_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, UnityMusicLensFilterParserClass))
00036 
00037 typedef struct _UnityMusicLensFilterParser UnityMusicLensFilterParser;
00038 typedef struct _UnityMusicLensFilterParserClass UnityMusicLensFilterParserClass;
00039 typedef struct _UnityMusicLensFilterParserPrivate UnityMusicLensFilterParserPrivate;
00040 
00041 #define UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER (unity_music_lens_genre_filter_parser_get_type ())
00042 #define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParser))
00043 #define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
00044 #define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
00045 #define UNITY_MUSIC_LENS_IS_GENRE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER))
00046 #define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserClass))
00047 
00048 typedef struct _UnityMusicLensGenreFilterParser UnityMusicLensGenreFilterParser;
00049 typedef struct _UnityMusicLensGenreFilterParserClass UnityMusicLensGenreFilterParserClass;
00050 typedef struct _UnityMusicLensGenreFilterParserPrivate UnityMusicLensGenreFilterParserPrivate;
00051 
00052 #define UNITY_MUSIC_LENS_TYPE_GENRE (unity_music_lens_genre_get_type ())
00053 #define UNITY_MUSIC_LENS_GENRE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenre))
00054 #define UNITY_MUSIC_LENS_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenreClass))
00055 #define UNITY_MUSIC_LENS_IS_GENRE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_GENRE))
00056 #define UNITY_MUSIC_LENS_IS_GENRE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_GENRE))
00057 #define UNITY_MUSIC_LENS_GENRE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_GENRE, UnityMusicLensGenreClass))
00058 
00059 typedef struct _UnityMusicLensGenre UnityMusicLensGenre;
00060 typedef struct _UnityMusicLensGenreClass UnityMusicLensGenreClass;
00061 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00062 #define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
00063 
00064 struct _UnityMusicLensFilterParser {
00065        GObject parent_instance;
00066        UnityMusicLensFilterParserPrivate * priv;
00067 };
00068 
00069 struct _UnityMusicLensFilterParserClass {
00070        GObjectClass parent_class;
00071        gchar* (*parse) (UnityMusicLensFilterParser* self);
00072        const gchar* (*get_id) (UnityMusicLensFilterParser* self);
00073 };
00074 
00075 struct _UnityMusicLensGenreFilterParser {
00076        UnityMusicLensFilterParser parent_instance;
00077        UnityMusicLensGenreFilterParserPrivate * priv;
00078 };
00079 
00080 struct _UnityMusicLensGenreFilterParserClass {
00081        UnityMusicLensFilterParserClass parent_class;
00082 };
00083 
00084 struct _UnityMusicLensGenreFilterParserPrivate {
00085        UnityMusicLensGenre* _map;
00086 };
00087 
00088 
00089 static gpointer unity_music_lens_genre_filter_parser_parent_class = NULL;
00090 
00091 GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
00092 GType unity_music_lens_genre_filter_parser_get_type (void) G_GNUC_CONST;
00093 GType unity_music_lens_genre_get_type (void) G_GNUC_CONST;
00094 #define UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, UnityMusicLensGenreFilterParserPrivate))
00095 enum  {
00096        UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_DUMMY_PROPERTY,
00097        UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_ID,
00098        UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP
00099 };
00100 UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_new (UnityCheckOptionFilterCompact* filter);
00101 UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_construct (GType object_type, UnityCheckOptionFilterCompact* filter);
00102 UnityMusicLensFilterParser* unity_music_lens_filter_parser_construct (GType object_type, UnityFilter* filter);
00103 UnityMusicLensGenre* unity_music_lens_genre_new (void);
00104 UnityMusicLensGenre* unity_music_lens_genre_construct (GType object_type);
00105 static void unity_music_lens_genre_filter_parser_set_map (UnityMusicLensGenreFilterParser* self, UnityMusicLensGenre* value);
00106 static gchar* unity_music_lens_genre_filter_parser_real_parse (UnityMusicLensFilterParser* base);
00107 GList* unity_music_lens_genre_filter_parser_get_all_selected_genres (UnityMusicLensGenreFilterParser* self);
00108 UnityFilter* unity_music_lens_filter_parser_get_filter (UnityMusicLensFilterParser* self);
00109 static void _g_object_unref0_ (gpointer var);
00110 static void _g_list_free__g_object_unref0_ (GList* self);
00111 UnityMusicLensGenre* unity_music_lens_genre_filter_parser_get_map (UnityMusicLensGenreFilterParser* self);
00112 static void unity_music_lens_genre_filter_parser_finalize (GObject* obj);
00113 const gchar* unity_music_lens_filter_parser_get_id (UnityMusicLensFilterParser* self);
00114 static void _vala_unity_music_lens_genre_filter_parser_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
00115 static void _vala_unity_music_lens_genre_filter_parser_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
00116 
00117 
00118 UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_construct (GType object_type, UnityCheckOptionFilterCompact* filter) {
00119        UnityMusicLensGenreFilterParser * self = NULL;
00120        UnityCheckOptionFilterCompact* _tmp0_;
00121        UnityMusicLensGenre* _tmp1_;
00122        UnityMusicLensGenre* _tmp2_;
00123        g_return_val_if_fail (filter != NULL, NULL);
00124        _tmp0_ = filter;
00125        self = (UnityMusicLensGenreFilterParser*) unity_music_lens_filter_parser_construct (object_type, (UnityFilter*) _tmp0_);
00126        _tmp1_ = unity_music_lens_genre_new ();
00127        _tmp2_ = _tmp1_;
00128        unity_music_lens_genre_filter_parser_set_map (self, _tmp2_);
00129        _g_object_unref0 (_tmp2_);
00130        return self;
00131 }
00132 
00133 
00134 UnityMusicLensGenreFilterParser* unity_music_lens_genre_filter_parser_new (UnityCheckOptionFilterCompact* filter) {
00135        return unity_music_lens_genre_filter_parser_construct (UNITY_MUSIC_LENS_TYPE_GENRE_FILTER_PARSER, filter);
00136 }
00137 
00138 
00139 static gchar* unity_music_lens_genre_filter_parser_real_parse (UnityMusicLensFilterParser* base) {
00140        UnityMusicLensGenreFilterParser * self;
00141        gchar* result = NULL;
00142        gchar* _tmp0_;
00143        self = (UnityMusicLensGenreFilterParser*) base;
00144        _tmp0_ = g_strdup ("");
00145        result = _tmp0_;
00146        return result;
00147 }
00148 
00149 
00150 static gpointer _g_object_ref0 (gpointer self) {
00151        return self ? g_object_ref (self) : NULL;
00152 }
00153 
00154 
00155 static void _g_object_unref0_ (gpointer var) {
00156        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
00157 }
00158 
00159 
00160 static void _g_list_free__g_object_unref0_ (GList* self) {
00161        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
00162        g_list_free (self);
00163 }
00164 
00165 
00166 GList* unity_music_lens_genre_filter_parser_get_all_selected_genres (UnityMusicLensGenreFilterParser* self) {
00167        GList* result = NULL;
00168        UnityFilter* _tmp0_;
00169        UnityFilter* _tmp1_;
00170        GList* _tmp2_;
00171        GList* options;
00172        GList* active;
00173        GList* _tmp3_;
00174        g_return_val_if_fail (self != NULL, NULL);
00175        _tmp0_ = unity_music_lens_filter_parser_get_filter ((UnityMusicLensFilterParser*) self);
00176        _tmp1_ = _tmp0_;
00177        _tmp2_ = ((UnityOptionsFilter*) (UNITY_IS_CHECK_OPTION_FILTER_COMPACT (_tmp1_) ? ((UnityCheckOptionFilterCompact*) _tmp1_) : NULL))->options;
00178        options = _tmp2_;
00179        active = NULL;
00180        _tmp3_ = options;
00181        {
00182               GList* option_collection = NULL;
00183               GList* option_it = NULL;
00184               option_collection = _tmp3_;
00185               for (option_it = option_collection; option_it != NULL; option_it = option_it->next) {
00186                      UnityFilterOption* _tmp4_;
00187                      UnityFilterOption* option = NULL;
00188                      _tmp4_ = _g_object_ref0 ((UnityFilterOption*) option_it->data);
00189                      option = _tmp4_;
00190                      {
00191                             UnityFilterOption* _tmp5_;
00192                             gboolean _tmp6_;
00193                             gboolean _tmp7_;
00194                             _tmp5_ = option;
00195                             _tmp6_ = unity_filter_option_get_active (_tmp5_);
00196                             _tmp7_ = _tmp6_;
00197                             if (_tmp7_) {
00198                                    UnityFilterOption* _tmp8_;
00199                                    UnityFilterOption* _tmp9_;
00200                                    _tmp8_ = option;
00201                                    _tmp9_ = _g_object_ref0 (_tmp8_);
00202                                    active = g_list_append (active, _tmp9_);
00203                             }
00204                             _g_object_unref0 (option);
00205                      }
00206               }
00207        }
00208        result = active;
00209        return result;
00210 }
00211 
00212 
00213 static const gchar* unity_music_lens_genre_filter_parser_real_get_id (UnityMusicLensFilterParser* base) {
00214        const gchar* result;
00215        UnityMusicLensGenreFilterParser* self;
00216        self = (UnityMusicLensGenreFilterParser*) base;
00217        result = "genre";
00218        return result;
00219 }
00220 
00221 
00222 UnityMusicLensGenre* unity_music_lens_genre_filter_parser_get_map (UnityMusicLensGenreFilterParser* self) {
00223        UnityMusicLensGenre* result;
00224        UnityMusicLensGenre* _tmp0_;
00225        g_return_val_if_fail (self != NULL, NULL);
00226        _tmp0_ = self->priv->_map;
00227        result = _tmp0_;
00228        return result;
00229 }
00230 
00231 
00232 static void unity_music_lens_genre_filter_parser_set_map (UnityMusicLensGenreFilterParser* self, UnityMusicLensGenre* value) {
00233        UnityMusicLensGenre* _tmp0_;
00234        UnityMusicLensGenre* _tmp1_;
00235        g_return_if_fail (self != NULL);
00236        _tmp0_ = value;
00237        _tmp1_ = _g_object_ref0 (_tmp0_);
00238        _g_object_unref0 (self->priv->_map);
00239        self->priv->_map = _tmp1_;
00240        g_object_notify ((GObject *) self, "map");
00241 }
00242 
00243 
00244 static void unity_music_lens_genre_filter_parser_class_init (UnityMusicLensGenreFilterParserClass * klass) {
00245        unity_music_lens_genre_filter_parser_parent_class = g_type_class_peek_parent (klass);
00246        g_type_class_add_private (klass, sizeof (UnityMusicLensGenreFilterParserPrivate));
00247        UNITY_MUSIC_LENS_FILTER_PARSER_CLASS (klass)->parse = unity_music_lens_genre_filter_parser_real_parse;
00248        UNITY_MUSIC_LENS_FILTER_PARSER_CLASS (klass)->get_id = unity_music_lens_genre_filter_parser_real_get_id;
00249        G_OBJECT_CLASS (klass)->get_property = _vala_unity_music_lens_genre_filter_parser_get_property;
00250        G_OBJECT_CLASS (klass)->set_property = _vala_unity_music_lens_genre_filter_parser_set_property;
00251        G_OBJECT_CLASS (klass)->finalize = unity_music_lens_genre_filter_parser_finalize;
00252        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_ID, g_param_spec_string ("id", "id", "id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
00253        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP, g_param_spec_object ("map", "map", "map", UNITY_MUSIC_LENS_TYPE_GENRE, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
00254 }
00255 
00256 
00257 static void unity_music_lens_genre_filter_parser_instance_init (UnityMusicLensGenreFilterParser * self) {
00258        self->priv = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_GET_PRIVATE (self);
00259 }
00260 
00261 
00262 static void unity_music_lens_genre_filter_parser_finalize (GObject* obj) {
00263        UnityMusicLensGenreFilterParser * self;
00264        self = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER (obj);
00265        _g_object_unref0 (self->priv->_map);
00266        G_OBJECT_CLASS (unity_music_lens_genre_filter_parser_parent_class)->finalize (obj);
00267 }
00268 
00269 
00270 GType unity_music_lens_genre_filter_parser_get_type (void) {
00271        static volatile gsize unity_music_lens_genre_filter_parser_type_id__volatile = 0;
00272        if (g_once_init_enter (&unity_music_lens_genre_filter_parser_type_id__volatile)) {
00273               static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensGenreFilterParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_genre_filter_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensGenreFilterParser), 0, (GInstanceInitFunc) unity_music_lens_genre_filter_parser_instance_init, NULL };
00274               GType unity_music_lens_genre_filter_parser_type_id;
00275               unity_music_lens_genre_filter_parser_type_id = g_type_register_static (UNITY_MUSIC_LENS_TYPE_FILTER_PARSER, "UnityMusicLensGenreFilterParser", &g_define_type_info, 0);
00276               g_once_init_leave (&unity_music_lens_genre_filter_parser_type_id__volatile, unity_music_lens_genre_filter_parser_type_id);
00277        }
00278        return unity_music_lens_genre_filter_parser_type_id__volatile;
00279 }
00280 
00281 
00282 static void _vala_unity_music_lens_genre_filter_parser_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
00283        UnityMusicLensGenreFilterParser * self;
00284        self = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER (object);
00285        switch (property_id) {
00286               case UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_ID:
00287               g_value_set_string (value, unity_music_lens_filter_parser_get_id ((UnityMusicLensFilterParser*) self));
00288               break;
00289               case UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP:
00290               g_value_set_object (value, unity_music_lens_genre_filter_parser_get_map (self));
00291               break;
00292               default:
00293               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
00294               break;
00295        }
00296 }
00297 
00298 
00299 static void _vala_unity_music_lens_genre_filter_parser_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
00300        UnityMusicLensGenreFilterParser * self;
00301        self = UNITY_MUSIC_LENS_GENRE_FILTER_PARSER (object);
00302        switch (property_id) {
00303               case UNITY_MUSIC_LENS_GENRE_FILTER_PARSER_MAP:
00304               unity_music_lens_genre_filter_parser_set_map (self, g_value_get_object (value));
00305               break;
00306               default:
00307               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
00308               break;
00309        }
00310 }
00311 
00312 
00313