New changed signal.
2001-03-05 Christopher James Lahey <clahey@ximian.com> * gal-view-collection.c, gal-view-collection.h (gal_view_collection_changed): New changed signal. svn path=/trunk/; revision=8555
This commit is contained in:
committed by
Chris Lahey
parent
455d1eabc1
commit
8436f727bb
@ -23,6 +23,7 @@ static GtkObjectClass *gal_view_collection_parent_class;
|
||||
|
||||
enum {
|
||||
DISPLAY_VIEW,
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
@ -46,6 +47,16 @@ gal_view_collection_display_view (GalViewCollection *collection,
|
||||
view);
|
||||
}
|
||||
|
||||
static void
|
||||
gal_view_collection_changed (GalViewCollection *collection)
|
||||
{
|
||||
g_return_if_fail (collection != NULL);
|
||||
g_return_if_fail (GAL_IS_VIEW_COLLECTION (collection));
|
||||
|
||||
gtk_signal_emit (GTK_OBJECT (collection),
|
||||
gal_view_collection_signals [CHANGED]);
|
||||
}
|
||||
|
||||
static void
|
||||
gal_view_collection_item_free (GalViewCollectionItem *item)
|
||||
{
|
||||
@ -93,11 +104,20 @@ gal_view_collection_class_init (GtkObjectClass *object_class)
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GalViewCollectionClass, display_view),
|
||||
gtk_marshal_NONE__OBJECT,
|
||||
GTK_TYPE_NONE, 1, GTK_TYPE_OBJECT);
|
||||
GTK_TYPE_NONE, 1, GAL_VIEW_TYPE);
|
||||
|
||||
gal_view_collection_signals [CHANGED] =
|
||||
gtk_signal_new ("changed",
|
||||
GTK_RUN_LAST,
|
||||
object_class->type,
|
||||
GTK_SIGNAL_OFFSET (GalViewCollectionClass, changed),
|
||||
gtk_marshal_NONE__NONE,
|
||||
GTK_TYPE_NONE, 0);
|
||||
|
||||
gtk_object_class_add_signals (object_class, gal_view_collection_signals, LAST_SIGNAL);
|
||||
|
||||
klass->display_view = NULL;
|
||||
klass->display_view = NULL;
|
||||
klass->changed = NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
@ -197,6 +217,8 @@ view_changed (GalView *view,
|
||||
{
|
||||
item->changed = TRUE;
|
||||
item->ever_changed = TRUE;
|
||||
|
||||
gal_view_collection_changed(item->collection);
|
||||
}
|
||||
|
||||
static GalViewCollectionItem *
|
||||
@ -214,6 +236,7 @@ load_single_file (GalViewCollection *collection,
|
||||
item->title = e_xml_get_string_prop_by_name(node, "title");
|
||||
item->filename = e_xml_get_string_prop_by_name(node, "filename");
|
||||
item->type = e_xml_get_string_prop_by_name(node, "type");
|
||||
item->collection = collection;
|
||||
if (item->filename) {
|
||||
GalViewFactory *factory;
|
||||
GList *factories;
|
||||
@ -483,6 +506,7 @@ gal_view_collection_append (GalViewCollection *collection,
|
||||
item->id = gal_view_generate_id(collection, view);
|
||||
item->filename = g_strdup_printf("%s.galview", item->id);
|
||||
item->view = view;
|
||||
item->collection = collection;
|
||||
gtk_object_ref(GTK_OBJECT(view));
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(item->view), "changed",
|
||||
@ -491,6 +515,8 @@ gal_view_collection_append (GalViewCollection *collection,
|
||||
collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
|
||||
collection->view_data[collection->view_count] = item;
|
||||
collection->view_count ++;
|
||||
|
||||
gal_view_collection_changed(collection);
|
||||
}
|
||||
|
||||
void
|
||||
@ -509,6 +535,8 @@ gal_view_collection_delete_view (GalViewCollection *collection,
|
||||
} else {
|
||||
gal_view_collection_item_free (item);
|
||||
}
|
||||
|
||||
gal_view_collection_changed(collection);
|
||||
}
|
||||
|
||||
void
|
||||
@ -527,6 +555,7 @@ gal_view_collection_copy_view (GalViewCollection *collection,
|
||||
item->id = gal_view_generate_id(collection, view);
|
||||
item->filename = g_strdup_printf("%s.galview", item->id);
|
||||
item->view = gal_view_clone(view);
|
||||
item->collection = collection;
|
||||
|
||||
gtk_signal_connect(GTK_OBJECT(item->view), "changed",
|
||||
GTK_SIGNAL_FUNC(view_changed), item);
|
||||
@ -534,4 +563,6 @@ gal_view_collection_copy_view (GalViewCollection *collection,
|
||||
collection->view_data = g_renew(GalViewCollectionItem *, collection->view_data, collection->view_count + 1);
|
||||
collection->view_data[collection->view_count] = item;
|
||||
collection->view_count ++;
|
||||
|
||||
gal_view_collection_changed(collection);
|
||||
}
|
||||
|
||||
@ -16,16 +16,7 @@ extern "C" {
|
||||
#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 {
|
||||
GalView *view;
|
||||
char *id;
|
||||
gboolean changed;
|
||||
gboolean ever_changed;
|
||||
gboolean built_in;
|
||||
char *filename;
|
||||
char *title;
|
||||
char *type;
|
||||
} GalViewCollectionItem;
|
||||
typedef struct GalViewCollectionItem GalViewCollectionItem;
|
||||
|
||||
typedef struct {
|
||||
GtkObject base;
|
||||
@ -49,8 +40,21 @@ typedef struct {
|
||||
*/
|
||||
void (*display_view) (GalViewCollection *collection,
|
||||
GalView *view);
|
||||
void (*changed) (GalViewCollection *collection);
|
||||
} GalViewCollectionClass;
|
||||
|
||||
struct GalViewCollectionItem {
|
||||
GalView *view;
|
||||
char *id;
|
||||
gboolean changed;
|
||||
gboolean ever_changed;
|
||||
gboolean built_in;
|
||||
char *filename;
|
||||
char *title;
|
||||
char *type;
|
||||
GalViewCollection *collection;
|
||||
};
|
||||
|
||||
/* Standard functions */
|
||||
GtkType gal_view_collection_get_type (void);
|
||||
GalViewCollection *gal_view_collection_new (void);
|
||||
|
||||
Reference in New Issue
Block a user