255cf6e8f3123dab4de1ae35af28c07f83d8a0ac
[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
15
16 #define TYPE_IDENTITY_MANAGER_APP (identity_manager_app_get_type ())
17 #define IDENTITY_MANAGER_APP(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_APP, IdentityManagerApp))
18 #define IDENTITY_MANAGER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppClass))
19 #define IS_IDENTITY_MANAGER_APP(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_APP))
20 #define IS_IDENTITY_MANAGER_APP_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_APP))
21 #define IDENTITY_MANAGER_APP_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppClass))
22
23 typedef struct _IdentityManagerApp IdentityManagerApp;
24 typedef struct _IdentityManagerAppClass IdentityManagerAppClass;
25 typedef struct _IdentityManagerAppPrivate IdentityManagerAppPrivate;
26
27 #define TYPE_IDENTITY_MANAGER_MODEL (identity_manager_model_get_type ())
28 #define IDENTITY_MANAGER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModel))
29 #define IDENTITY_MANAGER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModelClass))
30 #define IS_IDENTITY_MANAGER_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_MODEL))
31 #define IS_IDENTITY_MANAGER_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_MODEL))
32 #define IDENTITY_MANAGER_MODEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_MODEL, IdentityManagerModelClass))
33
34 typedef struct _IdentityManagerModel IdentityManagerModel;
35 typedef struct _IdentityManagerModelClass IdentityManagerModelClass;
36
37 #define TYPE_IDENTITY_MANAGER_VIEW (identity_manager_view_get_type ())
38 #define IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerView))
39 #define IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))
40 #define IS_IDENTITY_MANAGER_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_IDENTITY_MANAGER_VIEW))
41 #define IS_IDENTITY_MANAGER_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_IDENTITY_MANAGER_VIEW))
42 #define IDENTITY_MANAGER_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_IDENTITY_MANAGER_VIEW, IdentityManagerViewClass))
43
44 typedef struct _IdentityManagerView IdentityManagerView;
45 typedef struct _IdentityManagerViewClass IdentityManagerViewClass;
46
47 #define TYPE_MOONSHOT_SERVER (moonshot_server_get_type ())
48 #define MOONSHOT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_MOONSHOT_SERVER, MoonshotServer))
49 #define MOONSHOT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_MOONSHOT_SERVER, MoonshotServerClass))
50 #define IS_MOONSHOT_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_MOONSHOT_SERVER))
51 #define IS_MOONSHOT_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_MOONSHOT_SERVER))
52 #define MOONSHOT_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_MOONSHOT_SERVER, MoonshotServerClass))
53
54 typedef struct _MoonshotServer MoonshotServer;
55 typedef struct _MoonshotServerClass MoonshotServerClass;
56 #define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
57 #define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
58 #define _g_free0(var) (var = (g_free (var), NULL))
59
60 struct _IdentityManagerApp {
61         GtkWindow parent_instance;
62         IdentityManagerAppPrivate * priv;
63         IdentityManagerModel* model;
64 };
65
66 struct _IdentityManagerAppClass {
67         GtkWindowClass parent_class;
68 };
69
70 struct _IdentityManagerAppPrivate {
71         IdentityManagerView* view;
72         MoonshotServer* ipc_server;
73 };
74
75
76 static gpointer identity_manager_app_parent_class = NULL;
77
78 GType identity_manager_app_get_type (void) G_GNUC_CONST;
79 GType identity_manager_model_get_type (void) G_GNUC_CONST;
80 GType identity_manager_view_get_type (void) G_GNUC_CONST;
81 GType moonshot_server_get_type (void) G_GNUC_CONST;
82 guint moonshot_server_register_object (void* object, GDBusConnection* connection, const gchar* path, GError** error);
83 #define IDENTITY_MANAGER_APP_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), TYPE_IDENTITY_MANAGER_APP, IdentityManagerAppPrivate))
84 enum  {
85         IDENTITY_MANAGER_APP_DUMMY_PROPERTY
86 };
87 #define IDENTITY_MANAGER_APP_WINDOW_WIDTH 400
88 #define IDENTITY_MANAGER_APP_WINDOW_HEIGHT 500
89 void identity_manager_app_show (IdentityManagerApp* self);
90 IdentityManagerApp* identity_manager_app_new (void);
91 IdentityManagerApp* identity_manager_app_construct (GType object_type);
92 IdentityManagerModel* identity_manager_model_new (IdentityManagerApp* parent_app);
93 IdentityManagerModel* identity_manager_model_construct (GType object_type, IdentityManagerApp* parent_app);
94 IdentityManagerView* identity_manager_view_new (IdentityManagerApp* app);
95 IdentityManagerView* identity_manager_view_construct (GType object_type, IdentityManagerApp* app);
96 static void identity_manager_app_init_ipc_server (IdentityManagerApp* self);
97 static void identity_manager_app_bus_acquired_cb (IdentityManagerApp* self, GDBusConnection* conn);
98 MoonshotServer* moonshot_server_new (GtkWindow* window);
99 MoonshotServer* moonshot_server_construct (GType object_type, GtkWindow* window);
100 static void _identity_manager_app_bus_acquired_cb_gbus_acquired_callback (GDBusConnection* connection, const char* name, gpointer self);
101 static void _lambda6_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self);
102 static void __lambda6__gbus_name_acquired_callback (GDBusConnection* connection, const char* name, gpointer self);
103 static void _lambda7_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self);
104 static void __lambda7__gbus_name_lost_callback (GDBusConnection* connection, const char* name, gpointer self);
105 static void identity_manager_app_finalize (GObject* obj);
106 gint _vala_main (char** args, int args_length1);
107
108
109
110 void identity_manager_app_show (IdentityManagerApp* self) {
111         g_return_if_fail (self != NULL);
112         gtk_widget_show ((GtkWidget*) self->priv->view);
113 }
114
115
116 IdentityManagerApp* identity_manager_app_construct (GType object_type) {
117         IdentityManagerApp * self;
118         IdentityManagerModel* _tmp0_;
119         IdentityManagerView* _tmp1_;
120         self = g_object_newv (object_type, 0, NULL);
121         self->model = (_tmp0_ = identity_manager_model_new (self), _g_object_unref0 (self->model), _tmp0_);
122         self->priv->view = (_tmp1_ = g_object_ref_sink (identity_manager_view_new (self)), _g_object_unref0 (self->priv->view), _tmp1_);
123         identity_manager_app_init_ipc_server (self);
124         gtk_widget_show ((GtkWidget*) self->priv->view);
125         return self;
126 }
127
128
129 IdentityManagerApp* identity_manager_app_new (void) {
130         return identity_manager_app_construct (TYPE_IDENTITY_MANAGER_APP);
131 }
132
133
134 static void identity_manager_app_bus_acquired_cb (IdentityManagerApp* self, GDBusConnection* conn) {
135         GError * _inner_error_ = NULL;
136         g_return_if_fail (self != NULL);
137         g_return_if_fail (conn != NULL);
138         {
139                 moonshot_server_register_object (self->priv->ipc_server, conn, "/org/janet/moonshot", &_inner_error_);
140                 if (_inner_error_ != NULL) {
141                         goto __catch0_g_error;
142                 }
143         }
144         goto __finally0;
145         __catch0_g_error:
146         {
147                 GError * e;
148                 e = _inner_error_;
149                 _inner_error_ = NULL;
150                 {
151                         fprintf (stderr, "%s\n", e->message);
152                         _g_error_free0 (e);
153                 }
154         }
155         __finally0:
156         if (_inner_error_ != NULL) {
157                 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);
158                 g_clear_error (&_inner_error_);
159                 return;
160         }
161 }
162
163
164 static void _identity_manager_app_bus_acquired_cb_gbus_acquired_callback (GDBusConnection* connection, const char* name, gpointer self) {
165         identity_manager_app_bus_acquired_cb (self, connection);
166 }
167
168
169 static void _lambda6_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self) {
170         g_return_if_fail (conn != NULL);
171         g_return_if_fail (name != NULL);
172 }
173
174
175 static void __lambda6__gbus_name_acquired_callback (GDBusConnection* connection, const char* name, gpointer self) {
176         _lambda6_ (connection, name, self);
177 }
178
179
180 static void _lambda7_ (GDBusConnection* conn, const char* name, IdentityManagerApp* self) {
181         g_return_if_fail (conn != NULL);
182         g_return_if_fail (name != NULL);
183         g_error ("moonshot-identity-manager-app.vala:79: Couldn't own name %s on DBus.", name);
184 }
185
186
187 static void __lambda7__gbus_name_lost_callback (GDBusConnection* connection, const char* name, gpointer self) {
188         _lambda7_ (connection, name, self);
189 }
190
191
192 static void identity_manager_app_init_ipc_server (IdentityManagerApp* self) {
193         MoonshotServer* _tmp0_;
194         g_return_if_fail (self != NULL);
195         self->priv->ipc_server = (_tmp0_ = moonshot_server_new ((GtkWindow*) self->priv->view), _g_object_unref0 (self->priv->ipc_server), _tmp0_);
196         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, g_object_ref (self), g_object_unref), (GClosure*) g_cclosure_new ((GCallback) __lambda6__gbus_name_acquired_callback, g_object_ref (self), g_object_unref), (GClosure*) g_cclosure_new ((GCallback) __lambda7__gbus_name_lost_callback, g_object_ref (self), g_object_unref));
197 }
198
199
200 static void identity_manager_app_class_init (IdentityManagerAppClass * klass) {
201         identity_manager_app_parent_class = g_type_class_peek_parent (klass);
202         g_type_class_add_private (klass, sizeof (IdentityManagerAppPrivate));
203         G_OBJECT_CLASS (klass)->finalize = identity_manager_app_finalize;
204 }
205
206
207 static void identity_manager_app_instance_init (IdentityManagerApp * self) {
208         self->priv = IDENTITY_MANAGER_APP_GET_PRIVATE (self);
209 }
210
211
212 static void identity_manager_app_finalize (GObject* obj) {
213         IdentityManagerApp * self;
214         self = IDENTITY_MANAGER_APP (obj);
215         _g_object_unref0 (self->model);
216         _g_object_unref0 (self->priv->view);
217         _g_object_unref0 (self->priv->ipc_server);
218         G_OBJECT_CLASS (identity_manager_app_parent_class)->finalize (obj);
219 }
220
221
222 GType identity_manager_app_get_type (void) {
223         static volatile gsize identity_manager_app_type_id__volatile = 0;
224         if (g_once_init_enter (&identity_manager_app_type_id__volatile)) {
225                 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, NULL };
226                 GType identity_manager_app_type_id;
227                 identity_manager_app_type_id = g_type_register_static (GTK_TYPE_WINDOW, "IdentityManagerApp", &g_define_type_info, 0);
228                 g_once_init_leave (&identity_manager_app_type_id__volatile, identity_manager_app_type_id);
229         }
230         return identity_manager_app_type_id__volatile;
231 }
232
233
234 gint _vala_main (char** args, int args_length1) {
235         gint result = 0;
236         IdentityManagerApp* app;
237         gtk_init (&args_length1, &args);
238         fprintf (stdout, "Hello\n");
239         {
240                 char** arg_collection;
241                 int arg_collection_length1;
242                 int arg_it;
243                 arg_collection = args;
244                 arg_collection_length1 = args_length1;
245                 for (arg_it = 0; arg_it < args_length1; arg_it = arg_it + 1) {
246                         char* arg;
247                         arg = g_strdup (arg_collection[arg_it]);
248                         {
249                                 fprintf (stdout, "arg %s\n", arg);
250                                 _g_free0 (arg);
251                         }
252                 }
253         }
254         bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
255         bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
256         textdomain (GETTEXT_PACKAGE);
257         app = g_object_ref_sink (identity_manager_app_new ());
258         identity_manager_app_show (app);
259         gtk_main ();
260         result = 0;
261         _g_object_unref0 (app);
262         return result;
263 }
264
265
266 int main (int argc, char ** argv) {
267         g_type_init ();
268         return _vala_main (argv, argc);
269 }
270
271
272
273