diff options
author | Chris Toshok <toshok@ximian.com> | 2002-11-17 07:31:47 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2002-11-17 07:31:47 +0800 |
commit | 6e93dd6be8cdf45628a9799e7e6c9cb84af49156 (patch) | |
tree | 3ba0099ae93eed957b3983575d4428345759012b /e-util | |
parent | 941ee0f35bb344ad6ac718b83d0f4d2b30cc23cd (diff) | |
download | gsoc2013-evolution-6e93dd6be8cdf45628a9799e7e6c9cb84af49156.tar.gz gsoc2013-evolution-6e93dd6be8cdf45628a9799e7e6c9cb84af49156.tar.zst gsoc2013-evolution-6e93dd6be8cdf45628a9799e7e6c9cb84af49156.zip |
add lots of marshallers (most, if not all, for etable).
2002-11-16 Chris Toshok <toshok@ximian.com>
* gal/util/e-marshal.list: add lots of marshallers (most, if not
all, for etable).
* gal/util/e-text-event-processor-emacs-like.[ch]: lotsa GObject work.
* gal/util/e-text-event-processor.[ch]: lotsa GObject work.
* gal/util/e-util.c: same.
* gal/e-paned/e-hpaned.[ch]: lotsa GObject work.
* gal/e-paned/e-paned.[ch]: same.
* gal/e-paned/e-vpaned.[ch]: same.
svn path=/trunk/; revision=18797
Diffstat (limited to 'e-util')
-rw-r--r-- | e-util/e-marshal.list | 2 | ||||
-rw-r--r-- | e-util/e-text-event-processor-emacs-like.c | 46 | ||||
-rw-r--r-- | e-util/e-text-event-processor-emacs-like.h | 8 | ||||
-rw-r--r-- | e-util/e-text-event-processor.c | 110 | ||||
-rw-r--r-- | e-util/e-text-event-processor.h | 8 | ||||
-rw-r--r-- | e-util/e-util.c | 4 |
6 files changed, 82 insertions, 96 deletions
diff --git a/e-util/e-marshal.list b/e-util/e-marshal.list index 0efa7cb14d..6bb2419d7d 100644 --- a/e-util/e-marshal.list +++ b/e-util/e-marshal.list @@ -12,6 +12,7 @@ INT:INT INT:INT,INT,BOXED INT:INT,POINTER,INT,BOXED INT:OBJECT,BOXED +INT:POINTER NONE:BOXED NONE:BOXED,INT NONE:BOXED,INT,INT @@ -37,6 +38,7 @@ NONE:NONE NONE:OBJECT NONE:OBJECT,OBJECT NONE:OBJECT,DOUBLE,DOUBLE,BOOLEAN +NONE:POINTER NONE:POINTER,BOOLEAN NONE:POINTER,BOOLEAN,BOOLEAN,BOOLEAN NONE:POINTER,INT diff --git a/e-util/e-text-event-processor-emacs-like.c b/e-util/e-text-event-processor-emacs-like.c index 887cfd9e24..2c47eb47c4 100644 --- a/e-util/e-text-event-processor-emacs-like.c +++ b/e-util/e-text-event-processor-emacs-like.c @@ -24,12 +24,14 @@ #include <string.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtksignal.h> +#include <gal/util/e-util.h> #include "e-text-event-processor-emacs-like.h" static void e_text_event_processor_emacs_like_init (ETextEventProcessorEmacsLike *card); static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass); static gint e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventProcessorEvent *event); +#define PARENT_TYPE E_TEXT_EVENT_PROCESSOR_TYPE static ETextEventProcessorClass *parent_class = NULL; /* The arguments we take */ @@ -98,30 +100,12 @@ static const ETextEventProcessorCommand alt_keys[26] = }; -GtkType -e_text_event_processor_emacs_like_get_type (void) -{ - static GtkType text_event_processor_emacs_like_type = 0; - - if (!text_event_processor_emacs_like_type) - { - static const GtkTypeInfo text_event_processor_emacs_like_info = - { - "ETextEventProcessorEmacsLike", - sizeof (ETextEventProcessorEmacsLike), - sizeof (ETextEventProcessorEmacsLikeClass), - (GtkClassInitFunc) e_text_event_processor_emacs_like_class_init, - (GtkObjectInitFunc) e_text_event_processor_emacs_like_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_emacs_like_type = gtk_type_unique (e_text_event_processor_get_type (), &text_event_processor_emacs_like_info); - } - - return text_event_processor_emacs_like_type; -} +E_MAKE_TYPE (e_text_event_processor_emacs_like, + "ETextEventProcessorEmacsLike", + ETextEventProcessorEmacsLike, + e_text_event_processor_emacs_like_class_init, + e_text_event_processor_emacs_like_init, + PARENT_TYPE) static void e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass *klass) @@ -132,7 +116,7 @@ e_text_event_processor_emacs_like_class_init (ETextEventProcessorEmacsLikeClass object_class = (GtkObjectClass*) klass; processor_class = (ETextEventProcessorClass*) klass; - parent_class = gtk_type_class (e_text_event_processor_get_type ()); + parent_class = g_type_class_ref (PARENT_TYPE); processor_class->event = e_text_event_processor_emacs_like_event; } @@ -153,7 +137,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro if (event->button.button == 1) { command.action = E_TEP_GRAB; command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); + g_signal_emit_by_name (tep, "command", &command); if (event->button.state & GDK_SHIFT_MASK) command.action = E_TEP_SELECT; else @@ -188,7 +172,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro command.position = E_TEP_VALUE; command.value = event->button.position; command.time = event->button.time; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); + g_signal_emit_by_name (tep, "command", &command); command.action = E_TEP_GET_SELECTION; command.position = E_TEP_SELECTION; @@ -285,7 +269,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro } else if (key.state & GDK_SHIFT_MASK) { command.action = E_TEP_COPY; command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); + g_signal_emit_by_name (tep, "command", &command); command.action = E_TEP_DELETE; command.position = E_TEP_SELECTION; @@ -449,7 +433,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro if (key.keyval == 'x') { command.action = E_TEP_COPY; command.position = E_TEP_SELECTION; - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); + g_signal_emit_by_name (tep, "command", &command); command.action = E_TEP_DELETE; command.position = E_TEP_SELECTION; @@ -492,7 +476,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro } } if (command.action != E_TEP_NOP) { - gtk_signal_emit_by_name (GTK_OBJECT (tep), "command", &command); + g_signal_emit_by_name (tep, "command", &command); return 1; } else @@ -502,7 +486,7 @@ e_text_event_processor_emacs_like_event (ETextEventProcessor *tep, ETextEventPro ETextEventProcessor * e_text_event_processor_emacs_like_new (void) { - ETextEventProcessorEmacsLike *retval = gtk_type_new (e_text_event_processor_emacs_like_get_type ()); + ETextEventProcessorEmacsLike *retval = g_object_new (E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, NULL); return E_TEXT_EVENT_PROCESSOR (retval); } diff --git a/e-util/e-text-event-processor-emacs-like.h b/e-util/e-text-event-processor-emacs-like.h index 58a92168a8..906c0d04b7 100644 --- a/e-util/e-text-event-processor-emacs-like.h +++ b/e-util/e-text-event-processor-emacs-like.h @@ -36,10 +36,10 @@ extern "C" { */ #define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE (e_text_event_processor_emacs_like_get_type ()) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike)) -#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) +#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLike)) +#define E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE, ETextEventProcessorEmacsLikeClass)) +#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) +#define E_IS_TEXT_EVENT_PROCESSOR_EMACS_LIKE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_EMACS_LIKE_TYPE)) typedef struct _ETextEventProcessorEmacsLike ETextEventProcessorEmacsLike; diff --git a/e-util/e-text-event-processor.c b/e-util/e-text-event-processor.c index c8b9437714..bd05c8cc48 100644 --- a/e-util/e-text-event-processor.c +++ b/e-util/e-text-event-processor.c @@ -23,20 +23,28 @@ #include "e-text-event-processor.h" #include <gal/util/e-util.h> -#include <gtk/gtksignal.h> +#include <gal/util/e-i18n.h> +#include "gal/util/e-marshal.h" static void e_text_event_processor_init (ETextEventProcessor *card); static void e_text_event_processor_class_init (ETextEventProcessorClass *klass); -static void e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id); -static void e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); +static void e_text_event_processor_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec); +static void e_text_event_processor_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec); +#define PARENT_TYPE GTK_TYPE_OBJECT static GtkObjectClass *parent_class = NULL; /* The arguments we take */ enum { - ARG_0, - ARG_ALLOW_NEWLINES + PROP_0, + PROP_ALLOW_NEWLINES }; enum { @@ -46,59 +54,45 @@ enum { static guint e_tep_signals[E_TEP_LAST_SIGNAL] = { 0 }; -GtkType -e_text_event_processor_get_type (void) -{ - static GtkType text_event_processor_type = 0; - - if (!text_event_processor_type) - { - static const GtkTypeInfo text_event_processor_info = - { - "ETextEventProcessor", - sizeof (ETextEventProcessor), - sizeof (ETextEventProcessorClass), - (GtkClassInitFunc) e_text_event_processor_class_init, - (GtkObjectInitFunc) e_text_event_processor_init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, - }; - - text_event_processor_type = gtk_type_unique (gtk_object_get_type (), &text_event_processor_info); - } - - return text_event_processor_type; -} +E_MAKE_TYPE (e_text_event_processor, + "ETextEventProcessor", + ETextEventProcessor, + e_text_event_processor_class_init, + e_text_event_processor_init, + PARENT_TYPE) static void e_text_event_processor_class_init (ETextEventProcessorClass *klass) { - GtkObjectClass *object_class; + GObjectClass *object_class; - object_class = (GtkObjectClass*) klass; + object_class = (GObjectClass*) klass; - parent_class = gtk_type_class (gtk_object_get_type ()); + parent_class = g_type_class_ref (PARENT_TYPE); - e_tep_signals[E_TEP_EVENT] = - gtk_signal_new ("command", - GTK_RUN_LAST, - E_OBJECT_CLASS_TYPE (object_class), - GTK_SIGNAL_OFFSET (ETextEventProcessorClass, command), - gtk_marshal_NONE__POINTER, - GTK_TYPE_NONE, 1, - GTK_TYPE_POINTER); + object_class->set_property = e_text_event_processor_set_property; + object_class->get_property = e_text_event_processor_get_property; - E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_tep_signals, E_TEP_LAST_SIGNAL); - - gtk_object_add_arg_type ("ETextEventProcessor::allow_newlines", GTK_TYPE_BOOL, - GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES); + e_tep_signals[E_TEP_EVENT] = + g_signal_new ("command", + G_OBJECT_CLASS_TYPE (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ETextEventProcessorClass, command), + NULL, NULL, + e_marshal_NONE__POINTER, + G_TYPE_NONE, 1, + G_TYPE_POINTER); + + g_object_class_install_property (object_class, PROP_ALLOW_NEWLINES, + g_param_spec_boolean ("allow_newlines", + _( "Allow newlines" ), + _( "Allow newlines" ), + FALSE, + G_PARAM_READWRITE)); klass->event = NULL; klass->command = NULL; - object_class->set_arg = e_text_event_processor_set_arg; - object_class->get_arg = e_text_event_processor_get_arg; } static void @@ -118,13 +112,16 @@ e_text_event_processor_handle_event (ETextEventProcessor *tep, ETextEventProcess /* Set_arg handler for the text item */ static void -e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +e_text_event_processor_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object); - switch (arg_id) { - case ARG_ALLOW_NEWLINES: - tep->allow_newlines = GTK_VALUE_BOOL (*arg); + switch (prop_id) { + case PROP_ALLOW_NEWLINES: + tep->allow_newlines = g_value_get_boolean (value); break; default: return; @@ -133,16 +130,19 @@ e_text_event_processor_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) /* Get_arg handler for the text item */ static void -e_text_event_processor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +e_text_event_processor_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { ETextEventProcessor *tep = E_TEXT_EVENT_PROCESSOR (object); - switch (arg_id) { - case ARG_ALLOW_NEWLINES: - GTK_VALUE_BOOL (*arg) = tep->allow_newlines; + switch (prop_id) { + case PROP_ALLOW_NEWLINES: + g_value_set_boolean (value, tep->allow_newlines); break; default: - arg->type = GTK_TYPE_INVALID; + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; } } diff --git a/e-util/e-text-event-processor.h b/e-util/e-text-event-processor.h index 2f9bd590dc..2c55a839e0 100644 --- a/e-util/e-text-event-processor.h +++ b/e-util/e-text-event-processor.h @@ -38,10 +38,10 @@ extern "C" { */ #define E_TEXT_EVENT_PROCESSOR_TYPE (e_text_event_processor_get_type ()) -#define E_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor)) -#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass)) -#define E_IS_TEXT_EVENT_PROCESSOR(obj) (GTK_CHECK_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) -#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) +#define E_TEXT_EVENT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessor)) +#define E_TEXT_EVENT_PROCESSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TEXT_EVENT_PROCESSOR_TYPE, ETextEventProcessorClass)) +#define E_IS_TEXT_EVENT_PROCESSOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) +#define E_IS_TEXT_EVENT_PROCESSOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_TEXT_EVENT_PROCESSOR_TYPE)) typedef struct _ETextEventProcessor ETextEventProcessor; diff --git a/e-util/e-util.c b/e-util/e-util.c index 135386f1cf..c425050c4e 100644 --- a/e-util/e-util.c +++ b/e-util/e-util.c @@ -91,7 +91,7 @@ e_free_object_list (GList *list) GList *p; for (p = list; p != NULL; p = p->next) - gtk_object_unref (GTK_OBJECT (p->data)); + g_object_unref (p->data); g_list_free (list); } @@ -102,7 +102,7 @@ e_free_object_slist (GSList *list) GSList *p; for (p = list; p != NULL; p = p->next) - gtk_object_unref (GTK_OBJECT (p->data)); + g_object_unref (p->data); g_slist_free (list); } |