From a4ffdf03149da2b7fdf1df343a1745eee9ab17ab Mon Sep 17 00:00:00 2001 From: Georges Basile Stavracas Neto Date: Mon, 9 Feb 2015 14:37:34 -0200 Subject: [PATCH] source-dialog: bind title when diting --- src/gcal-source-dialog.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c index f8d1db54..81525990 100644 --- a/src/gcal-source-dialog.c +++ b/src/gcal-source-dialog.c @@ -35,6 +35,7 @@ typedef struct /* flags */ gint mode : 1; ESource *source; + GBinding *title_bind; /* manager */ GcalManager *manager; @@ -227,12 +228,25 @@ gcal_source_dialog_set_mode (GcalSourceDialog *dialog, if (!edit_mode) { + /* Free any bindings left behind */ + if (priv->title_bind != NULL) + { + g_binding_unbind (priv->title_bind); + priv->title_bind = NULL; + } + gtk_window_resize (GTK_WINDOW (dialog), 550, 500); gtk_header_bar_set_title (GTK_HEADER_BAR (priv->headerbar), _("Add Calendar")); gtk_header_bar_set_subtitle (GTK_HEADER_BAR (priv->headerbar), ""); } else { + /* bind title when nothing is binded */ + if (priv->title_bind == NULL) + { + priv->title_bind = g_object_bind_property (priv->name_entry, "text", priv->headerbar, "title", + G_BINDING_DEFAULT); + } gtk_window_resize (GTK_WINDOW (dialog), 550, 250); } }