Made GalViewCollectionItem a public type. (load_single_file): Made it so

2001-01-23  Christopher James Lahey  <clahey@helixcode.com>

	* gal-view-collection.c, gal-view-collection.h: Made
	GalViewCollectionItem a public type.
	(load_single_file): Made it so that the filename does not get
	saved with the directory structure.
	(gal_view_collection_get_view_item): Added this function to return
	a certain GalViewCollectionItem.

svn path=/trunk/; revision=7773
This commit is contained in:
Christopher James Lahey
2001-01-24 04:22:08 +00:00
committed by Chris Lahey
parent d6599e25f2
commit 6b3050b79e
2 changed files with 39 additions and 40 deletions

View File

@ -19,17 +19,6 @@
#define PARENT_TYPE gtk_object_get_type ()
struct _GalViewCollectionItem {
GalView *view;
char *id;
gboolean changed;
gboolean ever_changed;
gboolean built_in;
char *filename;
char *title;
char *type;
};
static GtkObjectClass *gal_view_collection_parent_class;
enum {
@ -226,13 +215,8 @@ load_single_file (GalViewCollection *collection,
item->type = e_xml_get_string_prop_by_name(node, "type");
if (item->filename) {
GalViewFactory *factory;
char *temp;
GList *factories;
temp = g_concat_dir_and_file(dir, item->filename);
g_free(item->filename);
item->filename = temp;
factory = NULL;
for (factories = collection->factory_list; factories; factories = factories->next) {
if (!strcmp(gal_view_factory_get_type_code(factories->data), item->type)) {
@ -241,12 +225,17 @@ load_single_file (GalViewCollection *collection,
}
}
if (factory) {
item->view = gal_view_factory_new_view (factory, item->filename);
gal_view_load(item->view, item->filename);
char *filename;
filename = g_concat_dir_and_file(dir, item->filename);
item->view = gal_view_factory_new_view (factory, item->title);
gal_view_load(item->view, filename);
gal_view_set_title (item->view, item->title);
gtk_signal_connect(GTK_OBJECT(item->view), "changed",
GTK_SIGNAL_FUNC(view_changed), item);
g_free(filename);
}
}
return item;
}

View File

@ -11,7 +11,16 @@
#define GAL_IS_VIEW_COLLECTION(o) (GTK_CHECK_TYPE ((o), GAL_VIEW_COLLECTION_TYPE))
#define GAL_IS_VIEW_COLLECTION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), GAL_VIEW_COLLECTION_TYPE))
typedef struct _GalViewCollectionItem GalViewCollectionItem;
typedef struct {
GalView *view;
char *id;
gboolean changed;
gboolean ever_changed;
gboolean built_in;
char *filename;
char *title;
char *type;
} GalViewCollectionItem;
typedef struct {
GtkObject base;
@ -38,34 +47,35 @@ typedef struct {
} GalViewCollectionClass;
/* Standard functions */
GtkType gal_view_collection_get_type (void);
GalViewCollection *gal_view_collection_new (void);
GtkType gal_view_collection_get_type (void);
GalViewCollection *gal_view_collection_new (void);
/* Set up the view collection */
void gal_view_collection_set_storage_directories (GalViewCollection *collection,
const char *system_dir,
const char *local_dir);
void gal_view_collection_add_factory (GalViewCollection *collection,
GalViewFactory *factory);
void gal_view_collection_set_storage_directories (GalViewCollection *collection,
const char *system_dir,
const char *local_dir);
void gal_view_collection_add_factory (GalViewCollection *collection,
GalViewFactory *factory);
/* Send the display view signal. */
void gal_view_collection_display_view (GalViewCollection *collection,
GalView *view);
void gal_view_collection_display_view (GalViewCollection *collection,
GalView *view);
gint gal_view_collection_get_count (GalViewCollection *collection);
GalView *gal_view_collection_get_view (GalViewCollection *collection,
int n);
GalViewCollectionItem *gal_view_collection_get_view_item (GalViewCollection *collection,
int n);
gint gal_view_collection_get_count (GalViewCollection *collection);
GalView *gal_view_collection_get_view (GalViewCollection *collection,
int n);
void gal_view_collection_append (GalViewCollection *collection,
GalView *view);
void gal_view_collection_delete_view (GalViewCollection *collection,
int i);
void gal_view_collection_copy_view (GalViewCollection *collection,
int i);
void gal_view_collection_append (GalViewCollection *collection,
GalView *view);
void gal_view_collection_delete_view (GalViewCollection *collection,
int i);
void gal_view_collection_copy_view (GalViewCollection *collection,
int i);
/* Call set_storage_directories and add factories for anything that
* might be found there before doing either of these. */
void gal_view_collection_load (GalViewCollection *collection);
void gal_view_collection_save (GalViewCollection *collection);
void gal_view_collection_load (GalViewCollection *collection);
void gal_view_collection_save (GalViewCollection *collection);
#endif /* _GAL_VIEW_COLLECTION_H_ */