[gnome-calendar] source-dialog: bind title when diting



commit a4ffdf03149da2b7fdf1df343a1745eee9ab17ab
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Feb 9 14:37:34 2015 -0200

    source-dialog: bind title when diting

 src/gcal-source-dialog.c |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)
---
diff --git a/src/gcal-source-dialog.c b/src/gcal-source-dialog.c
index f8d1db5..8152599 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);
     }
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]