Commit 7340d9ef authored by Sebastien Granjoux's avatar Sebastien Granjoux

Bug #560857 - Remove deprecated GLib symbols in project wizard

	* plugins/project-wizard/plugin.c,
	plugins/project-wizard/plugin.h,
	plugins/project-wizard/values.c,
	plugins/project-wizard/values.h,
	plugins/project-wizard/parser.c,
	plugins/project-wizard/parser.h,
	plugins/project-wizard/autogen.c,
	plugins/project-wizard/autogen.h,
	plugins/project-wizard/install.c,
	plugins/project-wizard/install.h,
	plugins/project-wizard/druid.c,
	plugins/project-wizard/action.c,
	plugins/project-wizard/action.h,
	plugins/project-wizard/file.c,
	plugins/project-wizard/file.h,
	plugins/project-wizard/property.c,
	plugins/project-wizard/property.h,
	plugins/project-wizard/header.c,
	plugins/project-wizard/header.h,
	plugins/project-wizard/Makefile.am,
	plugins/class-gen/plugin.c,
	plugins/class-gen/window.c,
	plugins/class-gen/window.h,
	plugins/class-gen/element-editor.c,
	plugins/class-gen/element-editor.h,
	plugins/class-gen/generator.c,
	plugins/class-gen/generator.h:
	Bug #560857 - Remove deprecated GLib symbols in project wizard

