Kaydet (Commit) 9b0d78ec authored tarafından Nick Treleaven's avatar Nick Treleaven

Remember scribble cursor position.


git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@3791 ea778897-0a13-0410-b9d1-a72fbfd435f5
üst 884751f0
2009-05-13 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/keyfile.c:
Remember scribble cursor position.
2009-05-12 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/symbols.c, doc/geany.txt, doc/geany.html,
......
......@@ -86,6 +86,7 @@
static gchar *scribble_text = NULL;
static gint scribble_pos = -1;
static GPtrArray *session_files = NULL;
static gint session_notebook_page;
static gint hpan_position;
......@@ -462,13 +463,19 @@ static void save_ui_prefs(GKeyFile *config)
/* get the text from the scribble textview */
{
GtkTextBuffer *buffer;
GtkTextIter start, end;
GtkTextIter start, end, iter;
GtkTextMark *mark;
buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui_lookup_widget(main_widgets.window, "textview_scribble")));
gtk_text_buffer_get_bounds(buffer, &start, &end);
scribble_text = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
g_key_file_set_string(config, PACKAGE, "scribble_text", scribble_text);
g_free(scribble_text);
mark = gtk_text_buffer_get_insert(buffer);
gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
scribble_pos = gtk_text_iter_get_offset(&iter);
g_key_file_set_integer(config, PACKAGE, "scribble_pos", scribble_pos);
}
if (prefs.save_winpos)
......@@ -807,6 +814,7 @@ static void load_ui_prefs(GKeyFile *config)
scribble_text = utils_get_setting_string(config, PACKAGE, "scribble_text",
_("Type here what you want, use it as a notice/scratch board"));
scribble_pos = utils_get_setting_integer(config, PACKAGE, "scribble_pos", -1);
geo = g_key_file_get_integer_list(config, PACKAGE, "geometry", NULL, &error);
if (error)
......@@ -1026,9 +1034,14 @@ void configuration_apply_settings(void)
{
if (scribble_text)
{ /* update the scribble widget, because now it's realized */
gtk_text_buffer_set_text(
gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui_lookup_widget(main_widgets.window,
"textview_scribble"))), scribble_text, -1);
GtkTextIter iter;
GtkTextBuffer *buffer =
gtk_text_view_get_buffer(GTK_TEXT_VIEW(ui_lookup_widget(main_widgets.window,
"textview_scribble")));
gtk_text_buffer_set_text(buffer, scribble_text, -1);
gtk_text_buffer_get_iter_at_offset(buffer, &iter, scribble_pos);
gtk_text_buffer_place_cursor(buffer, &iter);
}
g_free(scribble_text);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment