Fixed a number of small bugs in how we were saving and loading view
2001-02-05 Christopher James Lahey <clahey@helixcode.com> * gal-view-collection.c: Fixed a number of small bugs in how we were saving and loading view collections. * gal-view-etable.c (config_changed): Send the changed signal properly. (gal_view_etable_construct): Duplicate the spec's state here. svn path=/trunk/; revision=7986
This commit is contained in:
committed by
Chris Lahey
parent
707cce7733
commit
fdb765da59
@ -196,6 +196,7 @@ view_changed (GalView *view,
|
||||
GalViewCollectionItem *item)
|
||||
{
|
||||
item->changed = TRUE;
|
||||
item->ever_changed = TRUE;
|
||||
}
|
||||
|
||||
static GalViewCollectionItem *
|
||||
@ -269,17 +270,18 @@ load_single_dir (GalViewCollection *collection,
|
||||
}
|
||||
if (!found) {
|
||||
for (i = 0; i < collection->removed_view_count; i++) {
|
||||
if (!strcmp(id, collection->removed_view_data[i]->id))
|
||||
if (!strcmp(id, collection->removed_view_data[i]->id)) {
|
||||
if (!local)
|
||||
collection->removed_view_data[i]->built_in = TRUE;
|
||||
found = TRUE;
|
||||
break;
|
||||
found = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
GalViewCollectionItem *item = load_single_file (collection, dir, local, child);
|
||||
if (item->filename) {
|
||||
if (item->filename && *item->filename) {
|
||||
collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
|
||||
collection->view_data[collection->view_count] = item;
|
||||
collection->view_count ++;
|
||||
@ -348,6 +350,18 @@ gal_view_collection_save (GalViewCollection *collection)
|
||||
}
|
||||
}
|
||||
}
|
||||
for (i = 0; i < collection->removed_view_count; i++) {
|
||||
xmlNode *child;
|
||||
GalViewCollectionItem *item;
|
||||
|
||||
item = collection->removed_view_data[i];
|
||||
|
||||
child = xmlNewChild(root, NULL, "GalView", NULL);
|
||||
e_xml_set_string_prop_by_name(child, "id", item->id);
|
||||
e_xml_set_string_prop_by_name(child, "title", item->title);
|
||||
e_xml_set_string_prop_by_name(child, "type", item->type);
|
||||
|
||||
}
|
||||
filename = g_concat_dir_and_file(collection->local_dir, "galview.xml");
|
||||
xmlSaveFile(filename, doc);
|
||||
xmlFreeDoc(doc);
|
||||
@ -432,6 +446,10 @@ gal_view_check_string (GalViewCollection *collection,
|
||||
if (!strcmp(string, collection->view_data[i]->id))
|
||||
return FALSE;
|
||||
}
|
||||
for (i = 0; i < collection->removed_view_count; i++) {
|
||||
if (!strcmp(string, collection->removed_view_data[i]->id))
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
@ -15,13 +15,28 @@
|
||||
|
||||
static GalViewClass *gal_view_etable_parent_class;
|
||||
|
||||
|
||||
static void
|
||||
config_changed (ETableConfig *config, ETableState *state, GalViewEtable *view)
|
||||
{
|
||||
if (view->state)
|
||||
gtk_object_unref(GTK_OBJECT(view->state));
|
||||
view->state = e_table_state_duplicate(state);
|
||||
gal_view_changed(GAL_VIEW(view));
|
||||
}
|
||||
|
||||
static void
|
||||
gal_view_etable_edit (GalView *view)
|
||||
{
|
||||
GalViewEtable *etable_view = GAL_VIEW_ETABLE(view);
|
||||
e_table_config_new(etable_view->title,
|
||||
etable_view->spec,
|
||||
etable_view->state);
|
||||
ETableConfig *config;
|
||||
|
||||
config = e_table_config_new(etable_view->title,
|
||||
etable_view->spec,
|
||||
etable_view->state);
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(config), "changed",
|
||||
GTK_SIGNAL_FUNC(config_changed), view);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -147,7 +162,13 @@ gal_view_etable_construct (GalViewEtable *view,
|
||||
if (spec)
|
||||
gtk_object_ref(GTK_OBJECT(spec));
|
||||
view->spec = spec;
|
||||
|
||||
if (view->state)
|
||||
gtk_object_unref(GTK_OBJECT(view->state));
|
||||
view->state = e_table_state_duplicate(spec->state);
|
||||
|
||||
view->title = g_strdup(title);
|
||||
|
||||
return GAL_VIEW(view);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user