svn path=/trunk/; revision=4481
parent 7f33996f
2008-12-24 Sébastien Granjoux <seb.sfo@free.fr>
* plugins/project-wizard/plugin.c,
plugins/project-wizard/plugin.h,
plugins/project-wizard/values.c,
plugins/project-wizard/values.h,
plugins/project-wizard/parser.c,
plugins/project-wizard/parser.h,
plugins/project-wizard/autogen.c,
plugins/project-wizard/autogen.h,
plugins/project-wizard/install.c,
plugins/project-wizard/install.h,
plugins/project-wizard/druid.c,
plugins/project-wizard/action.c,
plugins/project-wizard/action.h,
plugins/project-wizard/file.c,
plugins/project-wizard/file.h,
plugins/project-wizard/property.c,
plugins/project-wizard/property.h,
plugins/project-wizard/header.c,
plugins/project-wizard/header.h,
plugins/project-wizard/Makefile.am,
plugins/class-gen/plugin.c,
plugins/class-gen/window.c,
plugins/class-gen/window.h,
plugins/class-gen/element-editor.c,
plugins/class-gen/element-editor.h,
plugins/class-gen/generator.c,
plugins/class-gen/generator.h:
Bug #560857 - Remove deprecated GLib symbols in project wizard
2008-12-23 Massimo Cora' <mcora@svn.gnome.org>
* plugins/symbol-db/plugin.c (do_add_new_files),
......@@ -750,7 +750,7 @@ cg_element_editor_set_valuesv_foreach_func (gpointer key,
static void
cg_element_editor_set_valuesv (CgElementEditor *editor,
const gchar *name,
NPWValueHeap *values,
GHashTable *values,
CgElementEditorTransformFunc func,
gpointer user_data,
const gchar **field_names)
......@@ -798,7 +798,7 @@ cg_element_editor_set_valuesv (CgElementEditor *editor,
value = npw_value_heap_find_value (values, value_name);
npw_value_heap_set_value (values, value, value_str->str,
npw_value_set_value (value, value_str->str,
NPW_VALID_VALUE);
g_string_set_size (value_str, 0);
......@@ -813,7 +813,7 @@ cg_element_editor_set_valuesv (CgElementEditor *editor,
void
cg_element_editor_set_values (CgElementEditor *editor,
const gchar *name,
NPWValueHeap *values,
GHashTable *values,
CgElementEditorTransformFunc func,
gpointer user_data,
...)
......@@ -841,7 +841,7 @@ cg_element_editor_set_values (CgElementEditor *editor,
void
cg_element_editor_set_value_count (CgElementEditor *editor,
const gchar *name,
NPWValueHeap *values,
GHashTable *values,
CgElementEditorConditionFunc func,
gpointer user_data)
{
......@@ -881,5 +881,5 @@ cg_element_editor_set_value_count (CgElementEditor *editor,
sprintf (count_str, "%u", count);
value = npw_value_heap_find_value (values, name);
npw_value_heap_set_value (values, value, count_str, NPW_VALID_VALUE);
npw_value_set_value (value, count_str, NPW_VALID_VALUE);
}
......@@ -80,7 +80,7 @@ typedef void(*CgElementEditorTransformFunc) (GHashTable *, gpointer);
* eventually. */
void cg_element_editor_set_values (CgElementEditor *editor,
const gchar *name,
NPWValueHeap *values,
GHashTable *values,
CgElementEditorTransformFunc func,
gpointer user_data,
...);
......@@ -89,7 +89,7 @@ typedef gboolean(*CgElementEditorConditionFunc) (const gchar **, gpointer);
void cg_element_editor_set_value_count (CgElementEditor *editor,
const gchar *name,
NPWValueHeap *values,
GHashTable *values,
CgElementEditorConditionFunc func,
gpointer user_data);
......
......@@ -388,7 +388,7 @@ cg_generator_new (const gchar *header_template,
gboolean
cg_generator_run (CgGenerator *generator,
NPWValueHeap *values,
GHashTable *values,
GError **error)
{
CgGeneratorPrivate *priv;
......
......@@ -63,7 +63,7 @@ CgGenerator *cg_generator_new (const gchar *header_template,
const gchar *header_destination,
const gchar *source_destination);
gboolean cg_generator_run (CgGenerator *generator,
NPWValueHeap *values,
GHashTable *values,
GError **error);
const gchar *cg_generator_get_header_template (CgGenerator *generator);
......
......@@ -359,7 +359,7 @@ cg_plugin_window_response_cb (G_GNUC_UNUSED GtkDialog *dialog,
{
AnjutaClassGenPlugin *plugin;
IAnjutaProjectManager *manager;
NPWValueHeap *values;
GHashTable *values;
NPWValue *value;
GError *error;
gchar *name;
......@@ -402,7 +402,7 @@ cg_plugin_window_response_cb (G_GNUC_UNUSED GtkDialog *dialog,
/* Use basename of the project's root URI as project name. */
name = g_path_get_basename (plugin->top_dir);
value = npw_value_heap_find_value (values, "ProjectName");
npw_value_heap_set_value (values, value, name, NPW_VALID_VALUE);
npw_value_set_value (value, name, NPW_VALID_VALUE);
g_free (name);
}
else
......@@ -410,7 +410,7 @@ cg_plugin_window_response_cb (G_GNUC_UNUSED GtkDialog *dialog,
name = g_path_get_basename (cg_window_get_source_file(
plugin->window));
value = npw_value_heap_find_value (values, "ProjectName");
npw_value_heap_set_value (values, value, name, NPW_VALID_VALUE);
npw_value_set_value (value, name, NPW_VALID_VALUE);
g_free (name);
}
......
......@@ -225,7 +225,7 @@ cg_window_fetch_boolean (CgWindow *window,
static void
cg_window_set_heap_value (CgWindow *window,
NPWValueHeap *values,
GHashTable *values,
GType type,
const gchar *name,
const gchar *id)
......@@ -242,16 +242,16 @@ cg_window_set_heap_value (CgWindow *window,
{
case G_TYPE_STRING:
text = cg_window_fetch_string (window, id);
npw_value_heap_set_value (values, value, text, NPW_VALID_VALUE);
npw_value_set_value (value, text, NPW_VALID_VALUE);
g_free (text);
break;
case G_TYPE_INT:
int_value = cg_window_fetch_integer (window, id);
sprintf (int_buffer, "%d", int_value);
npw_value_heap_set_value (values, value, int_buffer, NPW_VALID_VALUE);
npw_value_set_value (value, int_buffer, NPW_VALID_VALUE);
break;
case G_TYPE_BOOLEAN:
npw_value_heap_set_value (values, value,
npw_value_set_value (value,
cg_window_fetch_boolean (window, id) ? "1" : "0", NPW_VALID_VALUE);
break;
......@@ -865,7 +865,7 @@ cg_window_get_dialog (CgWindow *window)
return GTK_DIALOG (CG_WINDOW_PRIVATE (window)->window);
}
NPWValueHeap *
GHashTable *
cg_window_create_value_heap (CgWindow *window)
{
static const gchar *LICENSES[] = {
......@@ -875,7 +875,7 @@ cg_window_create_value_heap (CgWindow *window)
};
CgWindowPrivate *priv;
NPWValueHeap *values;
GHashTable *values;
NPWValue *value;
GError *error;
gint license_index;
......@@ -934,10 +934,10 @@ cg_window_create_value_heap (CgWindow *window)
g_free (text);
value = npw_value_heap_find_value (values, "BaseTypePrefix");
npw_value_heap_set_value (values, value, base_prefix, NPW_VALID_VALUE);
npw_value_set_value (value, base_prefix, NPW_VALID_VALUE);
value = npw_value_heap_find_value (values, "BaseTypeSuffix");
npw_value_heap_set_value (values, value, base_suffix, NPW_VALID_VALUE);
npw_value_set_value (value, base_suffix, NPW_VALID_VALUE);
g_free (base_prefix);
g_free (base_suffix);
......@@ -1002,17 +1002,17 @@ cg_window_create_value_heap (CgWindow *window)
license_index = cg_window_fetch_integer (window, "license");
value = npw_value_heap_find_value (values, "License");
npw_value_heap_set_value(values, value, LICENSES[license_index],
npw_value_set_value(value, LICENSES[license_index],
NPW_VALID_VALUE);
header_file = g_path_get_basename (cg_window_get_header_file (window));
source_file = g_path_get_basename (cg_window_get_source_file (window));
value = npw_value_heap_find_value (values, "HeaderFile");
npw_value_heap_set_value (values, value, header_file, NPW_VALID_VALUE);
npw_value_set_value (value, header_file, NPW_VALID_VALUE);
value = npw_value_heap_find_value (values, "SourceFile");
npw_value_heap_set_value (values, value, source_file, NPW_VALID_VALUE);
npw_value_set_value (value, source_file, NPW_VALID_VALUE);
g_free (header_file);
g_free (source_file);
......
......@@ -55,7 +55,7 @@ GType cg_window_get_type (void) G_GNUC_CONST;
CgWindow *cg_window_new (void);
GtkDialog *cg_window_get_dialog (CgWindow *window);
NPWValueHeap *cg_window_create_value_heap (CgWindow *window);
GHashTable *cg_window_create_value_heap (CgWindow *window);
const gchar *cg_window_get_header_template (CgWindow *window);
const gchar *cg_window_get_header_file (CgWindow *window);
......
......@@ -30,7 +30,8 @@ plugin_LTLIBRARIES = libanjuta-project-wizard.la
AM_CPPFLAGS = \
$(WARN_CFLAGS) \
$(DEPRECATED_FLAGS) \
$(LIBANJUTA_CFLAGS)
$(LIBANJUTA_CFLAGS) \
-DG_LOG_DOMAIN=\"libanjuta-project-wizard\"
libanjuta_project_wizard_la_LDFLAGS = $(ANJUTA_PLUGIN_LDFLAGS)
......
......@@ -20,39 +20,17 @@
/*
* Actions data read in .wiz file
*
* It's just a list containing all data
*---------------------------------------------------------------------------*/
#include <config.h>
#include "action.h"
#include <glib.h>
/*---------------------------------------------------------------------------*/
#define STRING_CHUNK_SIZE 256
/*---------------------------------------------------------------------------*/
/* List containing all actions. It includes chunk for strings and actions
* object, so memory allocation is handled by the list itself */
struct _NPWActionList
{
GList* list;
GStringChunk* string_pool;
GMemChunk* data_pool;
};
/* Action object, it includes a pointer on its owner to allocate new data */
struct _NPWAction {
NPWActionType type;
gchar* command;
NPWActionList* owner;
GList* node;
};
/* Action object
......@@ -60,97 +38,54 @@ struct _NPWAction {
*---------------------------------------------------------------------------*/
NPWAction*
npw_action_new (NPWActionList* owner, NPWActionType type)
npw_action_new_file (const gchar *file)
{
NPWAction* this;
NPWAction* action;
g_return_val_if_fail (owner != NULL, NULL);
g_return_val_if_fail (file != NULL, NULL);
this = g_chunk_new0(NPWAction, owner->data_pool);
this->type = type;
this->owner = owner;
owner->list = g_list_append (owner->list, this);
this->node = g_list_last (owner->list);
return this;
}
action = g_slice_new (NPWAction);
action->type = NPW_OPEN_ACTION;
action->command = g_strdup (file);
void
npw_action_free (NPWAction* this)
{
/* Memory allocated in string pool and project pool is not free */
return action;
}
NPWActionType
npw_action_get_type (const NPWAction* this)
NPWAction*
npw_action_new_command (const gchar *command)
{
return this->type;
}
NPWAction* action;
void
npw_action_set_command (NPWAction* this, const gchar* command)
{
this->command = g_string_chunk_insert (this->owner->string_pool, command);
}
g_return_val_if_fail (command != NULL, NULL);
action = g_slice_new (NPWAction);
action->type = NPW_RUN_ACTION;
action->command = g_strdup (command);
const gchar*
npw_action_get_command (const NPWAction* this)
{
return this->command;
return action;
}
void
npw_action_set_file (NPWAction* this, const gchar* file)
{
npw_action_set_command (this, file);
}
const gchar*
npw_action_get_file (const NPWAction* this)
npw_action_free (NPWAction* action)
{
return npw_action_get_command (this);
g_free (action->command);
g_slice_free (NPWAction, action);
}
const NPWAction*
npw_action_next (const NPWAction* this)
{
GList* node = this->node->next;
return node == NULL ? NULL : (NPWAction *)node->data;
}
/* Action list object
*---------------------------------------------------------------------------*/
NPWActionList*
npw_action_list_new (void)
NPWActionType
npw_action_get_type (const NPWAction* action)
{
NPWActionList* this;
this = g_new (NPWActionList, 1);
this->string_pool = g_string_chunk_new (STRING_CHUNK_SIZE);
this->data_pool = g_mem_chunk_new ("action pool", sizeof (NPWAction), STRING_CHUNK_SIZE * sizeof (NPWAction) / 4, G_ALLOC_ONLY);
this->list = NULL;
return this;
return action->type;
}
void
npw_action_list_free (NPWActionList* this)
const gchar*
npw_action_get_command (const NPWAction* action)
{
g_return_if_fail (this != NULL);
g_string_chunk_free (this->string_pool);
g_mem_chunk_destroy (this->data_pool);
g_list_free (this->list);
g_free (this);
return action->command;
}
const NPWAction*
npw_action_list_first (const NPWActionList* this)
const gchar*
npw_action_get_file (const NPWAction* action)
{
GList* node = g_list_first (this->list);
return node == NULL ? NULL : (NPWAction *)node->data;
return action->command;
}
......@@ -24,30 +24,19 @@
#include <glib.h>
typedef struct _NPWAction NPWAction;
typedef struct _NPWActionList NPWActionList;
typedef enum {
NPW_RUN_ACTION,
NPW_OPEN_ACTION
} NPWActionType;
NPWAction* npw_action_new (NPWActionList* owner, NPWActionType type);
void npw_action_free (NPWAction* this);
NPWAction* npw_action_new_file (const gchar *file);
NPWAction* npw_action_new_command (const gchar *command);
NPWActionType npw_action_get_type (const NPWAction* this);
void npw_action_free (NPWAction* action);
void npw_action_set_command (NPWAction* this, const gchar* command);
const gchar* npw_action_get_command (const NPWAction* this);
void npw_action_set_file (NPWAction* this, const gchar* command);
const gchar* npw_action_get_file (const NPWAction* this);
const NPWAction* npw_action_next (const NPWAction* this);
NPWActionList* npw_action_list_new (void);
void npw_action_list_free (NPWActionList* this);
const NPWAction* npw_action_list_first (const NPWActionList* this);
NPWActionType npw_action_get_type (const NPWAction* action);
const gchar* npw_action_get_command (const NPWAction* action);
const gchar* npw_action_get_file (const NPWAction* action);
#endif
......@@ -117,19 +117,19 @@ npw_check_autogen (void)
*---------------------------------------------------------------------------*/
static void
cb_autogen_write_definition (const gchar* name, const gchar* value, NPWValueTag tag, gpointer user_data)
cb_autogen_write_definition (const gchar* name, NPWValue * node, gpointer user_data)
{
FILE* def = (FILE *)user_data;
if ((tag & NPW_VALID_VALUE) && (value != NULL))
if ((npw_value_get_tag(node) & NPW_VALID_VALUE) && (npw_value_get_value(node) != NULL))
{
if(value[0] == '{') /* Seems to be a list, so do not quote */
if(npw_value_get_value (node)[0] == '{') /* Seems to be a list, so do not quote */
{
fprintf(def, "%s = %s;\n", name, value);
fprintf(def, "%s = %s;\n", name, npw_value_get_value (node));
}
else
{
gchar *esc_value = g_strescape (value, NULL);
gchar *esc_value = g_strescape (npw_value_get_value (node), NULL);
fprintf (def, "%s = \"%s\";\n", name, esc_value);
g_free (esc_value);
}
......@@ -137,7 +137,7 @@ cb_autogen_write_definition (const gchar* name, const gchar* value, NPWValueTag
}
gboolean
npw_autogen_write_definition_file (NPWAutogen* this, NPWValueHeap* values)
npw_autogen_write_definition_file (NPWAutogen* this, GHashTable* values)
{
FILE* def;
......@@ -149,7 +149,7 @@ npw_autogen_write_definition_file (NPWAutogen* this, NPWValueHeap* values)
/* Generate definition data for autogen */
fputs ("AutoGen Definitions .;\n",def);
npw_value_heap_foreach_value (values, cb_autogen_write_definition, def);
npw_value_heap_foreach_value (values, (GHFunc)cb_autogen_write_definition, def);
fclose (def);
......
......@@ -34,7 +34,7 @@ typedef void (*NPWAutogenOutputFunc) (const gchar* output, gpointer data);
NPWAutogen* npw_autogen_new (void);
void npw_autogen_free (NPWAutogen* this);
gboolean npw_autogen_write_definition_file (NPWAutogen* this, NPWValueHeap* values);
gboolean npw_autogen_write_definition_file (NPWAutogen* this, GHashTable* values);
gboolean npw_autogen_set_input_file (NPWAutogen* this, const gchar* filename, const gchar* start_marker, const gchar* end_marker);
gboolean npw_autogen_set_output_file (NPWAutogen* this, const gchar* filename);
......
......@@ -93,7 +93,7 @@ struct _NPWDruid
{
GtkWidget* dialog;
GtkNotebook* project_book;
GMemChunk* pool;
GList *stuff_list;
GnomeDruid* druid;
const gchar* project_file;
GnomeDruidPage* selection_page;
......@@ -106,9 +106,9 @@ struct _NPWDruid
guint page;
GQueue* page_list;
NPWValueHeap* values;
GHashTable* values;
NPWPageParser* parser;
NPWHeaderList* header_list;
GList* header_list;
NPWHeader* header;
NPWAutogen* gen;
gboolean busy;
......@@ -185,7 +185,7 @@ npw_druid_fill_summary (NPWDruid* this)
for (i = 0; (page = g_queue_peek_nth (this->page_list, i)) != NULL; ++i)
{
npw_page_foreach_property (page, cb_druid_add_summary_property, text);
npw_page_foreach_property (page, (GFunc)cb_druid_add_summary_property, text);
}
gnome_druid_page_edge_set_text (GNOME_DRUID_PAGE_EDGE (this->finish_page), text->str);
......@@ -230,10 +230,11 @@ on_druid_project_select_page (GtkWidget* widget, gpointer user_data)
/* Add a project in the icon list */
static void
cb_druid_insert_project_icon (NPWHeader* header, gpointer user_data)
cb_druid_insert_project_icon (gpointer data, gpointer user_data)
{
gint idx;
NPWHeader *header = (NPWHeader *)data;
GnomeIconList* list = GNOME_ICON_LIST (user_data);
gint idx;
idx = gnome_icon_list_append (list, npw_header_get_iconfile (header), _(npw_header_get_name (header)));
gnome_icon_list_set_icon_data (list, idx, header);
......@@ -241,7 +242,7 @@ cb_druid_insert_project_icon (NPWHeader* header, gpointer user_data)
/* Add a page in the project notebook */
static void
cb_druid_insert_project_page (NPWHeader* header, gpointer user_data)
cb_druid_insert_project_page (gpointer value, gpointer user_data)
{
NPWDruid* this = (NPWDruid*)user_data;
GladeXML* xml;
......@@ -249,11 +250,12 @@ cb_druid_insert_project_page (NPWHeader* header, gpointer user_data)
GtkWidget* frame;
GnomeIconList* list;
GtkLabel* desc;
GList *template_list = (GList *)value;
const gchar* category;
NPWDruidAndTextBuffer* data;
category = npw_header_get_category(header);
category = npw_header_get_category ((NPWHeader *)template_list->data);
/* Create new frame according to glade file */
xml = glade_xml_new (GLADE_FILE, PROJECT_SELECTION_FRAME, NULL);
g_return_if_fail (xml != NULL);
......@@ -262,11 +264,12 @@ cb_druid_insert_project_page (NPWHeader* header, gpointer user_data)
list = GNOME_ICON_LIST (glade_xml_get_widget (xml, PROJECT_SELECTION_LIST));
desc = GTK_LABEL (glade_xml_get_widget (xml, PROJECT_DESCRIPTION));
npw_header_list_foreach_project_in (this->header_list, category, cb_druid_insert_project_icon, list);
g_list_foreach (template_list, cb_druid_insert_project_icon, list);
/* put druid address and corresponding text buffer in one structure
* to pass them to a call back function as an unique pointer */
data = g_chunk_new (NPWDruidAndTextBuffer, this->pool);
data = g_slice_new (NPWDruidAndTextBuffer);
this->stuff_list = g_list_prepend (this->stuff_list, data);
data->druid = this;
data->description = desc;
data->header = (NPWHeader*)gnome_icon_list_get_icon_data (list, 0);
......@@ -280,7 +283,7 @@ cb_druid_insert_project_page (NPWHeader* header, gpointer user_data)
g_return_if_fail (xml != NULL);
label = glade_xml_get_widget (xml, PROJECT_SELECTION_BOOK_LABEL);
g_object_unref (xml);
gtk_label_set_text (GTK_LABEL(label), category);
gtk_label_set_text (GTK_LABEL(label), (const gchar *)category);
gtk_notebook_append_page (this->project_book, frame, label);
}
......@@ -297,13 +300,13 @@ npw_druid_fill_selection_page (NPWDruid* this)
this->header_list = npw_header_list_new ();
/* Fill list with all project in directory */
ok = npw_header_list_readdir (this->header_list, PROJECT_WIZARD_DIRECTORY);
ok = npw_header_list_readdir (&this->header_list, PROJECT_WIZARD_DIRECTORY);
#ifdef LOCAL_PROJECT_WIZARD_DIRECTORY
local_dir = g_build_filename (g_get_home_dir(), LOCAL_PROJECT_WIZARD_DIRECTORY, NULL);
#else
local_dir = anjuta_util_get_user_data_file_path ("projects/",NULL);
#endif
ok = npw_header_list_readdir (this->header_list, local_dir) || ok;
ok = npw_header_list_readdir (&this->header_list, local_dir) || ok;
g_free (local_dir);
if (!ok)
{
......@@ -313,7 +316,8 @@ npw_druid_fill_selection_page (NPWDruid* this)
/* Add all notebook page */
gtk_notebook_remove_page(this->project_book, 0);
npw_header_list_foreach_category (this->header_list, cb_druid_insert_project_page, this);
g_list_foreach (this->header_list, cb_druid_insert_project_page, this);
return TRUE;
}
......@@ -403,7 +407,7 @@ npw_druid_fill_property_page (NPWDruid* this, NPWPage* page)
/* Add new widget */
data.druid = this;
data.row = 0;
npw_page_foreach_property (page, cb_druid_add_property, &data);
npw_page_foreach_property (page, (GFunc)cb_druid_add_property, &data);
/* Change page only if current is project selection page */
gnome_druid_set_page (this->druid, GNOME_DRUID_PAGE (this->property_page));
......@@ -581,7 +585,7 @@ npw_druid_save_valid_values (NPWDruid* this)
data.modified = FALSE;
data.next = TRUE;
data.parent = GTK_WINDOW (this->dialog);
npw_page_foreach_property (page, cb_save_valid_property, &data);
npw_page_foreach_property (page, (GFunc)cb_save_valid_property, &data);
if (data.modified) npw_druid_remove_following_page (this);
......@@ -598,7 +602,7 @@ npw_druid_save_old_values (NPWDruid* this)
page = g_queue_peek_nth (this->page_list, this->page - 1);
modified = FALSE;
npw_page_foreach_property (page, cb_save_old_property, &modified);
npw_page_foreach_property (page, (GFunc)cb_save_old_property, &modified);
}
......@@ -890,7 +894,7 @@ npw_druid_add_default_property (NPWDruid* this)
/* Add default base project directory */
value = npw_value_heap_find_value (this->values, ANJUTA_PROJECT_DIRECTORY_PROPERTY);
s = anjuta_preferences_get (pref, "anjuta.project.directory");
npw_value_heap_set_value (this->values, value, s == NULL ? "~" : s, NPW_VALID_VALUE);
npw_value_set_value (value, s == NULL ? "~" : s, NPW_VALID_VALUE);
g_free (s);
/* Add user name */
......@@ -899,11 +903,11 @@ npw_druid_add_default_property (NPWDruid* this)
if (!s || strlen(s) == 0)
{
s = (gchar *)g_get_real_name();
npw_value_heap_set_value (this->values, value, s, NPW_VALID_VALUE);
npw_value_set_value (value, s, NPW_VALID_VALUE);
}
else
{
npw_value_heap_set_value (this->values, value, s, NPW_VALID_VALUE);
npw_value_set_value (value, s, NPW_VALID_VALUE);
g_free (s);
}
/* Add Email address */
......@@ -916,7 +920,7 @@ npw_druid_add_default_property (NPWDruid* this)
s = getenv("USER");
s = g_strconcat(s, "@", getenv("HOSTNAME"), NULL);
}
npw_value_heap_set_value (this->values, value, s, NPW_VALID_VALUE);
npw_value_set_value (value, s, NPW_VALID_VALUE);
g_free (s);
}
......@@ -949,8 +953,7 @@ npw_druid_new (NPWPlugin* plugin)
return NULL;
}
this->pool = g_mem_chunk_new ("druid pool", sizeof(NPWDruidStuff), sizeof(NPWDruidStuff) * 20, G_ALLOC_ONLY);
/* Get reference on all useful widget */
this->dialog = glade_xml_get_widget (xml, NEW_PROJECT_DIALOG);
gtk_window_set_transient_for (GTK_WINDOW (this->dialog),
......@@ -999,6 +1002,12 @@ npw_druid_new (NPWPlugin* plugin)
return this;
}
static void
npw_druid_stuff_free (NPWDruidStuff *stuff)
{
g_slice_free (NPWDruidStuff, stuff);
}
void
npw_druid_free (NPWDruid* this)
{
......@@ -1018,7 +1027,8 @@ npw_druid_free (NPWDruid* this)
npw_value_heap_free (this->values);
npw_autogen_free (this->gen);
if (this->parser != NULL) npw_page_parser_free (this->parser);
g_mem_chunk_destroy(this->pool);
g_list_foreach (this->stuff_list, (GFunc)npw_druid_stuff_free, NULL);
g_list_free (this->stuff_list);
npw_header_list_free (this->header_list);
gtk_widget_destroy (this->dialog);
this->plugin->druid = NULL;
......
......@@ -27,28 +27,13 @@
#include "file.h"
#include <glib.h>
/*---------------------------------------------------------------------------*/
#define STRING_CHUNK_SIZE 256
/*---------------------------------------------------------------------------*/
struct _NPWFileList
{
GNode* list;
GStringChunk* string_pool;
GMemChunk* data_pool;
};
struct _NPWFile {
NPWFileType type;
gchar* source;