Add stash_group_free_settings() function to API
Frees the memory allocated for setting values in a group.
This commit is contained in:
parent
c7b3a09f05
commit
f2d33bc16e
@ -418,6 +418,8 @@
|
|||||||
geany_functions->p_stash->stash_group_display
|
geany_functions->p_stash->stash_group_display
|
||||||
#define stash_group_update \
|
#define stash_group_update \
|
||||||
geany_functions->p_stash->stash_group_update
|
geany_functions->p_stash->stash_group_update
|
||||||
|
#define stash_group_free_settings \
|
||||||
|
geany_functions->p_stash->stash_group_free_settings
|
||||||
#define symbols_get_context_separator \
|
#define symbols_get_context_separator \
|
||||||
geany_functions->p_symbols->symbols_get_context_separator
|
geany_functions->p_symbols->symbols_get_context_separator
|
||||||
#define build_activate_menu_item \
|
#define build_activate_menu_item \
|
||||||
|
|||||||
@ -55,7 +55,7 @@ G_BEGIN_DECLS
|
|||||||
* @warning You should not test for values below 200 as previously
|
* @warning You should not test for values below 200 as previously
|
||||||
* @c GEANY_API_VERSION was defined as an enum value, not a macro.
|
* @c GEANY_API_VERSION was defined as an enum value, not a macro.
|
||||||
*/
|
*/
|
||||||
#define GEANY_API_VERSION 214
|
#define GEANY_API_VERSION 215
|
||||||
|
|
||||||
/** The Application Binary Interface (ABI) version, incremented whenever
|
/** The Application Binary Interface (ABI) version, incremented whenever
|
||||||
* existing fields in the plugin data types have to be changed or reordered.
|
* existing fields in the plugin data types have to be changed or reordered.
|
||||||
@ -701,6 +701,7 @@ typedef struct StashFuncs
|
|||||||
const gchar *property_name, GType type);
|
const gchar *property_name, GType type);
|
||||||
void (*stash_group_display)(struct StashGroup *group, GtkWidget *owner);
|
void (*stash_group_display)(struct StashGroup *group, GtkWidget *owner);
|
||||||
void (*stash_group_update)(struct StashGroup *group, GtkWidget *owner);
|
void (*stash_group_update)(struct StashGroup *group, GtkWidget *owner);
|
||||||
|
void (*stash_group_free_settings)(struct StashGroup *group);
|
||||||
}
|
}
|
||||||
StashFuncs;
|
StashFuncs;
|
||||||
|
|
||||||
@ -716,7 +717,7 @@ SymbolsFuncs;
|
|||||||
typedef struct BuildFuncs
|
typedef struct BuildFuncs
|
||||||
{
|
{
|
||||||
void (*build_activate_menu_item)(const GeanyBuildGroup grp, const guint cmd);
|
void (*build_activate_menu_item)(const GeanyBuildGroup grp, const guint cmd);
|
||||||
const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd,
|
const gchar *(*build_get_current_menu_item)(const GeanyBuildGroup grp, const guint cmd,
|
||||||
const GeanyBuildCmdEntries field);
|
const GeanyBuildCmdEntries field);
|
||||||
void (*build_remove_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp,
|
void (*build_remove_menu_item)(const GeanyBuildSource src, const GeanyBuildGroup grp,
|
||||||
const gint cmd);
|
const gint cmd);
|
||||||
|
|||||||
@ -346,7 +346,8 @@ static StashFuncs stash_funcs = {
|
|||||||
&stash_group_add_entry,
|
&stash_group_add_entry,
|
||||||
&stash_group_add_widget_property,
|
&stash_group_add_widget_property,
|
||||||
&stash_group_display,
|
&stash_group_display,
|
||||||
&stash_group_update
|
&stash_group_update,
|
||||||
|
&stash_group_free_settings
|
||||||
};
|
};
|
||||||
|
|
||||||
static SymbolsFuncs symbols_funcs = {
|
static SymbolsFuncs symbols_funcs = {
|
||||||
|
|||||||
23
src/stash.c
23
src/stash.c
@ -335,6 +335,29 @@ StashGroup *stash_group_new(const gchar *name)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/** Frees the memory allocated for setting values in a group.
|
||||||
|
* Useful e.g. to avoid freeing strings individually.
|
||||||
|
* @note This is *not* called by stash_group_free().
|
||||||
|
* @param group . */
|
||||||
|
void stash_group_free_settings(StashGroup *group)
|
||||||
|
{
|
||||||
|
StashPref *entry;
|
||||||
|
guint i;
|
||||||
|
|
||||||
|
foreach_ptr_array(entry, i, group->entries)
|
||||||
|
{
|
||||||
|
if (entry->setting_type == G_TYPE_STRING)
|
||||||
|
g_free(*(gchararray *) entry->setting);
|
||||||
|
else if (entry->setting_type == G_TYPE_STRV)
|
||||||
|
g_strfreev(*(gchararray **) entry->setting);
|
||||||
|
else
|
||||||
|
continue;
|
||||||
|
|
||||||
|
*(gpointer**) entry->setting = NULL;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/** Frees a group.
|
/** Frees a group.
|
||||||
* @param group . */
|
* @param group . */
|
||||||
void stash_group_free(StashGroup *group)
|
void stash_group_free(StashGroup *group)
|
||||||
|
|||||||
@ -60,6 +60,8 @@ gboolean stash_group_load_from_file(StashGroup *group, const gchar *filename);
|
|||||||
gint stash_group_save_to_file(StashGroup *group, const gchar *filename,
|
gint stash_group_save_to_file(StashGroup *group, const gchar *filename,
|
||||||
GKeyFileFlags flags);
|
GKeyFileFlags flags);
|
||||||
|
|
||||||
|
void stash_group_free_settings(StashGroup *group);
|
||||||
|
|
||||||
void stash_group_free(StashGroup *group);
|
void stash_group_free(StashGroup *group);
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user