build: rename instance variable and add docs

This commit is contained in:
Erick Pérez Castellanos
2014-12-04 17:10:34 -05:00
parent 8a3ad4fc98
commit bee7b6fa1c
2 changed files with 21 additions and 8 deletions
+8 -7
View File
@@ -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"));
}
+13 -1
View File
@@ -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 */