diff options
author | Mike Kestner <mkestner@ximian.com> | 2002-11-06 08:07:08 +0800 |
---|---|---|
committer | Mike Kestner <mkestner@src.gnome.org> | 2002-11-06 08:07:08 +0800 |
commit | 75f89dc8698e1d6589c7f5e51c8fe3164584f583 (patch) | |
tree | 33a91740545e865bc0db014aa70438ee3ac30aa4 | |
parent | 4256558b9c4d4a37236ba3daa66efd3d3b465851 (diff) | |
download | gsoc2013-evolution-75f89dc8698e1d6589c7f5e51c8fe3164584f583.tar gsoc2013-evolution-75f89dc8698e1d6589c7f5e51c8fe3164584f583.tar.gz gsoc2013-evolution-75f89dc8698e1d6589c7f5e51c8fe3164584f583.tar.bz2 gsoc2013-evolution-75f89dc8698e1d6589c7f5e51c8fe3164584f583.tar.lz gsoc2013-evolution-75f89dc8698e1d6589c7f5e51c8fe3164584f583.tar.xz gsoc2013-evolution-75f89dc8698e1d6589c7f5e51c8fe3164584f583.tar.zst gsoc2013-evolution-75f89dc8698e1d6589c7f5e51c8fe3164584f583.zip |
GObjectify GObjectify
2002-11-05 Mike Kestner <mkestner@ximian.com>
* e-table-sorted-variable.[ch] : GObjectify
* e-tree-sorted-variable.[ch] : GObjectify
svn path=/trunk/; revision=18573
-rw-r--r-- | widgets/table/e-table-sorted-variable.c | 39 | ||||
-rw-r--r-- | widgets/table/e-table-sorted-variable.h | 21 | ||||
-rw-r--r-- | widgets/table/e-tree-sorted-variable.c | 45 | ||||
-rw-r--r-- | widgets/table/e-tree-sorted-variable.h | 13 |
4 files changed, 55 insertions, 63 deletions
diff --git a/widgets/table/e-table-sorted-variable.c b/widgets/table/e-table-sorted-variable.c index 93e103e1cc..1e271f997f 100644 --- a/widgets/table/e-table-sorted-variable.c +++ b/widgets/table/e-table-sorted-variable.c @@ -23,7 +23,6 @@ #include <config.h> #include <stdlib.h> -#include <gtk/gtksignal.h> #include <string.h> #include "gal/util/e-util.h" #include "e-table-sorted-variable.h" @@ -31,8 +30,6 @@ #define d(x) -#define PARENT_TYPE E_TABLE_SUBSET_VARIABLE_TYPE - #define INCREMENT_AMOUNT 100 /* maximum insertions between an idle event that we will do without scheduling an idle sort */ @@ -46,13 +43,13 @@ static void etsv_add (ETableSubsetVariable *etssv, gint static void etsv_add_all (ETableSubsetVariable *etssv); static void -etsv_destroy (GtkObject *object) +etsv_dispose (GObject *object) { ETableSortedVariable *etsv = E_TABLE_SORTED_VARIABLE (object); if (etsv->sort_info_changed_id) - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); + g_signal_handler_disconnect (G_OBJECT (etsv->sort_info), + etsv->sort_info_changed_id); etsv->sort_info_changed_id = 0; if (etsv->sort_idle_id) { @@ -65,24 +62,24 @@ etsv_destroy (GtkObject *object) } if (etsv->sort_info) - gtk_object_unref(GTK_OBJECT(etsv->sort_info)); + g_object_unref(etsv->sort_info); etsv->sort_info = NULL; if (etsv->full_header) - gtk_object_unref(GTK_OBJECT(etsv->full_header)); + g_object_unref(etsv->full_header); etsv->full_header = NULL; - GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); + G_OBJECT_CLASS (etsv_parent_class)->dispose (object); } static void -etsv_class_init (GtkObjectClass *object_class) +etsv_class_init (GObjectClass *object_class) { ETableSubsetVariableClass *etssv_class = E_TABLE_SUBSET_VARIABLE_CLASS(object_class); - etsv_parent_class = gtk_type_class (PARENT_TYPE); + etsv_parent_class = g_type_class_peek_parent (object_class); - object_class->destroy = etsv_destroy; + object_class->dispose = etsv_dispose; etssv_class->add = etsv_add; etssv_class->add_all = etsv_add_all; @@ -100,16 +97,16 @@ etsv_init (ETableSortedVariable *etsv) etsv->insert_count = 0; } -E_MAKE_TYPE(e_table_sorted_variable, "ETableSortedVariable", ETableSortedVariable, etsv_class_init, etsv_init, PARENT_TYPE) +E_MAKE_TYPE(e_table_sorted_variable, "ETableSortedVariable", ETableSortedVariable, etsv_class_init, etsv_init, E_TABLE_SUBSET_VARIABLE_TYPE) static gboolean etsv_sort_idle(ETableSortedVariable *etsv) { - gtk_object_ref(GTK_OBJECT(etsv)); + g_object_ref(etsv); etsv_sort(etsv); etsv->sort_idle_id = 0; etsv->insert_count = 0; - gtk_object_unref(GTK_OBJECT(etsv)); + g_object_unref(etsv); return FALSE; } @@ -188,21 +185,21 @@ etsv_add_all (ETableSubsetVariable *etssv) ETableModel * e_table_sorted_variable_new (ETableModel *source, ETableHeader *full_header, ETableSortInfo *sort_info) { - ETableSortedVariable *etsv = gtk_type_new (E_TABLE_SORTED_VARIABLE_TYPE); + ETableSortedVariable *etsv = g_object_new (E_TABLE_SORTED_VARIABLE_TYPE, NULL); ETableSubsetVariable *etssv = E_TABLE_SUBSET_VARIABLE (etsv); if (e_table_subset_variable_construct (etssv, source) == NULL){ - gtk_object_unref (GTK_OBJECT (etsv)); + g_object_unref (etsv); return NULL; } etsv->sort_info = sort_info; - gtk_object_ref(GTK_OBJECT(etsv->sort_info)); + g_object_ref(etsv->sort_info); etsv->full_header = full_header; - gtk_object_ref(GTK_OBJECT(etsv->full_header)); + g_object_ref(etsv->full_header); - etsv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC (etsv_sort_info_changed), etsv); + etsv->sort_info_changed_id = g_signal_connect (G_OBJECT (sort_info), "sort_info_changed", + G_CALLBACK (etsv_sort_info_changed), etsv); return E_TABLE_MODEL(etsv); } diff --git a/widgets/table/e-table-sorted-variable.h b/widgets/table/e-table-sorted-variable.h index 02b342d3a4..546d04b240 100644 --- a/widgets/table/e-table-sorted-variable.h +++ b/widgets/table/e-table-sorted-variable.h @@ -24,21 +24,20 @@ #ifndef _E_TABLE_SORTED_VARIABLE_H_ #define _E_TABLE_SORTED_VARIABLE_H_ -#include <gtk/gtkobject.h> +#include <glib-object.h> #include <gal/e-table/e-table-model.h> #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table-sort-info.h> #include <gal/e-table/e-table-header.h> -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ +G_BEGIN_DECLS #define E_TABLE_SORTED_VARIABLE_TYPE (e_table_sorted_variable_get_type ()) -#define E_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariable)) -#define E_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) -#define E_IS_TABLE_SORTED_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TABLE_SORTED_VARIABLE_TYPE)) -#define E_IS_TABLE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_VARIABLE_TYPE)) +#define E_TABLE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariable)) +#define E_TABLE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) +#define E_IS_TABLE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TABLE_SORTED_VARIABLE_TYPE)) +#define E_IS_TABLE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TABLE_SORTED_VARIABLE_TYPE)) +#define E_TABLE_SORTED_VARIABLE_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS((o), E_TABLE_SORTED_VARIABLE_TYPE, ETableSortedVariableClass)) typedef struct { ETableSubsetVariable base; @@ -58,11 +57,9 @@ typedef struct { ETableSubsetVariableClass parent_class; } ETableSortedVariableClass; -GtkType e_table_sorted_variable_get_type (void); +GType e_table_sorted_variable_get_type (void); ETableModel *e_table_sorted_variable_new (ETableModel *etm, ETableHeader *header, ETableSortInfo *sort_info); -#ifdef __cplusplus -} -#endif /* __cplusplus */ +G_END_DECLS #endif /* _E_TABLE_SORTED_VARIABLE_H_ */ diff --git a/widgets/table/e-tree-sorted-variable.c b/widgets/table/e-tree-sorted-variable.c index 9fa587022f..1086ee90aa 100644 --- a/widgets/table/e-tree-sorted-variable.c +++ b/widgets/table/e-tree-sorted-variable.c @@ -24,14 +24,11 @@ #include <config.h> #include <stdlib.h> #include <string.h> -#include <gtk/gtksignal.h> #include "gal/util/e-util.h" #include "e-tree-sorted-variable.h" #define d(x) -#define PARENT_TYPE E_TREE_MODEL_TYPE - #define INCREMENT_AMOUNT 100 /* maximum insertions between an idle event that we will do without scheduling an idle sort */ @@ -58,13 +55,13 @@ static void etsv_add (ETreeSortedVariable *etsv, gint static void etsv_add_all (ETreeSortedVariable *etsv); static void -etsv_destroy (GtkObject *object) +etsv_dispose (GObject *object) { ETreeSortedVariable *etsv = E_TREE_SORTED_VARIABLE (object); if (etsv->table_model_changed_id) - gtk_signal_disconnect (GTK_OBJECT (etss->source), - etsv->table_model_changed_id); + g_signal_handler_disconnect (G_OBJECT (etss->source), + etsv->table_model_changed_id); etsv->table_model_changed_id = 0; #if 0 @@ -77,8 +74,8 @@ etsv_destroy (GtkObject *object) etsv->table_model_cell_changed_id = 0; #endif if (etsv->sort_info_changed_id) - gtk_signal_disconnect (GTK_OBJECT (etsv->sort_info), - etsv->sort_info_changed_id); + g_signal_handler_disconnect (G_OBJECT (etsv->sort_info), + etsv->sort_info_changed_id); etsv->sort_info_changed_id = 0; if (etsv->sort_idle_id) @@ -90,24 +87,24 @@ etsv_destroy (GtkObject *object) etsv->insert_idle_id = 0; if (etsv->sort_info) - gtk_object_unref(GTK_OBJECT(etsv->sort_info)); + g_object_unref(etsv->sort_info); etsv->sort_info = NULL; if (etsv->full_header) - gtk_object_unref(GTK_OBJECT(etsv->full_header)); + g_object_unref(etsv->full_header); etsv->full_header = NULL; - GTK_OBJECT_CLASS (etsv_parent_class)->destroy (object); + G_OBJECT_CLASS (etsv_parent_class)->dispose (object); } static void -etsv_class_init (GtkObjectClass *object_class) +etsv_class_init (GObjectClass *object_class) { ETreeSortedVariableClass *etsv_class = E_TREE_MODEL_CLASS(object_class); - etsv_parent_class = gtk_type_class (PARENT_TYPE); + etsv_parent_class = g_type_class_peek_parent (object_class); - object_class->destroy = etsv_destroy; + object_class->dispose = etsv_dispose; etsv_class->add = etsv_add; etsv_class->add_all = etsv_add_all; @@ -128,16 +125,16 @@ etsv_init (ETreeSortedVariable *etsv) etsv->insert_count = 0; } -E_MAKE_TYPE(e_tree_sorted_variable, "ETreeSortedVariable", ETreeSortedVariable, etsv_class_init, etsv_init, PARENT_TYPE) +E_MAKE_TYPE(e_tree_sorted_variable, "ETreeSortedVariable", ETreeSortedVariable, etsv_class_init, etsv_init, E_TREE_MODEL_TYPE) static gboolean etsv_sort_idle(ETreeSortedVariable *etsv) { - gtk_object_ref(GTK_OBJECT(etsv)); + g_object_ref(etsv); etsv_sort(etsv); etsv->sort_idle_id = 0; etsv->insert_count = 0; - gtk_object_unref(GTK_OBJECT(etsv)); + g_object_unref(etsv); return FALSE; } @@ -157,25 +154,25 @@ e_tree_sorted_variable_new (ETreeModel *source, ETableHeader *full_header, ETabl ETreeSortedVariable *etsv = E_TABLE_SUBSET_VARIABLE (etsv); if (e_table_subset_variable_construct (etsv, source) == NULL){ - gtk_object_unref (GTK_OBJECT (etsv)); + g_object_unref (etsv); return NULL; } etsv->sort_info = sort_info; - gtk_object_ref(GTK_OBJECT(etsv->sort_info)); + g_object_ref(etsv->sort_info); etsv->full_header = full_header; - gtk_object_ref(GTK_OBJECT(etsv->full_header)); + g_object_ref(etsv->full_header); - etsv->table_model_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_changed", - GTK_SIGNAL_FUNC (etsv_proxy_model_changed), etsv); + etsv->table_model_changed_id = g_signal_connect (G_OBJECT (source), "model_changed", + G_CALLBACK (etsv_proxy_model_changed), etsv); #if 0 etsv->table_model_row_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_row_changed", GTK_SIGNAL_FUNC (etsv_proxy_model_row_changed), etsv); etsv->table_model_cell_changed_id = gtk_signal_connect (GTK_OBJECT (source), "model_cell_changed", GTK_SIGNAL_FUNC (etsv_proxy_model_cell_changed), etsv); #endif - etsv->sort_info_changed_id = gtk_signal_connect (GTK_OBJECT (sort_info), "sort_info_changed", - GTK_SIGNAL_FUNC (etsv_sort_info_changed), etsv); + etsv->sort_info_changed_id = g_signal_connect (G_OBJECT (sort_info), "sort_info_changed", + G_CALLBACK (etsv_sort_info_changed), etsv); return E_TABLE_MODEL(etsv); } diff --git a/widgets/table/e-tree-sorted-variable.h b/widgets/table/e-tree-sorted-variable.h index 7818ee8182..5c46c7ef49 100644 --- a/widgets/table/e-tree-sorted-variable.h +++ b/widgets/table/e-tree-sorted-variable.h @@ -24,7 +24,7 @@ #ifndef _E_TREE_SORTED_VARIABLE_H_ #define _E_TREE_SORTED_VARIABLE_H_ -#include <gtk/gtkobject.h> +#include <glib-object.h> #include <gal/e-tree/e-tree-model.h> #include <gal/e-table/e-table-subset-variable.h> #include <gal/e-table/e-table-sort-info.h> @@ -33,10 +33,11 @@ G_BEGIN_DECLS #define E_TREE_SORTED_VARIABLE_TYPE (e_tree_sorted_variable_get_type ()) -#define E_TREE_SORTED_VARIABLE(o) (GTK_CHECK_CAST ((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariable)) -#define E_TREE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariableClass)) -#define E_IS_TREE_SORTED_VARIABLE(o) (GTK_CHECK_TYPE ((o), E_TREE_SORTED_VARIABLE_TYPE)) -#define E_IS_TREE_SORTED_VARIABLE_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_VARIABLE_TYPE)) +#define E_TREE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariable)) +#define E_TREE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariableClass)) +#define E_IS_TREE_SORTED_VARIABLE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_TREE_SORTED_VARIABLE_TYPE)) +#define E_IS_TREE_SORTED_VARIABLE_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_TREE_SORTED_VARIABLE_TYPE)) +#define E_TREE_SORTED_VARIABLE_GET_CLASS(o) (G_TYPE_CHECK_CLASS_CAST((o), E_TREE_SORTED_VARIABLE_TYPE, ETreeSortedVariableClass)) typedef struct { ETreeModel base; @@ -59,7 +60,7 @@ typedef struct { ETreeModelClass parent_class; } ETreeSortedVariableClass; -GtkType e_tree_sorted_variable_get_type (void); +GType e_tree_sorted_variable_get_type (void); ETableModel *e_tree_sorted_variable_new (ETreeModel *etm, ETableHeader *header, ETableSortInfo *sort_info); |