Back to index

libunity  5.92.0
unity-lens-activation.c
Go to the documentation of this file.
00001 /* unity-lens-activation.c generated by valac 0.17.2, the Vala compiler
00002  * generated from unity-lens-activation.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 "unity.h"
00027 #include <stdlib.h>
00028 #include <string.h>
00029 #include <dee.h>
00030 
00031 #define _g_free0(var) (var = (g_free (var), NULL))
00032 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
00033 #define _g_hash_table_unref0(var) ((var == NULL) ? NULL : (var = (g_hash_table_unref (var), NULL)))
00034 
00035 struct _UnityActivationResponsePrivate {
00036        UnityHandledType _handled;
00037        gchar* _goto_uri;
00038        UnityPreview* _preview;
00039 };
00040 
00041 
00042 static gpointer unity_activation_response_parent_class = NULL;
00043 
00044 #define UNITY_ACTIVATION_RESPONSE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), UNITY_TYPE_ACTIVATION_RESPONSE, UnityActivationResponsePrivate))
00045 enum  {
00046        UNITY_ACTIVATION_RESPONSE_DUMMY_PROPERTY,
00047        UNITY_ACTIVATION_RESPONSE_HANDLED,
00048        UNITY_ACTIVATION_RESPONSE_GOTO_URI
00049 };
00050 void unity_activation_response_set_preview (UnityActivationResponse* self, UnityPreview* preview);
00051 GHashTable* unity_activation_response_get_hints (UnityActivationResponse* self);
00052 static void _g_free0_ (gpointer var);
00053 static void _g_variant_unref0_ (gpointer var);
00054 static GVariant* _variant_new15 (const gchar* value);
00055 UnityPreview* unity_activation_response_get_preview (UnityActivationResponse* self);
00056 static void unity_activation_response_finalize (GObject* obj);
00057 static void _vala_unity_activation_response_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
00058 static void _vala_unity_activation_response_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);
00059 
00060 
00061 GType unity_handled_type_get_type (void) {
00062        static volatile gsize unity_handled_type_type_id__volatile = 0;
00063        if (g_once_init_enter (&unity_handled_type_type_id__volatile)) {
00064               static const GEnumValue values[] = {{UNITY_HANDLED_TYPE_NOT_HANDLED, "UNITY_HANDLED_TYPE_NOT_HANDLED", "not-handled"}, {UNITY_HANDLED_TYPE_SHOW_DASH, "UNITY_HANDLED_TYPE_SHOW_DASH", "show-dash"}, {UNITY_HANDLED_TYPE_HIDE_DASH, "UNITY_HANDLED_TYPE_HIDE_DASH", "hide-dash"}, {UNITY_HANDLED_TYPE_GOTO_DASH_URI, "UNITY_HANDLED_TYPE_GOTO_DASH_URI", "goto-dash-uri"}, {UNITY_HANDLED_TYPE_SHOW_PREVIEW, "UNITY_HANDLED_TYPE_SHOW_PREVIEW", "show-preview"}, {0, NULL, NULL}};
00065               GType unity_handled_type_type_id;
00066               unity_handled_type_type_id = g_enum_register_static ("UnityHandledType", values);
00067               g_once_init_leave (&unity_handled_type_type_id__volatile, unity_handled_type_type_id);
00068        }
00069        return unity_handled_type_type_id__volatile;
00070 }
00071 
00072 
00073 UnityActivationResponse* unity_activation_response_construct (GType object_type, UnityHandledType handled, const gchar* goto_uri) {
00074        UnityActivationResponse * self = NULL;
00075        UnityHandledType _tmp0_;
00076        const gchar* _tmp1_;
00077        g_return_val_if_fail (goto_uri != NULL, NULL);
00078        _tmp0_ = handled;
00079        _tmp1_ = goto_uri;
00080        self = (UnityActivationResponse*) g_object_new (object_type, "handled", _tmp0_, "goto-uri", _tmp1_, NULL);
00081        return self;
00082 }
00083 
00084 
00085 UnityActivationResponse* unity_activation_response_new (UnityHandledType handled, const gchar* goto_uri) {
00086        return unity_activation_response_construct (UNITY_TYPE_ACTIVATION_RESPONSE, handled, goto_uri);
00087 }
00088 
00089 
00090 UnityActivationResponse* unity_activation_response_construct_with_preview (GType object_type, UnityPreview* preview) {
00091        UnityActivationResponse * self = NULL;
00092        UnityPreview* _tmp0_;
00093        g_return_val_if_fail (preview != NULL, NULL);
00094        self = (UnityActivationResponse*) g_object_new (object_type, "handled", UNITY_HANDLED_TYPE_SHOW_PREVIEW, NULL);
00095        _tmp0_ = preview;
00096        unity_activation_response_set_preview (self, _tmp0_);
00097        return self;
00098 }
00099 
00100 
00101 UnityActivationResponse* unity_activation_response_new_with_preview (UnityPreview* preview) {
00102        return unity_activation_response_construct_with_preview (UNITY_TYPE_ACTIVATION_RESPONSE, preview);
00103 }
00104 
00105 
00106 static void _g_free0_ (gpointer var) {
00107        var = (g_free (var), NULL);
00108 }
00109 
00110 
00111 static void _g_variant_unref0_ (gpointer var) {
00112        (var == NULL) ? NULL : (var = (g_variant_unref (var), NULL));
00113 }
00114 
00115 
00116 static GVariant* _variant_new15 (const gchar* value) {
00117        return g_variant_ref_sink (g_variant_new_string (value));
00118 }
00119 
00120 
00121 GHashTable* unity_activation_response_get_hints (UnityActivationResponse* self) {
00122        GHashTable* result = NULL;
00123        GHashTable* _tmp0_;
00124        GHashTable* hash;
00125        gboolean _tmp1_ = FALSE;
00126        const gchar* _tmp2_;
00127        gboolean _tmp4_;
00128        UnityPreview* _tmp9_;
00129        g_return_val_if_fail (self != NULL, NULL);
00130        _tmp0_ = g_hash_table_new_full (NULL, NULL, _g_free0_, _g_variant_unref0_);
00131        hash = _tmp0_;
00132        _tmp2_ = self->priv->_goto_uri;
00133        if (_tmp2_ != NULL) {
00134               const gchar* _tmp3_;
00135               _tmp3_ = self->priv->_goto_uri;
00136               _tmp1_ = g_strcmp0 (_tmp3_, "") != 0;
00137        } else {
00138               _tmp1_ = FALSE;
00139        }
00140        _tmp4_ = _tmp1_;
00141        if (_tmp4_) {
00142               GHashTable* _tmp5_;
00143               gchar* _tmp6_;
00144               const gchar* _tmp7_;
00145               GVariant* _tmp8_;
00146               _tmp5_ = hash;
00147               _tmp6_ = g_strdup ("goto-uri");
00148               _tmp7_ = self->priv->_goto_uri;
00149               _tmp8_ = _variant_new15 (_tmp7_);
00150               g_hash_table_insert (_tmp5_, _tmp6_, _tmp8_);
00151        }
00152        _tmp9_ = self->priv->_preview;
00153        if (_tmp9_ != NULL) {
00154               GHashTable* _tmp10_;
00155               gchar* _tmp11_;
00156               UnityPreview* _tmp12_;
00157               GVariant* _tmp13_ = NULL;
00158               _tmp10_ = hash;
00159               _tmp11_ = g_strdup ("preview");
00160               _tmp12_ = self->priv->_preview;
00161               _tmp13_ = dee_serializable_serialize ((DeeSerializable*) _tmp12_);
00162               g_hash_table_insert (_tmp10_, _tmp11_, _tmp13_);
00163        }
00164        result = hash;
00165        return result;
00166 }
00167 
00168 
00169 static gpointer _g_object_ref0 (gpointer self) {
00170        return self ? g_object_ref (self) : NULL;
00171 }
00172 
00173 
00174 void unity_activation_response_set_preview (UnityActivationResponse* self, UnityPreview* preview) {
00175        UnityPreview* _tmp0_;
00176        UnityPreview* _tmp1_;
00177        g_return_if_fail (self != NULL);
00178        g_return_if_fail (preview != NULL);
00179        _tmp0_ = preview;
00180        _tmp1_ = _g_object_ref0 (_tmp0_);
00181        _g_object_unref0 (self->priv->_preview);
00182        self->priv->_preview = _tmp1_;
00183 }
00184 
00185 
00186 UnityPreview* unity_activation_response_get_preview (UnityActivationResponse* self) {
00187        UnityPreview* result = NULL;
00188        UnityPreview* _tmp0_;
00189        g_return_val_if_fail (self != NULL, NULL);
00190        _tmp0_ = self->priv->_preview;
00191        result = _tmp0_;
00192        return result;
00193 }
00194 
00195 
00196 UnityHandledType unity_activation_response_get_handled (UnityActivationResponse* self) {
00197        UnityHandledType result;
00198        UnityHandledType _tmp0_;
00199        g_return_val_if_fail (self != NULL, 0);
00200        _tmp0_ = self->priv->_handled;
00201        result = _tmp0_;
00202        return result;
00203 }
00204 
00205 
00206 static void unity_activation_response_set_handled (UnityActivationResponse* self, UnityHandledType value) {
00207        UnityHandledType _tmp0_;
00208        g_return_if_fail (self != NULL);
00209        _tmp0_ = value;
00210        self->priv->_handled = _tmp0_;
00211        g_object_notify ((GObject *) self, "handled");
00212 }
00213 
00214 
00215 const gchar* unity_activation_response_get_goto_uri (UnityActivationResponse* self) {
00216        const gchar* result;
00217        const gchar* _tmp0_;
00218        g_return_val_if_fail (self != NULL, NULL);
00219        _tmp0_ = self->priv->_goto_uri;
00220        result = _tmp0_;
00221        return result;
00222 }
00223 
00224 
00225 void unity_activation_response_set_goto_uri (UnityActivationResponse* self, const gchar* value) {
00226        const gchar* _tmp0_;
00227        gchar* _tmp1_;
00228        g_return_if_fail (self != NULL);
00229        _tmp0_ = value;
00230        _tmp1_ = g_strdup (_tmp0_);
00231        _g_free0 (self->priv->_goto_uri);
00232        self->priv->_goto_uri = _tmp1_;
00233        g_object_notify ((GObject *) self, "goto-uri");
00234 }
00235 
00236 
00237 static void unity_activation_response_class_init (UnityActivationResponseClass * klass) {
00238        unity_activation_response_parent_class = g_type_class_peek_parent (klass);
00239        g_type_class_add_private (klass, sizeof (UnityActivationResponsePrivate));
00240        G_OBJECT_CLASS (klass)->get_property = _vala_unity_activation_response_get_property;
00241        G_OBJECT_CLASS (klass)->set_property = _vala_unity_activation_response_set_property;
00242        G_OBJECT_CLASS (klass)->finalize = unity_activation_response_finalize;
00243        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_ACTIVATION_RESPONSE_HANDLED, g_param_spec_enum ("handled", "handled", "handled", UNITY_TYPE_HANDLED_TYPE, 0, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
00244        g_object_class_install_property (G_OBJECT_CLASS (klass), UNITY_ACTIVATION_RESPONSE_GOTO_URI, g_param_spec_string ("goto-uri", "goto-uri", "goto-uri", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
00245 }
00246 
00247 
00248 static void unity_activation_response_instance_init (UnityActivationResponse * self) {
00249        self->priv = UNITY_ACTIVATION_RESPONSE_GET_PRIVATE (self);
00250 }
00251 
00252 
00253 static void unity_activation_response_finalize (GObject* obj) {
00254        UnityActivationResponse * self;
00255        self = G_TYPE_CHECK_INSTANCE_CAST (obj, UNITY_TYPE_ACTIVATION_RESPONSE, UnityActivationResponse);
00256        _g_free0 (self->priv->_goto_uri);
00257        _g_object_unref0 (self->priv->_preview);
00258        G_OBJECT_CLASS (unity_activation_response_parent_class)->finalize (obj);
00259 }
00260 
00261 
00262 GType unity_activation_response_get_type (void) {
00263        static volatile gsize unity_activation_response_type_id__volatile = 0;
00264        if (g_once_init_enter (&unity_activation_response_type_id__volatile)) {
00265               static const GTypeInfo g_define_type_info = { sizeof (UnityActivationResponseClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) unity_activation_response_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UnityActivationResponse), 0, (GInstanceInitFunc) unity_activation_response_instance_init, NULL };
00266               GType unity_activation_response_type_id;
00267               unity_activation_response_type_id = g_type_register_static (G_TYPE_INITIALLY_UNOWNED, "UnityActivationResponse", &g_define_type_info, 0);
00268               g_once_init_leave (&unity_activation_response_type_id__volatile, unity_activation_response_type_id);
00269        }
00270        return unity_activation_response_type_id__volatile;
00271 }
00272 
00273 
00274 static void _vala_unity_activation_response_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
00275        UnityActivationResponse * self;
00276        self = G_TYPE_CHECK_INSTANCE_CAST (object, UNITY_TYPE_ACTIVATION_RESPONSE, UnityActivationResponse);
00277        switch (property_id) {
00278               case UNITY_ACTIVATION_RESPONSE_HANDLED:
00279               g_value_set_enum (value, unity_activation_response_get_handled (self));
00280               break;
00281               case UNITY_ACTIVATION_RESPONSE_GOTO_URI:
00282               g_value_set_string (value, unity_activation_response_get_goto_uri (self));
00283               break;
00284               default:
00285               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
00286               break;
00287        }
00288 }
00289 
00290 
00291 static void _vala_unity_activation_response_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
00292        UnityActivationResponse * self;
00293        self = G_TYPE_CHECK_INSTANCE_CAST (object, UNITY_TYPE_ACTIVATION_RESPONSE, UnityActivationResponse);
00294        switch (property_id) {
00295               case UNITY_ACTIVATION_RESPONSE_HANDLED:
00296               unity_activation_response_set_handled (self, g_value_get_enum (value));
00297               break;
00298               case UNITY_ACTIVATION_RESPONSE_GOTO_URI:
00299               unity_activation_response_set_goto_uri (self, g_value_get_string (value));
00300               break;
00301               default:
00302               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
00303               break;
00304        }
00305 }
00306 
00307 
00308