From bee7b6fa1c55185c1df4566621e6057f220567ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erick=20P=C3=A9rez=20Castellanos?= Date: Tue, 23 Sep 2014 10:13:57 -0400 Subject: [PATCH] build: rename instance variable and add docs --- src/gcal-application.c | 15 ++++++++------- src/gcal-window.c | 14 +++++++++++++- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/gcal-application.c b/src/gcal-application.c index 4b1ec90e..16307b3a 100644 --- a/src/gcal-application.c +++ b/src/gcal-application.c @@ -32,7 +32,7 @@ typedef struct { GtkWidget *window; - GSimpleAction *view; + GSimpleAction *view_action; GSettings *settings; GcalManager *manager; @@ -145,9 +145,10 @@ gcal_application_activate (GApplication *application) g_object_bind_property (priv->window, "new-event-mode", - priv->view, + priv->view_action, "enabled", - G_BINDING_DEFAULT | G_BINDING_INVERT_BOOLEAN); + G_BINDING_DEFAULT | + G_BINDING_INVERT_BOOLEAN); gtk_widget_show_all (priv->window); } @@ -254,14 +255,14 @@ gcal_application_set_app_menu (GApplication *app) g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (search)); g_menu_append (app_menu, _("Search"), "app.search"); - priv->view = g_simple_action_new_stateful ( + priv->view_action = g_simple_action_new_stateful ( "view", G_VARIANT_TYPE_STRING, g_settings_get_value (priv->settings, "active-view")); - g_signal_connect (priv->view, "activate", + g_signal_connect (priv->view_action, "activate", G_CALLBACK (gcal_application_change_view), app); - g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (priv->view)); + g_action_map_add_action ( G_ACTION_MAP (app), G_ACTION (priv->view_action)); view_as = g_menu_new (); g_menu_append (view_as, _("Day"), "app.view::day"); @@ -392,7 +393,7 @@ gcal_application_changed_view (GSettings *settings, GcalApplicationPrivate *priv; priv = gcal_application_get_instance_private (GCAL_APPLICATION (user_data)); - g_simple_action_set_state (priv->view, + g_simple_action_set_state (priv->view_action, g_settings_get_value (priv->settings, "active-view")); } diff --git a/src/gcal-window.c b/src/gcal-window.c index e4b3d222..c9c3f7f8 100644 --- a/src/gcal-window.c +++ b/src/gcal-window.c @@ -389,6 +389,9 @@ save_geometry (gpointer user_data) * @window: * * Calling update view on the active view + * For the view: + * - update the date the view will present + * - recreate the child widgets representing the events for that date **/ static void update_view (GcalWindow *window) @@ -428,6 +431,15 @@ update_view (GcalWindow *window) g_free (header); } +/** + * view_changed: + * @object: + * @pspec: + * @user_data: + * + * Retrieve the enum value representing the view, update internal + * @active_view with it and call @update_view + **/ static void view_changed (GObject *object, GParamSpec *pspec, @@ -472,7 +484,7 @@ set_new_event_mode (GcalWindow *window, priv->new_event_mode = enabled; g_object_notify (G_OBJECT (window), "new-event-mode"); - if (! enabled) + if (! enabled && priv->views[priv->active_view] != NULL) gcal_view_clear_marks (GCAL_VIEW (priv->views[priv->active_view])); /* XXX: here we could disable clicks from the views, yet */