-
Notifications
You must be signed in to change notification settings - Fork 1
/
Ultipost.c
617 lines (536 loc) · 21.7 KB
/
Ultipost.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
/* Ultipost.c generated by valac 0.30.0, the Vala compiler
* generated from Ultipost.vala, do not modify */
#include <glib.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#define ULTI_TYPE_ACTION_MENU (ulti_action_menu_get_type ())
#define ULTI_ACTION_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ULTI_TYPE_ACTION_MENU, UltiActionMenu))
#define ULTI_ACTION_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ULTI_TYPE_ACTION_MENU, UltiActionMenuClass))
#define ULTI_IS_ACTION_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ULTI_TYPE_ACTION_MENU))
#define ULTI_IS_ACTION_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ULTI_TYPE_ACTION_MENU))
#define ULTI_ACTION_MENU_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ULTI_TYPE_ACTION_MENU, UltiActionMenuClass))
typedef struct _UltiActionMenu UltiActionMenu;
typedef struct _UltiActionMenuClass UltiActionMenuClass;
typedef struct _UltiActionMenuPrivate UltiActionMenuPrivate;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define ULTI_TYPE_ULTIPOST (ulti_ultipost_get_type ())
#define ULTI_ULTIPOST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ULTI_TYPE_ULTIPOST, UltiUltipost))
#define ULTI_ULTIPOST_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ULTI_TYPE_ULTIPOST, UltiUltipostClass))
#define ULTI_IS_ULTIPOST(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ULTI_TYPE_ULTIPOST))
#define ULTI_IS_ULTIPOST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ULTI_TYPE_ULTIPOST))
#define ULTI_ULTIPOST_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ULTI_TYPE_ULTIPOST, UltiUltipostClass))
typedef struct _UltiUltipost UltiUltipost;
typedef struct _UltiUltipostClass UltiUltipostClass;
typedef struct _UltiUltipostPrivate UltiUltipostPrivate;
#define ULTI_TYPE_ULTI_PANEL (ulti_ulti_panel_get_type ())
#define ULTI_ULTI_PANEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ULTI_TYPE_ULTI_PANEL, UltiUltiPanel))
#define ULTI_ULTI_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ULTI_TYPE_ULTI_PANEL, UltiUltiPanelClass))
#define ULTI_IS_ULTI_PANEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ULTI_TYPE_ULTI_PANEL))
#define ULTI_IS_ULTI_PANEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ULTI_TYPE_ULTI_PANEL))
#define ULTI_ULTI_PANEL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ULTI_TYPE_ULTI_PANEL, UltiUltiPanelClass))
typedef struct _UltiUltiPanel UltiUltiPanel;
typedef struct _UltiUltiPanelClass UltiUltiPanelClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))
typedef struct _UltiUltiPanelPrivate UltiUltiPanelPrivate;
#define ULTI_TYPE_ULTI_LAUNCH (ulti_ulti_launch_get_type ())
#define ULTI_ULTI_LAUNCH(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), ULTI_TYPE_ULTI_LAUNCH, UltiUltiLaunch))
#define ULTI_ULTI_LAUNCH_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ULTI_TYPE_ULTI_LAUNCH, UltiUltiLaunchClass))
#define ULTI_IS_ULTI_LAUNCH(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), ULTI_TYPE_ULTI_LAUNCH))
#define ULTI_IS_ULTI_LAUNCH_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ULTI_TYPE_ULTI_LAUNCH))
#define ULTI_ULTI_LAUNCH_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ULTI_TYPE_ULTI_LAUNCH, UltiUltiLaunchClass))
typedef struct _UltiUltiLaunch UltiUltiLaunch;
typedef struct _UltiUltiLaunchClass UltiUltiLaunchClass;
struct _UltiActionMenu {
GtkWindow parent_instance;
UltiActionMenuPrivate * priv;
};
struct _UltiActionMenuClass {
GtkWindowClass parent_class;
};
struct _UltiActionMenuPrivate {
GtkBox* box;
GtkButton* btn_shutdown;
GtkButton* btn_reboot;
GtkButton* btn_preferences;
GtkLabel* label;
GSubprocessLauncher* processL;
};
struct _UltiUltipost {
GtkBin parent_instance;
UltiUltipostPrivate * priv;
GtkToggleButton* Launch;
GtkToggleButton* Action;
UltiUltiPanel* p;
UltiActionMenu* action;
};
struct _UltiUltipostClass {
GtkBinClass parent_class;
};
struct _UltiUltipostPrivate {
GtkBox* box;
GtkLabel* time_dis;
};
struct _UltiUltiPanel {
GtkBin parent_instance;
UltiUltiPanelPrivate * priv;
gboolean has_activated;
};
struct _UltiUltiPanelClass {
GtkBinClass parent_class;
};
static gpointer ulti_action_menu_parent_class = NULL;
static gpointer ulti_ultipost_parent_class = NULL;
extern UltiUltiLaunch* ulti_ulti_panel_launcher;
GType ulti_action_menu_get_type (void) G_GNUC_CONST;
#define ULTI_ACTION_MENU_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ULTI_TYPE_ACTION_MENU, UltiActionMenuPrivate))
enum {
ULTI_ACTION_MENU_DUMMY_PROPERTY
};
void ulti_action_menu_appear (UltiActionMenu* self);
void ulti_action_menu_vanish (UltiActionMenu* self);
static void ulti_action_menu_shutdown (UltiActionMenu* self);
static void ulti_action_menu_reboot (UltiActionMenu* self);
static void ulti_action_menu_preferences (UltiActionMenu* self);
UltiActionMenu* ulti_action_menu_new (void);
UltiActionMenu* ulti_action_menu_construct (GType object_type);
static void _ulti_action_menu_shutdown_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void _ulti_action_menu_reboot_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void _ulti_action_menu_preferences_gtk_button_clicked (GtkButton* _sender, gpointer self);
static void ulti_action_menu_finalize (GObject* obj);
GType ulti_ultipost_get_type (void) G_GNUC_CONST;
GType ulti_ulti_panel_get_type (void) G_GNUC_CONST;
#define ULTI_ULTIPOST_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), ULTI_TYPE_ULTIPOST, UltiUltipostPrivate))
enum {
ULTI_ULTIPOST_DUMMY_PROPERTY
};
static void ulti_ultipost_timer (UltiUltipost* self);
static void ulti_ultipost_launch_toggle (UltiUltipost* self);
GType ulti_ulti_launch_get_type (void) G_GNUC_CONST;
void ulti_ulti_launch_vanish (UltiUltiLaunch* self);
void ulti_ulti_launch_appear (UltiUltiLaunch* self);
static void ulti_ultipost_action_toggle (UltiUltipost* self);
UltiUltipost* ulti_ultipost_new (GtkWidget* BtnTask, UltiUltiPanel* panel);
UltiUltipost* ulti_ultipost_construct (GType object_type, GtkWidget* BtnTask, UltiUltiPanel* panel);
static void _ulti_ultipost_launch_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void _ulti_ultipost_action_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self);
static void ulti_ultipost_finalize (GObject* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
void ulti_action_menu_appear (UltiActionMenu* self) {
g_return_if_fail (self != NULL);
gtk_widget_show_all ((GtkWidget*) self);
}
void ulti_action_menu_vanish (UltiActionMenu* self) {
g_return_if_fail (self != NULL);
gtk_widget_hide ((GtkWidget*) self);
}
static void ulti_action_menu_shutdown (UltiActionMenu* self) {
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
{
GSubprocessLauncher* _tmp0_ = NULL;
gchar* _tmp1_ = NULL;
gchar* _tmp2_ = NULL;
gchar* _tmp3_ = NULL;
gchar** _tmp4_ = NULL;
gchar** _tmp5_ = NULL;
gint _tmp5__length1 = 0;
GSubprocess* _tmp6_ = NULL;
GSubprocess* _tmp7_ = NULL;
_tmp0_ = self->priv->processL;
_tmp1_ = g_strdup ("shutdown");
_tmp2_ = g_strdup ("-P");
_tmp3_ = g_strdup ("now");
_tmp4_ = g_new0 (gchar*, 4 + 1);
_tmp4_[0] = _tmp1_;
_tmp4_[1] = _tmp2_;
_tmp4_[2] = _tmp3_;
_tmp4_[3] = NULL;
_tmp5_ = _tmp4_;
_tmp5__length1 = 4;
_tmp6_ = g_subprocess_launcher_spawnv (_tmp0_, _tmp5_, &_inner_error_);
_tmp7_ = _tmp6_;
_g_object_unref0 (_tmp7_);
_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
if (G_UNLIKELY (_inner_error_ != NULL)) {
goto __catch2_g_error;
}
}
goto __finally2;
__catch2_g_error:
{
GError* e = NULL;
FILE* _tmp8_ = NULL;
GError* _tmp9_ = NULL;
const gchar* _tmp10_ = NULL;
e = _inner_error_;
_inner_error_ = NULL;
_tmp8_ = stderr;
_tmp9_ = e;
_tmp10_ = _tmp9_->message;
fprintf (_tmp8_, "Failed to shutdown: %s\n", _tmp10_);
_g_error_free0 (e);
}
__finally2:
if (G_UNLIKELY (_inner_error_ != NULL)) {
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);
g_clear_error (&_inner_error_);
return;
}
}
static void ulti_action_menu_reboot (UltiActionMenu* self) {
GError * _inner_error_ = NULL;
g_return_if_fail (self != NULL);
{
GSubprocessLauncher* _tmp0_ = NULL;
gchar* _tmp1_ = NULL;
gchar* _tmp2_ = NULL;
gchar* _tmp3_ = NULL;
gchar** _tmp4_ = NULL;
gchar** _tmp5_ = NULL;
gint _tmp5__length1 = 0;
GSubprocess* _tmp6_ = NULL;
GSubprocess* _tmp7_ = NULL;
_tmp0_ = self->priv->processL;
_tmp1_ = g_strdup ("shutdown");
_tmp2_ = g_strdup ("-r");
_tmp3_ = g_strdup ("now");
_tmp4_ = g_new0 (gchar*, 4 + 1);
_tmp4_[0] = _tmp1_;
_tmp4_[1] = _tmp2_;
_tmp4_[2] = _tmp3_;
_tmp4_[3] = NULL;
_tmp5_ = _tmp4_;
_tmp5__length1 = 4;
_tmp6_ = g_subprocess_launcher_spawnv (_tmp0_, _tmp5_, &_inner_error_);
_tmp7_ = _tmp6_;
_g_object_unref0 (_tmp7_);
_tmp5_ = (_vala_array_free (_tmp5_, _tmp5__length1, (GDestroyNotify) g_free), NULL);
if (G_UNLIKELY (_inner_error_ != NULL)) {
goto __catch3_g_error;
}
}
goto __finally3;
__catch3_g_error:
{
GError* e = NULL;
FILE* _tmp8_ = NULL;
GError* _tmp9_ = NULL;
const gchar* _tmp10_ = NULL;
e = _inner_error_;
_inner_error_ = NULL;
_tmp8_ = stderr;
_tmp9_ = e;
_tmp10_ = _tmp9_->message;
fprintf (_tmp8_, "Failed to reboot: %s\n", _tmp10_);
_g_error_free0 (e);
}
__finally3:
if (G_UNLIKELY (_inner_error_ != NULL)) {
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);
g_clear_error (&_inner_error_);
return;
}
}
static void ulti_action_menu_preferences (UltiActionMenu* self) {
g_return_if_fail (self != NULL);
}
static void _ulti_action_menu_shutdown_gtk_button_clicked (GtkButton* _sender, gpointer self) {
ulti_action_menu_shutdown ((UltiActionMenu*) self);
}
static void _ulti_action_menu_reboot_gtk_button_clicked (GtkButton* _sender, gpointer self) {
ulti_action_menu_reboot ((UltiActionMenu*) self);
}
static void _ulti_action_menu_preferences_gtk_button_clicked (GtkButton* _sender, gpointer self) {
ulti_action_menu_preferences ((UltiActionMenu*) self);
}
UltiActionMenu* ulti_action_menu_construct (GType object_type) {
UltiActionMenu * self = NULL;
GtkButton* _tmp0_ = NULL;
GtkButton* _tmp1_ = NULL;
GtkButton* _tmp2_ = NULL;
GtkButton* _tmp3_ = NULL;
GtkButton* _tmp4_ = NULL;
GtkButton* _tmp5_ = NULL;
GtkBox* _tmp6_ = NULL;
GtkLabel* _tmp7_ = NULL;
GtkBox* _tmp8_ = NULL;
GtkButton* _tmp9_ = NULL;
GtkBox* _tmp10_ = NULL;
GtkButton* _tmp11_ = NULL;
GtkBox* _tmp12_ = NULL;
GtkButton* _tmp13_ = NULL;
GtkBox* _tmp14_ = NULL;
self = (UltiActionMenu*) g_object_new (object_type, NULL);
gtk_window_set_decorated ((GtkWindow*) self, FALSE);
gtk_window_set_skip_pager_hint ((GtkWindow*) self, TRUE);
gtk_window_set_skip_taskbar_hint ((GtkWindow*) self, TRUE);
gtk_window_set_keep_above ((GtkWindow*) self, TRUE);
gtk_window_stick ((GtkWindow*) self);
gtk_window_set_position ((GtkWindow*) self, GTK_WIN_POS_CENTER_ALWAYS);
gtk_window_maximize ((GtkWindow*) self);
_tmp0_ = self->priv->btn_shutdown;
gtk_button_set_label (_tmp0_, "Shutdown");
_tmp1_ = self->priv->btn_shutdown;
g_signal_connect_object (_tmp1_, "clicked", (GCallback) _ulti_action_menu_shutdown_gtk_button_clicked, self, 0);
_tmp2_ = self->priv->btn_reboot;
gtk_button_set_label (_tmp2_, "Reboot");
_tmp3_ = self->priv->btn_reboot;
g_signal_connect_object (_tmp3_, "clicked", (GCallback) _ulti_action_menu_reboot_gtk_button_clicked, self, 0);
_tmp4_ = self->priv->btn_preferences;
gtk_button_set_label (_tmp4_, "Preferences");
_tmp5_ = self->priv->btn_preferences;
g_signal_connect_object (_tmp5_, "clicked", (GCallback) _ulti_action_menu_preferences_gtk_button_clicked, self, 0);
_tmp6_ = self->priv->box;
_tmp7_ = self->priv->label;
gtk_box_pack_start (_tmp6_, (GtkWidget*) _tmp7_, TRUE, TRUE, (guint) 0);
_tmp8_ = self->priv->box;
_tmp9_ = self->priv->btn_shutdown;
gtk_box_pack_start (_tmp8_, (GtkWidget*) _tmp9_, TRUE, TRUE, (guint) 0);
_tmp10_ = self->priv->box;
_tmp11_ = self->priv->btn_reboot;
gtk_box_pack_start (_tmp10_, (GtkWidget*) _tmp11_, TRUE, TRUE, (guint) 0);
_tmp12_ = self->priv->box;
_tmp13_ = self->priv->btn_preferences;
gtk_box_pack_start (_tmp12_, (GtkWidget*) _tmp13_, TRUE, TRUE, (guint) 0);
_tmp14_ = self->priv->box;
gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp14_);
gtk_container_set_border_width ((GtkContainer*) self, (guint) 3);
return self;
}
UltiActionMenu* ulti_action_menu_new (void) {
return ulti_action_menu_construct (ULTI_TYPE_ACTION_MENU);
}
static void ulti_action_menu_class_init (UltiActionMenuClass * klass) {
ulti_action_menu_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (UltiActionMenuPrivate));
G_OBJECT_CLASS (klass)->finalize = ulti_action_menu_finalize;
}
static void ulti_action_menu_instance_init (UltiActionMenu * self) {
GtkBox* _tmp0_ = NULL;
GtkButton* _tmp1_ = NULL;
GtkButton* _tmp2_ = NULL;
GtkButton* _tmp3_ = NULL;
GtkLabel* _tmp4_ = NULL;
GSubprocessLauncher* _tmp5_ = NULL;
self->priv = ULTI_ACTION_MENU_GET_PRIVATE (self);
_tmp0_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 3);
g_object_ref_sink (_tmp0_);
self->priv->box = _tmp0_;
_tmp1_ = (GtkButton*) gtk_button_new ();
g_object_ref_sink (_tmp1_);
self->priv->btn_shutdown = _tmp1_;
_tmp2_ = (GtkButton*) gtk_button_new ();
g_object_ref_sink (_tmp2_);
self->priv->btn_reboot = _tmp2_;
_tmp3_ = (GtkButton*) gtk_button_new ();
g_object_ref_sink (_tmp3_);
self->priv->btn_preferences = _tmp3_;
_tmp4_ = (GtkLabel*) gtk_label_new ("IceBerg OS Action Menu");
g_object_ref_sink (_tmp4_);
self->priv->label = _tmp4_;
_tmp5_ = g_subprocess_launcher_new (G_SUBPROCESS_FLAGS_NONE);
self->priv->processL = _tmp5_;
}
static void ulti_action_menu_finalize (GObject* obj) {
UltiActionMenu * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, ULTI_TYPE_ACTION_MENU, UltiActionMenu);
_g_object_unref0 (self->priv->box);
_g_object_unref0 (self->priv->btn_shutdown);
_g_object_unref0 (self->priv->btn_reboot);
_g_object_unref0 (self->priv->btn_preferences);
_g_object_unref0 (self->priv->label);
_g_object_unref0 (self->priv->processL);
G_OBJECT_CLASS (ulti_action_menu_parent_class)->finalize (obj);
}
GType ulti_action_menu_get_type (void) {
static volatile gsize ulti_action_menu_type_id__volatile = 0;
if (g_once_init_enter (&ulti_action_menu_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (UltiActionMenuClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ulti_action_menu_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UltiActionMenu), 0, (GInstanceInitFunc) ulti_action_menu_instance_init, NULL };
GType ulti_action_menu_type_id;
ulti_action_menu_type_id = g_type_register_static (gtk_window_get_type (), "UltiActionMenu", &g_define_type_info, 0);
g_once_init_leave (&ulti_action_menu_type_id__volatile, ulti_action_menu_type_id);
}
return ulti_action_menu_type_id__volatile;
}
static void ulti_ultipost_timer (UltiUltipost* self) {
GDateTime* now = NULL;
GDateTime* _tmp0_ = NULL;
gchar* t = NULL;
gchar* _tmp1_ = NULL;
GtkToggleButton* _tmp2_ = NULL;
g_return_if_fail (self != NULL);
_tmp0_ = g_date_time_new_now_local ();
now = _tmp0_;
_tmp1_ = g_date_time_format (now, "%H:%M");
t = _tmp1_;
_tmp2_ = self->Action;
gtk_button_set_label ((GtkButton*) _tmp2_, t);
_g_free0 (t);
_g_date_time_unref0 (now);
}
static void ulti_ultipost_launch_toggle (UltiUltipost* self) {
UltiUltiPanel* _tmp0_ = NULL;
UltiUltiLaunch* _tmp1_ = NULL;
gboolean _tmp2_ = FALSE;
gboolean _tmp3_ = FALSE;
g_return_if_fail (self != NULL);
_tmp0_ = self->p;
_tmp0_->has_activated = TRUE;
_tmp1_ = ulti_ulti_panel_launcher;
_tmp2_ = gtk_widget_get_visible ((GtkWidget*) _tmp1_);
_tmp3_ = _tmp2_;
if (_tmp3_) {
UltiUltiLaunch* _tmp4_ = NULL;
_tmp4_ = ulti_ulti_panel_launcher;
ulti_ulti_launch_vanish (_tmp4_);
} else {
UltiUltiLaunch* _tmp5_ = NULL;
_tmp5_ = ulti_ulti_panel_launcher;
ulti_ulti_launch_appear (_tmp5_);
}
}
static void ulti_ultipost_action_toggle (UltiUltipost* self) {
UltiActionMenu* _tmp0_ = NULL;
gboolean _tmp1_ = FALSE;
gboolean _tmp2_ = FALSE;
g_return_if_fail (self != NULL);
_tmp0_ = self->action;
_tmp1_ = gtk_widget_get_visible ((GtkWidget*) _tmp0_);
_tmp2_ = _tmp1_;
if (_tmp2_) {
UltiActionMenu* _tmp3_ = NULL;
_tmp3_ = self->action;
ulti_action_menu_vanish (_tmp3_);
} else {
UltiActionMenu* _tmp4_ = NULL;
_tmp4_ = self->action;
ulti_action_menu_appear (_tmp4_);
}
}
static gpointer _g_object_ref0 (gpointer self) {
return self ? g_object_ref (self) : NULL;
}
static void _ulti_ultipost_launch_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
ulti_ultipost_launch_toggle ((UltiUltipost*) self);
}
static void _ulti_ultipost_action_toggle_gtk_toggle_button_toggled (GtkToggleButton* _sender, gpointer self) {
ulti_ultipost_action_toggle ((UltiUltipost*) self);
}
UltiUltipost* ulti_ultipost_construct (GType object_type, GtkWidget* BtnTask, UltiUltiPanel* panel) {
UltiUltipost * self = NULL;
UltiUltiPanel* _tmp0_ = NULL;
UltiUltiPanel* _tmp1_ = NULL;
GtkBox* _tmp2_ = NULL;
GtkBox* _tmp3_ = NULL;
GtkWidget* _tmp4_ = NULL;
GtkBox* _tmp5_ = NULL;
GtkToggleButton* _tmp6_ = NULL;
GtkBox* _tmp7_ = NULL;
GtkToggleButton* _tmp8_ = NULL;
GtkToggleButton* _tmp9_ = NULL;
GtkToggleButton* _tmp10_ = NULL;
GtkBox* _tmp11_ = NULL;
GtkLabel* _tmp12_ = NULL;
g_return_val_if_fail (BtnTask != NULL, NULL);
g_return_val_if_fail (panel != NULL, NULL);
self = (UltiUltipost*) g_object_new (object_type, NULL);
_tmp0_ = panel;
_tmp1_ = _g_object_ref0 (_tmp0_);
_g_object_unref0 (self->p);
self->p = _tmp1_;
_tmp2_ = self->priv->box;
gtk_container_add ((GtkContainer*) self, (GtkWidget*) _tmp2_);
_tmp3_ = self->priv->box;
_tmp4_ = BtnTask;
gtk_box_pack_start (_tmp3_, _tmp4_, FALSE, FALSE, (guint) 0);
_tmp5_ = self->priv->box;
_tmp6_ = self->Launch;
gtk_box_pack_start (_tmp5_, (GtkWidget*) _tmp6_, FALSE, FALSE, (guint) 0);
_tmp7_ = self->priv->box;
_tmp8_ = self->Action;
gtk_box_pack_end (_tmp7_, (GtkWidget*) _tmp8_, FALSE, FALSE, (guint) 0);
_tmp9_ = self->Launch;
g_signal_connect_object (_tmp9_, "toggled", (GCallback) _ulti_ultipost_launch_toggle_gtk_toggle_button_toggled, self, 0);
_tmp10_ = self->Action;
g_signal_connect_object (_tmp10_, "toggled", (GCallback) _ulti_ultipost_action_toggle_gtk_toggle_button_toggled, self, 0);
_tmp11_ = self->priv->box;
_tmp12_ = self->priv->time_dis;
gtk_box_pack_end (_tmp11_, (GtkWidget*) _tmp12_, FALSE, FALSE, (guint) 0);
g_timeout_add_full (G_PRIORITY_DEFAULT, (guint) 1000, (GSourceFunc) ulti_ultipost_timer, g_object_ref (self), NULL);
ulti_ultipost_timer (self);
gtk_widget_show_all ((GtkWidget*) self);
return self;
}
UltiUltipost* ulti_ultipost_new (GtkWidget* BtnTask, UltiUltiPanel* panel) {
return ulti_ultipost_construct (ULTI_TYPE_ULTIPOST, BtnTask, panel);
}
static void ulti_ultipost_class_init (UltiUltipostClass * klass) {
ulti_ultipost_parent_class = g_type_class_peek_parent (klass);
g_type_class_add_private (klass, sizeof (UltiUltipostPrivate));
G_OBJECT_CLASS (klass)->finalize = ulti_ultipost_finalize;
}
static void ulti_ultipost_instance_init (UltiUltipost * self) {
GtkToggleButton* _tmp0_ = NULL;
GtkToggleButton* _tmp1_ = NULL;
GtkBox* _tmp2_ = NULL;
GtkLabel* _tmp3_ = NULL;
UltiActionMenu* _tmp4_ = NULL;
self->priv = ULTI_ULTIPOST_GET_PRIVATE (self);
_tmp0_ = (GtkToggleButton*) gtk_toggle_button_new_with_label ("Launcher");
g_object_ref_sink (_tmp0_);
self->Launch = _tmp0_;
_tmp1_ = (GtkToggleButton*) gtk_toggle_button_new ();
g_object_ref_sink (_tmp1_);
self->Action = _tmp1_;
_tmp2_ = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
g_object_ref_sink (_tmp2_);
self->priv->box = _tmp2_;
_tmp3_ = (GtkLabel*) gtk_label_new ("");
g_object_ref_sink (_tmp3_);
self->priv->time_dis = _tmp3_;
_tmp4_ = ulti_action_menu_new ();
g_object_ref_sink (_tmp4_);
self->action = _tmp4_;
}
static void ulti_ultipost_finalize (GObject* obj) {
UltiUltipost * self;
self = G_TYPE_CHECK_INSTANCE_CAST (obj, ULTI_TYPE_ULTIPOST, UltiUltipost);
_g_object_unref0 (self->Launch);
_g_object_unref0 (self->Action);
_g_object_unref0 (self->priv->box);
_g_object_unref0 (self->priv->time_dis);
_g_object_unref0 (self->p);
_g_object_unref0 (self->action);
G_OBJECT_CLASS (ulti_ultipost_parent_class)->finalize (obj);
}
GType ulti_ultipost_get_type (void) {
static volatile gsize ulti_ultipost_type_id__volatile = 0;
if (g_once_init_enter (&ulti_ultipost_type_id__volatile)) {
static const GTypeInfo g_define_type_info = { sizeof (UltiUltipostClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) ulti_ultipost_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (UltiUltipost), 0, (GInstanceInitFunc) ulti_ultipost_instance_init, NULL };
GType ulti_ultipost_type_id;
ulti_ultipost_type_id = g_type_register_static (gtk_bin_get_type (), "UltiUltipost", &g_define_type_info, 0);
g_once_init_leave (&ulti_ultipost_type_id__volatile, ulti_ultipost_type_id);
}
return ulti_ultipost_type_id__volatile;
}
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
if ((array != NULL) && (destroy_func != NULL)) {
int i;
for (i = 0; i < array_length; i = i + 1) {
if (((gpointer*) array)[i] != NULL) {
destroy_func (((gpointer*) array)[i]);
}
}
}
}
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
_vala_array_destroy (array, array_length, destroy_func);
g_free (array);
}