[gnome-calendar] gcal-window: ordered according to HACKING
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] gcal-window: ordered according to HACKING
- Date: Thu, 4 Dec 2014 22:26:21 +0000 (UTC)
commit 6b7e27a115355c15cd18bdce265ac841582d5745
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Sat Jun 22 23:37:16 2013 -0400
gcal-window: ordered according to HACKING
Renamed methods
src/gcal-window.c | 180 ++++++++++++++++++++++++++--------------------------
1 files changed, 90 insertions(+), 90 deletions(-)
---
diff --git a/src/gcal-window.c b/src/gcal-window.c
index 1643de6..051555a 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -102,6 +102,10 @@ static void date_updated (GtkButton *b
static void update_view (GcalWindow *window);
+static void view_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data);
+
static void show_new_event_widget (GcalView *view,
gpointer start_span,
gpointer end_span,
@@ -109,6 +113,11 @@ static void show_new_event_widget (GcalView *v
gdouble y,
gpointer user_data);
+static gboolean place_new_event_widget (GtkOverlay *overlay,
+ GtkWidget *child,
+ GdkRectangle *allocation,
+ gpointer user_data);
+
static void gcal_window_constructed (GObject *object);
static void gcal_window_finalize (GObject *object);
@@ -123,15 +132,6 @@ static void gcal_window_get_property (GObject *o
GValue *value,
GParamSpec *pspec);
-static gboolean gcal_window_place_new_event_widget (GtkOverlay *overlay,
- GtkWidget *child,
- GdkRectangle *allocation,
- gpointer user_data);
-
-static void gcal_window_view_changed (GObject *object,
- GParamSpec *pspec,
- gpointer user_data);
-
static void gcal_window_search_toggled (GObject *object,
GParamSpec *pspec,
gpointer user_data);
@@ -286,6 +286,39 @@ update_view (GcalWindow *window)
g_object_set (priv->nav_bar, "right-header", header, NULL);
g_free (header);
}
+static void
+view_changed (GObject *object,
+ GParamSpec *pspec,
+ gpointer user_data)
+{
+ GcalWindowPrivate *priv;
+
+ GcalWindow *window;
+
+ GEnumClass *eklass;
+ GEnumValue *eval;
+ GcalWindowViewType view_type;
+
+ priv = GCAL_WINDOW (user_data)->priv;
+
+ window = GCAL_WINDOW (user_data);
+
+ eklass = g_type_class_ref (gcal_window_view_type_get_type ());
+ eval = g_enum_get_value_by_nick (
+ eklass,
+ gtk_stack_get_visible_child_name (GTK_STACK (priv->views_stack)));
+
+ view_type = eval->value;
+
+ g_type_class_unref (eklass);
+
+ /* Get view_type from widget, or widget-name */
+ priv->active_view = view_type;
+ g_object_notify (G_OBJECT (window), "active-view");
+
+ update_view (GCAL_WINDOW (user_data));
+}
+
/* Second flow new-event flow */
static void
show_new_event_widget (GcalView *view,
@@ -334,6 +367,49 @@ show_new_event_widget (GcalView *view,
priv->new_event_widget);
}
+static gboolean
+place_new_event_widget (GtkOverlay *overlay,
+ GtkWidget *child,
+ GdkRectangle *allocation,
+ gpointer user_data)
+{
+ GcalWindowPrivate *priv;
+ gint nat_width;
+ gint nat_height;
+
+ priv = GCAL_WINDOW (user_data)->priv;
+
+ if (! priv->new_event_mode)
+ return FALSE;
+
+ gtk_widget_get_preferred_width (priv->new_event_widget,
+ NULL,
+ &nat_width);
+ gtk_widget_get_preferred_height_for_width (priv->new_event_widget,
+ nat_width,
+ NULL,
+ &nat_height);
+
+ g_debug ("[allocate-child] incoming value (%d, %d) - (%d, %d)",
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+ g_debug ("[allocate-child] natural size (%d, %d)",
+ nat_width, nat_height);
+ allocation->x = priv->event_creation_data->x;
+ allocation->y = priv->event_creation_data->y;
+ allocation->width = nat_width;
+ allocation->height = nat_height;
+
+ g_debug ("[allocate-child]: outgoing value (%d, %d) - (%d, %d)",
+ allocation->x,
+ allocation->y,
+ allocation->width,
+ allocation->height);
+
+ return TRUE;
+}
static void
gcal_window_class_init(GcalWindowClass *klass)
@@ -553,14 +629,15 @@ gcal_window_constructed (GObject *object)
G_CALLBACK (show_new_event_widget), object);
}
g_signal_connect (priv->views_overlay, "get-child-position",
- G_CALLBACK (gcal_window_place_new_event_widget), object);
- g_signal_connect (priv->views_stack, "notify::visible-child",
- G_CALLBACK (gcal_window_view_changed), object);
+ G_CALLBACK (place_new_event_widget), object);
+
g_signal_connect (priv->search_bar, "notify::search-mode-enabled",
G_CALLBACK (gcal_window_search_toggled), object);
g_signal_connect (priv->search_entry, "changed",
G_CALLBACK (gcal_window_search_changed), object);
+ g_signal_connect (priv->views_stack, "notify::visible-child",
+ G_CALLBACK (view_changed), object);
g_signal_connect (gcal_nav_bar_get_prev_button (GCAL_NAV_BAR (priv->nav_bar)),
"clicked", G_CALLBACK (date_updated), object);
g_signal_connect (gcal_nav_bar_get_next_button (GCAL_NAV_BAR (priv->nav_bar)),
@@ -645,83 +722,6 @@ gcal_window_get_property (GObject *object,
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
}
-static gboolean
-gcal_window_place_new_event_widget (GtkOverlay *overlay,
- GtkWidget *child,
- GdkRectangle *allocation,
- gpointer user_data)
-{
- GcalWindowPrivate *priv;
- gint nat_width;
- gint nat_height;
-
- priv = GCAL_WINDOW (user_data)->priv;
-
- if (child != priv->new_event_widget)
- return FALSE;
-
- gtk_widget_get_preferred_width (priv->new_event_widget,
- NULL,
- &nat_width);
- gtk_widget_get_preferred_height_for_width (priv->new_event_widget,
- nat_width,
- NULL,
- &nat_height);
-
- g_debug ("incoming value (%d, %d) - (%d, %d)",
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
- g_debug ("natural size (%d, %d)",
- nat_width, nat_height);
- allocation->x = 600;
- allocation->y = 600;
- allocation->width = nat_width;
- allocation->height = nat_height;
-
- g_debug ("outgoing value (%d, %d) - (%d, %d)",
- allocation->x,
- allocation->y,
- allocation->width,
- allocation->height);
-
- return TRUE;
-}
-
-static void
-gcal_window_view_changed (GObject *object,
- GParamSpec *pspec,
- gpointer user_data)
-{
- GcalWindowPrivate *priv;
-
- GcalWindow *window;
-
- GEnumClass *eklass;
- GEnumValue *eval;
- GcalWindowViewType view_type;
-
- priv = GCAL_WINDOW (user_data)->priv;
-
- window = GCAL_WINDOW (user_data);
-
- eklass = g_type_class_ref (gcal_window_view_type_get_type ());
- eval = g_enum_get_value_by_nick (
- eklass,
- gtk_stack_get_visible_child_name (GTK_STACK (priv->views_stack)));
-
- view_type = eval->value;
-
- g_type_class_unref (eklass);
-
- /* Get view_type from widget, or widget-name */
- priv->active_view = view_type;
- g_object_notify (G_OBJECT (window), "active-view");
-
- update_view (GCAL_WINDOW (user_data));
-}
-
static void
gcal_window_search_toggled (GObject *object,
GParamSpec *pspec,
@@ -1348,7 +1348,7 @@ gcal_window_new_with_view (GcalApplication *app,
/* init hack */
if (view_type == GCAL_WINDOW_VIEW_DAY)
- gcal_window_view_changed (NULL, NULL, win);
+ view_changed (NULL, NULL, win);
return GTK_WIDGET (win);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]