Back to index

libunity  5.92.0
test-launcher-integration.c
Go to the documentation of this file.
00001 /* test-launcher-integration.c generated by valac 0.17.2, the Vala compiler
00002  * generated from test-launcher-integration.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 Mikkel Kamstrup Erlandsen <mikkel.kamstrup@canonical.com>
00020  *
00021  */
00022 /*
00023  * Despite the relative simplicity of this API we still need to relegate it
00024  * to the integration tests suite because it depends on the GSettings schema
00025  * from Unity.
00026  */
00027 
00028 #include <glib.h>
00029 #include <glib-object.h>
00030 #include <stdlib.h>
00031 #include <string.h>
00032 #include <config.h>
00033 #include <gio/gio.h>
00034 #include <unity-internal.h>
00035 #include <gio/gdesktopappinfo.h>
00036 #include <gobject/gvaluecollector.h>
00037 
00038 
00039 #define TYPE_MAIN (main_get_type ())
00040 #define MAIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MAIN, Main))
00041 #define MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MAIN, MainClass))
00042 #define IS_MAIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MAIN))
00043 #define IS_MAIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MAIN))
00044 #define MAIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MAIN, MainClass))
00045 
00046 typedef struct _Main Main;
00047 typedef struct _MainClass MainClass;
00048 typedef struct _MainPrivate MainPrivate;
00049 #define _g_free0(var) (var = (g_free (var), NULL))
00050 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00051 typedef struct _Block1Data Block1Data;
00052 #define _g_main_loop_unref0(var) ((var == NULL) ? NULL : (var = (g_main_loop_unref (var), NULL)))
00053 typedef struct _ParamSpecMain ParamSpecMain;
00054 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
00055 
00056 struct _Main {
00057        GTypeInstance parent_instance;
00058        volatile int ref_count;
00059        MainPrivate * priv;
00060 };
00061 
00062 struct _MainClass {
00063        GTypeClass parent_class;
00064        void (*finalize) (Main *self);
00065 };
00066 
00067 struct _Block1Data {
00068        int _ref_count_;
00069        gboolean was_changed;
00070        GMainLoop* ml;
00071 };
00072 
00073 struct _ParamSpecMain {
00074        GParamSpec parent_instance;
00075 };
00076 
00077 
00078 static gpointer main_parent_class = NULL;
00079 
00080 gpointer main_ref (gpointer instance);
00081 void main_unref (gpointer instance);
00082 GParamSpec* param_spec_main (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
00083 void value_set_main (GValue* value, gpointer v_object);
00084 void value_take_main (GValue* value, gpointer v_object);
00085 gpointer value_get_main (const GValue* value);
00086 GType main_get_type (void) G_GNUC_CONST;
00087 enum  {
00088        MAIN_DUMMY_PROPERTY
00089 };
00090 gint main_main (gchar** args, int args_length1);
00091 void main_test_has_unknown_apps (void);
00092 static void _main_test_has_unknown_apps_gtest_data_func (gpointer self);
00093 void main_test_has_sample_apps (void);
00094 static void _main_test_has_sample_apps_gtest_data_func (gpointer self);
00095 void main_test_lookup (void);
00096 static void _main_test_lookup_gtest_data_func (gpointer self);
00097 void main_test_enumerate_ids (void);
00098 static void _main_test_enumerate_ids_gtest_data_func (gpointer self);
00099 void main_test_enumerate_app_infos (void);
00100 static void _main_test_enumerate_app_infos_gtest_data_func (gpointer self);
00101 void main_test_changes (void);
00102 static void _main_test_changes_gtest_data_func (gpointer self);
00103 void main_set_up (void);
00104 static Block1Data* block1_data_ref (Block1Data* _data1_);
00105 static void block1_data_unref (void * _userdata_);
00106 static void __lambda2_ (Block1Data* _data1_);
00107 static void ___lambda2__unity_launcher_favorites_changed (UnityLauncherFavorites* _sender, gpointer self);
00108 static gboolean __lambda3_ (Block1Data* _data1_);
00109 static gboolean ___lambda3__gsource_func (gpointer self);
00110 Main* main_new (void);
00111 Main* main_construct (GType object_type);
00112 static void main_finalize (Main* obj);
00113 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
00114 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
00115 
00116 
00117 static void _main_test_has_unknown_apps_gtest_data_func (gpointer self) {
00118        main_test_has_unknown_apps ();
00119 }
00120 
00121 
00122 static void _main_test_has_sample_apps_gtest_data_func (gpointer self) {
00123        main_test_has_sample_apps ();
00124 }
00125 
00126 
00127 static void _main_test_lookup_gtest_data_func (gpointer self) {
00128        main_test_lookup ();
00129 }
00130 
00131 
00132 static void _main_test_enumerate_ids_gtest_data_func (gpointer self) {
00133        main_test_enumerate_ids ();
00134 }
00135 
00136 
00137 static void _main_test_enumerate_app_infos_gtest_data_func (gpointer self) {
00138        main_test_enumerate_app_infos ();
00139 }
00140 
00141 
00142 static void _main_test_changes_gtest_data_func (gpointer self) {
00143        main_test_changes ();
00144 }
00145 
00146 
00147 gint main_main (gchar** args, int args_length1) {
00148        gint result = 0;
00149        const gchar* _tmp0_ = NULL;
00150        gchar* _tmp1_;
00151        gchar* datadirs;
00152        const gchar* _tmp2_;
00153        const gchar* _tmp6_;
00154        _tmp0_ = g_getenv ("XDG_DATA_DIRS");
00155        _tmp1_ = g_strdup (_tmp0_);
00156        datadirs = _tmp1_;
00157        _tmp2_ = datadirs;
00158        if (_tmp2_ != NULL) {
00159               const gchar* _tmp3_;
00160               gchar* _tmp4_;
00161               _tmp3_ = datadirs;
00162               _tmp4_ = g_strconcat (TESTDIR "/data:", _tmp3_, NULL);
00163               _g_free0 (datadirs);
00164               datadirs = _tmp4_;
00165        } else {
00166               gchar* _tmp5_;
00167               _tmp5_ = g_strdup (TESTDIR "/data");
00168               _g_free0 (datadirs);
00169               datadirs = _tmp5_;
00170        }
00171        _tmp6_ = datadirs;
00172        g_setenv ("XDG_DATA_DIRS", _tmp6_, TRUE);
00173        g_setenv ("GSETTINGS_BACKEND", "memory", TRUE);
00174        g_test_init (&args_length1, &args, NULL);
00175        g_test_add_data_func ("/Integration/Launcher/Favorites/UnknownApps", NULL, _main_test_has_unknown_apps_gtest_data_func);
00176        g_test_add_data_func ("/Integration/Launcher/Favorites/HasSampleApps", NULL, _main_test_has_sample_apps_gtest_data_func);
00177        g_test_add_data_func ("/Integration/Launcher/Favorites/Lookup", NULL, _main_test_lookup_gtest_data_func);
00178        g_test_add_data_func ("/Integration/Launcher/Favorites/EnumerateIds", NULL, _main_test_enumerate_ids_gtest_data_func);
00179        g_test_add_data_func ("/Integration/Launcher/Favorites/EnumerateAppInfos", NULL, _main_test_enumerate_app_infos_gtest_data_func);
00180        g_test_add_data_func ("/Integration/Launcher/Favorites/Changes", NULL, _main_test_changes_gtest_data_func);
00181        g_test_run ();
00182        result = 0;
00183        _g_free0 (datadirs);
00184        return result;
00185 }
00186 
00187 
00188 int main (int argc, char ** argv) {
00189        g_type_init ();
00190        return main_main (argv, argc);
00191 }
00192 
00193 
00194 void main_set_up (void) {
00195        const gchar* _tmp0_ = NULL;
00196        GSettings* _tmp1_;
00197        GSettings* settings;
00198        gchar* _tmp2_;
00199        gchar* _tmp3_;
00200        gchar* _tmp4_;
00201        gchar** _tmp5_ = NULL;
00202        gchar** faves;
00203        gint faves_length1;
00204        gint _faves_size_;
00205        _tmp0_ = g_getenv ("GSETTINGS_BACKEND");
00206        _vala_assert (g_strcmp0 ("memory", _tmp0_) == 0, "\"memory\" == Environment.get_variable (\"GSETTINGS_BACKEND\")");
00207        _tmp1_ = g_settings_new ("com.canonical.Unity.Launcher");
00208        settings = _tmp1_;
00209        _tmp2_ = g_strdup ("rhythmbox.desktop");
00210        _tmp3_ = g_strdup ("testapp1.desktop");
00211        _tmp4_ = g_strdup ("ubuntu-about.desktop");
00212        _tmp5_ = g_new0 (gchar*, 3 + 1);
00213        _tmp5_[0] = _tmp2_;
00214        _tmp5_[1] = _tmp3_;
00215        _tmp5_[2] = _tmp4_;
00216        faves = _tmp5_;
00217        faves_length1 = 3;
00218        _faves_size_ = faves_length1;
00219        g_settings_set_strv (settings, "favorites", faves);
00220        faves = (_vala_array_free (faves, faves_length1, (GDestroyNotify) g_free), NULL);
00221        _g_object_unref0 (settings);
00222 }
00223 
00224 
00225 static gpointer _g_object_ref0 (gpointer self) {
00226        return self ? g_object_ref (self) : NULL;
00227 }
00228 
00229 
00230 void main_test_has_unknown_apps (void) {
00231        UnityLauncherFavorites* _tmp0_ = NULL;
00232        UnityLauncherFavorites* _tmp1_;
00233        UnityLauncherFavorites* faves;
00234        gboolean _tmp2_ = FALSE;
00235        GDesktopAppInfo* _tmp3_;
00236        GDesktopAppInfo* appinfo;
00237        gboolean _tmp4_ = FALSE;
00238        main_set_up ();
00239        _tmp0_ = unity_launcher_favorites_get_default ();
00240        _tmp1_ = _g_object_ref0 (_tmp0_);
00241        faves = _tmp1_;
00242        _tmp2_ = unity_launcher_favorites_has_app_id (faves, "hulabaloola");
00243        _vala_assert (!_tmp2_, "!faves.has_app_id (\"hulabaloola\")");
00244        _tmp3_ = g_desktop_app_info_new ("asdasdasd.desktop");
00245        appinfo = _tmp3_;
00246        _vala_assert (appinfo != NULL, "appinfo != null");
00247        _tmp4_ = unity_launcher_favorites_has_app_info (faves, (GAppInfo*) appinfo);
00248        _vala_assert (!_tmp4_, "!faves.has_app_info (appinfo)");
00249        _g_object_unref0 (appinfo);
00250        _g_object_unref0 (faves);
00251 }
00252 
00253 
00254 void main_test_has_sample_apps (void) {
00255        UnityLauncherFavorites* _tmp0_ = NULL;
00256        UnityLauncherFavorites* _tmp1_;
00257        UnityLauncherFavorites* faves;
00258        gboolean _tmp2_ = FALSE;
00259        gboolean _tmp3_ = FALSE;
00260        gboolean _tmp4_ = FALSE;
00261        GDesktopAppInfo* _tmp5_;
00262        GDesktopAppInfo* appinfo;
00263        GDesktopAppInfo* _tmp6_;
00264        gboolean _tmp7_ = FALSE;
00265        GDesktopAppInfo* _tmp8_;
00266        GDesktopAppInfo* _tmp9_;
00267        gboolean _tmp10_ = FALSE;
00268        GDesktopAppInfo* _tmp11_;
00269        GDesktopAppInfo* _tmp12_;
00270        gboolean _tmp13_ = FALSE;
00271        main_set_up ();
00272        _tmp0_ = unity_launcher_favorites_get_default ();
00273        _tmp1_ = _g_object_ref0 (_tmp0_);
00274        faves = _tmp1_;
00275        _tmp2_ = unity_launcher_favorites_has_app_id (faves, "rhythmbox.desktop");
00276        _vala_assert (_tmp2_, "faves.has_app_id (\"rhythmbox.desktop\")");
00277        _tmp3_ = unity_launcher_favorites_has_app_id (faves, "testapp1.desktop");
00278        _vala_assert (_tmp3_, "faves.has_app_id (\"testapp1.desktop\")");
00279        _tmp4_ = unity_launcher_favorites_has_app_id (faves, "ubuntu-about.desktop");
00280        _vala_assert (_tmp4_, "faves.has_app_id (\"ubuntu-about.desktop\")");
00281        _tmp5_ = g_desktop_app_info_new ("rhythmbox.desktop");
00282        appinfo = _tmp5_;
00283        _tmp6_ = appinfo;
00284        _tmp7_ = unity_launcher_favorites_has_app_info (faves, (GAppInfo*) _tmp6_);
00285        _vala_assert (_tmp7_, "faves.has_app_info (appinfo)");
00286        _tmp8_ = g_desktop_app_info_new ("testapp1.desktop");
00287        _g_object_unref0 (appinfo);
00288        appinfo = _tmp8_;
00289        _tmp9_ = appinfo;
00290        _tmp10_ = unity_launcher_favorites_has_app_info (faves, (GAppInfo*) _tmp9_);
00291        _vala_assert (_tmp10_, "faves.has_app_info (appinfo)");
00292        _tmp11_ = g_desktop_app_info_new ("ubuntu-about.desktop");
00293        _g_object_unref0 (appinfo);
00294        appinfo = _tmp11_;
00295        _tmp12_ = appinfo;
00296        _tmp13_ = unity_launcher_favorites_has_app_info (faves, (GAppInfo*) _tmp12_);
00297        _vala_assert (_tmp13_, "faves.has_app_info (appinfo)");
00298        _g_object_unref0 (appinfo);
00299        _g_object_unref0 (faves);
00300 }
00301 
00302 
00303 void main_test_lookup (void) {
00304        UnityLauncherFavorites* _tmp0_ = NULL;
00305        UnityLauncherFavorites* _tmp1_;
00306        UnityLauncherFavorites* faves;
00307        GAppInfo* _tmp2_ = NULL;
00308        GAppInfo* appinfo;
00309        GAppInfo* _tmp3_;
00310        const gchar* _tmp4_ = NULL;
00311        GAppInfo* _tmp5_ = NULL;
00312        GAppInfo* _tmp6_;
00313        const gchar* _tmp7_ = NULL;
00314        GAppInfo* _tmp8_ = NULL;
00315        GAppInfo* _tmp9_;
00316        const gchar* _tmp10_ = NULL;
00317        GAppInfo* _tmp11_ = NULL;
00318        GAppInfo* _tmp12_;
00319        main_set_up ();
00320        _tmp0_ = unity_launcher_favorites_get_default ();
00321        _tmp1_ = _g_object_ref0 (_tmp0_);
00322        faves = _tmp1_;
00323        _tmp2_ = unity_launcher_favorites_lookup (faves, "rhythmbox.desktop");
00324        appinfo = _tmp2_;
00325        _tmp3_ = appinfo;
00326        _tmp4_ = g_app_info_get_name (_tmp3_);
00327        _vala_assert (g_strcmp0 (_tmp4_, "Rhythmbox") == 0, "appinfo.get_name () == \"Rhythmbox\"");
00328        _tmp5_ = unity_launcher_favorites_lookup (faves, "testapp1.desktop");
00329        _g_object_unref0 (appinfo);
00330        appinfo = _tmp5_;
00331        _tmp6_ = appinfo;
00332        _tmp7_ = g_app_info_get_name (_tmp6_);
00333        _vala_assert (g_strcmp0 (_tmp7_, "libunity test app 1") == 0, "appinfo.get_name () == \"libunity test app 1\"");
00334        _tmp8_ = unity_launcher_favorites_lookup (faves, "ubuntu-about.desktop");
00335        _g_object_unref0 (appinfo);
00336        appinfo = _tmp8_;
00337        _tmp9_ = appinfo;
00338        _tmp10_ = g_app_info_get_name (_tmp9_);
00339        _vala_assert (g_strcmp0 (_tmp10_, "About Ubuntu") == 0, "appinfo.get_name () == \"About Ubuntu\"");
00340        _tmp11_ = unity_launcher_favorites_lookup (faves, "pakupachupikamachu.desktop");
00341        _g_object_unref0 (appinfo);
00342        appinfo = _tmp11_;
00343        _tmp12_ = appinfo;
00344        _vala_assert (_tmp12_ == NULL, "appinfo == null");
00345        _g_object_unref0 (appinfo);
00346        _g_object_unref0 (faves);
00347 }
00348 
00349 
00350 void main_test_enumerate_ids (void) {
00351        UnityLauncherFavorites* _tmp0_ = NULL;
00352        UnityLauncherFavorites* _tmp1_;
00353        UnityLauncherFavorites* faves;
00354        gint _tmp2_ = 0;
00355        gchar** _tmp3_ = NULL;
00356        gchar** ids;
00357        gint ids_length1;
00358        gint _ids_size_;
00359        const gchar* _tmp4_;
00360        const gchar* _tmp5_;
00361        const gchar* _tmp6_;
00362        main_set_up ();
00363        _tmp0_ = unity_launcher_favorites_get_default ();
00364        _tmp1_ = _g_object_ref0 (_tmp0_);
00365        faves = _tmp1_;
00366        _tmp3_ = unity_launcher_favorites_enumerate_ids (faves, &_tmp2_);
00367        ids = _tmp3_;
00368        ids_length1 = _tmp2_;
00369        _ids_size_ = ids_length1;
00370        _vala_assert (ids_length1 == 3, "ids.length == 3");
00371        _tmp4_ = ids[0];
00372        _vala_assert (g_strcmp0 (_tmp4_, "rhythmbox.desktop") == 0, "ids[0] == \"rhythmbox.desktop\"");
00373        _tmp5_ = ids[1];
00374        _vala_assert (g_strcmp0 (_tmp5_, "testapp1.desktop") == 0, "ids[1] == \"testapp1.desktop\"");
00375        _tmp6_ = ids[2];
00376        _vala_assert (g_strcmp0 (_tmp6_, "ubuntu-about.desktop") == 0, "ids[2] == \"ubuntu-about.desktop\"");
00377        ids = (_vala_array_free (ids, ids_length1, (GDestroyNotify) g_free), NULL);
00378        _g_object_unref0 (faves);
00379 }
00380 
00381 
00382 void main_test_enumerate_app_infos (void) {
00383        UnityLauncherFavorites* _tmp0_ = NULL;
00384        UnityLauncherFavorites* _tmp1_;
00385        UnityLauncherFavorites* faves;
00386        gint _tmp2_ = 0;
00387        GAppInfo** _tmp3_ = NULL;
00388        GAppInfo** infos;
00389        gint infos_length1;
00390        gint _infos_size_;
00391        GAppInfo* _tmp4_;
00392        const gchar* _tmp5_ = NULL;
00393        GAppInfo* _tmp6_;
00394        const gchar* _tmp7_ = NULL;
00395        GAppInfo* _tmp8_;
00396        const gchar* _tmp9_ = NULL;
00397        main_set_up ();
00398        _tmp0_ = unity_launcher_favorites_get_default ();
00399        _tmp1_ = _g_object_ref0 (_tmp0_);
00400        faves = _tmp1_;
00401        _tmp3_ = unity_launcher_favorites_enumerate_app_infos (faves, &_tmp2_);
00402        infos = _tmp3_;
00403        infos_length1 = _tmp2_;
00404        _infos_size_ = infos_length1;
00405        _vala_assert (infos_length1 == 3, "infos.length == 3");
00406        _tmp4_ = infos[0];
00407        _tmp5_ = g_app_info_get_name (_tmp4_);
00408        _vala_assert (g_strcmp0 (_tmp5_, "Rhythmbox") == 0, "infos[0].get_name() == \"Rhythmbox\"");
00409        _tmp6_ = infos[1];
00410        _tmp7_ = g_app_info_get_name (_tmp6_);
00411        _vala_assert (g_strcmp0 (_tmp7_, "libunity test app 1") == 0, "infos[1].get_name() == \"libunity test app 1\"");
00412        _tmp8_ = infos[2];
00413        _tmp9_ = g_app_info_get_name (_tmp8_);
00414        _vala_assert (g_strcmp0 (_tmp9_, "About Ubuntu") == 0, "infos[2].get_name() == \"About Ubuntu\"");
00415        infos = (_vala_array_free (infos, infos_length1, (GDestroyNotify) g_object_unref), NULL);
00416        _g_object_unref0 (faves);
00417 }
00418 
00419 
00420 static Block1Data* block1_data_ref (Block1Data* _data1_) {
00421        g_atomic_int_inc (&_data1_->_ref_count_);
00422        return _data1_;
00423 }
00424 
00425 
00426 static void block1_data_unref (void * _userdata_) {
00427        Block1Data* _data1_;
00428        _data1_ = (Block1Data*) _userdata_;
00429        if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
00430               _g_main_loop_unref0 (_data1_->ml);
00431               g_slice_free (Block1Data, _data1_);
00432        }
00433 }
00434 
00435 
00436 static void __lambda2_ (Block1Data* _data1_) {
00437        _data1_->was_changed = TRUE;
00438 }
00439 
00440 
00441 static void ___lambda2__unity_launcher_favorites_changed (UnityLauncherFavorites* _sender, gpointer self) {
00442        __lambda2_ (self);
00443 }
00444 
00445 
00446 static gboolean __lambda3_ (Block1Data* _data1_) {
00447        gboolean result = FALSE;
00448        g_main_loop_quit (_data1_->ml);
00449        result = FALSE;
00450        return result;
00451 }
00452 
00453 
00454 static gboolean ___lambda3__gsource_func (gpointer self) {
00455        gboolean result;
00456        result = __lambda3_ (self);
00457        return result;
00458 }
00459 
00460 
00461 void main_test_changes (void) {
00462        Block1Data* _data1_;
00463        UnityLauncherFavorites* _tmp0_ = NULL;
00464        UnityLauncherFavorites* _tmp1_;
00465        UnityLauncherFavorites* faves;
00466        GSettings* _tmp2_;
00467        GSettings* settings;
00468        gchar* _tmp3_;
00469        gchar** _tmp4_ = NULL;
00470        gchar** new_faves;
00471        gint new_faves_length1;
00472        gint _new_faves_size_;
00473        GMainLoop* _tmp5_;
00474        gint _tmp6_ = 0;
00475        gchar** _tmp7_ = NULL;
00476        gchar** _tmp8_;
00477        gint _tmp8__length1;
00478        gint _tmp9_ = 0;
00479        gchar** _tmp10_ = NULL;
00480        gchar** _tmp11_;
00481        gint _tmp11__length1;
00482        const gchar* _tmp12_;
00483        _data1_ = g_slice_new0 (Block1Data);
00484        _data1_->_ref_count_ = 1;
00485        main_set_up ();
00486        _tmp0_ = unity_launcher_favorites_get_default ();
00487        _tmp1_ = _g_object_ref0 (_tmp0_);
00488        faves = _tmp1_;
00489        _data1_->was_changed = FALSE;
00490        g_signal_connect_data (faves, "changed", (GCallback) ___lambda2__unity_launcher_favorites_changed, block1_data_ref (_data1_), (GClosureNotify) block1_data_unref, 0);
00491        _tmp2_ = g_settings_new ("com.canonical.Unity.Launcher");
00492        settings = _tmp2_;
00493        _tmp3_ = g_strdup ("rhythmbox.desktop");
00494        _tmp4_ = g_new0 (gchar*, 1 + 1);
00495        _tmp4_[0] = _tmp3_;
00496        new_faves = _tmp4_;
00497        new_faves_length1 = 1;
00498        _new_faves_size_ = new_faves_length1;
00499        g_settings_set_strv (settings, "favorites", new_faves);
00500        _tmp5_ = g_main_loop_new (NULL, FALSE);
00501        _data1_->ml = _tmp5_;
00502        g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda3__gsource_func, block1_data_ref (_data1_), block1_data_unref);
00503        g_main_loop_run (_data1_->ml);
00504        _vala_assert (_data1_->was_changed == TRUE, "was_changed == true");
00505        _tmp7_ = unity_launcher_favorites_enumerate_ids (faves, &_tmp6_);
00506        _tmp8_ = _tmp7_;
00507        _tmp8__length1 = _tmp6_;
00508        _vala_assert (_tmp6_ == 1, "faves.enumerate_ids().length == 1");
00509        _tmp8_ = (_vala_array_free (_tmp8_, _tmp8__length1, (GDestroyNotify) g_free), NULL);
00510        _tmp10_ = unity_launcher_favorites_enumerate_ids (faves, &_tmp9_);
00511        _tmp11_ = _tmp10_;
00512        _tmp11__length1 = _tmp9_;
00513        _tmp12_ = _tmp11_[0];
00514        _vala_assert (g_strcmp0 (_tmp12_, "rhythmbox.desktop") == 0, "faves.enumerate_ids()[0] == \"rhythmbox.desktop\"");
00515        _tmp11_ = (_vala_array_free (_tmp11_, _tmp11__length1, (GDestroyNotify) g_free), NULL);
00516        new_faves = (_vala_array_free (new_faves, new_faves_length1, (GDestroyNotify) g_free), NULL);
00517        _g_object_unref0 (settings);
00518        _g_object_unref0 (faves);
00519        block1_data_unref (_data1_);
00520        _data1_ = NULL;
00521 }
00522 
00523 
00524 Main* main_construct (GType object_type) {
00525        Main* self = NULL;
00526        self = (Main*) g_type_create_instance (object_type);
00527        return self;
00528 }
00529 
00530 
00531 Main* main_new (void) {
00532        return main_construct (TYPE_MAIN);
00533 }
00534 
00535 
00536 static void value_main_init (GValue* value) {
00537        value->data[0].v_pointer = NULL;
00538 }
00539 
00540 
00541 static void value_main_free_value (GValue* value) {
00542        if (value->data[0].v_pointer) {
00543               main_unref (value->data[0].v_pointer);
00544        }
00545 }
00546 
00547 
00548 static void value_main_copy_value (const GValue* src_value, GValue* dest_value) {
00549        if (src_value->data[0].v_pointer) {
00550               dest_value->data[0].v_pointer = main_ref (src_value->data[0].v_pointer);
00551        } else {
00552               dest_value->data[0].v_pointer = NULL;
00553        }
00554 }
00555 
00556 
00557 static gpointer value_main_peek_pointer (const GValue* value) {
00558        return value->data[0].v_pointer;
00559 }
00560 
00561 
00562 static gchar* value_main_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
00563        if (collect_values[0].v_pointer) {
00564               Main* object;
00565               object = collect_values[0].v_pointer;
00566               if (object->parent_instance.g_class == NULL) {
00567                      return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
00568               } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
00569                      return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
00570               }
00571               value->data[0].v_pointer = main_ref (object);
00572        } else {
00573               value->data[0].v_pointer = NULL;
00574        }
00575        return NULL;
00576 }
00577 
00578 
00579 static gchar* value_main_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
00580        Main** object_p;
00581        object_p = collect_values[0].v_pointer;
00582        if (!object_p) {
00583               return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
00584        }
00585        if (!value->data[0].v_pointer) {
00586               *object_p = NULL;
00587        } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
00588               *object_p = value->data[0].v_pointer;
00589        } else {
00590               *object_p = main_ref (value->data[0].v_pointer);
00591        }
00592        return NULL;
00593 }
00594 
00595 
00596 GParamSpec* param_spec_main (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
00597        ParamSpecMain* spec;
00598        g_return_val_if_fail (g_type_is_a (object_type, TYPE_MAIN), NULL);
00599        spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
00600        G_PARAM_SPEC (spec)->value_type = object_type;
00601        return G_PARAM_SPEC (spec);
00602 }
00603 
00604 
00605 gpointer value_get_main (const GValue* value) {
00606        g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN), NULL);
00607        return value->data[0].v_pointer;
00608 }
00609 
00610 
00611 void value_set_main (GValue* value, gpointer v_object) {
00612        Main* old;
00613        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN));
00614        old = value->data[0].v_pointer;
00615        if (v_object) {
00616               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN));
00617               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
00618               value->data[0].v_pointer = v_object;
00619               main_ref (value->data[0].v_pointer);
00620        } else {
00621               value->data[0].v_pointer = NULL;
00622        }
00623        if (old) {
00624               main_unref (old);
00625        }
00626 }
00627 
00628 
00629 void value_take_main (GValue* value, gpointer v_object) {
00630        Main* old;
00631        g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_MAIN));
00632        old = value->data[0].v_pointer;
00633        if (v_object) {
00634               g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_MAIN));
00635               g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
00636               value->data[0].v_pointer = v_object;
00637        } else {
00638               value->data[0].v_pointer = NULL;
00639        }
00640        if (old) {
00641               main_unref (old);
00642        }
00643 }
00644 
00645 
00646 static void main_class_init (MainClass * klass) {
00647        main_parent_class = g_type_class_peek_parent (klass);
00648        MAIN_CLASS (klass)->finalize = main_finalize;
00649 }
00650 
00651 
00652 static void main_instance_init (Main * self) {
00653        self->ref_count = 1;
00654 }
00655 
00656 
00657 static void main_finalize (Main* obj) {
00658        Main * self;
00659        self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_MAIN, Main);
00660 }
00661 
00662 
00663 GType main_get_type (void) {
00664        static volatile gsize main_type_id__volatile = 0;
00665        if (g_once_init_enter (&main_type_id__volatile)) {
00666               static const GTypeValueTable g_define_type_value_table = { value_main_init, value_main_free_value, value_main_copy_value, value_main_peek_pointer, "p", value_main_collect_value, "p", value_main_lcopy_value };
00667               static const GTypeInfo g_define_type_info = { sizeof (MainClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) main_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (Main), 0, (GInstanceInitFunc) main_instance_init, &g_define_type_value_table };
00668               static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
00669               GType main_type_id;
00670               main_type_id = g_type_register_fundamental (g_type_fundamental_next (), "Main", &g_define_type_info, &g_define_type_fundamental_info, 0);
00671               g_once_init_leave (&main_type_id__volatile, main_type_id);
00672        }
00673        return main_type_id__volatile;
00674 }
00675 
00676 
00677 gpointer main_ref (gpointer instance) {
00678        Main* self;
00679        self = instance;
00680        g_atomic_int_inc (&self->ref_count);
00681        return instance;
00682 }
00683 
00684 
00685 void main_unref (gpointer instance) {
00686        Main* self;
00687        self = instance;
00688        if (g_atomic_int_dec_and_test (&self->ref_count)) {
00689               MAIN_GET_CLASS (self)->finalize (self);
00690               g_type_free_instance ((GTypeInstance *) self);
00691        }
00692 }
00693 
00694 
00695 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
00696        if ((array != NULL) && (destroy_func != NULL)) {
00697               int i;
00698               for (i = 0; i < array_length; i = i + 1) {
00699                      if (((gpointer*) array)[i] != NULL) {
00700                             destroy_func (((gpointer*) array)[i]);
00701                      }
00702               }
00703        }
00704 }
00705 
00706 
00707 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
00708        _vala_array_destroy (array, array_length, destroy_func);
00709        g_free (array);
00710 }
00711 
00712 
00713