[gnome-builder] overwrite
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] overwrite
- Date: Tue, 24 Mar 2015 00:24:08 +0000 (UTC)
commit 0ab9936868a4a6ac14801ac8c03719ee20870aec
Author: Christian Hergert <christian hergert me>
Date: Wed Mar 18 16:52:01 2015 -0700
overwrite
data/ui/gb-editor-frame.ui | 12 ++++++++++++
libide/ide-source-view.c | 28 ++++++++++++++++++++++++++++
src/editor/gb-editor-frame-private.h | 1 +
src/editor/gb-editor-frame.c | 3 +++
4 files changed, 44 insertions(+), 0 deletions(-)
---
diff --git a/data/ui/gb-editor-frame.ui b/data/ui/gb-editor-frame.ui
index 288a0ff..4b356a6 100644
--- a/data/ui/gb-editor-frame.ui
+++ b/data/ui/gb-editor-frame.ui
@@ -12,6 +12,18 @@
<property name="primary_label"></property>
<property name="valign">end</property>
<property name="visible">true</property>
+ <child>
+ <object class="GtkLabel" id="overwrite_label">
+ <!-- translators: OVR indicates we are in overwite mode -->
+ <property name="label" translatable="yes">OVR</property>
+ <property name="margin-start">12</property>
+ <property name="visible">false</property>
+ </object>
+ <packing>
+ <property name="pack-type">start</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
</object>
</child>
<child type="overlay">
diff --git a/libide/ide-source-view.c b/libide/ide-source-view.c
index 5082d4a..d7be40c 100644
--- a/libide/ide-source-view.c
+++ b/libide/ide-source-view.c
@@ -164,6 +164,7 @@ enum {
PROP_FONT_NAME,
PROP_FONT_DESC,
PROP_INSERT_MATCHING_BRACE,
+ PROP_OVERWRITE,
PROP_OVERWRITE_BRACES,
PROP_SCROLL_OFFSET,
PROP_SEARCH_CONTEXT,
@@ -3007,6 +3008,7 @@ ide_source_view_real_set_mode (IdeSourceView *self,
overwrite = ide_source_view_mode_get_block_cursor (priv->mode);
if (overwrite != gtk_text_view_get_overwrite (GTK_TEXT_VIEW (self)))
gtk_text_view_set_overwrite (GTK_TEXT_VIEW (self), overwrite);
+ g_object_notify (G_OBJECT (self), "overwrite");
IDE_EXIT;
}
@@ -4296,6 +4298,22 @@ ide_source_view_end_user_action (IdeSourceView *self)
gtk_text_buffer_end_user_action (buffer);
}
+static gboolean
+ide_source_view_get_overwrite (IdeSourceView *self)
+{
+ IdeSourceViewPrivate *priv = ide_source_view_get_instance_private (self);
+
+ g_return_val_if_fail (IDE_IS_SOURCE_VIEW (self), FALSE);
+
+ if (gtk_text_view_get_overwrite (GTK_TEXT_VIEW (self)))
+ {
+ if (!priv->mode || !ide_source_view_mode_get_block_cursor (priv->mode))
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static void
ide_source_view_dispose (GObject *object)
{
@@ -4369,6 +4387,10 @@ ide_source_view_get_property (GObject *object,
g_value_set_boolean (value, ide_source_view_get_insert_matching_brace (self));
break;
+ case PROP_OVERWRITE:
+ g_value_set_boolean (value, ide_source_view_get_overwrite (self));
+ break;
+
case PROP_OVERWRITE_BRACES:
g_value_set_boolean (value, ide_source_view_get_overwrite_braces (self));
break;
@@ -4446,6 +4468,10 @@ ide_source_view_set_property (GObject *object,
ide_source_view_set_insert_matching_brace (self, g_value_get_boolean (value));
break;
+ case PROP_OVERWRITE:
+ gtk_text_view_set_overwrite (GTK_TEXT_VIEW (self), g_value_get_boolean (value));
+ break;
+
case PROP_OVERWRITE_BRACES:
ide_source_view_set_overwrite_braces (self, g_value_get_boolean (value));
break;
@@ -4599,6 +4625,8 @@ ide_source_view_class_init (IdeSourceViewClass *klass)
g_object_class_install_property (object_class, PROP_INSERT_MATCHING_BRACE,
gParamSpecs [PROP_INSERT_MATCHING_BRACE]);
+ g_object_class_override_property (object_class, PROP_OVERWRITE, "overwrite");
+
gParamSpecs [PROP_OVERWRITE_BRACES] =
g_param_spec_boolean ("overwrite-braces",
_("Overwrite Braces"),
diff --git a/src/editor/gb-editor-frame-private.h b/src/editor/gb-editor-frame-private.h
index 65fe097..f789578 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 *overwrite_label;
GtkScrolledWindow *scrolled_window;
GtkRevealer *search_revealer;
GdTaggedEntry *search_entry;
diff --git a/src/editor/gb-editor-frame.c b/src/editor/gb-editor-frame.c
index 9658ecd..e174c2a 100644
--- a/src/editor/gb-editor-frame.c
+++ b/src/editor/gb-editor-frame.c
@@ -209,6 +209,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, overwrite_label);
GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, scrolled_window);
GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, search_entry);
GB_WIDGET_CLASS_BIND (klass, GbEditorFrame, search_revealer);
@@ -238,4 +239,6 @@ gb_editor_frame_init (GbEditorFrame *self)
g_settings_bind_with_mapping (settings, "smart-home-end", self->source_view, "smart-home-end",
G_SETTINGS_BIND_GET, get_smart_home_end, NULL, NULL, NULL);
g_settings_bind (settings, "word-completion", self->source_view, "enable-word-completion",
G_SETTINGS_BIND_GET);
g_signal_connect (settings, "changed::keybindings", G_CALLBACK (keybindings_changed), self);
+
+ g_object_bind_property (self->source_view, "overwrite", self->overwrite_label, "visible",
G_BINDING_SYNC_CREATE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]