aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/menus/gal-define-views-model.c
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/menus/gal-define-views-model.c')
-rw-r--r--widgets/menus/gal-define-views-model.c115
1 files changed, 50 insertions, 65 deletions
diff --git a/widgets/menus/gal-define-views-model.c b/widgets/menus/gal-define-views-model.c
index eb41f3b84a..40e54a53b6 100644
--- a/widgets/menus/gal-define-views-model.c
+++ b/widgets/menus/gal-define-views-model.c
@@ -26,35 +26,36 @@
#include <libxml/parser.h>
#include <libxml/xmlmemory.h>
#include "gal-define-views-model.h"
+#include <gal/util/e-i18n.h>
+#include <gal/util/e-util.h>
-#define PARENT_TYPE e_table_model_get_type()
+#define PARENT_TYPE E_TABLE_MODEL_TYPE
static ETableModelClass *parent_class;
/*
* GalDefineViewsModel callbacks
* These are the callbacks that define the behavior of our custom model.
*/
-static void gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
-static void gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
-
+static void gal_define_views_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec);
+static void gal_define_views_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec);
enum {
- ARG_0,
- ARG_EDITABLE,
- ARG_COLLECTION
+ PROP_0,
+ PROP_EDITABLE,
+ PROP_COLLECTION
};
static void
-gdvm_destroy(GtkObject *object)
+gdvm_dispose(GObject *object)
{
GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object);
if (model->collection)
- gtk_object_unref(GTK_OBJECT(model->collection));
+ g_object_unref(model->collection);
model->collection = NULL;
- if (GTK_OBJECT_CLASS (parent_class)->destroy)
- (* GTK_OBJECT_CLASS (parent_class)->destroy) (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ (* G_OBJECT_CLASS (parent_class)->dispose) (object);
}
/* This function returns the number of columns in our ETableModel. */
@@ -162,20 +163,29 @@ gal_define_views_model_append (GalDefineViewsModel *model,
}
static void
-gal_define_views_model_class_init (GtkObjectClass *object_class)
+gal_define_views_model_class_init (GObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_ref (PARENT_TYPE);
+
+ object_class->dispose = gdvm_dispose;
+ object_class->set_property = gal_define_views_model_set_property;
+ object_class->get_property = gal_define_views_model_get_property;
- object_class->destroy = gdvm_destroy;
- object_class->set_arg = gal_define_views_model_set_arg;
- object_class->get_arg = gal_define_views_model_get_arg;
+ g_object_class_install_property (object_class, PROP_EDITABLE,
+ g_param_spec_boolean ("editable",
+ _("Editable"),
+ /*_( */"XXX blurb" /*)*/,
+ FALSE,
+ G_PARAM_READWRITE));
- gtk_object_add_arg_type ("GalDefineViewsModel::editable", GTK_TYPE_BOOL,
- GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("GalDefineViewsModel::collection", GAL_VIEW_COLLECTION_TYPE,
- GTK_ARG_READWRITE, ARG_COLLECTION);
+ g_object_class_install_property (object_class, PROP_COLLECTION,
+ g_param_spec_object ("collection",
+ _("Collection"),
+ /*_( */"XXX blurb" /*)*/,
+ GAL_VIEW_COLLECTION_TYPE,
+ G_PARAM_READWRITE));
model_class->column_count = gdvm_col_count;
model_class->row_count = gdvm_row_count;
@@ -191,7 +201,7 @@ gal_define_views_model_class_init (GtkObjectClass *object_class)
}
static void
-gal_define_views_model_init (GtkObject *object)
+gal_define_views_model_init (GObject *object)
{
GalDefineViewsModel *model = GAL_DEFINE_VIEWS_MODEL(object);
@@ -199,75 +209,50 @@ gal_define_views_model_init (GtkObject *object)
}
static void
-gal_define_views_model_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+gal_define_views_model_set_property (GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
GalDefineViewsModel *model;
- model = GAL_DEFINE_VIEWS_MODEL (o);
+ model = GAL_DEFINE_VIEWS_MODEL (object);
- switch (arg_id){
- case ARG_EDITABLE:
- model->editable = GTK_VALUE_BOOL (*arg);
+ switch (prop_id){
+ case PROP_EDITABLE:
+ model->editable = g_value_get_boolean (value);
break;
- case ARG_COLLECTION:
- e_table_model_pre_change(E_TABLE_MODEL(o));
- if (GTK_VALUE_OBJECT (*arg))
- model->collection = GAL_VIEW_COLLECTION(GTK_VALUE_OBJECT (*arg));
+ case PROP_COLLECTION:
+ e_table_model_pre_change(E_TABLE_MODEL(object));
+ if (g_value_get_object (value))
+ model->collection = GAL_VIEW_COLLECTION(g_value_get_object (value));
else
model->collection = NULL;
- e_table_model_changed(E_TABLE_MODEL(o));
+ e_table_model_changed(E_TABLE_MODEL(object));
break;
}
}
static void
-gal_define_views_model_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+gal_define_views_model_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
GalDefineViewsModel *model;
model = GAL_DEFINE_VIEWS_MODEL (object);
- switch (arg_id) {
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = model->editable;
+ switch (prop_id) {
+ case PROP_EDITABLE:
+ g_value_set_boolean (value, model->editable);
break;
- case ARG_COLLECTION:
- if (model->collection)
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(model->collection);
- else
- GTK_VALUE_OBJECT (*arg) = NULL;
- break;
+ case PROP_COLLECTION:
+ g_value_set_object (value, model->collection);
default:
- arg->type = GTK_TYPE_INVALID;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
-GtkType
-gal_define_views_model_get_type (void)
-{
- static GtkType type = 0;
-
- if (!type){
- GtkTypeInfo info = {
- "GalDefineViewsModel",
- sizeof (GalDefineViewsModel),
- sizeof (GalDefineViewsModelClass),
- (GtkClassInitFunc) gal_define_views_model_class_init,
- (GtkObjectInitFunc) gal_define_views_model_init,
- NULL, /* reserved 1 */
- NULL, /* reserved 2 */
- (GtkClassInitFunc) NULL
- };
-
- type = gtk_type_unique (PARENT_TYPE, &info);
- }
-
- return type;
-}
+E_MAKE_TYPE(gal_define_views_model, "GalDefineViewsModel", GalDefineViewsModel, gal_define_views_model_class_init, gal_define_views_model_init, PARENT_TYPE)
/**
* gal_define_views_model_new
@@ -282,7 +267,7 @@ gal_define_views_model_new (void)
{
GalDefineViewsModel *et;
- et = gtk_type_new (gal_define_views_model_get_type ());
+ et = g_object_new (GAL_DEFINE_VIEWS_MODEL_TYPE, NULL);
return E_TABLE_MODEL(et);
}