[gnome-calendar] window: create edit-dialog at construct time
- From: Erick Pérez Castellanos <erickpc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-calendar] window: create edit-dialog at construct time
- Date: Fri, 5 Dec 2014 13:22:52 +0000 (UTC)
commit da19ffd6abadf3e0738c50d2a72b6bda39aa6960
Author: Erick Pérez Castellanos <erick red gmail com>
Date: Thu Dec 4 23:40:19 2014 -0500
window: create edit-dialog at construct time
This isn't as dynamical as one was, so create it at construction will
work just fine, and we have the 'if's.
src/gcal-window.c | 33 +++++++--------------------------
1 files changed, 7 insertions(+), 26 deletions(-)
---
diff --git a/src/gcal-window.c b/src/gcal-window.c
index e9a2c31..9487f35 100644
--- a/src/gcal-window.c
+++ b/src/gcal-window.c
@@ -169,8 +169,6 @@ static void event_activated (GcalView *v
GcalEventWidget *event_widget,
gpointer user_data);
-static void init_edit_dialog (GcalWindow *window);
-
static void edit_dialog_closed (GtkDialog *dialog,
gint response,
gpointer user_data);
@@ -672,9 +670,6 @@ create_event (gpointer user_data,
edata->source = source;
edata->event_component = comp;
- if (priv->edit_dialog == NULL)
- init_edit_dialog (GCAL_WINDOW (user_data));
-
gcal_edit_dialog_set_event_is_new (GCAL_EDIT_DIALOG (priv->edit_dialog),
TRUE);
gcal_edit_dialog_set_event_data (GCAL_EDIT_DIALOG (priv->edit_dialog),
@@ -703,9 +698,6 @@ event_activated (GcalView *view,
priv = gcal_window_get_instance_private (GCAL_WINDOW (user_data));
- if (priv->edit_dialog == NULL)
- init_edit_dialog (GCAL_WINDOW (user_data));
-
data = gcal_event_widget_get_data (event_widget);
gcal_edit_dialog_set_event_is_new (
GCAL_EDIT_DIALOG (priv->edit_dialog),
@@ -719,24 +711,6 @@ event_activated (GcalView *view,
}
static void
-init_edit_dialog (GcalWindow *window)
-{
- GcalWindowPrivate *priv;
-
- priv = gcal_window_get_instance_private (window);
-
- priv->edit_dialog = gcal_edit_dialog_new ();
- gtk_window_set_transient_for (GTK_WINDOW (priv->edit_dialog),
- GTK_WINDOW (window));
- gcal_edit_dialog_set_manager (GCAL_EDIT_DIALOG (priv->edit_dialog),
- priv->manager);
-
- g_signal_connect (priv->edit_dialog,
- "response", G_CALLBACK (edit_dialog_closed),
- window);
-}
-
-static void
edit_dialog_closed (GtkDialog *dialog,
gint response,
gpointer user_data)
@@ -1099,6 +1073,13 @@ gcal_window_constructed (GObject *object)
g_object_unref (builder);
+ /* edit dialog initialization */
+ priv->edit_dialog = gcal_edit_dialog_new ();
+ gtk_window_set_transient_for (GTK_WINDOW (priv->edit_dialog), GTK_WINDOW (object));
+ gcal_edit_dialog_set_manager (GCAL_EDIT_DIALOG (priv->edit_dialog), priv->manager);
+
+ g_signal_connect (priv->edit_dialog, "response", G_CALLBACK (edit_dialog_closed), object);
+
/* search bar */
gtk_search_bar_connect_entry (GTK_SEARCH_BAR (priv->search_bar),
GTK_ENTRY (priv->search_entry));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]