[gtk/wip/sadiq/buildable-2080] builderparser: Allow bind-source without bind-property



commit 062702e77f3f87b066ddf268fad739e4d23112cf
Author: Mohammed Sadiq <sadiq sadiqpk org>
Date:   Wed Aug 7 07:42:03 2019 +0530

    builderparser: Allow bind-source without bind-property
    
    This allow users to bind same property of two objects with only
    specifing “name” and “bind-source” in UI file.
    
    See https://gitlab.gnome.org/GNOME/gtk/issues/2080

 gtk/gtkbuilderparser.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkbuilderparser.c b/gtk/gtkbuilderparser.c
index fc1c80db28..8a5a1608d6 100644
--- a/gtk/gtkbuilderparser.c
+++ b/gtk/gtkbuilderparser.c
@@ -598,7 +598,7 @@ parse_property (ParserData   *data,
 
   g_markup_parse_context_get_position (data->ctx, &line, &col);
 
-  if (bind_source && bind_property)
+  if (bind_source)
     {
       BindingInfo *binfo;
 
@@ -606,17 +606,17 @@ parse_property (ParserData   *data,
       binfo->target = NULL;
       binfo->target_pspec = pspec;
       binfo->source = g_strdup (bind_source);
-      binfo->source_property = g_strdup (bind_property);
+      binfo->source_property = bind_property ? g_strdup (bind_property) : g_strdup (name);
       binfo->flags = bind_flags;
       binfo->line = line;
       binfo->col = col;
 
       object_info->bindings = g_slist_prepend (object_info->bindings, binfo);
     }
-  else if (bind_source || bind_property)
+  else if (bind_property)
     {
       error_missing_attribute (data, element_name,
-                               (bind_source) ? "bind-property" : "bind-source",
+                               "bind-source",
                                error);
       return;
     }
@@ -626,7 +626,7 @@ parse_property (ParserData   *data,
   info->pspec = pspec;
   info->text = g_string_new ("");
   info->translatable = translatable;
-  info->bound = (bind_source && bind_property);
+  info->bound = bind_source != NULL;
   info->context = g_strdup (context);
   info->line = line;
   info->col = col;


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