[gnome-builder/wip/libide-merge] add • to signify m odify



commit d36f5fad5fbb7c89e70bef2ad8fc5b4af5d77018
Author: Christian Hergert <christian hergert me>
Date:   Sat Mar 21 15:08:34 2015 -0700

    add • to signify modify

 data/ui/gb-view-stack.ui          |   23 +++++++++++++++++++++--
 src/views/gb-view-stack-private.h |    2 ++
 src/views/gb-view-stack.c         |    8 ++++++++
 3 files changed, 31 insertions(+), 2 deletions(-)
---
diff --git a/data/ui/gb-view-stack.ui b/data/ui/gb-view-stack.ui
index e1bb205..860dc47 100644
--- a/data/ui/gb-view-stack.ui
+++ b/data/ui/gb-view-stack.ui
@@ -73,9 +73,28 @@
                       <class name="text-button"/>
                     </style>
                     <child>
-                      <object class="GtkLabel" id="title_label">
+                      <object class="GtkBox">
+                        <property name="spacing">6</property>
                         <property name="visible">true</property>
-                        <property name="width-chars">30</property>
+                        <property name="width-request">300</property>
+                        <child type="center">
+                          <object class="GtkLabel" id="title_label">
+                            <property name="hexpand">false</property>
+                            <property name="visible">true</property>
+                          </object>
+                        </child>
+                        <child>
+                          <object class="GtkLabel" id="modified_label">
+                            <property name="halign">fill</property>
+                            <property name="hexpand">true</property>
+                            <property name="xalign">0.0</property>
+                            <property name="label">•</property>
+                            <property name="visible">false</property>
+                          </object>
+                          <packing>
+                            <property name="pack-type">end</property>
+                          </packing>
+                        </child>
                       </object>
                     </child>
                   </object>
diff --git a/src/views/gb-view-stack-private.h b/src/views/gb-view-stack-private.h
index 72e6623..b1d2456 100644
--- a/src/views/gb-view-stack-private.h
+++ b/src/views/gb-view-stack-private.h
@@ -34,6 +34,7 @@ struct _GbViewStack
   /* Weak references */
   GtkWidget          *active_view;
   IdeContext         *context;
+  GBinding           *modified_binding;
   GBinding           *title_binding;
 
   /* Template references */
@@ -42,6 +43,7 @@ struct _GbViewStack
   GtkMenuButton      *document_button;
   GtkButton          *go_backward;
   GtkButton          *go_forward;
+  GtkLabel           *modified_label;
   GtkPopover         *popover;
   GtkStack           *stack;
   GtkLabel           *title_label;
diff --git a/src/views/gb-view-stack.c b/src/views/gb-view-stack.c
index 90a4033..58dff71 100644
--- a/src/views/gb-view-stack.c
+++ b/src/views/gb-view-stack.c
@@ -384,6 +384,7 @@ gb_view_stack_class_init (GbViewStackClass *klass)
   GB_WIDGET_CLASS_BIND (klass, GbViewStack, document_button);
   GB_WIDGET_CLASS_BIND (klass, GbViewStack, go_backward);
   GB_WIDGET_CLASS_BIND (klass, GbViewStack, go_forward);
+  GB_WIDGET_CLASS_BIND (klass, GbViewStack, modified_label);
   GB_WIDGET_CLASS_BIND (klass, GbViewStack, popover);
   GB_WIDGET_CLASS_BIND (klass, GbViewStack, stack);
   GB_WIDGET_CLASS_BIND (klass, GbViewStack, title_label);
@@ -431,6 +432,9 @@ gb_view_stack_set_active_view (GbViewStack *self,
           if (self->title_binding)
             g_binding_unbind (self->title_binding);
           ide_clear_weak_pointer (&self->title_binding);
+          if (self->modified_binding)
+            g_binding_unbind (self->modified_binding);
+          ide_clear_weak_pointer (&self->modified_binding);
           gtk_label_set_label (self->title_label, NULL);
           ide_clear_weak_pointer (&self->active_view);
           gtk_widget_hide (GTK_WIDGET (self->controls_stack));
@@ -451,6 +455,10 @@ gb_view_stack_set_active_view (GbViewStack *self,
                                             self->title_label, "label",
                                             G_BINDING_SYNC_CREATE);
           ide_set_weak_pointer (&self->title_binding, binding);
+          binding = g_object_bind_property (active_view, "modified",
+                                            self->modified_label, "visible",
+                                            G_BINDING_SYNC_CREATE);
+          ide_set_weak_pointer (&self->modified_binding, binding);
           ide_set_weak_pointer (&self->active_view, active_view);
           controls = gb_view_get_controls (GB_VIEW (active_view));
           if (controls)


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