Back to index

unity-lens-music  6.0.0
banshee-filter-parser-decade.c
Go to the documentation of this file.
00001 /* banshee-filter-parser-decade.c generated by valac 0.14.2, the Vala compiler
00002  * generated from banshee-filter-parser-decade.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_DECADE_FILTER_PARSER (unity_music_lens_decade_filter_parser_get_type ())
00042 #define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParser))
00043 #define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
00044 #define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
00045 #define UNITY_MUSIC_LENS_IS_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER))
00046 #define UNITY_MUSIC_LENS_DECADE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, UnityMusicLensDecadeFilterParserClass))
00047 
00048 typedef struct _UnityMusicLensDecadeFilterParser UnityMusicLensDecadeFilterParser;
00049 typedef struct _UnityMusicLensDecadeFilterParserClass UnityMusicLensDecadeFilterParserClass;
00050 typedef struct _UnityMusicLensDecadeFilterParserPrivate UnityMusicLensDecadeFilterParserPrivate;
00051 
00052 #define UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER (unity_music_lens_banshee_filter_parser_get_type ())
00053 #define UNITY_MUSIC_LENS_BANSHEE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER, UnityMusicLensBansheeFilterParser))
00054 #define UNITY_MUSIC_LENS_IS_BANSHEE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER))
00055 #define UNITY_MUSIC_LENS_BANSHEE_FILTER_PARSER_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER, UnityMusicLensBansheeFilterParserIface))
00056 
00057 typedef struct _UnityMusicLensBansheeFilterParser UnityMusicLensBansheeFilterParser;
00058 typedef struct _UnityMusicLensBansheeFilterParserIface UnityMusicLensBansheeFilterParserIface;
00059 
00060 #define UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER (unity_music_lens_banshee_decade_filter_parser_get_type ())
00061 #define UNITY_MUSIC_LENS_BANSHEE_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER, UnityMusicLensBansheeDecadeFilterParser))
00062 #define UNITY_MUSIC_LENS_BANSHEE_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER, UnityMusicLensBansheeDecadeFilterParserClass))
00063 #define UNITY_MUSIC_LENS_IS_BANSHEE_DECADE_FILTER_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER))
00064 #define UNITY_MUSIC_LENS_IS_BANSHEE_DECADE_FILTER_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER))
00065 #define UNITY_MUSIC_LENS_BANSHEE_DECADE_FILTER_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER, UnityMusicLensBansheeDecadeFilterParserClass))
00066 
00067 typedef struct _UnityMusicLensBansheeDecadeFilterParser UnityMusicLensBansheeDecadeFilterParser;
00068 typedef struct _UnityMusicLensBansheeDecadeFilterParserClass UnityMusicLensBansheeDecadeFilterParserClass;
00069 typedef struct _UnityMusicLensBansheeDecadeFilterParserPrivate UnityMusicLensBansheeDecadeFilterParserPrivate;
00070 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00071 
00072 struct _UnityMusicLensFilterParser {
00073        GObject parent_instance;
00074        UnityMusicLensFilterParserPrivate * priv;
00075 };
00076 
00077 struct _UnityMusicLensFilterParserClass {
00078        GObjectClass parent_class;
00079        gchar* (*parse) (UnityMusicLensFilterParser* self);
00080        const gchar* (*get_id) (UnityMusicLensFilterParser* self);
00081 };
00082 
00083 struct _UnityMusicLensDecadeFilterParser {
00084        UnityMusicLensFilterParser parent_instance;
00085        UnityMusicLensDecadeFilterParserPrivate * priv;
00086 };
00087 
00088 struct _UnityMusicLensDecadeFilterParserClass {
00089        UnityMusicLensFilterParserClass parent_class;
00090 };
00091 
00092 struct _UnityMusicLensBansheeFilterParserIface {
00093        GTypeInterface parent_iface;
00094 };
00095 
00096 struct _UnityMusicLensBansheeDecadeFilterParser {
00097        UnityMusicLensDecadeFilterParser parent_instance;
00098        UnityMusicLensBansheeDecadeFilterParserPrivate * priv;
00099 };
00100 
00101 struct _UnityMusicLensBansheeDecadeFilterParserClass {
00102        UnityMusicLensDecadeFilterParserClass parent_class;
00103 };
00104 
00105 
00106 static gpointer unity_music_lens_banshee_decade_filter_parser_parent_class = NULL;
00107 static UnityMusicLensBansheeFilterParserIface* unity_music_lens_banshee_decade_filter_parser_unity_music_lens_banshee_filter_parser_parent_iface = NULL;
00108 
00109 GType unity_music_lens_filter_parser_get_type (void) G_GNUC_CONST;
00110 GType unity_music_lens_decade_filter_parser_get_type (void) G_GNUC_CONST;
00111 GType unity_music_lens_banshee_filter_parser_get_type (void) G_GNUC_CONST;
00112 GType unity_music_lens_banshee_decade_filter_parser_get_type (void) G_GNUC_CONST;
00113 enum  {
00114        UNITY_MUSIC_LENS_BANSHEE_DECADE_FILTER_PARSER_DUMMY_PROPERTY
00115 };
00116 UnityMusicLensBansheeDecadeFilterParser* unity_music_lens_banshee_decade_filter_parser_new (UnityMusicLensDecadeFilterParser* parser);
00117 UnityMusicLensBansheeDecadeFilterParser* unity_music_lens_banshee_decade_filter_parser_construct (GType object_type, UnityMusicLensDecadeFilterParser* parser);
00118 UnityFilter* unity_music_lens_filter_parser_get_filter (UnityMusicLensFilterParser* self);
00119 UnityMusicLensDecadeFilterParser* unity_music_lens_decade_filter_parser_new (UnityMultiRangeFilter* filter);
00120 UnityMusicLensDecadeFilterParser* unity_music_lens_decade_filter_parser_construct (GType object_type, UnityMultiRangeFilter* filter);
00121 static gchar* unity_music_lens_banshee_decade_filter_parser_real_parse (UnityMusicLensFilterParser* base);
00122 
00123 
00124 UnityMusicLensBansheeDecadeFilterParser* unity_music_lens_banshee_decade_filter_parser_construct (GType object_type, UnityMusicLensDecadeFilterParser* parser) {
00125        UnityMusicLensBansheeDecadeFilterParser * self = NULL;
00126        UnityMusicLensDecadeFilterParser* _tmp0_;
00127        UnityFilter* _tmp1_;
00128        UnityFilter* _tmp2_;
00129        g_return_val_if_fail (parser != NULL, NULL);
00130        _tmp0_ = parser;
00131        _tmp1_ = unity_music_lens_filter_parser_get_filter ((UnityMusicLensFilterParser*) _tmp0_);
00132        _tmp2_ = _tmp1_;
00133        self = (UnityMusicLensBansheeDecadeFilterParser*) unity_music_lens_decade_filter_parser_construct (object_type, UNITY_IS_MULTI_RANGE_FILTER (_tmp2_) ? ((UnityMultiRangeFilter*) _tmp2_) : NULL);
00134        return self;
00135 }
00136 
00137 
00138 UnityMusicLensBansheeDecadeFilterParser* unity_music_lens_banshee_decade_filter_parser_new (UnityMusicLensDecadeFilterParser* parser) {
00139        return unity_music_lens_banshee_decade_filter_parser_construct (UNITY_MUSIC_LENS_TYPE_BANSHEE_DECADE_FILTER_PARSER, parser);
00140 }
00141 
00142 
00143 static gpointer _g_object_ref0 (gpointer self) {
00144        return self ? g_object_ref (self) : NULL;
00145 }
00146 
00147 
00148 static gchar* unity_music_lens_banshee_decade_filter_parser_real_parse (UnityMusicLensFilterParser* base) {
00149        UnityMusicLensBansheeDecadeFilterParser * self;
00150        gchar* result = NULL;
00151        gint start_year = 0;
00152        gint end_year = 0;
00153        UnityFilter* _tmp0_;
00154        UnityFilter* _tmp1_;
00155        UnityMultiRangeFilter* _tmp2_;
00156        UnityMultiRangeFilter* range_filter;
00157        UnityMultiRangeFilter* _tmp3_;
00158        UnityFilterOption* _tmp4_ = NULL;
00159        UnityFilterOption* start;
00160        UnityMultiRangeFilter* _tmp5_;
00161        UnityFilterOption* _tmp6_ = NULL;
00162        UnityFilterOption* end;
00163        UnityFilterOption* _tmp7_;
00164        const gchar* _tmp8_;
00165        const gchar* _tmp9_;
00166        gint _tmp10_ = 0;
00167        UnityFilterOption* _tmp11_;
00168        const gchar* _tmp12_;
00169        const gchar* _tmp13_;
00170        gint _tmp14_ = 0;
00171        UnityMultiRangeFilter* _tmp15_;
00172        GList* _tmp16_;
00173        UnityFilterOption* _tmp17_;
00174        gint _tmp18_ = 0;
00175        gint end_index;
00176        gint _tmp19_;
00177        UnityMultiRangeFilter* _tmp20_;
00178        GList* _tmp21_;
00179        guint _tmp22_ = 0U;
00180        gint _tmp31_;
00181        gint _tmp32_;
00182        gchar* _tmp33_ = NULL;
00183        self = (UnityMusicLensBansheeDecadeFilterParser*) base;
00184        _tmp0_ = unity_music_lens_filter_parser_get_filter ((UnityMusicLensFilterParser*) self);
00185        _tmp1_ = _tmp0_;
00186        _tmp2_ = _g_object_ref0 (UNITY_IS_MULTI_RANGE_FILTER (_tmp1_) ? ((UnityMultiRangeFilter*) _tmp1_) : NULL);
00187        range_filter = _tmp2_;
00188        _tmp3_ = range_filter;
00189        _tmp4_ = unity_multi_range_filter_get_first_active (_tmp3_);
00190        start = _tmp4_;
00191        _tmp5_ = range_filter;
00192        _tmp6_ = unity_multi_range_filter_get_last_active (_tmp5_);
00193        end = _tmp6_;
00194        _tmp7_ = start;
00195        _tmp8_ = unity_filter_option_get_id (_tmp7_);
00196        _tmp9_ = _tmp8_;
00197        _tmp10_ = atoi (_tmp9_);
00198        start_year = _tmp10_;
00199        _tmp11_ = end;
00200        _tmp12_ = unity_filter_option_get_id (_tmp11_);
00201        _tmp13_ = _tmp12_;
00202        _tmp14_ = atoi (_tmp13_);
00203        end_year = _tmp14_;
00204        _tmp15_ = range_filter;
00205        _tmp16_ = ((UnityOptionsFilter*) _tmp15_)->options;
00206        _tmp17_ = end;
00207        _tmp18_ = g_list_index (_tmp16_, _tmp17_);
00208        end_index = _tmp18_;
00209        _tmp19_ = end_index;
00210        _tmp20_ = range_filter;
00211        _tmp21_ = ((UnityOptionsFilter*) _tmp20_)->options;
00212        _tmp22_ = g_list_length (_tmp21_);
00213        if (((guint) _tmp19_) == (_tmp22_ - 1)) {
00214               gint _tmp23_;
00215               _tmp23_ = end_year;
00216               end_year = _tmp23_ + 10;
00217        } else {
00218               UnityMultiRangeFilter* _tmp24_;
00219               GList* _tmp25_;
00220               gint _tmp26_;
00221               gconstpointer _tmp27_ = NULL;
00222               const gchar* _tmp28_;
00223               const gchar* _tmp29_;
00224               gint _tmp30_ = 0;
00225               _tmp24_ = range_filter;
00226               _tmp25_ = ((UnityOptionsFilter*) _tmp24_)->options;
00227               _tmp26_ = end_index;
00228               _tmp27_ = g_list_nth_data (_tmp25_, (guint) (_tmp26_ + 1));
00229               _tmp28_ = unity_filter_option_get_id ((UnityFilterOption*) _tmp27_);
00230               _tmp29_ = _tmp28_;
00231               _tmp30_ = atoi (_tmp29_);
00232               end_year = _tmp30_;
00233        }
00234        _tmp31_ = start_year;
00235        _tmp32_ = end_year;
00236        _tmp33_ = g_strdup_printf ("(CoreTracks.Year >= %d AND CoreTracks.Year < %d) ", _tmp31_, _tmp32_);
00237        result = _tmp33_;
00238        _g_object_unref0 (end);
00239        _g_object_unref0 (start);
00240        _g_object_unref0 (range_filter);
00241        return result;
00242 }
00243 
00244 
00245 static void unity_music_lens_banshee_decade_filter_parser_class_init (UnityMusicLensBansheeDecadeFilterParserClass * klass) {
00246        unity_music_lens_banshee_decade_filter_parser_parent_class = g_type_class_peek_parent (klass);
00247        UNITY_MUSIC_LENS_FILTER_PARSER_CLASS (klass)->parse = unity_music_lens_banshee_decade_filter_parser_real_parse;
00248 }
00249 
00250 
00251 static void unity_music_lens_banshee_decade_filter_parser_unity_music_lens_banshee_filter_parser_interface_init (UnityMusicLensBansheeFilterParserIface * iface) {
00252        unity_music_lens_banshee_decade_filter_parser_unity_music_lens_banshee_filter_parser_parent_iface = g_type_interface_peek_parent (iface);
00253 }
00254 
00255 
00256 static void unity_music_lens_banshee_decade_filter_parser_instance_init (UnityMusicLensBansheeDecadeFilterParser * self) {
00257 }
00258 
00259 
00260 GType unity_music_lens_banshee_decade_filter_parser_get_type (void) {
00261        static volatile gsize unity_music_lens_banshee_decade_filter_parser_type_id__volatile = 0;
00262        if (g_once_init_enter (&unity_music_lens_banshee_decade_filter_parser_type_id__volatile)) {
00263               static const GTypeInfo g_define_type_info = { sizeof (UnityMusicLensBansheeDecadeFilterParserClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_music_lens_banshee_decade_filter_parser_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityMusicLensBansheeDecadeFilterParser), 0, (GInstanceInitFunc) unity_music_lens_banshee_decade_filter_parser_instance_init, NULL };
00264               static const GInterfaceInfo unity_music_lens_banshee_filter_parser_info = { (GInterfaceInitFunc) unity_music_lens_banshee_decade_filter_parser_unity_music_lens_banshee_filter_parser_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
00265               GType unity_music_lens_banshee_decade_filter_parser_type_id;
00266               unity_music_lens_banshee_decade_filter_parser_type_id = g_type_register_static (UNITY_MUSIC_LENS_TYPE_DECADE_FILTER_PARSER, "UnityMusicLensBansheeDecadeFilterParser", &g_define_type_info, 0);
00267               g_type_add_interface_static (unity_music_lens_banshee_decade_filter_parser_type_id, UNITY_MUSIC_LENS_TYPE_BANSHEE_FILTER_PARSER, &unity_music_lens_banshee_filter_parser_info);
00268               g_once_init_leave (&unity_music_lens_banshee_decade_filter_parser_type_id__volatile, unity_music_lens_banshee_decade_filter_parser_type_id);
00269        }
00270        return unity_music_lens_banshee_decade_filter_parser_type_id__volatile;
00271 }
00272 
00273 
00274