Revision: 2545 http://geany.svn.sourceforge.net/geany/?rev=2545&view=rev Author: ntrel Date: 2008-05-01 07:51:47 -0700 (Thu, 01 May 2008)
Log Message: ----------- Add filetypes_new() to create and initialize a new filetype.
Modified Paths: -------------- branches/custom-filetypes/ChangeLog branches/custom-filetypes/src/filetypes.c
Modified: branches/custom-filetypes/ChangeLog =================================================================== --- branches/custom-filetypes/ChangeLog 2008-05-01 14:30:20 UTC (rev 2544) +++ branches/custom-filetypes/ChangeLog 2008-05-01 14:51:47 UTC (rev 2545) @@ -8,6 +8,8 @@ filetype in filetypes_hash until TRUE is returned. Make filetypes_detect_from_extension() work for all filetypes in filetypes_hash. + * src/filetypes.c: + Add filetypes_new() to create and initialize a new filetype.
2008-04-29 Nick Treleaven <nick(dot)treleaven(at)btinternet(dot)com>
Modified: branches/custom-filetypes/src/filetypes.c =================================================================== --- branches/custom-filetypes/src/filetypes.c 2008-05-01 14:30:20 UTC (rev 2544) +++ branches/custom-filetypes/src/filetypes.c 2008-05-01 14:51:47 UTC (rev 2545) @@ -50,7 +50,7 @@ static void create_radio_menu_item(GtkWidget *menu, const gchar *label, filetype *ftype);
-static void fill_filetypes(void) +static void init_builtin_filetypes(void) { #define C /* these macros are only to ease navigation */ filetypes[GEANY_FILETYPES_C]->id = GEANY_FILETYPES_C; @@ -405,17 +405,18 @@ }
-static void create_built_in_filetypes(void) +/* initialize fields. */ +static filetype *filetypes_new(void) { - filetype_id ft_id; + filetype *ft = g_new0(filetype, 1);
- for (ft_id = 0; ft_id < GEANY_MAX_BUILT_IN_FILETYPES; ft_id++) - { - filetypes[ft_id] = g_new0(filetype, 1); - filetypes[ft_id]->programs = g_new0(struct build_programs, 1); - filetypes[ft_id]->actions = g_new0(struct build_actions, 1); - } - fill_filetypes(); +/* + ft->id = GEANY_FILETYPES_OTHER; +*/ + ft->lang = -2; /* no tagmanager parser */ + ft->programs = g_new0(struct build_programs, 1); + ft->actions = g_new0(struct build_actions, 1); + return ft; }
@@ -426,12 +427,18 @@
g_return_if_fail(filetypes_hash == NULL);
- create_built_in_filetypes(); - filetypes_hash = g_hash_table_new(g_str_hash, g_str_equal);
+ /* Create built-in filetypes */ for (ft_id = 0; ft_id < GEANY_MAX_BUILT_IN_FILETYPES; ft_id++) { + filetypes[ft_id] = filetypes_new(); + } + init_builtin_filetypes(); + + /* Add built-in filetypes to the hash */ + for (ft_id = 0; ft_id < GEANY_MAX_BUILT_IN_FILETYPES; ft_id++) + { filetypes_add(filetypes[ft_id]); } }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.