[gnome-calendar] Reorganized GcalApplication source-file.
- From: Erick PÃrez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] Reorganized GcalApplication source-file.
- Date: Wed, 11 Jul 2012 14:51:38 +0000 (UTC)
commit 89a941ec36df3073417d77602d7efb7b519163b9
Author: Erick PÃrez Castellanos <erick red gmail com>
Date: Sat Jul 7 22:55:55 2012 -0400
Reorganized GcalApplication source-file.
Connected settings to GcalWindow property.
src/gcal-application.c | 76 +++++++++++++++++++++++++++++++-----------------
1 files changed, 49 insertions(+), 27 deletions(-)
---
diff --git a/src/gcal-application.c b/src/gcal-application.c
index 4993e52..e664d85 100644
--- a/src/gcal-application.c
+++ b/src/gcal-application.c
@@ -37,9 +37,14 @@ struct _GcalApplicationPrivate
GtkCssProvider *provider;
};
-static void gcal_application_startup (GApplication *app);
+static void gcal_application_finalize (GObject *object);
+
+static void gcal_application_activate (GApplication *app);
+
+static void gcal_application_startup (GApplication *app);
static void gcal_application_set_app_menu (GApplication *app);
+
static void gcal_application_show_about (GSimpleAction *simple,
GVariant *parameter,
gpointer user_data);
@@ -50,29 +55,19 @@ static void gcal_application_quit (GSimpleAction *simple,
G_DEFINE_TYPE (GcalApplication, gcal_application, GTK_TYPE_APPLICATION);
static void
-gcal_application_activate (GApplication *application)
+gcal_application_class_init (GcalApplicationClass *klass)
{
- GcalApplicationPrivate *priv;
- priv = GCAL_APPLICATION (application)->priv;
+ GApplicationClass *application_class;
+ GObjectClass *object_class;
- if (priv->window != NULL)
- gtk_window_present (GTK_WINDOW (priv->window));
- else
- {
- priv->window = gcal_window_new (GCAL_APPLICATION (application));
- g_settings_bind (priv->settings,
- "active-view",
- priv->window,
- "active-view",
- G_SETTINGS_BIND_SET | G_SETTINGS_BIND_GET
- | G_SETTINGS_BIND_GET_NO_CHANGES);
- gtk_window_set_title (GTK_WINDOW (priv->window), _("Calendar"));
- gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (priv->window),
- TRUE);
+ application_class = G_APPLICATION_CLASS (klass);
+ application_class->activate = gcal_application_activate;
+ application_class->startup = gcal_application_startup;
- gtk_window_maximize (GTK_WINDOW (priv->window));
- gtk_widget_show_all (priv->window);
- }
+ object_class = G_OBJECT_CLASS (klass);
+ object_class->finalize = gcal_application_finalize;
+
+ g_type_class_add_private ((gpointer) klass, sizeof(GcalApplicationPrivate));
}
static void
@@ -86,18 +81,44 @@ gcal_application_init (GcalApplication *self)
static void
gcal_application_finalize (GObject *object)
{
- G_OBJECT_CLASS (gcal_application_parent_class)->finalize (object);
+ GcalApplicationPrivate *priv;
+
+ g_return_if_fail (GCAL_IS_APPLICATION (object));
+ priv = GCAL_APPLICATION (object)->priv;
+
+ if (priv->settings != NULL)
+ g_clear_object (&(priv->settings));
+
+ if (G_OBJECT_CLASS (gcal_application_parent_class)->finalize != NULL)
+ G_OBJECT_CLASS (gcal_application_parent_class)->finalize (object);
}
static void
-gcal_application_class_init (GcalApplicationClass *klass)
+gcal_application_activate (GApplication *application)
{
- G_APPLICATION_CLASS (klass)->activate = gcal_application_activate;
- G_APPLICATION_CLASS (klass)->startup = gcal_application_startup;
+ GcalApplicationPrivate *priv;
+ priv = GCAL_APPLICATION (application)->priv;
- G_OBJECT_CLASS (klass)->finalize = gcal_application_finalize;
+ if (priv->window != NULL)
+ {
+ gtk_window_present (GTK_WINDOW (priv->window));
+ }
+ else
+ {
+ priv->window = gcal_window_new (GCAL_APPLICATION (application));
+ g_settings_bind (priv->settings,
+ "active-view",
+ priv->window,
+ "active-view",
+ G_SETTINGS_BIND_SET | G_SETTINGS_BIND_GET
+ | G_SETTINGS_BIND_GET_NO_CHANGES);
+ gtk_window_set_title (GTK_WINDOW (priv->window), _("Calendar"));
+ gtk_window_set_hide_titlebar_when_maximized (GTK_WINDOW (priv->window),
+ TRUE);
- g_type_class_add_private ((gpointer) klass, sizeof(GcalApplicationPrivate));
+ gtk_window_maximize (GTK_WINDOW (priv->window));
+ gtk_widget_show_all (priv->window);
+ }
}
static void
@@ -181,6 +202,7 @@ gcal_application_quit (GSimpleAction *simple,
g_application_quit (app);
}
+/* Public API */
GcalApplication*
gcal_application_new (void)
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]