Revision: 5809 http://geany.svn.sourceforge.net/geany/?rev=5809&view=rev Author: statc Date: 2011-05-21 08:59:27 +0000 (Sat, 21 May 2011)
Log Message: ----------- Merge trunk (revisions 5701..5708)
Conflicts: src/document.c src/filetypes.c src/keyfile.c
Modified Paths: -------------- branches/sm/ChangeLog branches/sm/THANKS branches/sm/doc/pluginsignals.c branches/sm/plugins/filebrowser.c branches/sm/plugins/geanyfunctions.h branches/sm/src/about.c branches/sm/src/document.c branches/sm/src/document.h branches/sm/src/editor.c branches/sm/src/filetypes.c branches/sm/src/filetypes.h branches/sm/src/geanyobject.c branches/sm/src/geanyobject.h branches/sm/src/keyfile.c branches/sm/src/plugindata.h branches/sm/src/plugins.c branches/sm/src/search.c branches/sm/src/symbols.c branches/sm/src/ui_utils.c branches/sm/src/ui_utils.h branches/sm/tagmanager/sql.c
Modified: branches/sm/ChangeLog =================================================================== --- branches/sm/ChangeLog 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/ChangeLog 2011-05-21 08:59:27 UTC (rev 5809) @@ -1,3 +1,33 @@ +2011-04-11 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * plugins/filebrowser.c: + Update path when saving a new document for the first time if the + follow path option is enabled. + * src/about.c, src/keyfile.c, THANKS: + Store VTE path with the session (based on patch by Nicolas + Sierro, thanks). + There's still a bug with loading a project at startup; closing the + project doesn't restore old VTE path. + * src/filetypes.c, src/filetypes.h: + Refactor with filetypes_get_filename(). + Make filetypes_get_conf_extension() static. + + +2011-04-10 Enrico Tröger <enrico(dot)troeger(at)uvena(dot)de> + + * src/editor.c: + Ignore scrolling events in on_update_ui(). + * src/geanyobject.c, src/plugindata.h, src/geanyobject.h, + src/document.c, doc/pluginsignals.c: + Add and use signal "document-reload" to the plugin API. + * src/symbols.c, tagmanager/sql.c: + Fix mapping of SQL tags for Geany's symbol list (closes #3216474). + * src/ui_utils.h, src/plugindata.h, src/document.c, src/plugins.c, + src/document.h, src/ui_utils.c, plugins/geanyfunctions.h: + Add ui_menu_add_document_items_sorted() and + document_sort_by_display_name() to the plugin API. + + 2011-04-08 Colomban Wendling <colomban(at)geany(dot)org>
* scintilla/lexers/LexCPP.cxx:
Modified: branches/sm/THANKS =================================================================== --- branches/sm/THANKS 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/THANKS 2011-05-21 08:59:27 UTC (rev 5809) @@ -88,6 +88,7 @@ Taylor Venable <taylor(at)metasyntax(dot)net> - Erlang filetype Manuel Bua <manuel(dot)bua(at)gmail(dot)com> - Ensure consistent line endings pref. Matthew Brush <codebrainz(at)users(dot)sourceforge(dot)net> - Various patches. +Nicolas Sierro nicolas@sierro.net - store VTE path with session patch
Translators: ------------
Modified: branches/sm/doc/pluginsignals.c =================================================================== --- branches/sm/doc/pluginsignals.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/doc/pluginsignals.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -82,6 +82,18 @@ */ signal void (*document_open)(GObject *obj, GeanyDocument *doc, gpointer user_data);
+/** Sent when an existing document is reloaded. + * + * You need to include "document.h" for the declaration of GeanyDocument. + * + * @param obj a GeanyObject instance, should be ignored. + * @param doc the re-opened document. + * @param user_data user data. + * + * @since 0.21 + */ +signal void (*document_reload)(GObject *obj, GeanyDocument *doc, gpointer user_data); + /** Sent before a document is saved. * * You need to include "document.h" for the declaration of GeanyDocument.
Modified: branches/sm/plugins/filebrowser.c =================================================================== --- branches/sm/plugins/filebrowser.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/plugins/filebrowser.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -97,6 +97,7 @@
static void project_change_cb(GObject *obj, GKeyFile *config, gpointer data);
+/* note: other callbacks connected in plugin_init */ PluginCallback plugin_callbacks[] = { { "project-open", (GCallback) &project_change_cb, TRUE, NULL }, @@ -1042,11 +1043,15 @@ }
+static gpointer last_activate_path = NULL; + static void document_activate_cb(G_GNUC_UNUSED GObject *obj, GeanyDocument *doc, G_GNUC_UNUSED gpointer data) { gchar *new_dir;
+ last_activate_path = doc->real_path; + if (! fb_follow_path || doc->file_name == NULL || ! g_path_is_absolute(doc->file_name)) return;
@@ -1063,6 +1068,13 @@ }
+static void document_save_cb(GObject *obj, GeanyDocument *doc, gpointer user_data) +{ + if (!last_activate_path) + document_activate_cb(obj, doc, user_data); +} + + static void kb_activate(guint key_id) { gtk_notebook_set_current_page(GTK_NOTEBOOK(geany->main_widgets->sidebar_notebook), page_number); @@ -1125,6 +1137,8 @@
plugin_signal_connect(geany_plugin, NULL, "document-activate", TRUE, (GCallback) &document_activate_cb, NULL); + plugin_signal_connect(geany_plugin, NULL, "document-save", TRUE, + (GCallback) &document_save_cb, NULL); }
Modified: branches/sm/plugins/geanyfunctions.h =================================================================== --- branches/sm/plugins/geanyfunctions.h 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/plugins/geanyfunctions.h 2011-05-21 08:59:27 UTC (rev 5809) @@ -72,6 +72,8 @@ geany_functions->p_document->document_get_basename_for_display #define document_get_notebook_page \ geany_functions->p_document->document_get_notebook_page +#define document_sort_by_display_name \ + geany_functions->p_document->document_sort_by_display_name #define editor_get_indent_prefs \ geany_functions->p_editor->editor_get_indent_prefs #define editor_create_widget \ @@ -292,6 +294,8 @@ geany_functions->p_ui->ui_get_gtk_settings_integer #define ui_combo_box_add_to_history \ geany_functions->p_ui->ui_combo_box_add_to_history +#define ui_menu_add_document_items_sorted \ + geany_functions->p_ui->ui_menu_add_document_items_sorted #define dialogs_show_question \ geany_functions->p_dialogs->dialogs_show_question #define dialogs_show_msgbox \
Modified: branches/sm/src/about.c =================================================================== --- branches/sm/src/about.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/about.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -98,7 +98,8 @@ "John Gabriele, Jon Senior, Jon Strait, Josef Whiter, " "Jörn Reder, Kelvin Gardiner, Kevin Ellwood, Kristoffer A. Tjernås, Lex Trotman, " "Manuel Bua, Mário Silva, Marko Peric, Matthew Brush, Matti Mårds, " -"Moritz Barsnick, Ondrej Donek, Peter Strand, Philipp Gildein, Pierre Joye, Rob van der Linde, " +"Moritz Barsnick, Nicolas Sierro, Ondrej Donek, Peter Strand, Philipp Gildein, " +"Pierre Joye, Rob van der Linde, " "Robert McGinley, Roland Baudin, Ross McKay, S Jagannathan, Saleem Abdulrasool, " "Sebastian Kraft, Shiv, Slava Semushin, Stefan Oltmanns, Tamim, Taylor Venable, " "Thomas Huth, Thomas Martitz, Tomás Vírseda, "
Modified: branches/sm/src/document.c =================================================================== --- branches/sm/src/document.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/document.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -1255,18 +1255,21 @@ if (! main_status.opening_session_files) ui_add_recent_file(utf8_filename, update_recent_files_config);
- if (! reload) - g_signal_emit_by_name(geany_object, "document-open", doc); - if (reload) + { + g_signal_emit_by_name(geany_object, "document-reload", doc); ui_set_statusbar(TRUE, _("File %s reloaded."), display_filename); + } else + { + g_signal_emit_by_name(geany_object, "document-open", doc); /* For translators: this is the status window message for opening a file. %d is the number * of the newly opened file, %s indicates whether the file is opened read-only * (it is replaced with the string ", read-only"). */ msgwin_status_add(_("File %s opened(%d%s)."), display_filename, gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)), (readonly) ? _(", read-only") : ""); + } }
g_free(display_filename); @@ -3022,3 +3025,32 @@ } return ret; } + + +/** GCompareFunc-like sort function to sort documents, e.g. in a GPtrArray by + * their display names. + * Display names means the base name of the document's file. + * + * @param a @c document a. + * @param b @c document b. + * @return negative value if a < b; zero if a = b; positive value if a > b. + * + * @since 0.21 + */ +gint document_sort_by_display_name(gconstpointer a, gconstpointer b) +{ + GeanyDocument *doc_a = (GeanyDocument*) ((GPtrArray*) a)->pdata; + GeanyDocument *doc_b = (GeanyDocument*) ((GPtrArray*) b)->pdata; + gchar *base_name_a, *base_name_b; + gint result; + + base_name_a = g_path_get_basename(DOC_FILENAME(doc_a)); + base_name_b = g_path_get_basename(DOC_FILENAME(doc_b)); + + result = strcmp(base_name_a, base_name_b); + + g_free(base_name_a); + g_free(base_name_b); + + return result; +}
Modified: branches/sm/src/document.h =================================================================== --- branches/sm/src/document.h 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/document.h 2011-05-21 08:59:27 UTC (rev 5809) @@ -262,4 +262,6 @@
void document_apply_indent_settings(GeanyDocument *doc);
+gint document_sort_by_display_name(gconstpointer a, gconstpointer b); + #endif
Modified: branches/sm/src/editor.c =================================================================== --- branches/sm/src/editor.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/editor.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -515,6 +515,11 @@ ScintillaObject *sci = editor->sci; gint pos = sci_get_current_position(sci);
+ /* since Scintilla 2.24, SCN_UPDATEUI is also sent on scrolling though we don't need to handle + * this and so ignore every SCN_UPDATEUI events except for content and selection changes */ + if (! (nt->updated & SC_UPDATE_CONTENT) && ! (nt->updated & SC_UPDATE_SELECTION)) + return; + /* undo / redo menu update */ ui_update_popup_reundo_items(editor->document);
Modified: branches/sm/src/filetypes.c =================================================================== --- branches/sm/src/filetypes.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/filetypes.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -63,7 +63,9 @@
static void create_radio_menu_item(GtkWidget *menu, GeanyFiletype *ftype);
+static gchar *filetypes_get_conf_extension(gint filetype_idx);
+ enum TitleType { TITLE_SOURCE_FILE, @@ -1216,23 +1218,39 @@ }
-static void add_group_keys(GKeyFile *kf, const gchar *group, GeanyFiletype *ft) +static gchar *filetypes_get_filename(GeanyFiletype *ft, gboolean user) { - GKeyFile *src = g_key_file_new(); gchar *ext = filetypes_get_conf_extension(ft->id); const gchar *f;
- f = utils_make_filename(app->datadir, "filetypes.", ext, NULL); - if (!g_file_test(f, G_FILE_TEST_EXISTS)) + if (user) f = utils_make_filename(app->configdir, GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.", ext, NULL); + else + f = utils_make_filename(app->datadir, "filetypes.", ext, NULL); + g_free(ext); + return g_strdup(f); +}
+ +static void add_group_keys(GKeyFile *kf, const gchar *group, GeanyFiletype *ft) +{ + GKeyFile *src = g_key_file_new(); + gchar *f; + + f = filetypes_get_filename(ft, FALSE); + if (!g_file_test(f, G_FILE_TEST_EXISTS)) + f = filetypes_get_filename(ft, TRUE); + if (!g_key_file_load_from_file(src, f, G_KEY_FILE_NONE, NULL)) { geany_debug("Could not read config file %s for [%s=%s]!", f, group, ft->name); + g_free(f); return; } + g_free(f); + add_keys(kf, group, src); }
@@ -1310,15 +1328,14 @@ config_home = g_key_file_new(); { /* highlighting uses GEANY_FILETYPES_NONE for common settings */ - gchar *ext = filetypes_get_conf_extension(ft_id); - const gchar *f; + gchar *f;
- f = utils_make_filename(app->datadir, "filetypes.", ext, NULL); + f = filetypes_get_filename(ft, FALSE); load_system_keyfile(config, f, G_KEY_FILE_KEEP_COMMENTS, ft); - f = utils_make_filename(app->configdir, - GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S, "filetypes.", ext, NULL); + + setptr(f, filetypes_get_filename(ft, TRUE)); g_key_file_load_from_file(config_home, f, G_KEY_FILE_KEEP_COMMENTS, NULL); - g_free(ext); + g_free(f); } /* Copy keys for any groups with [group=C] from system keyfile */ copy_ft_groups(config); @@ -1356,29 +1373,27 @@ }
-gchar *filetypes_get_conf_extension(gint filetype_idx) +static gchar *filetypes_get_conf_extension(gint filetype_idx) { return get_filetype_conf_extension(filetypes[filetype_idx]); }
-void filetypes_save_commands(const GeanyFiletype *ft) +void filetypes_save_commands(GeanyFiletype *ft) { - gchar *ext = get_filetype_conf_extension(ft); - gchar *fname = g_strconcat(app->configdir, - G_DIR_SEPARATOR_S GEANY_FILEDEFS_SUBDIR G_DIR_SEPARATOR_S "filetypes.", ext, NULL); + gchar *fname; GKeyFile *config_home; gchar *data;
+ fname = filetypes_get_filename(ft, TRUE); config_home = g_key_file_new(); g_key_file_load_from_file(config_home, fname, G_KEY_FILE_KEEP_COMMENTS, NULL); - build_save_menu(config_home, (gpointer)(ft), GEANY_BCS_HOME_FT); + build_save_menu(config_home, ft, GEANY_BCS_HOME_FT); data = g_key_file_to_data(config_home, NULL, NULL); utils_write_file(fname, data); g_free(data); g_key_file_free(config_home); g_free(fname); - g_free(ext); }
Modified: branches/sm/src/filetypes.h =================================================================== --- branches/sm/src/filetypes.h 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/filetypes.h 2011-05-21 08:59:27 UTC (rev 5809) @@ -195,7 +195,7 @@
void filetypes_load_config(gint ft_id, gboolean reload);
-void filetypes_save_commands(const GeanyFiletype *ft); +void filetypes_save_commands(GeanyFiletype *ft);
void filetypes_select_radio_item(const GeanyFiletype *ft);
@@ -203,8 +203,6 @@
GtkFileFilter *filetypes_create_file_filter_all_source(void);
-gchar *filetypes_get_conf_extension(gint filetype_idx); - gboolean filetype_has_tags(GeanyFiletype *ft);
gboolean filetypes_parse_error_message(GeanyFiletype *ft, const gchar *message,
Modified: branches/sm/src/geanyobject.c =================================================================== --- branches/sm/src/geanyobject.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/geanyobject.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -189,6 +189,15 @@ g_cclosure_marshal_VOID__POINTER, G_TYPE_NONE, 1, G_TYPE_POINTER); + geany_object_signals[GCB_DOCUMENT_RELOAD] = g_signal_new ( + "document-reload", + G_OBJECT_CLASS_TYPE (g_object_class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (GeanyObjectClass, document_reload), + NULL, NULL, + g_cclosure_marshal_VOID__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); geany_object_signals[GCB_DOCUMENT_BEFORE_SAVE] = g_signal_new ( "document-before-save", G_OBJECT_CLASS_TYPE (g_object_class),
Modified: branches/sm/src/geanyobject.h =================================================================== --- branches/sm/src/geanyobject.h 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/geanyobject.h 2011-05-21 08:59:27 UTC (rev 5809) @@ -34,6 +34,7 @@ { GCB_DOCUMENT_NEW, GCB_DOCUMENT_OPEN, + GCB_DOCUMENT_RELOAD, GCB_DOCUMENT_BEFORE_SAVE, GCB_DOCUMENT_SAVE, GCB_DOCUMENT_FILETYPE_SET, @@ -82,6 +83,7 @@
void (*document_new)(GeanyDocument *doc); void (*document_open)(GeanyDocument *doc); + void (*document_reload)(GeanyDocument *doc); void (*document_before_save)(GeanyDocument *doc); void (*document_save)(GeanyDocument *doc); void (*document_filetype_set)(GeanyDocument *doc, GeanyFiletype *filetype_old);
Modified: branches/sm/src/keyfile.c =================================================================== --- branches/sm/src/keyfile.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/keyfile.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -371,6 +371,14 @@ i++; } } + +#ifdef HAVE_VTE + if (vte_info.have_vte) + { + vte_get_working_directory(); /* refresh vte_info.dir */ + g_key_file_set_string(config, "VTE", "last_dir", vte_info.dir); + } +#endif }
@@ -520,8 +528,6 @@ tmp_string = utils_get_hex_from_color(vc->colour_back); g_key_file_set_string(config, "VTE", "colour_back", tmp_string); g_free(tmp_string); - vte_get_working_directory(); /* refresh vte_info.dir */ - g_key_file_set_string(config, "VTE", "last_dir", vte_info.dir); } #endif } @@ -607,6 +613,13 @@
if (cl_options.load_session) configuration_save_session_files(config); +#ifdef HAVE_VTE + else if (vte_info.have_vte) + { + vte_get_working_directory(); /* refresh vte_info.dir */ + g_key_file_set_string(config, "VTE", "last_dir", vte_info.dir); + } +#endif }
if (write_recent_files) @@ -666,6 +679,16 @@ g_ptr_array_add(session_files, tmp_array); i++; } + +#ifdef HAVE_VTE + /* BUG: after loading project at startup, closing project doesn't restore old VTE path */ + if (vte_info.have_vte) + { + gchar *tmp_string = utils_get_setting_string(config, "VTE", "last_dir", NULL); + vte_cwd(tmp_string,TRUE); + g_free(tmp_string); + } +#endif }
Modified: branches/sm/src/plugindata.h =================================================================== --- branches/sm/src/plugindata.h 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/plugindata.h 2011-05-21 08:59:27 UTC (rev 5809) @@ -54,7 +54,7 @@ * @warning You should not test for values below 200 as previously * @c GEANY_API_VERSION was defined as an enum value, not a macro. */ -#define GEANY_API_VERSION 205 +#define GEANY_API_VERSION 207
/** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. @@ -310,6 +310,7 @@ const GdkColor* (*document_get_status_color) (struct GeanyDocument *doc); gchar* (*document_get_basename_for_display) (struct GeanyDocument *doc, gint length); gint (*document_get_notebook_page) (struct GeanyDocument *doc); + gint (*document_sort_by_display_name) (gconstpointer a, gconstpointer b); } DocumentFuncs;
@@ -473,6 +474,8 @@ gint (*ui_get_gtk_settings_integer) (const gchar *property_name, gint default_value); void (*ui_combo_box_add_to_history) (GtkComboBoxEntry *combo_entry, const gchar *text, gint history_len); + void (*ui_menu_add_document_items_sorted) (GtkMenu *menu, struct GeanyDocument *active, + GCallback callback, GCompareFunc sort_func); } UIUtilsFuncs;
Modified: branches/sm/src/plugins.c =================================================================== --- branches/sm/src/plugins.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/plugins.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -111,7 +111,8 @@ &document_rename_file, &document_get_status_color, &document_get_basename_for_display, - &document_get_notebook_page + &document_get_notebook_page, + &document_sort_by_display_name };
static EditorFuncs editor_funcs = { @@ -243,7 +244,8 @@ &ui_widget_modify_font_from_string, &ui_is_keyval_enter_or_return, &ui_get_gtk_settings_integer, - &ui_combo_box_add_to_history + &ui_combo_box_add_to_history, + &ui_menu_add_document_items_sorted };
static DialogFuncs dialog_funcs = {
Modified: branches/sm/src/search.c =================================================================== --- branches/sm/src/search.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/search.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -221,11 +221,10 @@ group = stash_group_new("search"); find_prefs = group; configuration_add_pref_group(group, FALSE); - /* if case is moved after regexp, the first regexp uncheck will clear it */ - stash_group_add_toggle_button(group, &settings.find_case_sensitive, - "find_case_sensitive", FALSE, "check_case"); stash_group_add_toggle_button(group, &settings.find_regexp, "find_regexp", FALSE, "check_regexp"); + stash_group_add_toggle_button(group, &settings.find_case_sensitive, + "find_case_sensitive", FALSE, "check_case"); stash_group_add_toggle_button(group, &settings.find_escape_sequences, "find_escape_sequences", FALSE, "check_escape"); stash_group_add_toggle_button(group, &settings.find_match_whole_word, @@ -238,10 +237,10 @@ group = stash_group_new("search"); replace_prefs = group; configuration_add_pref_group(group, FALSE); - stash_group_add_toggle_button(group, &settings.replace_case_sensitive, - "replace_case_sensitive", FALSE, "check_case"); stash_group_add_toggle_button(group, &settings.replace_regexp, "replace_regexp", FALSE, "check_regexp"); + stash_group_add_toggle_button(group, &settings.replace_case_sensitive, + "replace_case_sensitive", FALSE, "check_case"); stash_group_add_toggle_button(group, &settings.replace_escape_sequences, "replace_escape_sequences", FALSE, "check_escape"); stash_group_add_toggle_button(group, &settings.replace_match_whole_word,
Modified: branches/sm/src/symbols.c =================================================================== --- branches/sm/src/symbols.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/symbols.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -946,6 +946,19 @@ &tv_iters.tag_macro, _("Macros"), "classviewer-macro", NULL); break; + case GEANY_FILETYPES_SQL: + { + tag_list_add_groups(tag_store, + &(tv_iters.tag_function), _("Functions"), "classviewer-method", + &(tv_iters.tag_namespace), _("Procedures"), "classviewer-namespace", + &(tv_iters.tag_struct), _("Indexes"), "classviewer-struct", + &(tv_iters.tag_class), _("Tables"), "classviewer-class", + &(tv_iters.tag_macro), _("Triggers"), "classviewer-macro", + &(tv_iters.tag_member), _("Views"), "classviewer-var", + &(tv_iters.tag_other), _("Other"), "classviewer-other", + NULL); + break; + } case GEANY_FILETYPES_D: default: {
Modified: branches/sm/src/ui_utils.c =================================================================== --- branches/sm/src/ui_utils.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/ui_utils.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -2446,16 +2446,49 @@ * @since 0.19 */ void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback callback) { + ui_menu_add_document_items_sorted(menu, active, callback, NULL); +} + + +/** Adds a list of document items to @a menu. + * + * @a sort_func might be NULL to not sort the documents in the menu. In this case, + * the order of the document tabs is used. + * + * See document_sort_by_display_name() for an example sort function. + * + * @param menu Menu. + * @param active Which document to highlight, or @c NULL. + * @param callback is used for each menu item's @c "activate" signal and will be passed + * the corresponding document pointer as @c user_data. + * @param sort_func is used to sort the list. Might be @c NULL to not sort the list. + * @warning You should check @c doc->is_valid in the callback. + * @since 0.21 */ +void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, + GCallback callback, GCompareFunc sort_func) +{ GtkWidget *menu_item, *menu_item_label, *image; const GdkColor *color; GeanyDocument *doc; guint i, len; gchar *base_name, *label; + GPtrArray *sorted_documents;
len = gtk_notebook_get_n_pages(GTK_NOTEBOOK(main_widgets.notebook)); - for (i = 0; i < len; i++) + + sorted_documents = g_ptr_array_sized_new(len); + /* copy the documents_array into the new one */ + foreach_document(i) { - doc = document_get_from_page(i); + g_ptr_array_add(sorted_documents, documents[i]); + } + /* and now sort it */ + if (sort_func != NULL) + g_ptr_array_sort(sorted_documents, sort_func); + + for (i = 0; i < GEANY(sorted_documents)->len; i++) + { + doc = g_ptr_array_index(sorted_documents, i); if (! DOC_VALID(doc)) continue;
@@ -2482,6 +2515,7 @@
g_free(base_name); } + g_ptr_array_free(sorted_documents, TRUE); }
Modified: branches/sm/src/ui_utils.h =================================================================== --- branches/sm/src/ui_utils.h 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/src/ui_utils.h 2011-05-21 08:59:27 UTC (rev 5809) @@ -246,6 +246,8 @@
void ui_menu_add_document_items(GtkMenu *menu, GeanyDocument *active, GCallback callback);
+void ui_menu_add_document_items_sorted(GtkMenu *menu, GeanyDocument *active, + GCallback callback, GCompareFunc sort_func);
void ui_set_statusbar(gboolean log, const gchar *format, ...) G_GNUC_PRINTF (2, 3);
Modified: branches/sm/tagmanager/sql.c =================================================================== --- branches/sm/tagmanager/sql.c 2011-05-21 08:58:07 UTC (rev 5808) +++ branches/sm/tagmanager/sql.c 2011-05-21 08:59:27 UTC (rev 5809) @@ -182,18 +182,18 @@ { FALSE, 'l', "local", "local variables" }, { TRUE, 'L', "label", "block label" }, { TRUE, 'P', "package", "packages" }, - { TRUE, 'p', "procedure", "procedures" }, + { TRUE, 'n', "namespace", "procedures" }, { FALSE, 'r', "record", "records" }, { TRUE, 's', "subtype", "subtypes" }, - { TRUE, 't', "table", "tables" }, - { TRUE, 'T', "trigger", "triggers" }, + { TRUE, 't', "class", "tables" }, + { TRUE, 'T', "macro", "triggers" }, { TRUE, 'v', "variable", "variables" }, - { TRUE, 'i', "index", "indexes" }, + { TRUE, 'i', "struct", "indexes" }, { TRUE, 'e', "event", "events" }, { TRUE, 'U', "publication", "publications" }, { TRUE, 'R', "service", "services" }, { TRUE, 'D', "domain", "domains" }, - { TRUE, 'V', "view", "views" }, + { TRUE, 'm', "member", "views" }, { TRUE, 'n', "synonym", "synonyms" }, { TRUE, 'x', "mltable", "MobiLink Table Scripts" }, { TRUE, 'y', "mlconn", "MobiLink Conn Scripts" }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.