[gnome-builder] editor: track when the source buffer has been saved.
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] editor: track when the source buffer has been saved.
- Date: Sat, 13 Sep 2014 05:52:00 +0000 (UTC)
commit c351b9d2d2f682cdffbbbddf8a860d485e8e5d7d
Author: Christian Hergert <christian hergert me>
Date: Fri Sep 12 22:51:43 2014 -0700
editor: track when the source buffer has been saved.
Change drawing color for that.
src/editor/gb-editor-commands.c | 8 ++++++--
src/editor/gb-source-change-gutter-renderer.c | 6 ++++++
src/editor/gb-source-change-monitor.c | 19 +++++++++++++++++++
src/editor/gb-source-change-monitor.h | 1 +
4 files changed, 32 insertions(+), 2 deletions(-)
---
diff --git a/src/editor/gb-editor-commands.c b/src/editor/gb-editor-commands.c
index f3e477c..45911c6 100644
--- a/src/editor/gb-editor-commands.c
+++ b/src/editor/gb-editor-commands.c
@@ -428,8 +428,12 @@ on_save_cb (GtkSourceFileSaver *saver,
g_clear_error (&error);
}
else
- gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (tab->priv->document),
- FALSE);
+ {
+ gtk_text_buffer_set_modified (GTK_TEXT_BUFFER (tab->priv->document),
+ FALSE);
+ gb_source_change_monitor_saved (tab->priv->change_monitor);
+ gtk_widget_queue_draw (GTK_WIDGET (tab->priv->source_view));
+ }
g_object_unref (tab);
}
diff --git a/src/editor/gb-source-change-gutter-renderer.c b/src/editor/gb-source-change-gutter-renderer.c
index 0c8597d..315d3bc 100644
--- a/src/editor/gb-source-change-gutter-renderer.c
+++ b/src/editor/gb-source-change-gutter-renderer.c
@@ -108,6 +108,12 @@ gb_source_change_gutter_renderer_draw (GtkSourceGutterRenderer *renderer,
if ((flags & GB_SOURCE_CHANGE_CHANGED) != 0)
gdk_rgba_parse (&rgba, "#fcaf3e");
+ if ((flags & GB_SOURCE_CHANGE_DIRTY) == 0)
+ {
+ gdk_rgba_parse (&rgba, "#729fcf");
+ rgba.alpha = 0.8;
+ }
+
gdk_cairo_rectangle (cr, cell_area);
gdk_cairo_set_source_rgba (cr, &rgba);
cairo_fill (cr);
diff --git a/src/editor/gb-source-change-monitor.c b/src/editor/gb-source-change-monitor.c
index 4e332fb..8048377 100644
--- a/src/editor/gb-source-change-monitor.c
+++ b/src/editor/gb-source-change-monitor.c
@@ -244,6 +244,25 @@ gb_source_change_monitor_get_line (GbSourceChangeMonitor *monitor,
}
void
+gb_source_change_monitor_saved (GbSourceChangeMonitor *monitor)
+{
+ GbSourceChangeMonitorPrivate *priv;
+ GbSourceChangeFlags flags;
+ guint i;
+
+ g_return_if_fail (GB_IS_SOURCE_CHANGE_MONITOR (monitor));
+
+ priv = monitor->priv;
+
+ for (i = 0; i < priv->state->len; i++)
+ {
+ flags = g_array_index (priv->state, guint8, i);
+ flags &= ~GB_SOURCE_CHANGE_DIRTY;
+ g_array_index (priv->state, guint8, i) = flags;
+ }
+}
+
+void
gb_source_change_monitor_reset (GbSourceChangeMonitor *monitor)
{
GbSourceChangeMonitorPrivate *priv;
diff --git a/src/editor/gb-source-change-monitor.h b/src/editor/gb-source-change-monitor.h
index 91d310a..04f1ad1 100644
--- a/src/editor/gb-source-change-monitor.h
+++ b/src/editor/gb-source-change-monitor.h
@@ -60,6 +60,7 @@ GbSourceChangeMonitor *gb_source_change_monitor_new (GtkTextBuffer
GbSourceChangeFlags gb_source_change_monitor_get_line (GbSourceChangeMonitor *monitor,
guint lineno);
void gb_source_change_monitor_reset (GbSourceChangeMonitor *monitor);
+void gb_source_change_monitor_saved (GbSourceChangeMonitor *monitor);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]