42
45
void gpump_app_class_init (GPumpAppClass * klass);
43
46
void gpump_app_activate (GApplication * application);
44
47
void gpump_app_init (GPumpApp * self);
48
void gpump_app_dispose (GObject * object);
46
50
void _prepere_window (GPumpApp * self);
47
51
void _prepere_gear_menu (GPumpApp * self);
68
72
void gpump_app_init (GPumpApp * self) {
69
73
g_print ("init\n");
70
75
self->priv = GPUMP_APP_GET_PRIVATE (self);
77
/* We have to keep an instance of GPumpSettigsData alive
78
* It is later freed in *_dispose ()
80
* Keep in mind that when ever an instance of GPumpSettingsData is
81
* gotten it _will_ run g_object_ref () on it, meaning that it has to be
84
* When the GPumpApp is disposed of the last reference should be freed.
86
self->priv->settings = gpump_settings_data_get_default ();
74
89
void gpump_app_class_init (GPumpAppClass * klass) {
75
90
g_print("GPumpApp class init.\n");
77
// GObject * object_class = G_OBJECT_CLASS (klass);
92
g_type_class_add_private (klass, sizeof(GPumpAppPrivate));
78
94
GApplicationClass * application_class = G_APPLICATION_CLASS (klass);
80
96
application_class->activate = gpump_app_activate;
82
g_type_class_add_private (klass, sizeof(GPumpAppPrivate));
98
GObjectClass * object_class = G_OBJECT_CLASS (application_class);
99
object_class->dispose = gpump_app_dispose;
84
101
g_print ("GPumpApp class init done.\n");
104
void gpump_app_dispose (GObject * object) {
105
g_print ("Disponsing of Application...\n");
107
GPumpApp * self = GPUMP_APP (object);
109
/* Dispose of the widgets... */
111
/* Dispose of the GPumpSettingsData object */
112
g_object_unref (self->priv->settings);
114
if (self->priv->settings) {
115
g_print ("there was a dangling reference to GPumpSettingsData somewhare,"
116
"pleace check that all \"*_get_default_instance ()\" calles have"
117
"an g_object_unref () at the end of the scope!\n");
120
G_OBJECT_CLASS (gpump_app_parent_class)->dispose (object);
88
123
void gpump_app_activate (GApplication * application) {
89
124
g_print ("GPumpApp activate.\n");
105
140
_prepere_refresh_button (GPUMP_APP (application));
107
142
/* Init the settings object */
108
GPumpSettingsData * settings = gpump_settings_data_get_default ();
111
145
gtk_widget_show_all (GTK_WIDGET(GPUMP_APP(application)->priv->window));
113
g_object_unref (G_OBJECT(settings));
115
148
g_print ("done GPumpApp activate.\n");