Back to index

libunity  5.92.0
unity-scope-factory.c
Go to the documentation of this file.
00001 /* unity-scope-factory.c generated by valac 0.17.2, the Vala compiler
00002  * generated from unity-scope-factory.vala, do not modify */
00003 
00004 /*
00005  * Copyright (C) 2011 Canonical, Ltd.
00006  *
00007  * This library is free software; you can redistribute it and/or modify
00008  * it under the terms of the GNU Lesser General Public License
00009  * version 3.0 as published by the Free Software Foundation.
00010  *
00011  * This library 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 Lesser General Public License version 3.0 for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library. If not, see
00018  * <http://www.gnu.org/licenses/>.
00019  *
00020  * Authored by Neil Jagdish Patel <neil.patel@canonical.com>
00021  *
00022  */
00023 
00024 #include <glib.h>
00025 #include <glib-object.h>
00026 #include <gee.h>
00027 #include <gio/gio.h>
00028 #include <stdlib.h>
00029 #include <string.h>
00030 #include <unity-protocol.h>
00031 #include "unity.h"
00032 #include <dee.h>
00033 #include <unity-trace.h>
00034 #include <config.h>
00035 
00036 
00037 #define UNITY_TYPE_SCOPE_FACTORY (unity_scope_factory_get_type ())
00038 #define UNITY_SCOPE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactory))
00039 #define UNITY_SCOPE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactoryClass))
00040 #define UNITY_IS_SCOPE_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_SCOPE_FACTORY))
00041 #define UNITY_IS_SCOPE_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_SCOPE_FACTORY))
00042 #define UNITY_SCOPE_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactoryClass))
00043 
00044 typedef struct _UnityScopeFactory UnityScopeFactory;
00045 typedef struct _UnityScopeFactoryClass UnityScopeFactoryClass;
00046 typedef struct _UnityScopeFactoryPrivate UnityScopeFactoryPrivate;
00047 
00048 #define UNITY_TYPE_SCOPE_PROXY (unity_scope_proxy_get_type ())
00049 #define UNITY_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_SCOPE_PROXY, UnityScopeProxy))
00050 #define UNITY_IS_SCOPE_PROXY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_SCOPE_PROXY))
00051 #define UNITY_SCOPE_PROXY_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), UNITY_TYPE_SCOPE_PROXY, UnityScopeProxyIface))
00052 
00053 typedef struct _UnityScopeProxy UnityScopeProxy;
00054 typedef struct _UnityScopeProxyIface UnityScopeProxyIface;
00055 #define _g_free0(var) (var = (g_free (var), NULL))
00056 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00057 #define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
00058 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
00059 typedef struct _UnityScopeFactoryListLensDirectoryData UnityScopeFactoryListLensDirectoryData;
00060 
00061 #define UNITY_TYPE_SCOPE_PROXY_REMOTE (unity_scope_proxy_remote_get_type ())
00062 #define UNITY_SCOPE_PROXY_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_SCOPE_PROXY_REMOTE, UnityScopeProxyRemote))
00063 #define UNITY_SCOPE_PROXY_REMOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_SCOPE_PROXY_REMOTE, UnityScopeProxyRemoteClass))
00064 #define UNITY_IS_SCOPE_PROXY_REMOTE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_SCOPE_PROXY_REMOTE))
00065 #define UNITY_IS_SCOPE_PROXY_REMOTE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_SCOPE_PROXY_REMOTE))
00066 #define UNITY_SCOPE_PROXY_REMOTE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_SCOPE_PROXY_REMOTE, UnityScopeProxyRemoteClass))
00067 
00068 typedef struct _UnityScopeProxyRemote UnityScopeProxyRemote;
00069 typedef struct _UnityScopeProxyRemoteClass UnityScopeProxyRemoteClass;
00070 #define _g_key_file_free0(var) ((var == NULL) ? NULL : (var = (g_key_file_free (var), NULL)))
00071 
00072 #define UNITY_TYPE_SCOPE_PROXY_LOCAL (unity_scope_proxy_local_get_type ())
00073 #define UNITY_SCOPE_PROXY_LOCAL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), UNITY_TYPE_SCOPE_PROXY_LOCAL, UnityScopeProxyLocal))
00074 #define UNITY_SCOPE_PROXY_LOCAL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), UNITY_TYPE_SCOPE_PROXY_LOCAL, UnityScopeProxyLocalClass))
00075 #define UNITY_IS_SCOPE_PROXY_LOCAL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), UNITY_TYPE_SCOPE_PROXY_LOCAL))
00076 #define UNITY_IS_SCOPE_PROXY_LOCAL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), UNITY_TYPE_SCOPE_PROXY_LOCAL))
00077 #define UNITY_SCOPE_PROXY_LOCAL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), UNITY_TYPE_SCOPE_PROXY_LOCAL, UnityScopeProxyLocalClass))
00078 
00079 typedef struct _UnityScopeProxyLocal UnityScopeProxyLocal;
00080 typedef struct _UnityScopeProxyLocalClass UnityScopeProxyLocalClass;
00081 
00082 struct _UnityScopeProxyIface {
00083        GTypeInterface parent_iface;
00084        void (*activate) (UnityScopeProxy* self, const gchar* uri, UnityProtocolActionType action_type, GAsyncReadyCallback _callback_, gpointer _user_data_);
00085        void (*activate_finish) (UnityScopeProxy* self, GAsyncResult* _res_, UnityProtocolActivationReplyRaw* result);
00086        void (*update_preview_property) (UnityScopeProxy* self, const gchar* uri, GHashTable* values, GAsyncReadyCallback _callback_, gpointer _user_data_);
00087        GHashTable* (*update_preview_property_finish) (UnityScopeProxy* self, GAsyncResult* _res_, GError** error);
00088        void (*search) (UnityScopeProxy* self, const gchar* search_string, GHashTable* hints, GAsyncReadyCallback _callback_, gpointer _user_data_);
00089        GHashTable* (*search_finish) (UnityScopeProxy* self, GAsyncResult* _res_);
00090        void (*global_search) (UnityScopeProxy* self, const gchar* search_string, GHashTable* hints, GAsyncReadyCallback _callback_, gpointer _user_data_);
00091        GHashTable* (*global_search_finish) (UnityScopeProxy* self, GAsyncResult* _res_);
00092        void (*set_active_sources) (UnityScopeProxy* self, gchar** sources, int sources_length1, GAsyncReadyCallback _callback_, gpointer _user_data_);
00093        void (*set_active_sources_finish) (UnityScopeProxy* self, GAsyncResult* _res_);
00094        UnityOptionsFilter* (*get_sources) (UnityScopeProxy* self);
00095        void (*set_sources) (UnityScopeProxy* self, UnityOptionsFilter* value);
00096        gboolean (*get_search_in_global) (UnityScopeProxy* self);
00097        void (*set_search_in_global) (UnityScopeProxy* self, gboolean value);
00098        UnityProtocolViewType (*get_view_type) (UnityScopeProxy* self);
00099        void (*set_view_type) (UnityScopeProxy* self, UnityProtocolViewType value);
00100        DeeSerializableModel* (*get_results_model) (UnityScopeProxy* self);
00101        void (*set_results_model) (UnityScopeProxy* self, DeeSerializableModel* value);
00102        DeeSerializableModel* (*get_global_results_model) (UnityScopeProxy* self);
00103        void (*set_global_results_model) (UnityScopeProxy* self, DeeSerializableModel* value);
00104        DeeSerializableModel* (*get_filters_model) (UnityScopeProxy* self);
00105        void (*set_filters_model) (UnityScopeProxy* self, DeeSerializableModel* value);
00106 };
00107 
00108 struct _UnityScopeFactory {
00109        GObject parent_instance;
00110        UnityScopeFactoryPrivate * priv;
00111        GeeArrayList* scopes;
00112 };
00113 
00114 struct _UnityScopeFactoryClass {
00115        GObjectClass parent_class;
00116 };
00117 
00118 struct _UnityScopeFactoryPrivate {
00119        gchar* _lens_id;
00120        gchar* _lenses_directory;
00121 };
00122 
00123 struct _UnityScopeFactoryListLensDirectoryData {
00124        int _state_;
00125        GObject* _source_object_;
00126        GAsyncResult* _res_;
00127        GSimpleAsyncResult* _async_result;
00128        UnityScopeFactory* self;
00129        const gchar* _tmp0_;
00130        const gchar* _tmp1_;
00131        GFile* _tmp2_;
00132        GFile* dir;
00133        GFile* _tmp3_;
00134        GFileEnumerator* _tmp4_;
00135        GFileEnumerator* e;
00136        GFileEnumerator* _tmp5_;
00137        GList* _tmp6_;
00138        GList* files;
00139        GList* _tmp7_;
00140        GList* _tmp8_;
00141        GList* info_collection;
00142        GList* info_it;
00143        GFileInfo* _tmp9_;
00144        GFileInfo* info;
00145        GFileInfo* _tmp10_;
00146        const gchar* _tmp11_;
00147        gchar* _tmp12_;
00148        gchar* name;
00149        const gchar* _tmp13_;
00150        gboolean _tmp14_;
00151        const gchar* _tmp15_;
00152        GError* _error_;
00153        GError* _tmp16_;
00154        const gchar* _tmp17_;
00155        GError * _inner_error_;
00156 };
00157 
00158 
00159 static gpointer unity_scope_factory_parent_class = NULL;
00160 
00161 GType unity_scope_factory_get_type (void) G_GNUC_CONST;
00162 GType unity_scope_proxy_get_type (void) G_GNUC_CONST;
00163 #define UNITY_SCOPE_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactoryPrivate))
00164 enum  {
00165        UNITY_SCOPE_FACTORY_DUMMY_PROPERTY,
00166        UNITY_SCOPE_FACTORY_LENS_ID,
00167        UNITY_SCOPE_FACTORY_LENSES_DIRECTORY
00168 };
00169 UnityScopeFactory* unity_scope_factory_new (const gchar* lens_id_, const gchar* lenses_directory_);
00170 UnityScopeFactory* unity_scope_factory_construct (GType object_type, const gchar* lens_id_, const gchar* lenses_directory_);
00171 static void unity_scope_factory_list_lens_directory_data_free (gpointer _data);
00172 static void unity_scope_factory_list_lens_directory (UnityScopeFactory* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
00173 static void unity_scope_factory_list_lens_directory_finish (UnityScopeFactory* self, GAsyncResult* _res_);
00174 static gboolean unity_scope_factory_list_lens_directory_co (UnityScopeFactoryListLensDirectoryData* _data_);
00175 const gchar* unity_scope_factory_get_lenses_directory (UnityScopeFactory* self);
00176 static void unity_scope_factory_list_lens_directory_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
00177 static void _g_object_unref0_ (gpointer var);
00178 static void _g_list_free__g_object_unref0_ (GList* self);
00179 static void unity_scope_factory_load_scope_file (UnityScopeFactory* self, const gchar* name);
00180 UnityScopeProxyRemote* unity_scope_proxy_remote_new (const gchar* dbus_name_, const gchar* dbus_path_);
00181 UnityScopeProxyRemote* unity_scope_proxy_remote_construct (GType object_type, const gchar* dbus_name_, const gchar* dbus_path_);
00182 GType unity_scope_proxy_remote_get_type (void) G_GNUC_CONST;
00183 void unity_scope_factory_add_local_scope (UnityScopeFactory* self, UnityScope* scope);
00184 UnityScopeProxyLocal* unity_scope_proxy_local_new (UnityScope* scope);
00185 UnityScopeProxyLocal* unity_scope_proxy_local_construct (GType object_type, UnityScope* scope);
00186 GType unity_scope_proxy_local_get_type (void) G_GNUC_CONST;
00187 void unity_scope_set_local (UnityScope* self, gboolean is_local_);
00188 const gchar* unity_scope_factory_get_lens_id (UnityScopeFactory* self);
00189 static void unity_scope_factory_set_lens_id (UnityScopeFactory* self, const gchar* value);
00190 static void unity_scope_factory_set_lenses_directory (UnityScopeFactory* self, const gchar* value);
00191 static GObject * unity_scope_factory_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties);
00192 static void unity_scope_factory_finalize (GObject* obj);
00193 static void _vala_unity_scope_factory_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
00194 static void _vala_unity_scope_factory_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
00195 
00196 
00197 UnityScopeFactory* unity_scope_factory_construct (GType object_type, const gchar* lens_id_, const gchar* lenses_directory_) {
00198        UnityScopeFactory * self = NULL;
00199        const gchar* _tmp0_;
00200        const gchar* _tmp1_;
00201        g_return_val_if_fail (lens_id_ != NULL, NULL);
00202        g_return_val_if_fail (lenses_directory_ != NULL, NULL);
00203        _tmp0_ = lens_id_;
00204        _tmp1_ = lenses_directory_;
00205        self = (UnityScopeFactory*) g_object_new (object_type, "lens-id", _tmp0_, "lenses-directory", _tmp1_, NULL);
00206        return self;
00207 }
00208 
00209 
00210 UnityScopeFactory* unity_scope_factory_new (const gchar* lens_id_, const gchar* lenses_directory_) {
00211        return unity_scope_factory_construct (UNITY_TYPE_SCOPE_FACTORY, lens_id_, lenses_directory_);
00212 }
00213 
00214 
00215 static void unity_scope_factory_list_lens_directory_data_free (gpointer _data) {
00216        UnityScopeFactoryListLensDirectoryData* _data_;
00217        _data_ = _data;
00218        _g_object_unref0 (_data_->self);
00219        g_slice_free (UnityScopeFactoryListLensDirectoryData, _data_);
00220 }
00221 
00222 
00223 static gpointer _g_object_ref0 (gpointer self) {
00224        return self ? g_object_ref (self) : NULL;
00225 }
00226 
00227 
00228 static void unity_scope_factory_list_lens_directory (UnityScopeFactory* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
00229        UnityScopeFactoryListLensDirectoryData* _data_;
00230        UnityScopeFactory* _tmp0_;
00231        _data_ = g_slice_new0 (UnityScopeFactoryListLensDirectoryData);
00232        _data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, unity_scope_factory_list_lens_directory);
00233        g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, unity_scope_factory_list_lens_directory_data_free);
00234        _tmp0_ = _g_object_ref0 (self);
00235        _data_->self = _tmp0_;
00236        unity_scope_factory_list_lens_directory_co (_data_);
00237 }
00238 
00239 
00240 static void unity_scope_factory_list_lens_directory_finish (UnityScopeFactory* self, GAsyncResult* _res_) {
00241        UnityScopeFactoryListLensDirectoryData* _data_;
00242        _data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
00243 }
00244 
00245 
00246 static void unity_scope_factory_list_lens_directory_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
00247        UnityScopeFactoryListLensDirectoryData* _data_;
00248        _data_ = _user_data_;
00249        _data_->_source_object_ = source_object;
00250        _data_->_res_ = _res_;
00251        unity_scope_factory_list_lens_directory_co (_data_);
00252 }
00253 
00254 
00255 static void _g_object_unref0_ (gpointer var) {
00256        (var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
00257 }
00258 
00259 
00260 static void _g_list_free__g_object_unref0_ (GList* self) {
00261        g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
00262        g_list_free (self);
00263 }
00264 
00265 
00266 static gboolean unity_scope_factory_list_lens_directory_co (UnityScopeFactoryListLensDirectoryData* _data_) {
00267        switch (_data_->_state_) {
00268               case 0:
00269               goto _state_0;
00270               case 1:
00271               goto _state_1;
00272               case 2:
00273               goto _state_2;
00274               default:
00275               g_assert_not_reached ();
00276        }
00277        _state_0:
00278        _data_->_tmp0_ = _data_->self->priv->_lenses_directory;
00279        unity_trace_log_object ((GObject*) _data_->self, "Searching for Scopes in %s", _data_->_tmp0_);
00280        _data_->_tmp1_ = _data_->self->priv->_lenses_directory;
00281        _data_->_tmp2_ = NULL;
00282        _data_->_tmp2_ = g_file_new_for_path (_data_->_tmp1_);
00283        _data_->dir = _data_->_tmp2_;
00284        {
00285               _data_->_tmp3_ = _data_->dir;
00286               _data_->_state_ = 1;
00287               g_file_enumerate_children_async (_data_->_tmp3_, G_FILE_ATTRIBUTE_STANDARD_NAME, 0, G_PRIORITY_DEFAULT, NULL, unity_scope_factory_list_lens_directory_ready, _data_);
00288               return FALSE;
00289               _state_1:
00290               _data_->_tmp4_ = NULL;
00291               _data_->_tmp4_ = g_file_enumerate_children_finish (_data_->_tmp3_, _data_->_res_, &_data_->_inner_error_);
00292               _data_->e = _data_->_tmp4_;
00293               if (_data_->_inner_error_ != NULL) {
00294                      goto __catch21_g_error;
00295               }
00296               while (TRUE) {
00297                      _data_->_tmp5_ = _data_->e;
00298                      _data_->_state_ = 2;
00299                      g_file_enumerator_next_files_async (_data_->_tmp5_, 10, G_PRIORITY_DEFAULT, NULL, unity_scope_factory_list_lens_directory_ready, _data_);
00300                      return FALSE;
00301                      _state_2:
00302                      _data_->_tmp6_ = NULL;
00303                      _data_->_tmp6_ = g_file_enumerator_next_files_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error_);
00304                      _data_->files = _data_->_tmp6_;
00305                      if (_data_->_inner_error_ != NULL) {
00306                             _g_object_unref0 (_data_->e);
00307                             goto __catch21_g_error;
00308                      }
00309                      _data_->_tmp7_ = _data_->files;
00310                      if (_data_->_tmp7_ == NULL) {
00311                             __g_list_free__g_object_unref0_0 (_data_->files);
00312                             break;
00313                      }
00314                      _data_->_tmp8_ = _data_->files;
00315                      {
00316                             _data_->info_collection = _data_->_tmp8_;
00317                             for (_data_->info_it = _data_->info_collection; _data_->info_it != NULL; _data_->info_it = _data_->info_it->next) {
00318                                    _data_->_tmp9_ = _g_object_ref0 ((GFileInfo*) _data_->info_it->data);
00319                                    _data_->info = _data_->_tmp9_;
00320                                    {
00321                                           _data_->_tmp10_ = _data_->info;
00322                                           _data_->_tmp11_ = NULL;
00323                                           _data_->_tmp11_ = g_file_info_get_name (_data_->_tmp10_);
00324                                           _data_->_tmp12_ = g_strdup (_data_->_tmp11_);
00325                                           _data_->name = _data_->_tmp12_;
00326                                           _data_->_tmp13_ = _data_->name;
00327                                           _data_->_tmp14_ = FALSE;
00328                                           _data_->_tmp14_ = g_str_has_suffix (_data_->_tmp13_, ".scope");
00329                                           if (_data_->_tmp14_) {
00330                                                  _data_->_tmp15_ = _data_->name;
00331                                                  unity_scope_factory_load_scope_file (_data_->self, _data_->_tmp15_);
00332                                           }
00333                                           _g_free0 (_data_->name);
00334                                           _g_object_unref0 (_data_->info);
00335                                    }
00336                             }
00337                      }
00338                      __g_list_free__g_object_unref0_0 (_data_->files);
00339               }
00340               _g_object_unref0 (_data_->e);
00341        }
00342        goto __finally21;
00343        __catch21_g_error:
00344        {
00345               _data_->_error_ = _data_->_inner_error_;
00346               _data_->_inner_error_ = NULL;
00347               _data_->_tmp16_ = _data_->_error_;
00348               _data_->_tmp17_ = _data_->_tmp16_->message;
00349               g_warning ("unity-scope-factory.vala:78: Unable to search for scopes: %s", _data_->_tmp17_);
00350               _g_error_free0 (_data_->_error_);
00351        }
00352        __finally21:
00353        if (_data_->_inner_error_ != NULL) {
00354               _g_object_unref0 (_data_->dir);
00355               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
00356               g_clear_error (&_data_->_inner_error_);
00357               return FALSE;
00358        }
00359        _g_object_unref0 (_data_->dir);
00360        if (_data_->_state_ == 0) {
00361               g_simple_async_result_complete_in_idle (_data_->_async_result);
00362        } else {
00363               g_simple_async_result_complete (_data_->_async_result);
00364        }
00365        g_object_unref (_data_->_async_result);
00366        return FALSE;
00367 }
00368 
00369 
00370 static void unity_scope_factory_load_scope_file (UnityScopeFactory* self, const gchar* name) {
00371        static const char GROUP[] = "Scope";
00372        static const char DBUS_NAME[] = "DBusName";
00373        static const char DBUS_PATH[] = "DBusPath";
00374        const gchar* _tmp0_;
00375        const gchar* _tmp1_;
00376        gchar* _tmp2_ = NULL;
00377        gchar* path;
00378        GKeyFile* _tmp3_;
00379        GKeyFile* key_file;
00380        GError * _inner_error_ = NULL;
00381        g_return_if_fail (self != NULL);
00382        g_return_if_fail (name != NULL);
00383        _tmp0_ = self->priv->_lenses_directory;
00384        _tmp1_ = name;
00385        _tmp2_ = g_build_filename (_tmp0_, _tmp1_, NULL);
00386        path = _tmp2_;
00387        _tmp3_ = g_key_file_new ();
00388        key_file = _tmp3_;
00389        {
00390               GKeyFile* _tmp4_;
00391               const gchar* _tmp5_;
00392               GKeyFile* _tmp6_;
00393               gboolean _tmp7_ = FALSE;
00394               _tmp4_ = key_file;
00395               _tmp5_ = path;
00396               g_key_file_load_from_file (_tmp4_, _tmp5_, G_KEY_FILE_NONE, &_inner_error_);
00397               if (_inner_error_ != NULL) {
00398                      goto __catch22_g_error;
00399               }
00400               _tmp6_ = key_file;
00401               _tmp7_ = g_key_file_has_group (_tmp6_, "Scope");
00402               if (_tmp7_) {
00403                      GKeyFile* _tmp8_;
00404                      gchar* _tmp9_ = NULL;
00405                      gchar* dbus_name;
00406                      GKeyFile* _tmp10_;
00407                      gchar* _tmp11_ = NULL;
00408                      gchar* dbus_path;
00409                      const gchar* _tmp12_;
00410                      const gchar* _tmp13_;
00411                      UnityScopeProxyRemote* _tmp14_;
00412                      UnityScopeProxyRemote* scope;
00413                      GeeArrayList* _tmp15_;
00414                      UnityScopeProxyRemote* _tmp16_;
00415                      UnityScopeProxyRemote* _tmp17_;
00416                      const gchar* _tmp18_;
00417                      const gchar* _tmp19_;
00418                      const gchar* _tmp20_;
00419                      _tmp8_ = key_file;
00420                      _tmp9_ = g_key_file_get_string (_tmp8_, GROUP, DBUS_NAME, &_inner_error_);
00421                      dbus_name = _tmp9_;
00422                      if (_inner_error_ != NULL) {
00423                             goto __catch22_g_error;
00424                      }
00425                      _tmp10_ = key_file;
00426                      _tmp11_ = g_key_file_get_string (_tmp10_, GROUP, DBUS_PATH, &_inner_error_);
00427                      dbus_path = _tmp11_;
00428                      if (_inner_error_ != NULL) {
00429                             _g_free0 (dbus_name);
00430                             goto __catch22_g_error;
00431                      }
00432                      _tmp12_ = dbus_name;
00433                      _tmp13_ = dbus_path;
00434                      _tmp14_ = unity_scope_proxy_remote_new (_tmp12_, _tmp13_);
00435                      scope = _tmp14_;
00436                      _tmp15_ = self->scopes;
00437                      _tmp16_ = scope;
00438                      gee_abstract_collection_add ((GeeAbstractCollection*) _tmp15_, (UnityScopeProxy*) _tmp16_);
00439                      _tmp17_ = scope;
00440                      g_signal_emit_by_name (self, "scope-added", (UnityScopeProxy*) _tmp17_);
00441                      _tmp18_ = path;
00442                      _tmp19_ = dbus_path;
00443                      _tmp20_ = dbus_name;
00444                      unity_trace_log_object ((GObject*) self, "Successfully loaded %s: %s@%s", _tmp18_, _tmp19_, _tmp20_);
00445                      _g_object_unref0 (scope);
00446                      _g_free0 (dbus_path);
00447                      _g_free0 (dbus_name);
00448               } else {
00449                      const gchar* _tmp21_;
00450                      _tmp21_ = path;
00451                      g_warning ("unity-scope-factory.vala:107: Unable to load %s: Does not contain 'Sco" \
00452 "pe' group", _tmp21_);
00453               }
00454        }
00455        goto __finally22;
00456        __catch22_g_error:
00457        {
00458               GError* e = NULL;
00459               const gchar* _tmp22_;
00460               GError* _tmp23_;
00461               const gchar* _tmp24_;
00462               e = _inner_error_;
00463               _inner_error_ = NULL;
00464               _tmp22_ = path;
00465               _tmp23_ = e;
00466               _tmp24_ = _tmp23_->message;
00467               g_warning ("unity-scope-factory.vala:110: Unable to load %s: %s", _tmp22_, _tmp24_);
00468               _g_error_free0 (e);
00469        }
00470        __finally22:
00471        if (_inner_error_ != NULL) {
00472               _g_key_file_free0 (key_file);
00473               _g_free0 (path);
00474               g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
00475               g_clear_error (&_inner_error_);
00476               return;
00477        }
00478        _g_key_file_free0 (key_file);
00479        _g_free0 (path);
00480 }
00481 
00482 
00483 void unity_scope_factory_add_local_scope (UnityScopeFactory* self, UnityScope* scope) {
00484        UnityScope* _tmp0_;
00485        UnityScopeProxyLocal* _tmp1_;
00486        UnityScopeProxyLocal* proxy;
00487        UnityScope* _tmp2_;
00488        GeeArrayList* _tmp3_;
00489        g_return_if_fail (self != NULL);
00490        g_return_if_fail (scope != NULL);
00491        _tmp0_ = scope;
00492        _tmp1_ = unity_scope_proxy_local_new (_tmp0_);
00493        proxy = _tmp1_;
00494        _tmp2_ = scope;
00495        unity_scope_set_local (_tmp2_, TRUE);
00496        _tmp3_ = self->scopes;
00497        gee_abstract_collection_add ((GeeAbstractCollection*) _tmp3_, (UnityScopeProxy*) proxy);
00498        g_signal_emit_by_name (self, "scope-added", (UnityScopeProxy*) proxy);
00499        _g_object_unref0 (proxy);
00500 }
00501 
00502 
00503 const gchar* unity_scope_factory_get_lens_id (UnityScopeFactory* self) {
00504        const gchar* result;
00505        const gchar* _tmp0_;
00506        g_return_val_if_fail (self != NULL, NULL);
00507        _tmp0_ = self->priv->_lens_id;
00508        result = _tmp0_;
00509        return result;
00510 }
00511 
00512 
00513 static void unity_scope_factory_set_lens_id (UnityScopeFactory* self, const gchar* value) {
00514        const gchar* _tmp0_;
00515        gchar* _tmp1_;
00516        g_return_if_fail (self != NULL);
00517        _tmp0_ = value;
00518        _tmp1_ = g_strdup (_tmp0_);
00519        _g_free0 (self->priv->_lens_id);
00520        self->priv->_lens_id = _tmp1_;
00521        g_object_notify ((GObject *) self, "lens-id");
00522 }
00523 
00524 
00525 const gchar* unity_scope_factory_get_lenses_directory (UnityScopeFactory* self) {
00526        const gchar* result;
00527        const gchar* _tmp0_;
00528        g_return_val_if_fail (self != NULL, NULL);
00529        _tmp0_ = self->priv->_lenses_directory;
00530        result = _tmp0_;
00531        return result;
00532 }
00533 
00534 
00535 static void unity_scope_factory_set_lenses_directory (UnityScopeFactory* self, const gchar* value) {
00536        const gchar* _tmp0_;
00537        gchar* _tmp1_;
00538        g_return_if_fail (self != NULL);
00539        _tmp0_ = value;
00540        _tmp1_ = g_strdup (_tmp0_);
00541        _g_free0 (self->priv->_lenses_directory);
00542        self->priv->_lenses_directory = _tmp1_;
00543        g_object_notify ((GObject *) self, "lenses-directory");
00544 }
00545 
00546 
00547 static GObject * unity_scope_factory_constructor (GType type, guint n_construct_properties, GObjectConstructParam * construct_properties) {
00548        GObject * obj;
00549        GObjectClass * parent_class;
00550        UnityScopeFactory * self;
00551        const gchar* _tmp0_;
00552        GeeArrayList* _tmp4_;
00553        parent_class = G_OBJECT_CLASS (unity_scope_factory_parent_class);
00554        obj = parent_class->constructor (type, n_construct_properties, construct_properties);
00555        self = G_TYPE_CHECK_INSTANCE_CAST (obj, UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactory);
00556        _tmp0_ = self->priv->_lenses_directory;
00557        if (g_strcmp0 (_tmp0_, "") == 0) {
00558               const gchar* _tmp1_;
00559               gchar* _tmp2_ = NULL;
00560               gchar* _tmp3_;
00561               _tmp1_ = self->priv->_lens_id;
00562               _tmp2_ = g_strdup_printf ("%s/unity/lenses/%s", DATADIR, _tmp1_);
00563               _tmp3_ = _tmp2_;
00564               unity_scope_factory_set_lenses_directory (self, _tmp3_);
00565               _g_free0 (_tmp3_);
00566        }
00567        _tmp4_ = gee_array_list_new (UNITY_TYPE_SCOPE_PROXY, (GBoxedCopyFunc) g_object_ref, g_object_unref, NULL);
00568        _g_object_unref0 (self->scopes);
00569        self->scopes = _tmp4_;
00570        unity_scope_factory_list_lens_directory (self, NULL, NULL);
00571        return obj;
00572 }
00573 
00574 
00575 static void unity_scope_factory_class_init (UnityScopeFactoryClass * klass) {
00576        unity_scope_factory_parent_class = g_type_class_peek_parent (klass);
00577        g_type_class_add_private (klass, sizeof (UnityScopeFactoryPrivate));
00578        G_OBJECT_CLASS (klass)->get_property = _vala_unity_scope_factory_get_property;
00579        G_OBJECT_CLASS (klass)->set_property = _vala_unity_scope_factory_set_property;
00580        G_OBJECT_CLASS (klass)->constructor = unity_scope_factory_constructor;
00581        G_OBJECT_CLASS (klass)->finalize = unity_scope_factory_finalize;
00582        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_SCOPE_FACTORY_LENS_ID, g_param_spec_string ("lens-id", "lens-id", "lens-id", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
00583        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_SCOPE_FACTORY_LENSES_DIRECTORY, g_param_spec_string ("lenses-directory", "lenses-directory", "lenses-directory", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
00584        g_signal_new ("scope_added", UNITY_TYPE_SCOPE_FACTORY, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__OBJECT, G_TYPE_NONE, 1, UNITY_TYPE_SCOPE_PROXY);
00585 }
00586 
00587 
00588 static void unity_scope_factory_instance_init (UnityScopeFactory * self) {
00589        self->priv = UNITY_SCOPE_FACTORY_GET_PRIVATE (self);
00590 }
00591 
00592 
00593 static void unity_scope_factory_finalize (GObject* obj) {
00594        UnityScopeFactory * self;
00595        self = G_TYPE_CHECK_INSTANCE_CAST (obj, UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactory);
00596        _g_free0 (self->priv->_lens_id);
00597        _g_free0 (self->priv->_lenses_directory);
00598        _g_object_unref0 (self->scopes);
00599        G_OBJECT_CLASS (unity_scope_factory_parent_class)->finalize (obj);
00600 }
00601 
00602 
00603 GType unity_scope_factory_get_type (void) {
00604        static volatile gsize unity_scope_factory_type_id__volatile = 0;
00605        if (g_once_init_enter (&unity_scope_factory_type_id__volatile)) {
00606               static const GTypeInfo g_define_type_info = { sizeof (UnityScopeFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_scope_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityScopeFactory), 0, (GInstanceInitFunc) unity_scope_factory_instance_init, NULL };
00607               GType unity_scope_factory_type_id;
00608               unity_scope_factory_type_id = g_type_register_static (G_TYPE_OBJECT, "UnityScopeFactory", &g_define_type_info, 0);
00609               g_once_init_leave (&unity_scope_factory_type_id__volatile, unity_scope_factory_type_id);
00610        }
00611        return unity_scope_factory_type_id__volatile;
00612 }
00613 
00614 
00615 static void _vala_unity_scope_factory_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
00616        UnityScopeFactory * self;
00617        self = G_TYPE_CHECK_INSTANCE_CAST (object, UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactory);
00618        switch (property_id) {
00619               case UNITY_SCOPE_FACTORY_LENS_ID:
00620               g_value_set_string (value, unity_scope_factory_get_lens_id (self));
00621               break;
00622               case UNITY_SCOPE_FACTORY_LENSES_DIRECTORY:
00623               g_value_set_string (value, unity_scope_factory_get_lenses_directory (self));
00624               break;
00625               default:
00626               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
00627               break;
00628        }
00629 }
00630 
00631 
00632 static void _vala_unity_scope_factory_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
00633        UnityScopeFactory * self;
00634        self = G_TYPE_CHECK_INSTANCE_CAST (object, UNITY_TYPE_SCOPE_FACTORY, UnityScopeFactory);
00635        switch (property_id) {
00636               case UNITY_SCOPE_FACTORY_LENS_ID:
00637               unity_scope_factory_set_lens_id (self, g_value_get_string (value));
00638               break;
00639               case UNITY_SCOPE_FACTORY_LENSES_DIRECTORY:
00640               unity_scope_factory_set_lenses_directory (self, g_value_get_string (value));
00641               break;
00642               default:
00643               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
00644               break;
00645        }
00646 }
00647 
00648 
00649