[gnome-builder] prefs: denote snippet view is currently read-only
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] prefs: denote snippet view is currently read-only
- Date: Mon, 31 Aug 2015 10:07:37 +0000 (UTC)
commit 2db90647723bffde28ce32f9e51de49714785505
Author: Christian Hergert <christian hergert me>
Date: Mon Aug 31 03:07:30 2015 -0700
prefs: denote snippet view is currently read-only
data/ui/gb-editor-settings-widget.ui | 2 +-
src/editor/gb-editor-settings-widget.c | 23 +++++++++++++++++++----
2 files changed, 20 insertions(+), 5 deletions(-)
---
diff --git a/data/ui/gb-editor-settings-widget.ui b/data/ui/gb-editor-settings-widget.ui
index 8ee12fa..f57905d 100644
--- a/data/ui/gb-editor-settings-widget.ui
+++ b/data/ui/gb-editor-settings-widget.ui
@@ -254,7 +254,7 @@
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
- <property name="label" translatable="yes">Snippets</property>
+ <property name="label" translatable="yes">Snippets (read-only)</property>
<property name="margin-bottom">6</property>
<attributes>
<attribute name="weight" value="bold" />
diff --git a/src/editor/gb-editor-settings-widget.c b/src/editor/gb-editor-settings-widget.c
index fb44aea..28832a0 100644
--- a/src/editor/gb-editor-settings-widget.c
+++ b/src/editor/gb-editor-settings-widget.c
@@ -178,6 +178,20 @@ gb_editor_settings_widget_set_language (GbEditorSettingsWidget *widget,
}
}
+static gboolean
+transform_title_func (GBinding *binding,
+ const GValue *from_value,
+ GValue *to_value,
+ gpointer user_data)
+{
+ gchar *title;
+
+ title = g_strdup_printf (_("%s (read-only)"), g_value_get_string (from_value));
+ g_value_take_string (to_value, title);
+
+ return TRUE;
+}
+
static void
snippet_activated_cb (GbEditorSettingsWidget *self,
GtkListBoxRow *row,
@@ -200,7 +214,6 @@ snippet_activated_cb (GbEditorSettingsWidget *self,
snippet = g_object_get_data (G_OBJECT (row), "SNIPPET");
window = g_object_new (GTK_TYPE_WINDOW,
- "title", "Edit Snippet",
"default-width", 600,
"default-height", 400,
"transient-for", toplevel,
@@ -211,9 +224,11 @@ snippet_activated_cb (GbEditorSettingsWidget *self,
"show-close-button", TRUE,
"visible", TRUE,
NULL);
- g_object_bind_property (snippet, "trigger",
- header_bar, "title",
- G_BINDING_SYNC_CREATE);
+ g_object_bind_property_full (snippet, "trigger",
+ header_bar, "title",
+ G_BINDING_SYNC_CREATE,
+ transform_title_func,
+ NULL, NULL, NULL);
gtk_window_set_titlebar (window, GTK_WIDGET (header_bar));
scroller = g_object_new (GTK_TYPE_SCROLLED_WINDOW,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]