aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@ximian.com>2001-03-06 00:01:46 +0800
committerChris Lahey <clahey@src.gnome.org>2001-03-06 00:01:46 +0800
commit8436f727bb98db48b70cb09b7246f2fdf5d22a60 (patch)
tree7333540de7bcedd6b3f2d6dcc1bd24c01f9331ab
parent455d1eabc1ab7f5a8676bb027e6f3c7b79327b01 (diff)
downloadgsoc2013-evolution-8436f727bb98db48b70cb09b7246f2fdf5d22a60.tar
gsoc2013-evolution-8436f727bb98db48b70cb09b7246f2fdf5d22a60.tar.gz
gsoc2013-evolution-8436f727bb98db48b70cb09b7246f2fdf5d22a60.tar.bz2
gsoc2013-evolution-8436f727bb98db48b70cb09b7246f2fdf5d22a60.tar.lz
gsoc2013-evolution-8436f727bb98db48b70cb09b7246f2fdf5d22a60.tar.xz
gsoc2013-evolution-8436f727bb98db48b70cb09b7246f2fdf5d22a60.tar.zst
gsoc2013-evolution-8436f727bb98db48b70cb09b7246f2fdf5d22a60.zip
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
-rw-r--r--widgets/menus/gal-view-collection.c35
-rw-r--r--widgets/menus/gal-view-collection.h24
2 files changed, 47 insertions, 12 deletions
diff --git a/widgets/menus/gal-view-collection.c b/widgets/menus/gal-view-collection.c
index 6b110e2867..895b85c7c1 100644
--- a/widgets/menus/gal-view-collection.c
+++ b/widgets/menus/gal-view-collection.c
@@ -23,6 +23,7 @@ static GtkObjectClass *gal_view_collection_parent_class;
enum {
DISPLAY_VIEW,
+ CHANGED,
LAST_SIGNAL
};
@@ -47,6 +48,16 @@ gal_view_collection_display_view (GalViewCollection *collection,
}
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)
{
g_free(item->id);
@@ -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);
}
diff --git a/widgets/menus/gal-view-collection.h b/widgets/menus/gal-view-collection.h
index bfb790d0ae..82da6a2de6 100644
--- a/widgets/menus/gal-view-collection.h
+++ b/widgets/menus/gal-view-collection.h
@@ -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);