Add and use editor_set_indent_width() to only set indentation width

git-svn-id: https://geany.svn.sourceforge.net/svnroot/geany/trunk@5903 ea778897-0a13-0410-b9d1-a72fbfd435f5
This commit is contained in:
Colomban Wendling 2011-08-25 20:14:40 +00:00
parent 18388077e6
commit 3440b6770f
4 changed files with 19 additions and 15 deletions

View File

@ -4,6 +4,8 @@
doc/geany.html, data/filetypes.*:
Add support for filetype-specific indentation settings (closes
#3339420 and #3390435).
* src/callbacks.c, src/editor.c, src/editor.h:
Add editor_set_indent_width() to only set indentation width.
2011-08-24 Colomban Wendling <colomban(at)geany(dot)org>

View File

@ -2066,28 +2066,22 @@ void on_plugin_preferences1_activate(GtkMenuItem *menuitem, gpointer user_data)
}
static void set_indent_width(guint width)
void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data)
{
GeanyDocument *doc;
gchar *label;
gint width;
if (ignore_callback)
return;
doc = document_get_current();
g_return_if_fail(doc != NULL);
editor_set_indent(doc->editor, doc->editor->indent_type, width);
}
void on_indent_width_activate(GtkMenuItem *menuitem, gpointer user_data)
{
gchar *label = ui_menu_item_get_text(menuitem);
gint width = atoi(label);
label = ui_menu_item_get_text(menuitem);
width = atoi(label);
g_free(label);
if (width)
set_indent_width(width);
doc = document_get_current();
if (doc != NULL && width > 0)
editor_set_indent_width(doc->editor, width);
}

View File

@ -4468,6 +4468,12 @@ void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type)
}
void editor_set_indent_width(GeanyEditor *editor, gint width)
{
editor_set_indent(editor, editor->indent_type, width);
}
void editor_set_indent(GeanyEditor *editor, GeanyIndentType type, gint width)
{
const GeanyIndentPrefs *iprefs = editor_get_indent_prefs(editor);

View File

@ -294,6 +294,8 @@ const GeanyIndentPrefs *editor_get_indent_prefs(GeanyEditor *editor);
void editor_set_indent_type(GeanyEditor *editor, GeanyIndentType type);
void editor_set_indent_width(GeanyEditor *editor, gint width);
void editor_set_indent(GeanyEditor *editor, GeanyIndentType type, gint width);
void editor_set_line_wrapping(GeanyEditor *editor, gboolean wrap);