Hi, Here is a slightly newer version of the $subject patch.
Support for %_ has been removed, it doesn't make sense if the number of spaces can not be set, and only makes the text harder to read. The default status line text is _("line: %l / %n\t col: %c ..."), not _(GEANY_DEFAULT_STATUSBAR_TEMPLATE), for easier i18n. -- E-gards: Jimmy
--- ./src/keyfile.c.orig 2010-06-19 20:18:49.000000000 +0300 +++ ./src/keyfile.c 2010-06-27 15:07:29.000000000 +0300 @@ -661,6 +661,8 @@ interface_prefs.msgwin_messages_visible = utils_get_setting_boolean(config, PACKAGE, "msgwin_messages_visible", TRUE); interface_prefs.msgwin_scribble_visible = utils_get_setting_boolean(config, PACKAGE, "msgwin_scribble_visible", TRUE); interface_prefs.use_native_windows_dialogs = utils_get_setting_boolean(config, PACKAGE, "use_native_windows_dialogs", FALSE); + interface_prefs.statusbar_template = utils_get_setting_string(config, PACKAGE, "statusbar_template", + _("line: %l / %n\t col: %c\t sel: %s\t %w %t mode: %m encoding: %e filetype: %f %* scope: %a")); /* display, editor */ editor_prefs.long_line_global_enabled = utils_get_setting_boolean(config, PACKAGE, "long_line_enabled", TRUE); --- ./src/main.c.orig 2010-06-19 20:18:49.000000000 +0300 +++ ./src/main.c 2010-06-27 13:54:20.000000000 +0300 @@ -1173,6 +1173,7 @@ g_free(interface_prefs.editor_font); g_free(interface_prefs.tagbar_font); g_free(interface_prefs.msgwin_font); + g_free(interface_prefs.statusbar_template); g_free(editor_prefs.long_line_color); g_free(editor_prefs.comment_toggle_mark); g_free(editor_prefs.color_scheme); --- ./src/ui_utils.c.orig 2010-06-25 19:03:11.000000000 +0300 +++ ./src/ui_utils.c 2010-06-27 15:09:56.000000000 +0300 @@ -171,10 +171,10 @@ if (doc != NULL) { static GString *stats_str = NULL; - const gchar sp[] = " "; guint line, col; const gchar *cur_tag; - gchar *filetype_name = doc->file_type->name; + const gchar *stats_templ = interface_prefs.statusbar_template; + const gchar *expos; /* % expansion position */ if (G_UNLIKELY(stats_str == NULL)) stats_str = g_string_sized_new(120); @@ -191,51 +191,80 @@ else col = 0; - /* Status bar statistics: col = column, sel = selection. */ - g_string_printf(stats_str, _("line: %d / %d\t col: %d\t sel: %d\t "), - (line + 1), sci_get_line_count(doc->editor->sci), col, - sci_get_selected_text_length(doc->editor->sci) - 1); - - g_string_append(stats_str, - /* RO = read-only */ - (doc->readonly) ? _("RO ") : - /* OVR = overwrite/overtype, INS = insert */ - (sci_get_overtype(doc->editor->sci) ? _("OVR") : _("INS"))); - g_string_append(stats_str, sp); - - switch (editor_get_indent_prefs(doc->editor)->type) + g_string_assign(stats_str, ""); + while ((expos = strchr(stats_templ, '%')) != NULL) { - case GEANY_INDENT_TYPE_TABS: - g_string_append(stats_str, _("TAB")); - break; - case GEANY_INDENT_TYPE_SPACES: - g_string_append(stats_str, _("SP")); /* SP = space */ - break; - case GEANY_INDENT_TYPE_BOTH: - g_string_append(stats_str, _("T/S")); /* T/S = tabs and spaces */ + g_string_append_len(stats_str, stats_templ, expos - stats_templ); + + switch (*++expos) + { + case 'l' : g_string_append_printf(stats_str, "%d", line + 1); break; + case 'c' : g_string_append_printf(stats_str, "%d", col); break; + case 'n' : + g_string_append_printf(stats_str, "%d", + sci_get_line_count(doc->editor->sci)); + break; + case 's' : + g_string_append_printf(stats_str, "%d", + sci_get_selected_text_length(doc->editor->sci) - 1); + break; + case 'w' : + g_string_append(stats_str, (doc->readonly) ? _("RO ") : + /* OVR = overwrite/overtype, INS = insert */ + (sci_get_overtype(doc->editor->sci) ? _("OVR") : _("INS"))); + break; + case 't' : + { + switch (editor_get_indent_prefs(doc->editor)->type) + { + case GEANY_INDENT_TYPE_TABS: + g_string_append(stats_str, _("TAB")); + break; + case GEANY_INDENT_TYPE_SPACES: /* SP = space */ + g_string_append(stats_str, _("SP")); + break; + case GEANY_INDENT_TYPE_BOTH: /* T/S = tabs and spaces */ + g_string_append(stats_str, _("T/S")); + break; + } + break; + } + case 'm' : + g_string_append(stats_str, editor_get_eol_char_name(doc->editor)); + break; + case 'e' : + g_string_append(stats_str, + doc->encoding ? doc->encoding : _("unknown")); + break; + case 'b' : + if (encodings_is_unicode_charset(doc->encoding) && (doc->has_bom)) + g_string_append(stats_str, _("(with BOM)")); + break; + case 'f' : g_string_append(stats_str, doc->file_type->name); break; + case '*' : + if (doc->changed) /* MOD = modified */ + g_string_append(stats_str, _("MOD")); + break; + case 'a' : + { + symbols_get_current_function(doc, &cur_tag); + g_string_append(stats_str, cur_tag); + break; + } + case 'r' : + if (doc->readonly) + g_string_append(stats_str, _("RO ")); + break; + case 'o' : g_string_append_printf(stats_str, "%d", col + 1); break; + default : g_string_append_len(stats_str, expos, 1); + } + + if (*expos) + stats_templ = expos + 1; + else break; } - g_string_append(stats_str, sp); - g_string_append_printf(stats_str, _("mode: %s"), - editor_get_eol_char_name(doc->editor)); - g_string_append(stats_str, sp); - g_string_append_printf(stats_str, _("encoding: %s %s"), - (doc->encoding) ? doc->encoding : _("unknown"), - (encodings_is_unicode_charset(doc->encoding)) ? - /* BOM = byte order mark */ - ((doc->has_bom) ? _("(with BOM)") : "") : ""); - g_string_append(stats_str, sp); - g_string_append_printf(stats_str, _("filetype: %s"), filetype_name); - g_string_append(stats_str, sp); - if (doc->changed) - { - g_string_append(stats_str, _("MOD")); /* MOD = modified */ - g_string_append(stats_str, sp); - } - - symbols_get_current_function(doc, &cur_tag); - g_string_append_printf(stats_str, _("scope: %s"), - cur_tag); + g_string_append(stats_str, stats_templ); #ifdef GEANY_DEBUG g_string_append(stats_str, sp); --- ./src/ui_utils.h.orig 2010-06-19 20:18:49.000000000 +0300 +++ ./src/ui_utils.h 2010-06-27 13:37:29.000000000 +0300 @@ -59,6 +59,7 @@ gboolean msgwin_scribble_visible; gboolean use_native_windows_dialogs; /* only used on Windows */ gboolean compiler_tab_autoscroll; + gchar *statusbar_template; } GeanyInterfacePrefs;
_______________________________________________ Geany-devel mailing list Geany-devel@uvena.de http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel