[geany/geany] bbf63d: Fixups
Nick Treleaven
git-noreply at xxxxx
Mon Sep 29 15:12:57 UTC 2014
Branch: refs/heads/master
Author: Nick Treleaven <nick.treleaven at btinternet.com>
Committer: Nick Treleaven <nick.treleaven at btinternet.com>
Date: Mon, 29 Sep 2014 15:12:57 UTC
Commit: bbf63d131a84a099c9e1627ac5ec321985052fb4
https://github.com/geany/geany/commit/bbf63d131a84a099c9e1627ac5ec321985052fb4
Log Message:
-----------
Fixups
Fix adding stash group and applying defaults.
Don't let Properties dialog override per-document line wrapping state.
Use "editor" for key group name.
Remove code already handled by stash group.
Modified Paths:
--------------
src/editor.c
src/project.c
Modified: src/editor.c
26 lines changed, 10 insertions(+), 16 deletions(-)
===================================================================
@@ -375,17 +375,6 @@ static gboolean is_style_php(gint style)
}
-static gint editor_get_line_wrapping(void)
-{
- if (app->project)
- return app->project->priv->line_wrapping;
- if (!editor_prefs.line_wrapping)
- return 0;
- else
- return editor_prefs.line_wrapping;
-}
-
-
static gint editor_get_long_line_type(void)
{
if (app->project)
@@ -415,6 +404,12 @@ static gint editor_get_long_line_column(void)
}
+static gboolean editor_get_line_wrapping(void)
+{
+ return app->project ? app->project->priv->line_wrapping : editor_prefs.line_wrapping;
+}
+
+
static const GeanyEditorPrefs *
get_default_prefs(void)
{
@@ -4767,7 +4762,7 @@ static gboolean register_named_icon(ScintillaObject *sci, guint id, const gchar
* @note The @c "sci-notify" signal is connected separately. */
static ScintillaObject *create_new_sci(GeanyEditor *editor)
{
- ScintillaObject *sci;
+ ScintillaObject *sci;
sci = SCINTILLA(scintilla_new());
@@ -4786,7 +4781,7 @@ static ScintillaObject *create_new_sci(GeanyEditor *editor)
setup_sci_keys(sci);
sci_set_symbol_margin(sci, editor_prefs.show_markers_margin);
- sci_set_lines_wrapped(sci, editor_prefs.line_wrapping);
+ sci_set_lines_wrapped(sci, editor->line_wrapping);
sci_set_caret_policy_x(sci, CARET_JUMPS | CARET_EVEN, 0);
/*sci_set_caret_policy_y(sci, CARET_JUMPS | CARET_EVEN, 0);*/
SSM(sci, SCI_AUTOCSETSEPARATOR, '\n', 0);
@@ -4855,7 +4850,7 @@ GeanyEditor *editor_create(GeanyDocument *doc)
doc->editor = editor; /* needed in case some editor functions/callbacks expect it */
editor->auto_indent = (iprefs->auto_indent_mode != GEANY_AUTOINDENT_NONE);
- editor->line_wrapping = editor_prefs.line_wrapping;
+ editor->line_wrapping = editor_get_line_wrapping();
editor->scroll_percent = -1.0F;
editor->line_breaking = FALSE;
@@ -4994,7 +4989,7 @@ void editor_set_indentation_guides(GeanyEditor *editor)
}
-/* Apply just the prefs that can change in the Preferences dialog */
+/* Apply non-document prefs that can change in the Preferences dialog */
void editor_apply_update_prefs(GeanyEditor *editor)
{
ScintillaObject *sci;
@@ -5021,7 +5016,6 @@ void editor_apply_update_prefs(GeanyEditor *editor)
sci_set_autoc_max_height(sci, editor_prefs.symbolcompletion_max_height);
SSM(sci, SCI_AUTOCSETDROPRESTOFWORD, editor_prefs.completion_drops_rest_of_word, 0);
- editor_set_line_wrapping(editor, editor_get_line_wrapping());
editor_set_indentation_guides(editor);
sci_set_visible_white_spaces(sci, editor_prefs.show_white_space);
Modified: src/project.c
29 lines changed, 14 insertions(+), 15 deletions(-)
===================================================================
@@ -684,7 +684,6 @@ static GeanyProject *create_project(void)
project->priv->long_line_behaviour = 1 /* use global settings */;
project->priv->long_line_column = editor_prefs.long_line_column;
- project->priv->line_wrapping = editor_prefs.line_wrapping;
app->project = project;
return project;
@@ -1064,8 +1063,6 @@ static gboolean load_config(const gchar *filename)
"long_line_behaviour", 1 /* follow global */);
p->priv->long_line_column = utils_get_setting_integer(config, "long line marker",
"long_line_column", editor_prefs.long_line_column);
- p->priv->line_wrapping = utils_get_setting_boolean(config, "line_wrapping",
- "line_wrapping", editor_prefs.line_wrapping);
apply_editor_prefs();
build_load_menu(config, GEANY_BCS_PROJ, (gpointer)p);
@@ -1132,10 +1129,10 @@ static gboolean write_config(gboolean emit_signal)
g_key_file_set_string_list(config, "project", "file_patterns",
(const gchar**) p->file_patterns, g_strv_length(p->file_patterns));
+ // editor settings
g_key_file_set_integer(config, "long line marker", "long_line_behaviour", p->priv->long_line_behaviour);
g_key_file_set_integer(config, "long line marker", "long_line_column", p->priv->long_line_column);
- g_key_file_set_boolean(config, "line_wrapping", "line_wrapping", p->priv->line_wrapping);
/* store the session files into the project too */
if (project_prefs.project_session)
configuration_save_session_files(config);
@@ -1249,22 +1246,29 @@ void project_apply_prefs(void)
}
-static void add_stash_group(StashGroup *group)
+static void add_stash_group(StashGroup *group, gboolean apply_defaults)
{
+ GKeyFile *kf;
+
stash_groups = g_slist_prepend(stash_groups, group);
+ if (!apply_defaults)
+ return;
+
+ kf = g_key_file_new();
+ stash_group_load_from_key_file(group, kf);
+ g_key_file_free(kf);
}
static void init_stash_prefs(void)
{
StashGroup *group;
- GKeyFile *kf;
group = stash_group_new("indentation");
/* copy global defaults */
indentation = *editor_get_indent_prefs(NULL);
stash_group_set_use_defaults(group, FALSE);
- add_stash_group(group);
+ add_stash_group(group, FALSE);
stash_group_add_spin_button_integer(group, &indentation.width,
"indent_width", 4, "spin_indent_width_project");
@@ -1293,17 +1297,12 @@ static void init_stash_prefs(void)
"strip_trailing_spaces", file_prefs.strip_trailing_spaces, "check_trailing_spaces1");
stash_group_add_toggle_button(group, &priv.replace_tabs,
"replace_tabs", file_prefs.replace_tabs, "check_replace_tabs1");
- group = stash_group_new("file_prefs");
- add_stash_group(group);
+ add_stash_group(group, TRUE);
- group = stash_group_new("line_wrapping");
+ group = stash_group_new("editor");
stash_group_add_toggle_button(group, &priv.line_wrapping,
"line_wrapping", editor_prefs.line_wrapping, "check_line_wrapping1");
- add_stash_group(group);
- /* apply defaults */
- kf = g_key_file_new();
- stash_group_load_from_key_file(group, kf);
- g_key_file_free(kf);
+ add_stash_group(group, TRUE);
}
--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).
More information about the Commits
mailing list