Revision: 3677 http://geany.svn.sourceforge.net/geany/?rev=3677&view=rev Author: ntrel Date: 2009-04-02 15:00:17 +0000 (Thu, 02 Apr 2009)
Log Message: ----------- Rename sorted_filetypes filetypes_by_title, and add to GeanyData for plugin API access. Fix order of filetypes in Save Actions Instant Save configuration dialog.
Modified Paths: -------------- branches/reorder-filetypes/ChangeLog branches/reorder-filetypes/plugins/saveactions.c branches/reorder-filetypes/src/dialogs.c branches/reorder-filetypes/src/filetypes.c branches/reorder-filetypes/src/filetypes.h branches/reorder-filetypes/src/plugindata.h branches/reorder-filetypes/src/plugins.c branches/reorder-filetypes/src/templates.c
Modified: branches/reorder-filetypes/ChangeLog =================================================================== --- branches/reorder-filetypes/ChangeLog 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/ChangeLog 2009-04-02 15:00:17 UTC (rev 3677) @@ -1,3 +1,13 @@ +2009-04-02 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com> + + * src/templates.c, src/dialogs.c, src/plugindata.h, src/filetypes.c, + src/filetypes.h, src/plugins.c, plugins/saveactions.c: + Rename sorted_filetypes filetypes_by_title, and add to GeanyData + for plugin API access. + Fix order of filetypes in Save Actions Instant Save configuration + dialog. + + 2009-03-31 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
* src/templates.c, src/utils.h, src/dialogs.c, src/filetypes.c,
Modified: branches/reorder-filetypes/plugins/saveactions.c =================================================================== --- branches/reorder-filetypes/plugins/saveactions.c 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/plugins/saveactions.c 2009-04-02 15:00:17 UTC (rev 3677) @@ -603,6 +603,8 @@ { GtkWidget *combo; guint i; + GSList *node; + GeanyFiletype *ft;
notebook_vbox = gtk_vbox_new(FALSE, 2); inner_vbox = gtk_vbox_new(FALSE, 5); @@ -624,14 +626,14 @@ gtk_box_pack_start(GTK_BOX(inner_vbox), label, FALSE, FALSE, 0);
pref_widgets.instantsave_ft_combo = combo = gtk_combo_box_new_text(); - for (i = 0; i < geany->filetypes_array->len; i++) + i = 0; + foreach_slist(ft, node, geany->filetypes_by_title) { - GeanyFiletype *ft = filetypes_index(i); - gtk_combo_box_append_text(GTK_COMBO_BOX(combo), ft->name);
if (utils_str_equal(ft->name, instantsave_default_ft)) gtk_combo_box_set_active(GTK_COMBO_BOX(combo), i); + i++; } gtk_combo_box_set_wrap_width(GTK_COMBO_BOX(combo), 3); gtk_label_set_mnemonic_widget(GTK_LABEL(label), combo);
Modified: branches/reorder-filetypes/src/dialogs.c =================================================================== --- branches/reorder-filetypes/src/dialogs.c 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/src/dialogs.c 2009-04-02 15:00:17 UTC (rev 3677) @@ -91,7 +91,7 @@
/* ignore detect from file item */ if (filetype_idx > 0 && filetype_idx < GEANY_MAX_BUILT_IN_FILETYPES) - ft = g_slist_nth_data(sorted_filetypes, filetype_idx); + ft = g_slist_nth_data(filetypes_by_title, filetype_idx); if (encoding_idx >= 0 && encoding_idx < GEANY_ENCODINGS_MAX) charset = encodings[encoding_idx].charset;
@@ -216,7 +216,7 @@ /* now create meta filter "All Source" */ gtk_file_chooser_add_filter(GTK_FILE_CHOOSER(ui_widgets.open_filesel), filetypes_create_file_filter_all_source()); - foreach_slist(ft, node, sorted_filetypes) + foreach_slist(ft, node, filetypes_by_title) { if (ft->id == GEANY_FILETYPES_NONE) continue;
Modified: branches/reorder-filetypes/src/filetypes.c =================================================================== --- branches/reorder-filetypes/src/filetypes.c 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/src/filetypes.c 2009-04-02 15:00:17 UTC (rev 3677) @@ -69,11 +69,11 @@
static GHashTable *filetypes_hash = NULL; /* Hash of filetype pointers based on name keys */
-/* List of filetype pointers sorted by name, with ft[GEANY_FILETYPES_NONE] first, as this - * is usually treated specially. - * The list does not change after filetypes have been initialized, so you can use - * @code g_slist_nth_data(sorted_filetypes, n) @endcode and expect the same result at different times. */ -GSList *sorted_filetypes = NULL; +/** List of filetype pointers sorted by name, but with @c filetypes_index(GEANY_FILETYPES_NONE) + * first, as this is usually treated specially. + * The list does not change (after filetypes have been initialized), so you can use + * @code g_slist_nth_data(filetypes_by_title, n) @endcode and expect the same result at different times. */ +GSList *filetypes_by_title = NULL;
static void create_radio_menu_item(GtkWidget *menu, GeanyFiletype *ftype); @@ -618,7 +618,7 @@ g_ptr_array_add(filetypes_array, ft); g_hash_table_insert(filetypes_hash, ft->name, ft);
- sorted_filetypes = g_slist_insert_sorted(sorted_filetypes, ft, cmp_filetype); + filetypes_by_title = g_slist_insert_sorted(filetypes_by_title, ft, cmp_filetype); }
@@ -1487,7 +1487,7 @@ GSList *node; GeanyFiletype *ft;
- foreach_slist(ft, node, sorted_filetypes) + foreach_slist(ft, node, filetypes_by_title) { if (ft->id != GEANY_FILETYPES_NONE) callback(ft, user_data);
Modified: branches/reorder-filetypes/src/filetypes.h =================================================================== --- branches/reorder-filetypes/src/filetypes.h 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/src/filetypes.h 2009-04-02 15:00:17 UTC (rev 3677) @@ -144,7 +144,7 @@ * Example: filetypes[GEANY_FILETYPES_C]->name = ...; */ #define filetypes ((GeanyFiletype **)filetypes_array->pdata)
-extern GSList *sorted_filetypes; +extern GSList *filetypes_by_title;
GeanyFiletype *filetypes_lookup_by_name(const gchar *name);
Modified: branches/reorder-filetypes/src/plugindata.h =================================================================== --- branches/reorder-filetypes/src/plugindata.h 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/src/plugindata.h 2009-04-02 15:00:17 UTC (rev 3677) @@ -45,7 +45,7 @@ enum { /** The Application Programming Interface (API) version, incremented * whenever any plugin data types are modified or appended to. */ - GEANY_API_VERSION = 135, + GEANY_API_VERSION = 136,
/** The Application Binary Interface (ABI) version, incremented whenever * existing fields in the plugin data types have to be changed or reordered. */ @@ -188,6 +188,7 @@ struct GeanyToolPrefs *tool_prefs; /**< Tool settings */ struct GeanyTemplatePrefs *template_prefs; /**< Template settings */ struct GeanyBuildInfo *build_info; /**< Current build information */ + GSList *filetypes_by_title; /**< See filetypes.h#filetypes_by_title. */ } GeanyData;
Modified: branches/reorder-filetypes/src/plugins.c =================================================================== --- branches/reorder-filetypes/src/plugins.c 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/src/plugins.c 2009-04-02 15:00:17 UTC (rev 3677) @@ -347,7 +347,8 @@ &search_prefs, &tool_prefs, &template_prefs, - &build_info + &build_info, + filetypes_by_title }; memcpy(&geany_data, &gd, sizeof(GeanyData)); }
Modified: branches/reorder-filetypes/src/templates.c =================================================================== --- branches/reorder-filetypes/src/templates.c 2009-03-31 19:01:31 UTC (rev 3676) +++ branches/reorder-filetypes/src/templates.c 2009-04-02 15:00:17 UTC (rev 3677) @@ -365,7 +365,7 @@ GeanyFiletype *ft; GSList *node;
- foreach_slist(ft, node, sorted_filetypes) + foreach_slist(ft, node, filetypes_by_title) { filetype_id ft_id = ft->id; GtkWidget *tmp_menu, *tmp_button;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.