make dist; autoreconf
[moonshot-ui.git] / src / moonshot-identity-manager-app.c
1 /* moonshot-identity-manager-app.c generated by valac 0.10.4, the Vala compiler
2  * generated from moonshot-identity-manager-app.vala, do not modify */
3
4
5 #include <glib.h>
6 #include <glib-object.h>
7 #include <gtk/gtk.h>
8 #include <gio/gio.h>
9 #include <stdio.h>
10 #include <stdlib.h>
11 #include <string.h>
12 #include <glib/gi18n-lib.h>
13 #include <config.h>
14 #include <gobject/gvaluecollector.h>
15
16
17 #define TYPE_IDENTITY_MANAGER_APP (identity_manager_app_get_type ())
18 #define IDENTITY_MANAGER_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_APP, IdentityManagerApp))
19 #define IDENTITY_MANAGER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppClass))
20 #define IS_IDENTITY_MANAGER_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_APP))
21 #define IS_IDENTITY_MANAGER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_APP))
22 #define IDENTITY_MANAGER_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppClass))
23
24 typedef struct _IdentityManagerApp IdentityManagerApp;
25 typedef struct _IdentityManagerAppClass IdentityManagerAppClass;
26 typedef struct _IdentityManagerAppPrivate IdentityManagerAppPrivate;
27
28 #define TYPE_IDENTITY_MANAGER_MODEL (identity_manager_model_get_type ())
29 #define IDENTITY_MANAGER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModel))
30 #define IDENTITY_MANAGER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModelClass))
31 #define IS_IDENTITY_MANAGER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_MODEL))
32 #define IS_IDENTITY_MANAGER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_MODEL))
33 #define IDENTITY_MANAGER_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModelClass))
34
35 typedef struct _IdentityManagerModel IdentityManagerModel;
36 typedef struct _IdentityManagerModelClass IdentityManagerModelClass;
37
38 #define TYPE_IDENTITY_MANAGER_VIEW (identity_manager_view_get_type ())
39 #define IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerView))
40 #define IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))
41 #define IS_IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_VIEW))
42 #define IS_IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_VIEW))
43 #define IDENTITY_MANAGER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))
44
45 typedef struct _IdentityManagerView IdentityManagerView;
46 typedef struct _IdentityManagerViewClass IdentityManagerViewClass;
47
48 #define TYPE_MOONSHOT_SERVER (moonshot_server_get_type ())
49 #define MOONSHOT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MOONSHOT_SERVER, MoonshotServer))
50 #define MOONSHOT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MOONSHOT_SERVER, MoonshotServerClass))
51 #define IS_MOONSHOT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MOONSHOT_SERVER))
52 #define IS_MOONSHOT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MOONSHOT_SERVER))
53 #define MOONSHOT_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MOONSHOT_SERVER, MoonshotServerClass))
54
55 typedef struct _MoonshotServer MoonshotServer;
56 typedef struct _MoonshotServerClass MoonshotServerClass;
57 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
58 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
59 typedef struct _ParamSpecIdentityManagerApp ParamSpecIdentityManagerApp;
60 #define _g_free0(var) (var = (g_free (var), NULL))
61 #define _identity_manager_app_unref0(var) ((var == NULL) ? NULL : (var = (identity_manager_app_unref (var), NULL)))
62
63 struct _IdentityManagerApp {
64         GTypeInstance parent_instance;
65         volatile int ref_count;
66         IdentityManagerAppPrivate * priv;
67         IdentityManagerModel* model;
68 };
69
70 struct _IdentityManagerAppClass {
71         GTypeClass parent_class;
72         void (*finalize) (IdentityManagerApp *self);
73 };
74
75 struct _IdentityManagerAppPrivate {
76         IdentityManagerView* view;
77         MoonshotServer* ipc_server;
78 };
79
80 struct _ParamSpecIdentityManagerApp {
81         GParamSpec parent_instance;
82 };
83
84
85 static gpointer identity_manager_app_parent_class = NULL;
86
87 gpointer identity_manager_app_ref (gpointer instance);
88 void identity_manager_app_unref (gpointer instance);
89 GParamSpec* param_spec_identity_manager_app (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
90 void value_set_identity_manager_app (GValue* value, gpointer v_object);
91 void value_take_identity_manager_app (GValue* value, gpointer v_object);
92 gpointer value_get_identity_manager_app (const GValue* value);
93 GType identity_manager_app_get_type (void) G_GNUC_CONST;
94 GType identity_manager_model_get_type (void) G_GNUC_CONST;
95 GType identity_manager_view_get_type (void) G_GNUC_CONST;
96 GType moonshot_server_get_type (void) G_GNUC_CONST;
97 guint moonshot_server_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
98 #define IDENTITY_MANAGER_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppPrivate))
99 enum  {
100         IDENTITY_MANAGER_APP_DUMMY_PROPERTY
101 };
102 #define IDENTITY_MANAGER_APP_WINDOW_WIDTH 400
103 #define IDENTITY_MANAGER_APP_WINDOW_HEIGHT 500
104 void identity_manager_app_show (IdentityManagerApp* self);
105 IdentityManagerApp* identity_manager_app_new (void);
106 IdentityManagerApp* identity_manager_app_construct (GType object_type);
107 IdentityManagerModel* identity_manager_model_new (IdentityManagerApp* parent_app);
108 IdentityManagerModel* identity_manager_model_construct (GType object_type, IdentityManagerApp* parent_app);
109 IdentityManagerView* identity_manager_view_new (IdentityManagerApp* app);
110 IdentityManagerView* identity_manager_view_construct (GType object_type, IdentityManagerApp* app);
111 static void identity_manager_app_init_ipc_server (IdentityManagerApp* self);
112 static void identity_manager_app_bus_acquired_cb (IdentityManagerApp* self, GDBusConnection* conn);
113 MoonshotServer* moonshot_server_new (GtkWindow* window);
114 MoonshotServer* moonshot_server_construct (GType object_type, GtkWindow* window);
115 static void _identity_manager_app_bus_acquired_cb_gbus_acquired_callback (GDBusConnection* connection, const char* name, gpointer self);
116 static void _lambda6_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self);
117 static void __lambda6__gbus_name_acquired_callback (GDBusConnection* connection, const char* name, gpointer self);
118 static void _lambda7_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self);
119 static void __lambda7__gbus_name_lost_callback (GDBusConnection* connection, const char* name, gpointer self);
120 static void identity_manager_app_finalize (IdentityManagerApp* obj);
121 gint _vala_main (char** args, int args_length1);
122
123
124
125 void identity_manager_app_show (IdentityManagerApp* self) {
126         g_return_if_fail (self != NULL);
127         gtk_widget_show ((GtkWidget*) self->priv->view);
128 }
129
130
131 IdentityManagerApp* identity_manager_app_construct (GType object_type) {
132         IdentityManagerApp* self = (IdentityManagerApp*) g_type_create_instance (object_type);
133         IdentityManagerModel* _tmp0_;
134         IdentityManagerView* _tmp1_;
135         self->model = (_tmp0_ = identity_manager_model_new (self), _g_object_unref0 (self->model), _tmp0_);
136         self->priv->view = (_tmp1_ = g_object_ref_sink (identity_manager_view_new (self)), _g_object_unref0 (self->priv->view), _tmp1_);
137         identity_manager_app_init_ipc_server (self);
138         gtk_widget_show ((GtkWidget*) self->priv->view);
139         return self;
140 }
141
142
143 IdentityManagerApp* identity_manager_app_new (void) {
144         return identity_manager_app_construct (TYPE_IDENTITY_MANAGER_APP);
145 }
146
147
148 static void identity_manager_app_bus_acquired_cb (IdentityManagerApp* self, GDBusConnection* conn) {
149         GError * _inner_error_ = NULL;
150         g_return_if_fail (self != NULL);
151         g_return_if_fail (conn != NULL);
152         {
153                 moonshot_server_register_object (self->priv->ipc_server, conn, "/org/janet/moonshot", &_inner_error_);
154                 if (_inner_error_ != NULL) {
155                         goto __catch0_g_error;
156                 }
157         }
158         goto __finally0;
159         __catch0_g_error:
160         {
161                 GError * e;
162                 e = _inner_error_;
163                 _inner_error_ = NULL;
164                 {
165                         fprintf (stderr, "%s\n", e->message);
166                         _g_error_free0 (e);
167                 }
168         }
169         __finally0:
170         if (_inner_error_ != NULL) {
171                 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);
172                 g_clear_error (&_inner_error_);
173                 return;
174         }
175 }
176
177
178 static void _identity_manager_app_bus_acquired_cb_gbus_acquired_callback (GDBusConnection* connection, const char* name, gpointer self) {
179         identity_manager_app_bus_acquired_cb (self, connection);
180 }
181
182
183 static void _lambda6_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self) {
184         g_return_if_fail (conn != NULL);
185         g_return_if_fail (name != NULL);
186 }
187
188
189 static void __lambda6__gbus_name_acquired_callback (GDBusConnection* connection, const char* name, gpointer self) {
190         _lambda6_ (connection, name, self);
191 }
192
193
194 static void _lambda7_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self) {
195         g_return_if_fail (conn != NULL);
196         g_return_if_fail (name != NULL);
197         g_error ("moonshot-identity-manager-app.vala:79: Couldn't own name %s on DBus.", name);
198 }
199
200
201 static void __lambda7__gbus_name_lost_callback (GDBusConnection* connection, const char* name, gpointer self) {
202         _lambda7_ (connection, name, self);
203 }
204
205
206 static void identity_manager_app_init_ipc_server (IdentityManagerApp* self) {
207         MoonshotServer* _tmp0_;
208         g_return_if_fail (self != NULL);
209         self->priv->ipc_server = (_tmp0_ = moonshot_server_new ((GtkWindow*) self->priv->view), _g_object_unref0 (self->priv->ipc_server), _tmp0_);
210         g_bus_own_name_with_closures (G_BUS_TYPE_SESSION, "org.janet.Moonshot", G_BUS_NAME_OWNER_FLAGS_NONE, (GClosure*) g_cclosure_new ((GCallback) _identity_manager_app_bus_acquired_cb_gbus_acquired_callback, identity_manager_app_ref (self), identity_manager_app_unref), (GClosure*) g_cclosure_new ((GCallback) __lambda6__gbus_name_acquired_callback, identity_manager_app_ref (self), identity_manager_app_unref), (GClosure*) g_cclosure_new ((GCallback) __lambda7__gbus_name_lost_callback, identity_manager_app_ref (self), identity_manager_app_unref));
211 }
212
213
214 static void value_identity_manager_app_init (GValue* value) {
215         value->data[0].v_pointer = NULL;
216 }
217
218
219 static void value_identity_manager_app_free_value (GValue* value) {
220         if (value->data[0].v_pointer) {
221                 identity_manager_app_unref (value->data[0].v_pointer);
222         }
223 }
224
225
226 static void value_identity_manager_app_copy_value (const GValue* src_value, GValue* dest_value) {
227         if (src_value->data[0].v_pointer) {
228                 dest_value->data[0].v_pointer = identity_manager_app_ref (src_value->data[0].v_pointer);
229         } else {
230                 dest_value->data[0].v_pointer = NULL;
231         }
232 }
233
234
235 static gpointer value_identity_manager_app_peek_pointer (const GValue* value) {
236         return value->data[0].v_pointer;
237 }
238
239
240 static gchar* value_identity_manager_app_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
241         if (collect_values[0].v_pointer) {
242                 IdentityManagerApp* object;
243                 object = collect_values[0].v_pointer;
244                 if (object->parent_instance.g_class == NULL) {
245                         return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
246                 } else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
247                         return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
248                 }
249                 value->data[0].v_pointer = identity_manager_app_ref (object);
250         } else {
251                 value->data[0].v_pointer = NULL;
252         }
253         return NULL;
254 }
255
256
257 static gchar* value_identity_manager_app_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
258         IdentityManagerApp** object_p;
259         object_p = collect_values[0].v_pointer;
260         if (!object_p) {
261                 return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
262         }
263         if (!value->data[0].v_pointer) {
264                 *object_p = NULL;
265         } else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
266                 *object_p = value->data[0].v_pointer;
267         } else {
268                 *object_p = identity_manager_app_ref (value->data[0].v_pointer);
269         }
270         return NULL;
271 }
272
273
274 GParamSpec* param_spec_identity_manager_app (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
275         ParamSpecIdentityManagerApp* spec;
276         g_return_val_if_fail (g_type_is_a (object_type, TYPE_IDENTITY_MANAGER_APP), NULL);
277         spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
278         G_PARAM_SPEC (spec)->value_type = object_type;
279         return G_PARAM_SPEC (spec);
280 }
281
282
283 gpointer value_get_identity_manager_app (const GValue* value) {
284         g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_IDENTITY_MANAGER_APP), NULL);
285         return value->data[0].v_pointer;
286 }
287
288
289 void value_set_identity_manager_app (GValue* value, gpointer v_object) {
290         IdentityManagerApp* old;
291         g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_IDENTITY_MANAGER_APP));
292         old = value->data[0].v_pointer;
293         if (v_object) {
294                 g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_IDENTITY_MANAGER_APP));
295                 g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
296                 value->data[0].v_pointer = v_object;
297                 identity_manager_app_ref (value->data[0].v_pointer);
298         } else {
299                 value->data[0].v_pointer = NULL;
300         }
301         if (old) {
302                 identity_manager_app_unref (old);
303         }
304 }
305
306
307 void value_take_identity_manager_app (GValue* value, gpointer v_object) {
308         IdentityManagerApp* old;
309         g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_IDENTITY_MANAGER_APP));
310         old = value->data[0].v_pointer;
311         if (v_object) {
312                 g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_IDENTITY_MANAGER_APP));
313                 g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
314                 value->data[0].v_pointer = v_object;
315         } else {
316                 value->data[0].v_pointer = NULL;
317         }
318         if (old) {
319                 identity_manager_app_unref (old);
320         }
321 }
322
323
324 static void identity_manager_app_class_init (IdentityManagerAppClass * klass) {
325         identity_manager_app_parent_class = g_type_class_peek_parent (klass);
326         IDENTITY_MANAGER_APP_CLASS (klass)->finalize = identity_manager_app_finalize;
327         g_type_class_add_private (klass, sizeof (IdentityManagerAppPrivate));
328 }
329
330
331 static void identity_manager_app_instance_init (IdentityManagerApp * self) {
332         self->priv = IDENTITY_MANAGER_APP_GET_PRIVATE (self);
333         self->ref_count = 1;
334 }
335
336
337 static void identity_manager_app_finalize (IdentityManagerApp* obj) {
338         IdentityManagerApp * self;
339         self = IDENTITY_MANAGER_APP (obj);
340         _g_object_unref0 (self->model);
341         _g_object_unref0 (self->priv->view);
342         _g_object_unref0 (self->priv->ipc_server);
343 }
344
345
346 GType identity_manager_app_get_type (void) {
347         static volatile gsize identity_manager_app_type_id__volatile = 0;
348         if (g_once_init_enter (&identity_manager_app_type_id__volatile)) {
349                 static const GTypeValueTable g_define_type_value_table = { value_identity_manager_app_init, value_identity_manager_app_free_value, value_identity_manager_app_copy_value, value_identity_manager_app_peek_pointer, "p", value_identity_manager_app_collect_value, "p", value_identity_manager_app_lcopy_value };
350                 static const GTypeInfo g_define_type_info = { sizeof (IdentityManagerAppClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) identity_manager_app_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (IdentityManagerApp), 0, (GInstanceInitFunc) identity_manager_app_instance_init, &g_define_type_value_table };
351                 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) };
352                 GType identity_manager_app_type_id;
353                 identity_manager_app_type_id = g_type_register_fundamental (g_type_fundamental_next (), "IdentityManagerApp", &g_define_type_info, &g_define_type_fundamental_info, 0);
354                 g_once_init_leave (&identity_manager_app_type_id__volatile, identity_manager_app_type_id);
355         }
356         return identity_manager_app_type_id__volatile;
357 }
358
359
360 gpointer identity_manager_app_ref (gpointer instance) {
361         IdentityManagerApp* self;
362         self = instance;
363         g_atomic_int_inc (&self->ref_count);
364         return instance;
365 }
366
367
368 void identity_manager_app_unref (gpointer instance) {
369         IdentityManagerApp* self;
370         self = instance;
371         if (g_atomic_int_dec_and_test (&self->ref_count)) {
372                 IDENTITY_MANAGER_APP_GET_CLASS (self)->finalize (self);
373                 g_type_free_instance ((GTypeInstance *) self);
374         }
375 }
376
377
378 gint _vala_main (char** args, int args_length1) {
379         gint result = 0;
380         IdentityManagerApp* app;
381         gtk_init (&args_length1, &args);
382         fprintf (stdout, "Hello\n");
383         {
384                 char** arg_collection;
385                 int arg_collection_length1;
386                 int arg_it;
387                 arg_collection = args;
388                 arg_collection_length1 = args_length1;
389                 for (arg_it = 0; arg_it < args_length1; arg_it = arg_it + 1) {
390                         char* arg;
391                         arg = g_strdup (arg_collection[arg_it]);
392                         {
393                                 fprintf (stdout, "arg %s\n", arg);
394                                 _g_free0 (arg);
395                         }
396                 }
397         }
398         bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
399         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
400         textdomain (GETTEXT_PACKAGE);
401         app = identity_manager_app_new ();
402         identity_manager_app_show (app);
403         gtk_main ();
404         result = 0;
405         _identity_manager_app_unref0 (app);
406         return result;
407 }
408
409
410 int main (int argc, char ** argv) {
411         g_type_init ();
412         return _vala_main (argv, argc);
413 }
414
415
416
417