[gnome-builder] editor: connect keybinding mode display name to info widget
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor: connect keybinding mode display name to info widget
- Date: Mon, 30 Mar 2015 00:02:40 +0000 (UTC)
commit ecb7a6a3b2afe1af02ce9dbfb8486e6f7813bcff
Author: Christian Hergert <christian hergert me>
Date: Sun Mar 29 17:02:12 2015 -0700
editor: connect keybinding mode display name to info widget
data/ui/gb-editor-frame.ui | 11 +++++++++++
src/editor/gb-editor-frame-private.h | 1 +
src/editor/gb-editor-frame.c | 22 +++++++++++++++++++++-
3 files changed, 33 insertions(+), 1 deletions(-)
---
diff --git a/data/ui/gb-editor-frame.ui b/data/ui/gb-editor-frame.ui
index 85800b4..b3e262e 100644
--- a/data/ui/gb-editor-frame.ui
+++ b/data/ui/gb-editor-frame.ui
@@ -24,6 +24,17 @@
<property name="position">0</property>
</packing>
</child>
+ <child>
+ <object class="GtkLabel" id="mode_name_label">
+ <property name="margin-start">12</property>
+ <property name="margin-end">3</property>
+ <property name="visible">true</property>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
</object>
</child>
<child type="overlay">
diff --git a/src/editor/gb-editor-frame-private.h b/src/editor/gb-editor-frame-private.h
index 20528d9..df318ba 100644
--- a/src/editor/gb-editor-frame-private.h
+++ b/src/editor/gb-editor-frame-private.h
@@ -32,6 +32,7 @@ struct _GbEditorFrame
GtkBin parent_instance;
NautilusFloatingBar *floating_bar;
+ GtkLabel *mode_name_label;
GtkLabel *overwrite_label;
GtkScrolledWindow *scrolled_window;
GtkRevealer *search_revealer;
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index 461e33f..f55572b 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -200,6 +200,19 @@ search_text_transform_from (GBinding *binding,
return TRUE;
}
+static gboolean
+string_to_boolean (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data)
+{
+ gboolean visible;
+
+ visible = !gb_str_empty0 (g_value_get_string (from_value));
+ g_value_set_boolean (to_value, visible);
+ return TRUE;
+}
+
void
gb_editor_frame_set_document (GbEditorFrame *self,
GbEditorDocument *document)
@@ -235,7 +248,13 @@ gb_editor_frame_set_document (GbEditorFrame *self,
self,
G_CONNECT_SWAPPED);
-
+ g_object_bind_property (self->source_view, "mode-display-name",
+ self->mode_name_label, "label",
+ G_BINDING_SYNC_CREATE);
+ g_object_bind_property_full (self->source_view, "mode-display-name",
+ self->mode_name_label, "visible",
+ G_BINDING_SYNC_CREATE, string_to_boolean, NULL,
+ NULL, NULL);
}
static gboolean
@@ -567,6 +586,7 @@ gb_editor_frame_class_init (GbEditorFrameClass *klass)
GB_WIDGET_CLASS_TEMPLATE (klass, "gb-editor-frame.ui");
GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, floating_bar);
+ GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, mode_name_label);
GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, overwrite_label);
GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, scrolled_window);
GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, search_entry);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]