aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Toshok <toshok@ximian.com>2002-11-17 07:49:31 +0800
committerChris Toshok <toshok@src.gnome.org>2002-11-17 07:49:31 +0800
commitd8e4ebebc320c72ae93c88dc43d8ae220a94331d (patch)
treeee09f7d541eed7543ec2fb0edbc54c8723c15176
parent09e8fe231719c87f7b1b4a22cc7015773bb1be19 (diff)
downloadgsoc2013-evolution-d8e4ebebc320c72ae93c88dc43d8ae220a94331d.tar.gz
gsoc2013-evolution-d8e4ebebc320c72ae93c88dc43d8ae220a94331d.tar.zst
gsoc2013-evolution-d8e4ebebc320c72ae93c88dc43d8ae220a94331d.zip
Lots of GObject work.
2002-11-16 Chris Toshok <toshok@ximian.com> * gal/e-text/e-completion-test.c: Lots of GObject work. * gal/e-text/e-completion-view.[ch]: same. * gal/e-text/e-completion.[ch]: same. * gal/e-text/e-entry.[ch]: same. * gal/e-text/e-table-text-model.[ch]: same. * gal/e-text/e-text-model-uri.[ch]: same. * gal/e-text/e-text-model.[ch]: same. * gal/e-text/e-text-test.c: same. * gal/e-text/e-text.[ch]: same. svn path=/trunk/; revision=18800
-rw-r--r--widgets/text/e-completion-test.c32
-rw-r--r--widgets/text/e-completion-view.c257
-rw-r--r--widgets/text/e-completion-view.h8
-rw-r--r--widgets/text/e-completion.c199
-rw-r--r--widgets/text/e-completion.h8
-rw-r--r--widgets/text/e-entry-test.c15
-rw-r--r--widgets/text/e-entry.c811
-rw-r--r--widgets/text/e-entry.h8
-rw-r--r--widgets/text/e-table-text-model.c79
-rw-r--r--widgets/text/e-table-text-model.h8
-rw-r--r--widgets/text/e-text-model-uri.c50
-rw-r--r--widgets/text/e-text-model-uri.h8
-rw-r--r--widgets/text/e-text-model.c121
-rw-r--r--widgets/text/e-text-model.h8
-rw-r--r--widgets/text/e-text-test.c41
-rw-r--r--widgets/text/e-text.c992
-rw-r--r--widgets/text/e-text.h8
17 files changed, 1404 insertions, 1249 deletions
diff --git a/widgets/text/e-completion-test.c b/widgets/text/e-completion-test.c
index bfa53982a3..dfefe23e1b 100644
--- a/widgets/text/e-completion-test.c
+++ b/widgets/text/e-completion-test.c
@@ -188,28 +188,28 @@ main (int argc, gchar **argv)
read_dict ();
complete = e_completion_new ();
- gtk_signal_connect (GTK_OBJECT (complete),
- "request_completion",
- GTK_SIGNAL_FUNC (request_dict_search),
- NULL);
- gtk_signal_connect (GTK_OBJECT (complete),
- "end_completion",
- GTK_SIGNAL_FUNC (end_dict_search),
- NULL);
- gtk_signal_connect (GTK_OBJECT (complete),
- "cancel_completion",
- GTK_SIGNAL_FUNC (end_dict_search),
- NULL);
+ g_signal_connect (complete,
+ "request_completion",
+ G_CALLBACK (request_dict_search),
+ NULL);
+ g_signal_connect (complete,
+ "end_completion",
+ G_CALLBACK (end_dict_search),
+ NULL);
+ g_signal_connect (complete,
+ "cancel_completion",
+ G_CALLBACK (end_dict_search),
+ NULL);
win = gtk_window_new (GTK_WINDOW_TOPLEVEL);
entry = e_entry_new ();
e_entry_enable_completion_full (E_ENTRY (entry), complete, 0, NULL);
e_entry_set_editable (E_ENTRY (entry), TRUE);
- gtk_signal_connect (GTK_OBJECT (entry),
- "popup",
- GTK_SIGNAL_FUNC (popup_cb),
- NULL);
+ g_signal_connect (entry,
+ "popup",
+ G_CALLBACK (popup_cb),
+ NULL);
gtk_container_add (GTK_CONTAINER (win), entry);
gtk_widget_show_all (win);
diff --git a/widgets/text/e-completion-view.c b/widgets/text/e-completion-view.c
index d09176c98a..4e5bba3f9e 100644
--- a/widgets/text/e-completion-view.c
+++ b/widgets/text/e-completion-view.c
@@ -31,6 +31,7 @@
#include <gal/e-table/e-table-simple.h>
#include <gal/e-table/e-table-scrolled.h>
#include <gal/util/e-i18n.h>
+#include "gal/util/e-marshal.h"
enum {
E_COMPLETION_VIEW_NONEMPTY,
@@ -54,8 +55,9 @@ static gint e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *k
static void e_completion_view_class_init (ECompletionViewClass *klass);
static void e_completion_view_init (ECompletionView *completion);
-static void e_completion_view_destroy (GtkObject *object);
+static void e_completion_view_dispose (GObject *object);
+#define PARENT_TYPE GTK_TYPE_EVENT_BOX
static GtkObjectClass *parent_class;
@@ -193,89 +195,78 @@ e_completion_view_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
}
}
-GtkType
-e_completion_view_get_type (void)
-{
- static GtkType completion_view_type = 0;
-
- if (!completion_view_type) {
- GtkTypeInfo completion_view_info = {
- "ECompletionView",
- sizeof (ECompletionView),
- sizeof (ECompletionViewClass),
- (GtkClassInitFunc) e_completion_view_class_init,
- (GtkObjectInitFunc) e_completion_view_init,
- NULL, NULL, /* reserved */
- (GtkClassInitFunc) NULL
- };
-
- completion_view_type = gtk_type_unique (gtk_event_box_get_type (), &completion_view_info);
- }
-
- return completion_view_type;
-}
-
+E_MAKE_TYPE (e_completion_view,
+ "ECompletionView",
+ ECompletionView,
+ e_completion_view_class_init,
+ e_completion_view_init,
+ PARENT_TYPE)
+
static void
e_completion_view_class_init (ECompletionViewClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = (GObjectClass *) klass;
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_event_box_get_type ()));
+ parent_class = g_type_class_ref (PARENT_TYPE);
e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY] =
- gtk_signal_new ("nonempty",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, nonempty),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("nonempty",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionViewClass, nonempty),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_completion_view_signals[E_COMPLETION_VIEW_ADDED] =
- gtk_signal_new ("added",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, added),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("added",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionViewClass, added),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_completion_view_signals[E_COMPLETION_VIEW_FULL] =
- gtk_signal_new ("full",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, full),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("full",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionViewClass, full),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_completion_view_signals[E_COMPLETION_VIEW_BROWSE] =
- gtk_signal_new ("browse",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, browse),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
+ g_signal_new ("browse",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionViewClass, browse),
+ NULL, NULL,
+ e_marshal_NONE__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] =
- gtk_signal_new ("unbrowse",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, unbrowse),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("unbrowse",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionViewClass, unbrowse),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionViewClass, activate),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_completion_view_signals, E_COMPLETION_VIEW_LAST_SIGNAL);
+ g_signal_new ("activate",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionViewClass, activate),
+ NULL, NULL,
+ e_marshal_NONE__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
- object_class->destroy = e_completion_view_destroy;
+ object_class->dispose = e_completion_view_dispose;
widget_class->key_press_event = e_completion_view_local_key_press_handler;
widget_class->expose_event = e_completion_view_expose_event;
@@ -291,7 +282,7 @@ e_completion_view_init (ECompletionView *completion)
}
static void
-e_completion_view_destroy (GtkObject *object)
+e_completion_view_dispose (GObject *object)
{
ECompletionView *cv = E_COMPLETION_VIEW (object);
@@ -305,17 +296,17 @@ e_completion_view_destroy (GtkObject *object)
}
if (cv->key_widget) {
- gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id);
- gtk_object_unref (GTK_OBJECT (cv->key_widget));
+ g_signal_handler_disconnect (cv->key_widget, cv->key_signal_id);
+ g_object_unref (cv->key_widget);
cv->key_widget = NULL;
}
if (cv->completion)
- gtk_object_unref (GTK_OBJECT (cv->completion));
+ g_object_unref (cv->completion);
cv->completion = NULL;
- if (parent_class->destroy)
- (parent_class->destroy) (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ (G_OBJECT_CLASS (parent_class)->dispose) (object);
}
static void
@@ -325,19 +316,19 @@ e_completion_view_disconnect (ECompletionView *cv)
g_return_if_fail (E_IS_COMPLETION_VIEW (cv));
if (cv->begin_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->begin_signal_id);
+ g_signal_handler_disconnect (cv->completion, cv->begin_signal_id);
if (cv->comp_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->comp_signal_id);
+ g_signal_handler_disconnect (cv->completion, cv->comp_signal_id);
if (cv->restart_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->restart_signal_id);
+ g_signal_handler_disconnect (cv->completion, cv->restart_signal_id);
if (cv->cancel_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->cancel_signal_id);
+ g_signal_handler_disconnect (cv->completion, cv->cancel_signal_id);
if (cv->end_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->end_signal_id);
+ g_signal_handler_disconnect (cv->completion, cv->end_signal_id);
if (cv->clear_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->clear_signal_id);
+ g_signal_handler_disconnect (cv->completion, cv->clear_signal_id);
if (cv->lost_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (cv->completion), cv->lost_signal_id);
+ g_signal_handler_disconnect (cv->completion, cv->lost_signal_id);
cv->begin_signal_id = 0;
cv->comp_signal_id = 0;
@@ -450,7 +441,7 @@ e_completion_view_select (ECompletionView *cv, gint r)
cv->selection = r;
e_completion_view_set_cursor_row (cv, r);
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], match);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_ACTIVATE], 0, match);
}
static gint
@@ -474,14 +465,14 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
/* Start up a completion.*/
if (complete_key && !cv->editable) {
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], NULL);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], 0, NULL);
goto stop_emission;
}
/* Stop our completion. */
if (uncomplete_key && cv->editable && cv->selection < 0) {
e_completion_view_set_cursor_row (cv, -1);
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE], 0);
goto stop_emission;
}
@@ -577,15 +568,15 @@ e_completion_view_key_press_handler (GtkWidget *w, GdkEventKey *key_event, gpoin
e_completion_view_set_cursor_row (cv, cv->selection);
if (cv->selection >= 0)
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_BROWSE],
- g_ptr_array_index (cv->choices, cv->selection));
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_BROWSE], 0,
+ g_ptr_array_index (cv->choices, cv->selection));
else
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE], 0);
stop_emission:
if (key_handled)
- gtk_signal_emit_stop_by_name (GTK_OBJECT (w), "key_press_event");
+ g_signal_stop_emission_by_name (w, "key_press_event");
return key_handled;
}
@@ -619,7 +610,7 @@ cancel_completion_cb (ECompletion *completion, gpointer user_data)
e_completion_view_set_cursor_row (cv, -1);
e_table_model_changed (cv->model);
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE]);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_UNBROWSE] ,0);
}
static void
@@ -635,9 +626,9 @@ completion_cb (ECompletion *completion, ECompletionMatch *match, gpointer user_d
e_table_model_row_inserted (cv->model, r);
if (first)
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY]);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_NONEMPTY], 0);
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_ADDED]);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_ADDED], 0);
}
static void
@@ -649,7 +640,7 @@ end_completion_cb (ECompletion *completion, gpointer user_data)
e_table_model_changed (cv->model);
cv->have_all_choices = TRUE;
- gtk_signal_emit (GTK_OBJECT (cv), e_completion_view_signals[E_COMPLETION_VIEW_FULL]);
+ g_signal_emit (cv, e_completion_view_signals[E_COMPLETION_VIEW_FULL], 0);
}
static void
@@ -755,36 +746,36 @@ e_completion_view_construct (ECompletionView *cv, ECompletion *completion)
GTK_WIDGET_SET_FLAGS (GTK_WIDGET (cv), GTK_CAN_FOCUS);
cv->completion = completion;
- gtk_object_ref (GTK_OBJECT (completion));
-
- cv->begin_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "begin_completion",
- GTK_SIGNAL_FUNC (begin_completion_cb),
- cv);
- cv->comp_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "completion",
- GTK_SIGNAL_FUNC (completion_cb),
- cv);
- cv->restart_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "restart_completion",
- GTK_SIGNAL_FUNC (restart_completion_cb),
- cv);
- cv->cancel_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "cancel_completion",
- GTK_SIGNAL_FUNC (cancel_completion_cb),
- cv);
- cv->end_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "end_completion",
- GTK_SIGNAL_FUNC (end_completion_cb),
- cv);
- cv->clear_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "clear_completion",
- GTK_SIGNAL_FUNC (clear_completion_cb),
- cv);
- cv->lost_signal_id = gtk_signal_connect (GTK_OBJECT (completion),
- "lost_completion",
- GTK_SIGNAL_FUNC (lost_completion_cb),
- cv);
+ g_object_ref (completion);
+
+ cv->begin_signal_id = g_signal_connect (completion,
+ "begin_completion",
+ G_CALLBACK (begin_completion_cb),
+ cv);
+ cv->comp_signal_id = g_signal_connect (completion,
+ "completion",
+ G_CALLBACK (completion_cb),
+ cv);
+ cv->restart_signal_id = g_signal_connect (completion,
+ "restart_completion",
+ G_CALLBACK (restart_completion_cb),
+ cv);
+ cv->cancel_signal_id = g_signal_connect (completion,
+ "cancel_completion",
+ G_CALLBACK (cancel_completion_cb),
+ cv);
+ cv->end_signal_id = g_signal_connect (completion,
+ "end_completion",
+ G_CALLBACK (end_completion_cb),
+ cv);
+ cv->clear_signal_id = g_signal_connect (completion,
+ "clear_completion",
+ G_CALLBACK (clear_completion_cb),
+ cv);
+ cv->lost_signal_id = g_signal_connect (completion,
+ "lost_completion",
+ G_CALLBACK (lost_completion_cb),
+ cv);
cv->model = e_table_simple_new (table_col_count,
table_row_count,
@@ -801,7 +792,7 @@ e_completion_view_construct (ECompletionView *cv, ECompletion *completion)
cv);
cv->table = e_table_scrolled_new (cv->model, NULL, simple_spec, NULL);
- gtk_object_unref (GTK_OBJECT (cv->model));
+ g_object_unref (cv->model);
e_scroll_frame_set_shadow_type (E_SCROLL_FRAME (cv->table), GTK_SHADOW_NONE);
e_scroll_frame_set_scrollbar_spacing (E_SCROLL_FRAME (cv->table), 0);
@@ -810,10 +801,10 @@ e_completion_view_construct (ECompletionView *cv, ECompletion *completion)
gtk_container_add (GTK_CONTAINER (cv), cv->table);
gtk_widget_show_all (cv->table);
- gtk_signal_connect (GTK_OBJECT (e_completion_view_table (cv)),
- "click",
- GTK_SIGNAL_FUNC (table_click_cb),
- cv);
+ g_signal_connect (e_completion_view_table (cv),
+ "click",
+ G_CALLBACK (table_click_cb),
+ cv);
cv->selection = -1;
}
@@ -826,7 +817,7 @@ e_completion_view_new (ECompletion *completion)
g_return_val_if_fail (completion != NULL, NULL);
g_return_val_if_fail (E_IS_COMPLETION (completion), NULL);
- p = gtk_type_new (e_completion_view_get_type ());
+ p = g_object_new (E_COMPLETION_VIEW_TYPE, NULL);
e_completion_view_construct (E_COMPLETION_VIEW (p), completion);
@@ -841,18 +832,18 @@ e_completion_view_connect_keys (ECompletionView *cv, GtkWidget *w)
g_return_if_fail (w == NULL || GTK_IS_WIDGET (w));
if (cv->key_widget) {
- gtk_signal_disconnect (GTK_OBJECT (cv->key_widget), cv->key_signal_id);
- gtk_object_unref (GTK_OBJECT (cv->key_widget));
+ g_signal_handler_disconnect (cv->key_widget, cv->key_signal_id);
+ g_object_unref (cv->key_widget);
}
if (w) {
cv->key_widget = w;
- gtk_object_ref (GTK_OBJECT (w));
+ g_object_ref (w);
- cv->key_signal_id = gtk_signal_connect (GTK_OBJECT (w),
- "key_press_event",
- GTK_SIGNAL_FUNC (e_completion_view_key_press_handler),
- cv);
+ cv->key_signal_id = g_signal_connect (w,
+ "key_press_event",
+ G_CALLBACK (e_completion_view_key_press_handler),
+ cv);
} else {
cv->key_widget = NULL;
cv->key_signal_id = 0;
diff --git a/widgets/text/e-completion-view.h b/widgets/text/e-completion-view.h
index f869b92725..9aa3860ebd 100644
--- a/widgets/text/e-completion-view.h
+++ b/widgets/text/e-completion-view.h
@@ -32,10 +32,10 @@
G_BEGIN_DECLS
#define E_COMPLETION_VIEW_TYPE (e_completion_view_get_type ())
-#define E_COMPLETION_VIEW(o) (GTK_CHECK_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView))
-#define E_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_VIEW_TYPE, ECompletionViewClass))
-#define E_IS_COMPLETION_VIEW(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_VIEW_TYPE))
-#define E_IS_COMPLETION_VIEW_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_VIEW_TYPE))
+#define E_COMPLETION_VIEW(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPLETION_VIEW_TYPE, ECompletionView))
+#define E_COMPLETION_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_COMPLETION_VIEW_TYPE, ECompletionViewClass))
+#define E_IS_COMPLETION_VIEW(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPLETION_VIEW_TYPE))
+#define E_IS_COMPLETION_VIEW_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_COMPLETION_VIEW_TYPE))
typedef struct _ECompletionView ECompletionView;
typedef struct _ECompletionViewClass ECompletionViewClass;
diff --git a/widgets/text/e-completion.c b/widgets/text/e-completion.c
index f96e4cb258..cddd6ed4f4 100644
--- a/widgets/text/e-completion.c
+++ b/widgets/text/e-completion.c
@@ -26,9 +26,9 @@
#include <string.h>
#include <stdio.h>
#include <gtk/gtk.h>
-#include <gal/util/e-util.h>
#include "e-completion.h"
#include "gal/util/e-util.h"
+#include "gal/util/e-marshal.h"
enum {
E_COMPLETION_REQUEST_COMPLETION,
@@ -65,7 +65,7 @@ typedef struct {
static void e_completion_class_init (ECompletionClass *klass);
static void e_completion_init (ECompletion *complete);
-static void e_completion_destroy (GtkObject *object);
+static void e_completion_dispose (GObject *object);
static void e_completion_add_match (ECompletion *complete, ECompletionMatch *);
static void e_completion_clear_search_stack (ECompletion *complete);
@@ -73,109 +73,101 @@ static void e_completion_clear_matches (ECompletion *complete);
static gboolean e_completion_sort (ECompletion *complete);
static void e_completion_restart (ECompletion *complete);
+#define PARENT_TYPE GTK_TYPE_OBJECT
static GtkObjectClass *parent_class;
-GtkType
-e_completion_get_type (void)
-{
- static GtkType complete_type = 0;
-
- if (!complete_type) {
- GtkTypeInfo complete_info = {
- "ECompletion",
- sizeof (ECompletion),
- sizeof (ECompletionClass),
- (GtkClassInitFunc) e_completion_class_init,
- (GtkObjectInitFunc) e_completion_init,
- NULL, NULL, /* reserved */
- (GtkClassInitFunc) NULL
- };
-
- complete_type = gtk_type_unique (gtk_object_get_type (), &complete_info);
- }
-
- return complete_type;
-}
+E_MAKE_TYPE (e_completion,
+ "ECompletion",
+ ECompletion,
+ e_completion_class_init,
+ e_completion_init,
+ PARENT_TYPE)
static void
e_completion_class_init (ECompletionClass *klass)
{
- GtkObjectClass *object_class = (GtkObjectClass *) klass;
+ GObjectClass *object_class = (GObjectClass *) klass;
- parent_class = GTK_OBJECT_CLASS (gtk_type_class (gtk_object_get_type ()));
+ parent_class = g_type_class_ref (PARENT_TYPE);
e_completion_signals[E_COMPLETION_REQUEST_COMPLETION] =
- gtk_signal_new ("request_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, request_completion),
- e_marshal_NONE__POINTER_INT_INT,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT);
+ g_signal_new ("request_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, request_completion),
+ NULL, NULL,
+ e_marshal_NONE__POINTER_INT_INT,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
e_completion_signals[E_COMPLETION_BEGIN_COMPLETION] =
- gtk_signal_new ("begin_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, begin_completion),
- e_marshal_NONE__POINTER_INT_INT,
- GTK_TYPE_NONE, 3,
- GTK_TYPE_POINTER, GTK_TYPE_INT, GTK_TYPE_INT);
+ g_signal_new ("begin_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, begin_completion),
+ NULL, NULL,
+ e_marshal_NONE__POINTER_INT_INT,
+ G_TYPE_NONE, 3,
+ G_TYPE_POINTER, G_TYPE_INT, G_TYPE_INT);
e_completion_signals[E_COMPLETION_COMPLETION] =
- gtk_signal_new ("completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, completion),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_POINTER);
+ g_signal_new ("completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, completion),
+ NULL, NULL,
+ e_marshal_NONE__POINTER,
+ G_TYPE_NONE, 1,
+ G_TYPE_POINTER);
e_completion_signals[E_COMPLETION_RESTART_COMPLETION] =
- gtk_signal_new ("restart_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, restart_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
+ g_signal_new ("restart_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, restart_completion),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
+
e_completion_signals[E_COMPLETION_CANCEL_COMPLETION] =
- gtk_signal_new ("cancel_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, cancel_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
+ g_signal_new ("cancel_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, cancel_completion),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
+
e_completion_signals[E_COMPLETION_END_COMPLETION] =
- gtk_signal_new ("end_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, end_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("end_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, end_completion),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_completion_signals[E_COMPLETION_CLEAR_COMPLETION] =
- gtk_signal_new ("clear_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, clear_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("clear_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, clear_completion),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_completion_signals[E_COMPLETION_LOST_COMPLETION] =
- gtk_signal_new ("lost_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ECompletionClass, lost_completion),
- gtk_marshal_NONE__POINTER,
- GTK_TYPE_NONE, 1, GTK_TYPE_POINTER);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_completion_signals, E_COMPLETION_LAST_SIGNAL);
-
- object_class->destroy = e_completion_destroy;
+ g_signal_new ("lost_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ECompletionClass, lost_completion),
+ NULL, NULL,
+ e_marshal_NONE__POINTER,
+ G_TYPE_NONE, 1, G_TYPE_POINTER);
+
+ object_class->dispose = e_completion_dispose;
}
static void
@@ -186,7 +178,7 @@ e_completion_init (ECompletion *complete)
}
static void
-e_completion_destroy (GtkObject *object)
+e_completion_dispose (GObject *object)
{
ECompletion *complete = E_COMPLETION (object);
@@ -204,8 +196,8 @@ e_completion_destroy (GtkObject *object)
complete->priv = NULL;
}
- if (parent_class->destroy)
- (parent_class->destroy) (object);
+ if (G_OBJECT_CLASS (parent_class)->dispose)
+ (G_OBJECT_CLASS (parent_class)->dispose) (object);
}
static void
@@ -262,7 +254,7 @@ e_completion_clear (ECompletion *complete)
e_completion_clear_search_stack (complete);
complete->priv->refinement_count = 0;
complete->priv->match_count = 0;
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_CLEAR_COMPLETION]);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_CLEAR_COMPLETION], 0);
}
static void
@@ -328,7 +320,7 @@ e_completion_refine_search (ECompletion *comp, const gchar *text, gint pos, ECom
e_completion_push_search (comp, text, pos);
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], text, pos, comp->priv->limit);
+ g_signal_emit (comp, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0, text, pos, comp->priv->limit);
comp->priv->match_count = 0;
@@ -340,14 +332,14 @@ e_completion_refine_search (ECompletion *comp, const gchar *text, gint pos, ECom
if (comp->priv->refinement_count == match->hit_count
&& refine_fn (comp, match, text, pos)) {
++match->hit_count;
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_COMPLETION], match);
+ g_signal_emit (comp, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
++comp->priv->match_count;
}
}
++comp->priv->refinement_count;
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_END_COMPLETION]);
+ g_signal_emit (comp, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
comp->priv->searching = FALSE;
comp->priv->refining = FALSE;
@@ -363,7 +355,8 @@ e_completion_unrefine_search (ECompletion *comp)
e_completion_pop_search (comp);
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], comp->priv->search_text, comp->priv->pos, comp->priv->limit);
+ g_signal_emit (comp, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0,
+ comp->priv->search_text, comp->priv->pos, comp->priv->limit);
comp->priv->match_count = 0;
--comp->priv->refinement_count;
@@ -375,12 +368,12 @@ e_completion_unrefine_search (ECompletion *comp)
ECompletionMatch *match = g_ptr_array_index (m, i);
if (comp->priv->refinement_count <= match->hit_count) {
match->hit_count = comp->priv->refinement_count;
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_COMPLETION], match);
+ g_signal_emit (comp, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
++comp->priv->match_count;
}
}
- gtk_signal_emit (GTK_OBJECT (comp), e_completion_signals[E_COMPLETION_END_COMPLETION]);
+ g_signal_emit (comp, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
comp->priv->searching = FALSE;
comp->priv->refining = FALSE;
@@ -439,8 +432,8 @@ e_completion_begin_search (ECompletion *complete, const gchar *text, gint pos, g
complete->priv->limit = limit > 0 ? limit : G_MAXINT;
complete->priv->refinement_count = 0;
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], text, pos, limit);
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_REQUEST_COMPLETION], text, pos, limit);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_BEGIN_COMPLETION], 0, text, pos, limit);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_REQUEST_COMPLETION], 0, text, pos, limit);
}
void
@@ -453,7 +446,7 @@ e_completion_cancel_search (ECompletion *complete)
if (!complete->priv->searching)
return;
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_CANCEL_COMPLETION]);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_CANCEL_COMPLETION], 0);
complete->priv->searching = FALSE;
}
@@ -527,7 +520,7 @@ e_completion_foreach_match (ECompletion *complete, ECompletionMatchFn fn, gpoint
ECompletion *
e_completion_new (void)
{
- return E_COMPLETION (gtk_type_new (e_completion_get_type ()));
+ return E_COMPLETION (g_object_new (E_COMPLETION_TYPE, NULL));
}
static gboolean
@@ -568,15 +561,15 @@ e_completion_restart (ECompletion *complete)
GPtrArray *m;
gint i, count;
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_RESTART_COMPLETION]);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_RESTART_COMPLETION], 0);
m = complete->priv->matches;
for (i = count = 0;
i < m->len && count < complete->priv->limit;
i++, count++) {
- gtk_signal_emit (GTK_OBJECT (complete),
- e_completion_signals[E_COMPLETION_COMPLETION],
- g_ptr_array_index (m, i));
+ g_signal_emit (complete,
+ e_completion_signals[E_COMPLETION_COMPLETION], 0,
+ g_ptr_array_index (m, i));
}
}
@@ -601,7 +594,7 @@ e_completion_found_match (ECompletion *complete, ECompletionMatch *match)
e_completion_add_match (complete, match);
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_COMPLETION], match);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_COMPLETION], 0, match);
}
/* to optimize this, make the match a hash table */
@@ -620,7 +613,7 @@ e_completion_lost_match (ECompletion *complete, ECompletionMatch *match)
/* maybe just return here? */
g_return_if_fail (removed);
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_LOST_COMPLETION], match);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_LOST_COMPLETION], 0, match);
e_completion_match_unref (match);
}
@@ -639,7 +632,7 @@ e_completion_end_search (ECompletion *complete)
if (e_completion_sort (complete))
e_completion_restart (complete);
- gtk_signal_emit (GTK_OBJECT (complete), e_completion_signals[E_COMPLETION_END_COMPLETION]);
+ g_signal_emit (complete, e_completion_signals[E_COMPLETION_END_COMPLETION], 0);
complete->priv->searching = FALSE;
complete->priv->done_search = TRUE;
diff --git a/widgets/text/e-completion.h b/widgets/text/e-completion.h
index 2f228ac130..f8d38e45a7 100644
--- a/widgets/text/e-completion.h
+++ b/widgets/text/e-completion.h
@@ -31,10 +31,10 @@
G_BEGIN_DECLS
#define E_COMPLETION_TYPE (e_completion_get_type ())
-#define E_COMPLETION(o) (GTK_CHECK_CAST ((o), E_COMPLETION_TYPE, ECompletion))
-#define E_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_CAST ((k), E_COMPLETION_TYPE, ECompletionClass))
-#define E_IS_COMPLETION(o) (GTK_CHECK_TYPE ((o), E_COMPLETION_TYPE))
-#define E_IS_COMPLETION_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_COMPLETION_TYPE))
+#define E_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_COMPLETION_TYPE, ECompletion))
+#define E_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), E_COMPLETION_TYPE, ECompletionClass))
+#define E_IS_COMPLETION(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_COMPLETION_TYPE))
+#define E_IS_COMPLETION_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_COMPLETION_TYPE))
typedef struct _ECompletion ECompletion;
typedef struct _ECompletionClass ECompletionClass;
diff --git a/widgets/text/e-entry-test.c b/widgets/text/e-entry-test.c
index 5dc78364d4..d30ba20a9f 100644
--- a/widgets/text/e-entry-test.c
+++ b/widgets/text/e-entry-test.c
@@ -27,7 +27,7 @@
#include "e-entry.h"
#include <gal/util/e-i18n.h>
-static void destroy_callback(GtkWidget *app, gpointer data)
+static void destroy_callback(gpointer data, GObject *where_object_was)
{
exit(0);
}
@@ -64,16 +64,15 @@ int main( int argc, char *argv[] )
app = gnome_app_new("EEntry Test", NULL);
entry = e_entry_new();
- gtk_object_set(GTK_OBJECT(entry),
- "editable", TRUE,
- "use_ellipsis", TRUE,
- NULL);
+ g_object_set(entry,
+ "editable", TRUE,
+ "use_ellipsis", TRUE,
+ NULL);
gnome_app_set_contents( GNOME_APP( app ), entry );
/* Connect the signals */
- gtk_signal_connect( GTK_OBJECT( app ), "destroy",
- GTK_SIGNAL_FUNC( destroy_callback ),
- ( gpointer ) app );
+ g_object_weak_ref (G_OBJECT (app),
+ destroy_callback, app);
gtk_widget_show_all( app );
diff --git a/widgets/text/e-entry.c b/widgets/text/e-entry.c
index bb1c8266f6..746fba6121 100644
--- a/widgets/text/e-entry.c
+++ b/widgets/text/e-entry.c
@@ -35,6 +35,7 @@
#include <libxml/parser.h>
#include <libgnomecanvas/gnome-canvas.h>
#include "gal/util/e-util.h"
+#include "gal/util/e-i18n.h"
#include "gal/widgets/e-canvas.h"
#include "gal/widgets/e-canvas-utils.h"
#include "e-completion-view.h"
@@ -69,33 +70,33 @@ static guint e_entry_signals[E_ENTRY_LAST_SIGNAL] = { 0 };
/* Object argument IDs */
enum {
- ARG_0,
- ARG_MODEL,
- ARG_EVENT_PROCESSOR,
- ARG_TEXT,
- ARG_FONT,
- ARG_FONTSET,
- ARG_FONT_GDK,
- ARG_ANCHOR,
- ARG_JUSTIFICATION,
- ARG_X_OFFSET,
- ARG_Y_OFFSET,
- ARG_FILL_COLOR,
- ARG_FILL_COLOR_GDK,
- ARG_FILL_COLOR_RGBA,
- ARG_FILL_STIPPLE,
- ARG_EDITABLE,
- ARG_USE_ELLIPSIS,
- ARG_ELLIPSIS,
- ARG_LINE_WRAP,
- ARG_BREAK_CHARACTERS,
- ARG_MAX_LINES,
- ARG_ALLOW_NEWLINES,
- ARG_DRAW_BORDERS,
- ARG_DRAW_BACKGROUND,
- ARG_DRAW_BUTTON,
- ARG_EMULATE_LABEL_RESIZE,
- ARG_CURSOR_POS
+ PROP_0,
+ PROP_MODEL,
+ PROP_EVENT_PROCESSOR,
+ PROP_TEXT,
+ PROP_FONT,
+ PROP_FONTSET,
+ PROP_FONT_GDK,
+ PROP_ANCHOR,
+ PROP_JUSTIFICATION,
+ PROP_X_OFFSET,
+ PROP_Y_OFFSET,
+ PROP_FILL_COLOR,
+ PROP_FILL_COLOR_GDK,
+ PROP_FILL_COLOR_RGBA,
+ PROP_FILL_STIPPLE,
+ PROP_EDITABLE,
+ PROP_USE_ELLIPSIS,
+ PROP_ELLIPSIS,
+ PROP_LINE_WRAP,
+ PROP_BREAK_CHARACTERS,
+ PROP_MAX_LINES,
+ PROP_ALLOW_NEWLINES,
+ PROP_DRAW_BORDERS,
+ PROP_DRAW_BACKGROUND,
+ PROP_DRAW_BUTTON,
+ PROP_EMULATE_LABEL_RESIZE,
+ PROP_CURSOR_POS
};
typedef struct _EEntryPrivate EEntryPrivate;
@@ -143,10 +144,10 @@ canvas_size_allocate (GtkWidget *widget, GtkAllocation *alloc,
{
gnome_canvas_set_scroll_region (entry->canvas,
0, 0, alloc->width, alloc->height);
- gtk_object_set (GTK_OBJECT (entry->item),
- "clip_width", (double) (alloc->width),
- "clip_height", (double) (alloc->height),
- NULL);
+ g_object_set (entry->item,
+ "clip_width", (double) (alloc->width),
+ "clip_height", (double) (alloc->height),
+ NULL);
switch (entry->priv->justification) {
case GTK_JUSTIFY_RIGHT:
@@ -183,9 +184,9 @@ canvas_size_request (GtkWidget *widget, GtkRequisition *requisition,
if (entry->priv->emulate_label_resize) {
gdouble width;
- gtk_object_get (GTK_OBJECT (entry->item),
- "text_width", &width,
- NULL);
+ g_object_get (entry->item,
+ "text_width", &width,
+ NULL);
requisition->width = 2 + xthick + width;
} else {
requisition->width = 2 + MIN_ENTRY_WIDTH + xthick;
@@ -251,19 +252,19 @@ e_entry_proxy_changed (EText *text, EEntry *entry)
entry->priv->changed_since_keypress = TRUE;
entry->priv->changed_since_keypress_tag = gtk_timeout_add (20, changed_since_keypress_timeout_fn, entry);
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_CHANGED]);
+ g_signal_emit (entry, e_entry_signals [E_ENTRY_CHANGED], 0);
}
static void
e_entry_proxy_activate (EText *text, EEntry *entry)
{
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_ACTIVATE]);
+ g_signal_emit (entry, e_entry_signals [E_ENTRY_ACTIVATE], 0);
}
static void
e_entry_proxy_popup (EText *text, GdkEventButton *ev, gint pos, EEntry *entry)
{
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals [E_ENTRY_POPUP], ev, pos);
+ g_signal_emit (entry, e_entry_signals [E_ENTRY_POPUP], 0, ev, pos);
}
static void
@@ -280,20 +281,20 @@ e_entry_init (GtkObject *object)
entry->canvas = GNOME_CANVAS (e_canvas_new ());
- gtk_signal_connect (GTK_OBJECT (entry->canvas),
- "size_allocate",
- GTK_SIGNAL_FUNC (canvas_size_allocate),
- entry);
+ g_signal_connect (entry->canvas,
+ "size_allocate",
+ G_CALLBACK (canvas_size_allocate),
+ entry);
- gtk_signal_connect (GTK_OBJECT (entry->canvas),
- "size_request",
- GTK_SIGNAL_FUNC (canvas_size_request),
- entry);
+ g_signal_connect (entry->canvas,
+ "size_request",
+ G_CALLBACK (canvas_size_request),
+ entry);
- gtk_signal_connect(GTK_OBJECT (entry->canvas),
- "focus_in_event",
- GTK_SIGNAL_FUNC(canvas_focus_in_event),
- entry);
+ g_signal_connect (entry->canvas,
+ "focus_in_event",
+ G_CALLBACK(canvas_focus_in_event),
+ entry);
entry->priv->draw_borders = TRUE;
entry->priv->last_width = -1;
@@ -312,10 +313,10 @@ e_entry_init (GtkObject *object)
"allow_newlines", FALSE,
NULL));
- gtk_signal_connect (GTK_OBJECT (entry->item),
- "keypress",
- GTK_SIGNAL_FUNC (e_entry_text_keypress),
- entry);
+ g_signal_connect (entry->item,
+ "keypress",
+ G_CALLBACK (e_entry_text_keypress),
+ entry);
entry->priv->justification = GTK_JUSTIFY_LEFT;
gtk_table_attach (gtk_table, GTK_WIDGET (entry->canvas),
@@ -329,21 +330,18 @@ e_entry_init (GtkObject *object)
* Proxy functions: we proxy the changed and activate signals
* from the item to ourselves
*/
- entry->priv->changed_proxy_tag = gtk_signal_connect (
- GTK_OBJECT (entry->item),
- "changed",
- GTK_SIGNAL_FUNC (e_entry_proxy_changed),
- entry);
- entry->priv->activate_proxy_tag = gtk_signal_connect (
- GTK_OBJECT (entry->item),
- "activate",
- GTK_SIGNAL_FUNC (e_entry_proxy_activate),
- entry);
- entry->priv->popup_proxy_tag = gtk_signal_connect (
- GTK_OBJECT (entry->item),
- "popup",
- GTK_SIGNAL_FUNC (e_entry_proxy_popup),
- entry);
+ entry->priv->changed_proxy_tag = g_signal_connect (entry->item,
+ "changed",
+ G_CALLBACK (e_entry_proxy_changed),
+ entry);
+ entry->priv->activate_proxy_tag = g_signal_connect (entry->item,
+ "activate",
+ G_CALLBACK (e_entry_proxy_activate),
+ entry);
+ entry->priv->popup_proxy_tag = g_signal_connect (entry->item,
+ "popup",
+ G_CALLBACK (e_entry_proxy_popup),
+ entry);
entry->priv->completion_delay = 1;
}
@@ -372,7 +370,7 @@ GtkWidget *
e_entry_new (void)
{
EEntry *entry;
- entry = gtk_type_new (e_entry_get_type ());
+ entry = g_object_new (E_ENTRY_TYPE, NULL);
e_entry_construct (entry);
return GTK_WIDGET (entry);
@@ -399,9 +397,9 @@ e_entry_set_text_quiet (EEntry *entry, const gchar *txt)
{
g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
- gtk_signal_handler_block (GTK_OBJECT (entry->item), entry->priv->changed_proxy_tag);
+ g_signal_handler_block (entry->item, entry->priv->changed_proxy_tag);
e_entry_set_text (entry, txt);
- gtk_signal_handler_unblock (GTK_OBJECT (entry->item), entry->priv->changed_proxy_tag);
+ g_signal_handler_unblock (entry->item, entry->priv->changed_proxy_tag);
}
@@ -410,7 +408,7 @@ e_entry_set_editable (EEntry *entry, gboolean am_i_editable)
{
g_return_if_fail (entry != NULL && E_IS_ENTRY (entry));
- gtk_object_set (GTK_OBJECT (entry->item), "editable", am_i_editable, NULL);
+ g_object_set (entry->item, "editable", am_i_editable, NULL);
}
gint
@@ -559,7 +557,7 @@ e_entry_show_popup (EEntry *entry, gboolean visible)
if (entry->priv->popup_is_visible != visible) {
entry->priv->popup_is_visible = visible;
- gtk_signal_emit (GTK_OBJECT (entry), e_entry_signals[E_ENTRY_COMPLETION_POPUP], (gint) visible);
+ g_signal_emit (entry, e_entry_signals[E_ENTRY_COMPLETION_POPUP], 0, (gint) visible);
}
}
@@ -745,7 +743,7 @@ key_press_cb (GtkWidget *w, GdkEventKey *ev, gpointer user_data)
{
gint rv = 0;
/* Forward signal */
- gtk_signal_emit_by_name (GTK_OBJECT (user_data), "key_press_event", ev, &rv);
+ g_signal_emit_by_name (user_data, "key_press_event", ev, &rv);
return rv;
}
@@ -754,7 +752,7 @@ key_release_cb (GtkWidget *w, GdkEventKey *ev, gpointer user_data)
{
gint rv = 0;
/* Forward signal */
- gtk_signal_emit_by_name (GTK_OBJECT (user_data), "key_release_event", ev, &rv);
+ g_signal_emit_by_name (user_data, "key_release_event", ev, &rv);
return rv;
}
@@ -787,7 +785,7 @@ e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint del
g_return_if_fail (entry->priv->completion == NULL);
entry->priv->completion = completion;
- gtk_object_ref (GTK_OBJECT (completion));
+ g_object_ref (completion);
gtk_object_sink (GTK_OBJECT (completion));
entry->priv->completion_delay = delay;
@@ -798,63 +796,63 @@ e_entry_enable_completion_full (EEntry *entry, ECompletion *completion, gint del
e_completion_view_set_complete_key (E_COMPLETION_VIEW (entry->priv->completion_view), GDK_Down);
e_completion_view_set_uncomplete_key (E_COMPLETION_VIEW (entry->priv->completion_view), GDK_Up);
- gtk_signal_connect_after (GTK_OBJECT (entry->priv->completion_view),
- "button_press_event",
- GTK_SIGNAL_FUNC (button_press_cb),
- entry);
+ g_signal_connect_after (entry->priv->completion_view,
+ "button_press_event",
+ G_CALLBACK (button_press_cb),
+ entry);
+
+ entry->priv->nonempty_signal_id = g_signal_connect (entry->priv->completion_view,
+ "nonempty",
+ G_CALLBACK (nonempty_cb),
+ entry);
- entry->priv->nonempty_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "nonempty",
- GTK_SIGNAL_FUNC (nonempty_cb),
- entry);
+ entry->priv->added_signal_id = g_signal_connect (entry->priv->completion_view,
+ "added",
+ G_CALLBACK (added_cb),
+ entry);
- entry->priv->added_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "added",
- GTK_SIGNAL_FUNC (added_cb),
- entry);
+ entry->priv->full_signal_id = g_signal_connect (entry->priv->completion_view,
+ "full",
+ G_CALLBACK (full_cb),
+ entry);
- entry->priv->full_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "full",
- GTK_SIGNAL_FUNC (full_cb),
+ entry->priv->browse_signal_id = g_signal_connect (entry->priv->completion_view,
+ "browse",
+ G_CALLBACK (browse_cb),
entry);
- entry->priv->browse_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "browse",
- GTK_SIGNAL_FUNC (browse_cb),
+ entry->priv->unbrowse_signal_id = g_signal_connect (entry->priv->completion_view,
+ "unbrowse",
+ G_CALLBACK (unbrowse_cb),
entry);
- entry->priv->unbrowse_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "unbrowse",
- GTK_SIGNAL_FUNC (unbrowse_cb),
- entry);
-
- entry->priv->activate_signal_id = gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view),
- "activate",
- GTK_SIGNAL_FUNC (activate_cb),
- entry);
+ entry->priv->activate_signal_id = g_signal_connect (entry->priv->completion_view,
+ "activate",
+ G_CALLBACK (activate_cb),
+ entry);
entry->priv->completion_view_popup = gtk_window_new (GTK_WINDOW_POPUP);
e_entry_make_completion_window_transient (entry);
- gtk_signal_connect (GTK_OBJECT (entry->item->model),
- "cancel_completion",
- GTK_SIGNAL_FUNC (cancel_completion_cb),
- entry);
+ g_signal_connect (entry->item->model,
+ "cancel_completion",
+ G_CALLBACK (cancel_completion_cb),
+ entry);
- gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view_popup),
- "key_press_event",
- GTK_SIGNAL_FUNC (key_press_cb),
- entry->canvas);
- gtk_signal_connect (GTK_OBJECT (entry->priv->completion_view_popup),
- "key_release_event",
- GTK_SIGNAL_FUNC (key_release_cb),
- entry->canvas);
+ g_signal_connect (entry->priv->completion_view_popup,
+ "key_press_event",
+ G_CALLBACK (key_press_cb),
+ entry->canvas);
+ g_signal_connect (entry->priv->completion_view_popup,
+ "key_release_event",
+ G_CALLBACK (key_release_cb),
+ entry->canvas);
e_completion_view_connect_keys (E_COMPLETION_VIEW (entry->priv->completion_view),
GTK_WIDGET (entry->canvas));
- gtk_object_ref (GTK_OBJECT (entry->priv->completion_view_popup));
+ g_object_ref (entry->priv->completion_view_popup);
gtk_object_sink (GTK_OBJECT (entry->priv->completion_view_popup));
gtk_window_set_policy (GTK_WINDOW (entry->priv->completion_view_popup), TRUE, TRUE, TRUE);
gtk_container_add (GTK_CONTAINER (entry->priv->completion_view_popup), entry->priv->completion_view);
@@ -872,136 +870,104 @@ e_entry_completion_popup_is_visible (EEntry *entry)
/** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/
static void
-et_get_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+et_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
- EEntry *entry = E_ENTRY (o);
+ EEntry *entry = E_ENTRY (object);
GtkObject *item = GTK_OBJECT (entry->item);
- switch (arg_id){
- case ARG_MODEL:
- gtk_object_get(item,
- "model", &GTK_VALUE_OBJECT (*arg),
- NULL);
+ switch (prop_id){
+ case PROP_MODEL:
+ g_object_get_property (G_OBJECT (item), "model", value);
break;
-
- case ARG_EVENT_PROCESSOR:
- gtk_object_get(item,
- "event_processor", &GTK_VALUE_OBJECT (*arg),
- NULL);
+ case PROP_EVENT_PROCESSOR:
+ g_object_get_property (G_OBJECT (item), "event_processor", value);
break;
-
- case ARG_TEXT:
- gtk_object_get(item,
- "text", &GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_TEXT:
+ g_object_get_property (G_OBJECT (item), "text", value);
break;
- case ARG_FONT_GDK:
- gtk_object_get(item,
- "font_gdk", &GTK_VALUE_BOXED (*arg),
- NULL);
+ case PROP_FONT_GDK:
+ g_object_get_property (G_OBJECT (item), "font_gdk", value);
break;
- case ARG_JUSTIFICATION:
- gtk_object_get(item,
- "justification", &GTK_VALUE_INT (*arg),
- NULL);
+ case PROP_JUSTIFICATION:
+ g_object_get_property (G_OBJECT (item), "justification", value);
break;
- case ARG_FILL_COLOR_GDK:
- gtk_object_get(item,
- "fill_color_gdk", &GTK_VALUE_BOXED (*arg),
- NULL);
+ case PROP_FILL_COLOR_GDK:
+ g_object_get_property (G_OBJECT (item), "fill_color_gdk", value);
break;
- case ARG_FILL_COLOR_RGBA:
- gtk_object_get(item,
- "fill_color_rgba", &GTK_VALUE_UINT (*arg),
- NULL);
+ case PROP_FILL_COLOR_RGBA:
+ g_object_get_property (G_OBJECT (item), "fill_color_rgba", value);
break;
- case ARG_FILL_STIPPLE:
- gtk_object_get(item,
- "fill_stiple", &GTK_VALUE_BOXED (*arg),
- NULL);
+ case PROP_FILL_STIPPLE:
+ g_object_get_property (G_OBJECT (item), "fill_stiple", value);
break;
- case ARG_EDITABLE:
- gtk_object_get(item,
- "editable", &GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_EDITABLE:
+ g_object_get_property (G_OBJECT (item), "editable", value);
break;
- case ARG_USE_ELLIPSIS:
- gtk_object_get(item,
- "use_ellipsis", &GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_USE_ELLIPSIS:
+ g_object_get_property (G_OBJECT (item), "use_ellipsis", value);
break;
- case ARG_ELLIPSIS:
- gtk_object_get(item,
- "ellipsis", &GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_ELLIPSIS:
+ g_object_get_property (G_OBJECT (item), "ellipsis", value);
break;
- case ARG_LINE_WRAP:
- gtk_object_get(item,
- "line_wrap", &GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_LINE_WRAP:
+ g_object_get_property (G_OBJECT (item), "line_wrap", value);
break;
- case ARG_BREAK_CHARACTERS:
- gtk_object_get(item,
- "break_characters", &GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_BREAK_CHARACTERS:
+ g_object_get_property (G_OBJECT (item), "break_characters", value);
break;
- case ARG_MAX_LINES:
- gtk_object_get(item,
- "max_lines", &GTK_VALUE_INT (*arg),
- NULL);
+ case PROP_MAX_LINES:
+ g_object_get_property (G_OBJECT (item), "max_lines", value);
break;
- case ARG_ALLOW_NEWLINES:
- gtk_object_get(item,
- "allow_newlines", &GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_ALLOW_NEWLINES:
+ g_object_get_property (G_OBJECT (item), "allow_newlines", value);
break;
- case ARG_DRAW_BORDERS:
- GTK_VALUE_BOOL (*arg) = entry->priv->draw_borders;
+ case PROP_DRAW_BORDERS:
+ g_value_set_boolean (value, entry->priv->draw_borders);
break;
- case ARG_DRAW_BACKGROUND:
- gtk_object_get (item,
- "draw_background", &GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_DRAW_BACKGROUND:
+ g_object_get_property (G_OBJECT (item), "draw_background", value);
break;
- case ARG_DRAW_BUTTON:
- gtk_object_get (item,
- "draw_button", &GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_DRAW_BUTTON:
+ g_object_get_property (G_OBJECT (item), "draw_button", value);
break;
- case ARG_EMULATE_LABEL_RESIZE:
- GTK_VALUE_BOOL (*arg) = entry->priv->emulate_label_resize;
+ case PROP_EMULATE_LABEL_RESIZE:
+ g_value_set_boolean (value, entry->priv->emulate_label_resize);
break;
- case ARG_CURSOR_POS:
- gtk_object_get (item,
- "cursor_pos", &GTK_VALUE_INT (*arg),
- NULL);
+ case PROP_CURSOR_POS:
+ g_object_get_property (G_OBJECT (item), "cursor_pos", value);
default:
- arg->type = GTK_TYPE_INVALID;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
static void
-et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
+et_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
- EEntry *entry = E_ENTRY (o);
+ EEntry *entry = E_ENTRY (object);
GtkObject *item = GTK_OBJECT (entry->item);
GtkAnchorType anchor;
double width, height;
@@ -1009,63 +975,51 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
gint ythick;
GtkWidget *widget = GTK_WIDGET(entry->canvas);
- d(g_print("%s: arg_id: %d\n", __FUNCTION__, arg_id));
+ d(g_print("%s: prop_id: %d\n", __FUNCTION__, prop_id));
- switch (arg_id){
- case ARG_MODEL:
- gtk_object_set(item,
- "model", GTK_VALUE_OBJECT (*arg),
- NULL);
+ switch (prop_id){
+ case PROP_MODEL:
+ g_object_set_property (G_OBJECT (item), "model", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_EVENT_PROCESSOR:
- gtk_object_set(item,
- "event_processor", GTK_VALUE_OBJECT (*arg),
- NULL);
+ case PROP_EVENT_PROCESSOR:
+ g_object_set_property (G_OBJECT (item), "event_processor", value);
break;
- case ARG_TEXT:
- gtk_object_set(item,
- "text", GTK_VALUE_STRING (*arg),
- NULL);
- d(g_print("%s: text: %s\n", __FUNCTION__, GTK_VALUE_STRING (*arg)));
+ case PROP_TEXT:
+ g_object_set_property (G_OBJECT (item), "text", value);
+ d(g_print("%s: text: %s\n", __FUNCTION__, g_value_get_string (value)));
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_FONT:
- gtk_object_set(item,
- "font", GTK_VALUE_STRING (*arg),
- NULL);
- d(g_print("%s: font: %s\n", __FUNCTION__, GTK_VALUE_STRING (*arg)));
+ case PROP_FONT:
+ g_object_set_property (G_OBJECT (item), "font", value);
+ d(g_print("%s: font: %s\n", __FUNCTION__, g_value_get_string (value)));
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_FONTSET:
- gtk_object_set(item,
- "fontset", GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_FONTSET:
+ g_object_set_property (G_OBJECT (item), "fontset", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_FONT_GDK:
- gtk_object_set(item,
- "font_gdk", GTK_VALUE_BOXED (*arg),
- NULL);
+ case PROP_FONT_GDK:
+ g_object_set_property (G_OBJECT (item), "font_gdk", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_JUSTIFICATION:
- entry->priv->justification = GTK_VALUE_INT (*arg);
- gtk_object_get(item,
- "clip_width", &width,
- "clip_height", &height,
- NULL);
+ case PROP_JUSTIFICATION:
+ entry->priv->justification = g_value_get_enum (value);
+ g_object_get(item,
+ "clip_width", &width,
+ "clip_height", &height,
+ NULL);
if (entry->priv->draw_borders) {
xthick = 0;
@@ -1089,116 +1043,91 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
e_canvas_item_move_absolute(GNOME_CANVAS_ITEM(entry->item), xthick, ythick);
break;
}
- gtk_object_set(item,
- "justification", entry->priv->justification,
- "anchor", anchor,
- NULL);
+ g_object_set(item,
+ "justification", entry->priv->justification,
+ "anchor", anchor,
+ NULL);
break;
- case ARG_FILL_COLOR:
- gtk_object_set(item,
- "fill_color", GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_FILL_COLOR:
+ g_object_set_property (G_OBJECT (item), "fill_color", value);
break;
- case ARG_FILL_COLOR_GDK:
- gtk_object_set(item,
- "fill_color_gdk", GTK_VALUE_BOXED (*arg),
- NULL);
+ case PROP_FILL_COLOR_GDK:
+ g_object_set_property (G_OBJECT (item), "fill_color_gdk", value);
break;
- case ARG_FILL_COLOR_RGBA:
- gtk_object_set(item,
- "fill_color_rgba", GTK_VALUE_UINT (*arg),
- NULL);
+ case PROP_FILL_COLOR_RGBA:
+ g_object_set_property (G_OBJECT (item), "fill_color_rgba", value);
break;
- case ARG_FILL_STIPPLE:
- gtk_object_set(item,
- "fill_stiple", GTK_VALUE_BOXED (*arg),
- NULL);
+ case PROP_FILL_STIPPLE:
+ g_object_set_property (G_OBJECT (item), "fill_stiple", value);
break;
- case ARG_EDITABLE:
- gtk_object_set(item,
- "editable", GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_EDITABLE:
+ g_object_set_property (G_OBJECT (item), "editable", value);
break;
- case ARG_USE_ELLIPSIS:
- gtk_object_set(item,
- "use_ellipsis", GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_USE_ELLIPSIS:
+ g_object_set_property (G_OBJECT (item), "use_ellipsis", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_ELLIPSIS:
- gtk_object_set(item,
- "ellipsis", GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_ELLIPSIS:
+ g_object_set_property (G_OBJECT (item), "ellipsis", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_LINE_WRAP:
- gtk_object_set(item,
- "line_wrap", GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_LINE_WRAP:
+ g_object_set_property (G_OBJECT (item), "line_wrap", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_BREAK_CHARACTERS:
- gtk_object_set(item,
- "break_characters", GTK_VALUE_STRING (*arg),
- NULL);
+ case PROP_BREAK_CHARACTERS:
+ g_object_set_property (G_OBJECT (item), "break_characters", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_MAX_LINES:
- gtk_object_set(item,
- "max_lines", GTK_VALUE_INT (*arg),
- NULL);
+ case PROP_MAX_LINES:
+ g_object_set_property (G_OBJECT (item), "max_lines", value);
if (entry->priv->emulate_label_resize)
gtk_widget_queue_resize (widget);
break;
- case ARG_ALLOW_NEWLINES:
- gtk_object_set(item,
- "allow_newlines", GTK_VALUE_BOOL (*arg),
- NULL);
+ case PROP_ALLOW_NEWLINES:
+ g_object_set_property (G_OBJECT (item), "allow_newlines", value);
break;
- case ARG_DRAW_BORDERS:
- if (entry->priv->draw_borders != GTK_VALUE_BOOL (*arg)) {
- entry->priv->draw_borders = GTK_VALUE_BOOL (*arg);
- gtk_object_set (item,
- "draw_borders", entry->priv->draw_borders,
- NULL);
+ case PROP_DRAW_BORDERS:
+ if (entry->priv->draw_borders != g_value_get_boolean (value)) {
+ entry->priv->draw_borders = g_value_get_boolean (value);
+ g_object_set (item,
+ "draw_borders", entry->priv->draw_borders,
+ NULL);
gtk_widget_queue_resize (GTK_WIDGET (entry));
}
break;
- case ARG_CURSOR_POS:
- gtk_object_set (item,
- "cursor_pos", GTK_VALUE_INT (*arg), NULL);
+ case PROP_CURSOR_POS:
+ g_object_set_property (G_OBJECT (item), "cursor_pos", value);
break;
- case ARG_DRAW_BACKGROUND:
- gtk_object_set (item, "draw_background",
- GTK_VALUE_BOOL (*arg), NULL);
+ case PROP_DRAW_BACKGROUND:
+ g_object_set_property (G_OBJECT (item), "draw_background", value);
break;
- case ARG_DRAW_BUTTON:
- gtk_object_set (item, "draw_button",
- GTK_VALUE_BOOL (*arg), NULL);
+ case PROP_DRAW_BUTTON:
+ g_object_set_property (G_OBJECT (item), "draw_button", value);
break;
- case ARG_EMULATE_LABEL_RESIZE:
- if (entry->priv->emulate_label_resize != GTK_VALUE_BOOL (*arg)) {
- entry->priv->emulate_label_resize = GTK_VALUE_BOOL (*arg);
+ case PROP_EMULATE_LABEL_RESIZE:
+ if (entry->priv->emulate_label_resize != g_value_get_boolean (value)) {
+ entry->priv->emulate_label_resize = g_value_get_boolean (value);
gtk_widget_queue_resize (widget);
}
break;
@@ -1206,7 +1135,7 @@ et_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
}
static void
-e_entry_destroy (GtkObject *object)
+e_entry_dispose (GObject *object)
{
EEntry *entry = E_ENTRY (object);
@@ -1215,10 +1144,10 @@ e_entry_destroy (GtkObject *object)
gtk_timeout_remove (entry->priv->completion_delay_tag);
if (entry->priv->completion)
- gtk_object_unref (GTK_OBJECT (entry->priv->completion));
+ g_object_unref (entry->priv->completion);
if (entry->priv->completion_view_popup) {
gtk_widget_destroy (GTK_WIDGET (entry->priv->completion_view_popup));
- gtk_object_unref (GTK_OBJECT (entry->priv->completion_view_popup));
+ g_object_unref (entry->priv->completion_view_popup);
}
g_free (entry->priv->pre_browse_text);
@@ -1232,8 +1161,8 @@ e_entry_destroy (GtkObject *object)
entry->priv = 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);
}
static void
@@ -1255,16 +1184,16 @@ e_entry_realize (GtkWidget *widget)
}
static void
-e_entry_class_init (GtkObjectClass *object_class)
+e_entry_class_init (GObjectClass *object_class)
{
EEntryClass *klass = E_ENTRY_CLASS(object_class);
GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(object_class);
- parent_class = gtk_type_class (PARENT_TYPE);
+ parent_class = g_type_class_ref (PARENT_TYPE);
- object_class->set_arg = et_set_arg;
- object_class->get_arg = et_get_arg;
- object_class->destroy = e_entry_destroy;
+ object_class->set_property = et_set_property;
+ object_class->get_property = et_get_property;
+ object_class->dispose = e_entry_dispose;
widget_class->realize = e_entry_realize;
@@ -1272,86 +1201,200 @@ e_entry_class_init (GtkObjectClass *object_class)
klass->activate = NULL;
e_entry_signals[E_ENTRY_CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EEntryClass, changed),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_entry_signals[E_ENTRY_ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, activate),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("activate",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EEntryClass, activate),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_entry_signals[E_ENTRY_POPUP] =
- gtk_signal_new ("popup",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, popup),
- e_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
+ g_signal_new ("popup",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EEntryClass, popup),
+ NULL, NULL,
+ e_marshal_NONE__POINTER_INT,
+ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
e_entry_signals[E_ENTRY_COMPLETION_POPUP] =
- gtk_signal_new ("completion_popup",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (EEntryClass, completion_popup),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1, GTK_TYPE_INT);
-
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_entry_signals, E_ENTRY_LAST_SIGNAL);
-
- gtk_object_add_arg_type ("EEntry::model",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("EEntry::event_processor",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR);
- gtk_object_add_arg_type ("EEntry::text",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT);
- gtk_object_add_arg_type ("EEntry::font",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT);
- gtk_object_add_arg_type ("EEntry::fontset",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET);
- gtk_object_add_arg_type ("EEntry::font_gdk",
- GDK_TYPE_FONT, GTK_ARG_READWRITE, ARG_FONT_GDK);
- gtk_object_add_arg_type ("EEntry::justification",
- GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION);
- gtk_object_add_arg_type ("EEntry::fill_color",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR);
- gtk_object_add_arg_type ("EEntry::fill_color_gdk",
- GDK_TYPE_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK);
- gtk_object_add_arg_type ("EEntry::fill_color_rgba",
- GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA);
- gtk_object_add_arg_type ("EEntry::fill_stipple",
- GDK_TYPE_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE);
- gtk_object_add_arg_type ("EEntry::editable",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("EEntry::use_ellipsis",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USE_ELLIPSIS);
- gtk_object_add_arg_type ("EEntry::ellipsis",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ELLIPSIS);
- gtk_object_add_arg_type ("EEntry::line_wrap",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_LINE_WRAP);
- gtk_object_add_arg_type ("EEntry::break_characters",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_BREAK_CHARACTERS);
- gtk_object_add_arg_type ("EEntry::max_lines",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES);
- gtk_object_add_arg_type ("EEntry::allow_newlines",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES);
- gtk_object_add_arg_type ("EEntry::draw_borders",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BORDERS);
- gtk_object_add_arg_type ("EEntry::draw_background",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND);
- gtk_object_add_arg_type ("EEntry::draw_button",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BUTTON);
- gtk_object_add_arg_type ("EEntry::emulate_label_resize",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EMULATE_LABEL_RESIZE);
- gtk_object_add_arg_type ("EEntry::cursor_pos",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS);
+ g_signal_new ("completion_popup",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (EEntryClass, completion_popup),
+ NULL, NULL,
+ gtk_marshal_NONE__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
+ g_object_class_install_property (object_class, PROP_MODEL,
+ g_param_spec_object ("model",
+ _( "Model" ),
+ _( "Model" ),
+ E_TYPE_TEXT_MODEL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_EVENT_PROCESSOR,
+ g_param_spec_object ("event_processor",
+ _( "Event Processor" ),
+ _( "Event Processor" ),
+ E_TEXT_EVENT_PROCESSOR_TYPE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_TEXT,
+ g_param_spec_string ("text",
+ _( "Text" ),
+ _( "Text" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FONT,
+ g_param_spec_string ("font",
+ _( "Font" ),
+ _( "Font" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FONTSET,
+ g_param_spec_string ("fontset",
+ _( "Fontset" ),
+ _( "Fontset" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FONT_GDK,
+ g_param_spec_boxed ("font_gdk",
+ _( "GDKFont" ),
+ _( "GDKFont" ),
+ GDK_TYPE_FONT,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (object_class, PROP_JUSTIFICATION,
+ g_param_spec_enum ("justification",
+ _( "Justification" ),
+ _( "Justification" ),
+ GTK_TYPE_JUSTIFICATION, GTK_JUSTIFY_LEFT,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_COLOR,
+ g_param_spec_string ("fill_color",
+ _( "Fill color" ),
+ _( "Fill color" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_COLOR_GDK,
+ g_param_spec_pointer ("fill_color_gdk",
+ _( "GDK fill color" ),
+ _( "GDK fill color" ),
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_COLOR_RGBA,
+ g_param_spec_uint ("fill_color_rgba",
+ _( "GDK fill color" ),
+ _( "GDK fill color" ),
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_STIPPLE,
+ g_param_spec_object ("fill_stipple",
+ _( "Fill stipple" ),
+ _( "FIll stipple" ),
+ GDK_TYPE_WINDOW,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_EDITABLE,
+ g_param_spec_boolean ("editable",
+ _( "Editable" ),
+ _( "Editable" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_USE_ELLIPSIS,
+ g_param_spec_boolean ("use_ellipsis",
+ _( "Use ellipsis" ),
+ _( "Use ellipsis" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_ELLIPSIS,
+ g_param_spec_string ("ellipsis",
+ _( "Ellipsis" ),
+ _( "Ellipsis" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_LINE_WRAP,
+ g_param_spec_boolean ("line_wrap",
+ _( "Line wrap" ),
+ _( "Line wrap" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_BREAK_CHARACTERS,
+ g_param_spec_string ("break_characters",
+ _( "Break characters" ),
+ _( "Break characters" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_MAX_LINES,
+ g_param_spec_int ("max_lines",
+ _( "Max lines" ),
+ _( "Max lines" ),
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_ALLOW_NEWLINES,
+ g_param_spec_boolean ("allow_newlines",
+ _( "Allow newlines" ),
+ _( "Allow newlines" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_DRAW_BORDERS,
+ g_param_spec_boolean ("draw_borders",
+ _( "Draw borders" ),
+ _( "Draw borders" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_DRAW_BACKGROUND,
+ g_param_spec_boolean ("draw_background",
+ _( "Draw background" ),
+ _( "Draw background" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_DRAW_BUTTON,
+ g_param_spec_boolean ("draw_button",
+ _( "Draw button" ),
+ _( "Draw button" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_CURSOR_POS,
+ g_param_spec_int ("cursor_pos",
+ _( "Cursor position" ),
+ _( "Cursor position" ),
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_EMULATE_LABEL_RESIZE,
+ g_param_spec_boolean ("emulate_label_resize",
+ _( "Emulate label resize" ),
+ _( "Emulate label resize" ),
+ FALSE,
+ G_PARAM_READWRITE));
}
E_MAKE_TYPE(e_entry, "EEntry", EEntry, e_entry_class_init, e_entry_init, PARENT_TYPE)
diff --git a/widgets/text/e-entry.h b/widgets/text/e-entry.h
index 1e073a87e8..8c1093638b 100644
--- a/widgets/text/e-entry.h
+++ b/widgets/text/e-entry.h
@@ -34,10 +34,10 @@
G_BEGIN_DECLS
#define E_ENTRY_TYPE (e_entry_get_type ())
-#define E_ENTRY(o) (GTK_CHECK_CAST ((o), E_ENTRY_TYPE, EEntry))
-#define E_ENTRY_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass))
-#define E_IS_ENTRY(o) (GTK_CHECK_TYPE ((o), E_ENTRY_TYPE))
-#define E_IS_ENTRY_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_ENTRY_TYPE))
+#define E_ENTRY(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), E_ENTRY_TYPE, EEntry))
+#define E_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), E_ENTRY_TYPE, EEntryClass))
+#define E_IS_ENTRY(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), E_ENTRY_TYPE))
+#define E_IS_ENTRY_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), E_ENTRY_TYPE))
typedef struct _EEntry EEntry;
typedef struct _EEntryClass EEntryClass;
diff --git a/widgets/text/e-table-text-model.c b/widgets/text/e-table-text-model.c
index cd47f0ff43..909a982528 100644
--- a/widgets/text/e-table-text-model.c
+++ b/widgets/text/e-table-text-model.c
@@ -29,7 +29,7 @@
static void e_table_text_model_class_init (ETableTextModelClass *class);
static void e_table_text_model_init (ETableTextModel *model);
-static void e_table_text_model_destroy (GtkObject *object);
+static void e_table_text_model_dispose (GObject *object);
static const gchar *e_table_text_model_get_text (ETextModel *model);
static void e_table_text_model_set_text (ETextModel *model, const gchar *text);
@@ -37,6 +37,7 @@ static void e_table_text_model_insert (ETextModel *model, gint postion, const gc
static void e_table_text_model_insert_length (ETextModel *model, gint postion, const gchar *text, gint length);
static void e_table_text_model_delete (ETextModel *model, gint postion, gint length);
+#define PARENT_TYPE E_TYPE_TEXT_MODEL
static GtkObject *parent_class;
@@ -50,40 +51,24 @@ static GtkObject *parent_class;
*
* Return value: The type ID of the &ETableTextModel class.
**/
-GtkType
-e_table_text_model_get_type (void)
-{
- static GtkType model_type = 0;
-
- if (!model_type) {
- GtkTypeInfo model_info = {
- "ETableTextModel",
- sizeof (ETableTextModel),
- sizeof (ETableTextModelClass),
- (GtkClassInitFunc) e_table_text_model_class_init,
- (GtkObjectInitFunc) e_table_text_model_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_type = gtk_type_unique (e_text_model_get_type (), &model_info);
- }
-
- return model_type;
-}
-
+E_MAKE_TYPE (e_table_text_model,
+ "ETableTextModel",
+ ETableTextModel,
+ e_table_text_model_class_init,
+ e_table_text_model_init,
+ PARENT_TYPE)
+
/* Class initialization function for the text item */
static void
e_table_text_model_class_init (ETableTextModelClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
ETextModelClass *model_class;
- object_class = (GtkObjectClass *) klass;
+ object_class = (GObjectClass *) klass;
model_class = (ETextModelClass *) klass;
- parent_class = gtk_type_class (e_text_model_get_type ());
+ parent_class = g_type_class_ref (PARENT_TYPE);
model_class->get_text = e_table_text_model_get_text;
model_class->set_text = e_table_text_model_set_text;
@@ -91,7 +76,7 @@ e_table_text_model_class_init (ETableTextModelClass *klass)
model_class->insert_length = e_table_text_model_insert_length;
model_class->delete = e_table_text_model_delete;
- object_class->destroy = e_table_text_model_destroy;
+ object_class->dispose = e_table_text_model_dispose;
}
/* Object initialization function for the text item */
@@ -105,9 +90,9 @@ e_table_text_model_init (ETableTextModel *model)
model->row_changed_signal_id = 0;
}
-/* Destroy handler for the text item */
+/* Dispose handler for the text item */
static void
-e_table_text_model_destroy (GtkObject *object)
+e_table_text_model_dispose (GObject *object)
{
ETableTextModel *model;
@@ -120,21 +105,21 @@ e_table_text_model_destroy (GtkObject *object)
g_assert (GTK_IS_OBJECT (model->model));
if (model->cell_changed_signal_id)
- gtk_signal_disconnect (GTK_OBJECT(model->model),
- model->cell_changed_signal_id);
+ g_signal_handler_disconnect (model->model,
+ model->cell_changed_signal_id);
model->cell_changed_signal_id = 0;
if (model->row_changed_signal_id)
- gtk_signal_disconnect (GTK_OBJECT(model->model),
- model->row_changed_signal_id);
+ g_signal_handler_disconnect (model->model,
+ model->row_changed_signal_id);
model->row_changed_signal_id = 0;
if (model->model)
- gtk_object_unref (GTK_OBJECT(model->model));
+ g_object_unref (model->model);
model->model = 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);
}
static const gchar *
e_table_text_model_get_text (ETextModel *text_model)
@@ -227,20 +212,20 @@ e_table_text_model_new (ETableModel *table_model, int row, int model_col)
g_return_val_if_fail(table_model != NULL, NULL);
g_return_val_if_fail(E_IS_TABLE_MODEL(table_model), NULL);
- model = gtk_type_new (e_table_text_model_get_type ());
+ model = g_object_new (E_TYPE_TABLE_TEXT_MODEL, NULL);
model->model = table_model;
if (model->model){
- gtk_object_ref (GTK_OBJECT(model->model));
+ g_object_ref (model->model);
model->cell_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT(model->model),
- "model_cell_changed",
- GTK_SIGNAL_FUNC(cell_changed),
- model);
+ g_signal_connect (model->model,
+ "model_cell_changed",
+ G_CALLBACK(cell_changed),
+ model);
model->row_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT(model->model),
- "model_row_changed",
- GTK_SIGNAL_FUNC(row_changed),
- model);
+ g_signal_connect (model->model,
+ "model_row_changed",
+ G_CALLBACK(row_changed),
+ model);
}
model->row = row;
model->model_col = model_col;
diff --git a/widgets/text/e-table-text-model.h b/widgets/text/e-table-text-model.h
index 1c1a88dd47..46e82de1c4 100644
--- a/widgets/text/e-table-text-model.h
+++ b/widgets/text/e-table-text-model.h
@@ -30,10 +30,10 @@
G_BEGIN_DECLS
#define E_TYPE_TABLE_TEXT_MODEL (e_table_text_model_get_type ())
-#define E_TABLE_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel))
-#define E_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TABLE_TEXT_MODEL, ETableTextModelClass))
-#define E_IS_TABLE_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TABLE_TEXT_MODEL))
-#define E_IS_TABLE_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TABLE_TEXT_MODEL))
+#define E_TABLE_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TABLE_TEXT_MODEL, ETableTextModel))
+#define E_TABLE_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TABLE_TEXT_MODEL, ETableTextModelClass))
+#define E_IS_TABLE_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TABLE_TEXT_MODEL))
+#define E_IS_TABLE_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TABLE_TEXT_MODEL))
typedef struct _ETableTextModel ETableTextModel;
typedef struct _ETableTextModelClass ETableTextModelClass;
diff --git a/widgets/text/e-text-model-uri.c b/widgets/text/e-text-model-uri.c
index 7292d2954e..858771b481 100644
--- a/widgets/text/e-text-model-uri.c
+++ b/widgets/text/e-text-model-uri.c
@@ -30,10 +30,11 @@
#include <regex.h>
#include <gtk/gtkmain.h>
#include <libgnome/gnome-url.h>
+#include <gal/util/e-util.h>
static void e_text_model_uri_class_init (ETextModelURIClass *class);
static void e_text_model_uri_init (ETextModelURI *model);
-static void e_text_model_uri_destroy (GtkObject *object);
+static void e_text_model_uri_dispose (GObject *object);
static void objectify_uris (ETextModelURI *model);
@@ -48,43 +49,28 @@ struct _ObjInfo {
gint offset, len;
};
+#define PARENT_TYPE E_TYPE_TEXT_MODEL
static GtkObject *parent_class;
-GtkType
-e_text_model_uri_get_type (void)
-{
- static GtkType model_uri_type = 0;
-
- if (!model_uri_type) {
- GtkTypeInfo model_uri_info = {
- "ETextModelURI",
- sizeof (ETextModelURI),
- sizeof (ETextModelURIClass),
- (GtkClassInitFunc) e_text_model_uri_class_init,
- (GtkObjectInitFunc) e_text_model_uri_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_uri_type = gtk_type_unique (e_text_model_get_type (), &model_uri_info);
- }
-
- return model_uri_type;
-}
-
+E_MAKE_TYPE (e_text_model_uri,
+ "ETextModelURI",
+ ETextModelURI,
+ e_text_model_uri_class_init,
+ e_text_model_uri_init,
+ PARENT_TYPE)
+
static void
e_text_model_uri_class_init (ETextModelURIClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
ETextModelClass *model_class;
- object_class = (GtkObjectClass *) klass;
+ object_class = (GObjectClass *) klass;
model_class = E_TEXT_MODEL_CLASS (klass);
- parent_class = gtk_type_class (e_text_model_get_type ());
+ parent_class = g_type_class_ref (PARENT_TYPE);
- object_class->destroy = e_text_model_uri_destroy;
+ object_class->dispose = e_text_model_uri_dispose;
model_class->object_activated = e_text_model_uri_activate_nth_object;
@@ -102,7 +88,7 @@ e_text_model_uri_init (ETextModelURI *model)
}
static void
-e_text_model_uri_destroy (GtkObject *object)
+e_text_model_uri_dispose (GObject *object)
{
ETextModelURI *model_uri = E_TEXT_MODEL_URI (object);
GList *iter;
@@ -117,8 +103,8 @@ e_text_model_uri_destroy (GtkObject *object)
g_list_free (model_uri->uris);
model_uri->uris = 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);
}
@@ -351,7 +337,7 @@ e_text_model_uri_activate_nth_object (ETextModel *model, gint i)
ETextModel *
e_text_model_uri_new (void)
{
- return E_TEXT_MODEL (gtk_type_new (e_text_model_uri_get_type ()));
+ return E_TEXT_MODEL (g_object_new (E_TYPE_TEXT_MODEL_URI, NULL));
}
diff --git a/widgets/text/e-text-model-uri.h b/widgets/text/e-text-model-uri.h
index 9293a8f63f..2dcbddbaf6 100644
--- a/widgets/text/e-text-model-uri.h
+++ b/widgets/text/e-text-model-uri.h
@@ -29,10 +29,10 @@
G_BEGIN_DECLS
#define E_TYPE_TEXT_MODEL_URI (e_text_model_get_type ())
-#define E_TEXT_MODEL_URI(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI))
-#define E_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL_URI, ETextModelURIClass))
-#define E_IS_TEXT_MODEL_URI(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL_URI))
-#define E_IS_TEXT_MODEL_URI_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL_URI))
+#define E_TEXT_MODEL_URI(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT_MODEL_URI, ETextModelURI))
+#define E_TEXT_MODEL_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL_URI, ETextModelURIClass))
+#define E_IS_TEXT_MODEL_URI(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT_MODEL_URI))
+#define E_IS_TEXT_MODEL_URI_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL_URI))
typedef struct _ETextModelURI ETextModelURI;
typedef struct _ETextModelURIClass ETextModelURIClass;
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
index d761f8e193..b7287156f5 100644
--- a/widgets/text/e-text-model.c
+++ b/widgets/text/e-text-model.c
@@ -53,7 +53,7 @@ struct _ETextModelPrivate {
static void e_text_model_class_init (ETextModelClass *class);
static void e_text_model_init (ETextModel *model);
-static void e_text_model_destroy (GtkObject *object);
+static void e_text_model_dispose (GObject *object);
static gint e_text_model_real_validate_position (ETextModel *, gint pos);
static const gchar *e_text_model_real_get_text (ETextModel *model);
@@ -63,6 +63,7 @@ static void e_text_model_real_insert (ETextModel *model, gint
static void e_text_model_real_insert_length (ETextModel *model, gint postion, const gchar *text, gint length);
static void e_text_model_real_delete (ETextModel *model, gint postion, gint length);
+#define PARENT_TYPE GTK_TYPE_OBJECT
static GtkObject *parent_class;
@@ -76,74 +77,60 @@ static GtkObject *parent_class;
*
* Return value: The type ID of the &ETextModel class.
**/
-GtkType
-e_text_model_get_type (void)
-{
- static GtkType model_type = 0;
-
- if (!model_type) {
- GtkTypeInfo model_info = {
- "ETextModel",
- sizeof (ETextModel),
- sizeof (ETextModelClass),
- (GtkClassInitFunc) e_text_model_class_init,
- (GtkObjectInitFunc) e_text_model_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- model_type = gtk_type_unique (gtk_object_get_type (), &model_info);
- }
-
- return model_type;
-}
+E_MAKE_TYPE (e_text_model,
+ "ETextModel",
+ ETextModel,
+ e_text_model_class_init,
+ e_text_model_init,
+ PARENT_TYPE)
/* Class initialization function for the text item */
static void
e_text_model_class_init (ETextModelClass *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_text_model_signals[E_TEXT_MODEL_CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextModelClass, changed),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
e_text_model_signals[E_TEXT_MODEL_REPOSITION] =
- gtk_signal_new ("reposition",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, reposition),
- e_marshal_NONE__POINTER_POINTER,
- GTK_TYPE_NONE, 2,
- GTK_TYPE_POINTER, GTK_TYPE_POINTER);
+ g_signal_new ("reposition",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextModelClass, reposition),
+ NULL, NULL,
+ e_marshal_NONE__POINTER_POINTER,
+ G_TYPE_NONE, 2,
+ G_TYPE_POINTER, G_TYPE_POINTER);
e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED] =
- gtk_signal_new ("object_activated",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, object_activated),
- gtk_marshal_NONE__INT,
- GTK_TYPE_NONE, 1,
- GTK_TYPE_INT);
+ g_signal_new ("object_activated",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextModelClass, object_activated),
+ NULL, NULL,
+ e_marshal_NONE__INT,
+ G_TYPE_NONE, 1,
+ G_TYPE_INT);
e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION] =
- gtk_signal_new ("cancel_completion",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextModelClass, cancel_completion),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_text_model_signals, E_TEXT_MODEL_LAST_SIGNAL);
+ g_signal_new ("cancel_completion",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextModelClass, cancel_completion),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
/* No default signal handlers. */
klass->changed = NULL;
@@ -164,7 +151,7 @@ e_text_model_class_init (ETextModelClass *klass)
klass->obj_count = NULL;
klass->get_nth_obj = NULL;
- object_class->destroy = e_text_model_destroy;
+ object_class->dispose = e_text_model_dispose;
}
/* Object initialization function for the text item */
@@ -176,9 +163,9 @@ e_text_model_init (ETextModel *model)
model->priv->len = 0;
}
-/* Destroy handler for the text item */
+/* Dispose handler for the text item */
static void
-e_text_model_destroy (GtkObject *object)
+e_text_model_dispose (GObject *object)
{
ETextModel *model;
@@ -194,8 +181,8 @@ e_text_model_destroy (GtkObject *object)
model->priv = 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);
}
static gint
@@ -370,8 +357,8 @@ e_text_model_changed (ETextModel *model)
if (CLASS (model)->objectify)
CLASS (model)->objectify (model);
- gtk_signal_emit (GTK_OBJECT (model),
- e_text_model_signals[E_TEXT_MODEL_CHANGED]);
+ g_signal_emit (model,
+ e_text_model_signals[E_TEXT_MODEL_CHANGED], 0);
}
void
@@ -379,7 +366,7 @@ e_text_model_cancel_completion (ETextModel *model)
{
g_return_if_fail (E_IS_TEXT_MODEL (model));
- gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION]);
+ g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_CANCEL_COMPLETION], 0);
}
void
@@ -389,9 +376,9 @@ e_text_model_reposition (ETextModel *model, ETextModelReposFn fn, gpointer repos
g_return_if_fail (E_IS_TEXT_MODEL (model));
g_return_if_fail (fn != NULL);
- gtk_signal_emit (GTK_OBJECT (model),
- e_text_model_signals[E_TEXT_MODEL_REPOSITION],
- fn, repos_data);
+ g_signal_emit (model,
+ e_text_model_signals[E_TEXT_MODEL_REPOSITION], 0,
+ fn, repos_data);
}
gint
@@ -637,12 +624,12 @@ e_text_model_activate_nth_object (ETextModel *model, gint n)
g_return_if_fail (n >= 0);
g_return_if_fail (n < e_text_model_object_count (model));
- gtk_signal_emit (GTK_OBJECT (model), e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], n);
+ g_signal_emit (model, e_text_model_signals[E_TEXT_MODEL_OBJECT_ACTIVATED], 0, n);
}
ETextModel *
e_text_model_new (void)
{
- ETextModel *model = gtk_type_new (e_text_model_get_type ());
+ ETextModel *model = g_object_new (E_TYPE_TEXT_MODEL, NULL);
return model;
}
diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h
index 8b5c7aab23..c79376d9d0 100644
--- a/widgets/text/e-text-model.h
+++ b/widgets/text/e-text-model.h
@@ -30,10 +30,10 @@
G_BEGIN_DECLS
#define E_TYPE_TEXT_MODEL (e_text_model_get_type ())
-#define E_TEXT_MODEL(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel))
-#define E_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL, ETextModelClass))
-#define E_IS_TEXT_MODEL(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT_MODEL))
-#define E_IS_TEXT_MODEL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL))
+#define E_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT_MODEL, ETextModel))
+#define E_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT_MODEL, ETextModelClass))
+#define E_IS_TEXT_MODEL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT_MODEL))
+#define E_IS_TEXT_MODEL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT_MODEL))
typedef struct _ETextModel ETextModel;
typedef struct _ETextModelClass ETextModelClass;
diff --git a/widgets/text/e-text-test.c b/widgets/text/e-text-test.c
index 45b39d3352..d10a745d85 100644
--- a/widgets/text/e-text-test.c
+++ b/widgets/text/e-text-test.c
@@ -34,9 +34,9 @@ static void allocate_callback(GtkWidget *canvas, GtkAllocation *allocation, Gnom
gnome_canvas_item_set( item,
"width", (double) allocation->width,
NULL );
- gtk_object_get(GTK_OBJECT(item),
- "height", &height,
- NULL);
+ g_object_get(item,
+ "height", &height,
+ NULL);
height = MAX(height, allocation->height);
gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, allocation->width, height );
gnome_canvas_item_set( rect,
@@ -49,9 +49,9 @@ static void
reflow (GtkWidget *canvas, GnomeCanvasItem *item)
{
double height;
- gtk_object_get(GTK_OBJECT(item),
- "height", &height,
- NULL);
+ g_object_get(item,
+ "height", &height,
+ NULL);
height = MAX(height, canvas->allocation.height);
gnome_canvas_set_scroll_region(GNOME_CANVAS( canvas ), 0, 0, canvas->allocation.width, height );
gnome_canvas_item_set( rect,
@@ -61,8 +61,7 @@ reflow (GtkWidget *canvas, GnomeCanvasItem *item)
}
static void
-quit_cb (GtkWidget *widget,
- gpointer data)
+quit_cb (gpointer data, GObject *where_object_was)
{
gtk_main_quit ();
}
@@ -102,8 +101,8 @@ main (int argc,
gnome_init ("ETextTest", "0.0.1", argc, argv);
window = gtk_window_new (GTK_WINDOW_TOPLEVEL);
gtk_window_set_title (GTK_WINDOW (window), "EText Test");
- gtk_signal_connect (GTK_OBJECT (window), "destroy",
- GTK_SIGNAL_FUNC (quit_cb), NULL);
+ g_object_weak_ref (G_OBJECT (window),
+ quit_cb, NULL);
gtk_widget_push_colormap (gdk_rgb_get_cmap ());
canvas = e_canvas_new ();
@@ -150,17 +149,17 @@ main (int argc,
"width", 150.0,
NULL);
- gtk_signal_connect (GTK_OBJECT (text), "activate",
- GTK_SIGNAL_FUNC (change_text_cb), item);
- gtk_signal_connect (GTK_OBJECT (font), "activate",
- GTK_SIGNAL_FUNC (change_font_cb), item);
-
- gtk_signal_connect( GTK_OBJECT( canvas ), "size_allocate",
- GTK_SIGNAL_FUNC( allocate_callback ),
- item );
- gtk_signal_connect( GTK_OBJECT( canvas ), "reflow",
- GTK_SIGNAL_FUNC( reflow ),
- item );
+ g_signal_connect (text, "activate",
+ G_CALLBACK (change_text_cb), item);
+ g_signal_connect (font, "activate",
+ G_CALLBACK (change_font_cb), item);
+
+ g_signal_connect (canvas , "size_allocate",
+ G_CALLBACK (allocate_callback),
+ item );
+ g_signal_connect (canvas , "reflow",
+ G_CALLBACK (reflow),
+ item );
gnome_canvas_set_scroll_region (GNOME_CANVAS (canvas), 0.0, 0.0, 400.0, 400.0);
gtk_widget_show_all (window);
gtk_main ();
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index abaa788a98..237818f624 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -50,6 +50,7 @@
#include <libgnomecanvas/gnome-canvas-rect-ellipse.h>
#include "gal/util/e-util.h"
+#include "gal/util/e-i18n.h"
#include "gal/widgets/e-canvas.h"
#include "gal/widgets/e-canvas-utils.h"
#include "gal/widgets/e-unicode.h"
@@ -85,43 +86,43 @@ struct line {
/* Object argument IDs */
enum {
- ARG_0,
- ARG_MODEL,
- ARG_EVENT_PROCESSOR,
- ARG_TEXT,
- ARG_FONT,
- ARG_FONTSET,
- ARG_FONT_GDK,
- ARG_FONT_E,
- ARG_BOLD,
- ARG_STRIKEOUT,
- ARG_ANCHOR,
- ARG_JUSTIFICATION,
- ARG_CLIP_WIDTH,
- ARG_CLIP_HEIGHT,
- ARG_CLIP,
- ARG_FILL_CLIP_RECTANGLE,
- ARG_X_OFFSET,
- ARG_Y_OFFSET,
- ARG_FILL_COLOR,
- ARG_FILL_COLOR_GDK,
- ARG_FILL_COLOR_RGBA,
- ARG_FILL_STIPPLE,
- ARG_TEXT_WIDTH,
- ARG_TEXT_HEIGHT,
- ARG_EDITABLE,
- ARG_USE_ELLIPSIS,
- ARG_ELLIPSIS,
- ARG_LINE_WRAP,
- ARG_BREAK_CHARACTERS,
- ARG_MAX_LINES,
- ARG_WIDTH,
- ARG_HEIGHT,
- ARG_DRAW_BORDERS,
- ARG_ALLOW_NEWLINES,
- ARG_DRAW_BACKGROUND,
- ARG_DRAW_BUTTON,
- ARG_CURSOR_POS
+ PROP_0,
+ PROP_MODEL,
+ PROP_EVENT_PROCESSOR,
+ PROP_TEXT,
+ PROP_FONT,
+ PROP_FONTSET,
+ PROP_FONT_GDK,
+ PROP_FONT_E,
+ PROP_BOLD,
+ PROP_STRIKEOUT,
+ PROP_ANCHOR,
+ PROP_JUSTIFICATION,
+ PROP_CLIP_WIDTH,
+ PROP_CLIP_HEIGHT,
+ PROP_CLIP,
+ PROP_FILL_CLIP_RECTANGLE,
+ PROP_X_OFFSET,
+ PROP_Y_OFFSET,
+ PROP_FILL_COLOR,
+ PROP_FILL_COLOR_GDK,
+ PROP_FILL_COLOR_RGBA,
+ PROP_FILL_STIPPLE,
+ PROP_TEXT_WIDTH,
+ PROP_TEXT_HEIGHT,
+ PROP_EDITABLE,
+ PROP_USE_ELLIPSIS,
+ PROP_ELLIPSIS,
+ PROP_LINE_WRAP,
+ PROP_BREAK_CHARACTERS,
+ PROP_MAX_LINES,
+ PROP_WIDTH,
+ PROP_HEIGHT,
+ PROP_DRAW_BORDERS,
+ PROP_ALLOW_NEWLINES,
+ PROP_DRAW_BACKGROUND,
+ PROP_DRAW_BUTTON,
+ PROP_CURSOR_POS
};
@@ -177,6 +178,7 @@ static void calc_height (EText *text);
static void calc_line_widths (EText *text);
static void split_into_lines (EText *text);
+#define PARENT_TYPE GNOME_TYPE_CANVAS_ITEM
static GnomeCanvasItemClass *parent_class;
static GdkAtom clipboard_atom = GDK_NONE;
@@ -198,7 +200,7 @@ e_text_style_set (EText *text, GtkStyle *previous_style)
}
static void
-e_text_destroy (GtkObject *object)
+e_text_dispose (GObject *object)
{
EText *text;
@@ -212,30 +214,30 @@ e_text_destroy (GtkObject *object)
text->tooltip_owner = 0;
if (text->model_changed_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_changed_signal_id);
+ g_signal_handler_disconnect (text->model,
+ text->model_changed_signal_id);
text->model_changed_signal_id = 0;
if (text->model_repos_signal_id)
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_repos_signal_id);
+ g_signal_handler_disconnect (text->model,
+ text->model_repos_signal_id);
text->model_repos_signal_id = 0;
if (text->model)
- gtk_object_unref(GTK_OBJECT(text->model));
+ g_object_unref(text->model);
text->model = NULL;
if (text->tep_command_id)
- gtk_signal_disconnect(GTK_OBJECT(text->tep),
- text->tep_command_id);
+ g_signal_handler_disconnect(text->tep,
+ text->tep_command_id);
text->tep_command_id = 0;
if (text->tep)
- gtk_object_unref (GTK_OBJECT(text->tep));
+ g_object_unref (text->tep);
text->tep = NULL;
if (text->invisible)
- gtk_object_unref (GTK_OBJECT(text->invisible));
+ g_object_unref (text->invisible);
text->invisible = NULL;
g_free (text->lines);
@@ -289,8 +291,8 @@ e_text_destroy (GtkObject *object)
text->tpl_timeout = 0;
}
- 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);
}
static void
@@ -309,7 +311,7 @@ e_text_text_model_changed (ETextModel *model, EText *text)
e_canvas_item_request_reflow (GNOME_CANVAS_ITEM(text));
gnome_canvas_item_request_update (GNOME_CANVAS_ITEM (text));
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]);
+ g_signal_emit (text, e_text_signals[E_TEXT_CHANGED], 0);
}
static void
@@ -842,7 +844,10 @@ set_stipple (EText *text, GdkBitmap *stipple, int reconfigure)
/* Set_arg handler for the text item */
static void
-e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_text_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
{
GnomeCanvasItem *item;
EText *text;
@@ -860,71 +865,71 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
color_changed = FALSE;
have_pixel = FALSE;
- switch (arg_id) {
- case ARG_MODEL:
+ switch (prop_id) {
+ case PROP_MODEL:
if ( text->model_changed_signal_id )
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_changed_signal_id);
+ g_signal_handler_disconnect (text->model,
+ text->model_changed_signal_id);
if ( text->model_repos_signal_id )
- gtk_signal_disconnect (GTK_OBJECT (text->model),
- text->model_repos_signal_id);
+ g_signal_handler_disconnect (text->model,
+ text->model_repos_signal_id);
- gtk_object_unref (GTK_OBJECT (text->model));
- text->model = E_TEXT_MODEL (GTK_VALUE_OBJECT (*arg));
- gtk_object_ref (GTK_OBJECT (text->model));
+ g_object_unref (text->model);
+ text->model = E_TEXT_MODEL (g_value_get_object (value));
+ g_object_ref (text->model);
text->model_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "changed",
- GTK_SIGNAL_FUNC (e_text_text_model_changed),
- text);
+ g_signal_connect (text->model,
+ "changed",
+ G_CALLBACK (e_text_text_model_changed),
+ text);
text->model_repos_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "reposition",
- GTK_SIGNAL_FUNC (e_text_text_model_reposition),
- text);
+ g_signal_connect (text->model,
+ "reposition",
+ G_CALLBACK (e_text_text_model_reposition),
+ text);
e_text_free_lines(text);
text->text = e_text_model_get_text(text->model);
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_CHANGED]);
+ g_signal_emit (text, e_text_signals[E_TEXT_CHANGED], 0);
text->needs_split_into_lines = 1;
needs_reflow = 1;
break;
- case ARG_EVENT_PROCESSOR:
+ case PROP_EVENT_PROCESSOR:
if ( text->tep && text->tep_command_id )
- gtk_signal_disconnect(GTK_OBJECT(text->tep),
- text->tep_command_id);
+ g_signal_handler_disconnect(text->tep,
+ text->tep_command_id);
if ( text->tep ) {
- gtk_object_unref(GTK_OBJECT(text->tep));
+ g_object_unref(text->tep);
}
- text->tep = E_TEXT_EVENT_PROCESSOR(GTK_VALUE_OBJECT (*arg));
- gtk_object_ref(GTK_OBJECT(text->tep));
+ text->tep = E_TEXT_EVENT_PROCESSOR(g_value_get_object (value));
+ g_object_ref(text->tep);
text->tep_command_id =
- gtk_signal_connect(GTK_OBJECT(text->tep),
- "command",
- GTK_SIGNAL_FUNC(e_text_command),
- text);
+ g_signal_connect (text->tep,
+ "command",
+ G_CALLBACK(e_text_command),
+ text);
if (!text->allow_newlines)
- gtk_object_set (GTK_OBJECT (text->tep),
- "allow_newlines", FALSE,
- NULL);
+ g_object_set (text->tep,
+ "allow_newlines", FALSE,
+ NULL);
break;
- case ARG_TEXT:
- e_text_model_set_text(text->model, GTK_VALUE_STRING (*arg));
+ case PROP_TEXT:
+ e_text_model_set_text(text->model, g_value_get_string (value));
break;
- case ARG_FONT:
+ case PROP_FONT:
if (text->font)
e_font_unref (text->font);
- text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
+ text->font = e_font_from_gdk_name (g_value_get_string (value));
calc_ellipsis (text);
if ( text->line_wrap )
@@ -936,11 +941,11 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_FONTSET:
+ case PROP_FONTSET:
if (text->font)
e_font_unref (text->font);
- text->font = e_font_from_gdk_name (GTK_VALUE_STRING (*arg));
+ text->font = e_font_from_gdk_name (g_value_get_string (value));
calc_ellipsis (text);
if ( text->line_wrap )
@@ -952,14 +957,14 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_FONT_GDK:
+ case PROP_FONT_GDK:
/* Ref the font in case it was the font that is stored
in the e-font */
- gdk_font_ref (GTK_VALUE_POINTER (*arg));
+ gdk_font_ref (g_value_get_boxed (value));
if (text->font)
e_font_unref (text->font);
- text->font = e_font_from_gdk_font (GTK_VALUE_POINTER (*arg));
+ text->font = e_font_from_gdk_font (g_value_get_boxed (value));
calc_ellipsis (text);
if ( text->line_wrap )
@@ -971,11 +976,11 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_FONT_E:
+ case PROP_FONT_E:
if (text->font)
e_font_unref (text->font);
- text->font = GTK_VALUE_POINTER (*arg);
+ text->font = g_value_get_pointer (value);
e_font_ref (text->font);
calc_ellipsis (text);
@@ -988,8 +993,8 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_BOLD:
- text->bold = GTK_VALUE_BOOL (*arg);
+ case PROP_BOLD:
+ text->bold = g_value_get_boolean (value);
text->style = text->bold ? E_FONT_BOLD : E_FONT_PLAIN;
text->needs_redraw = 1;
@@ -1004,26 +1009,26 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_STRIKEOUT:
- text->strikeout = GTK_VALUE_BOOL (*arg);
+ case PROP_STRIKEOUT:
+ text->strikeout = g_value_get_boolean (value);
text->needs_redraw = 1;
needs_update = 1;
break;
- case ARG_ANCHOR:
- text->anchor = GTK_VALUE_INT (*arg);
+ case PROP_ANCHOR:
+ text->anchor = g_value_get_enum (value);
text->needs_recalc_bounds = 1;
needs_update = 1;
break;
- case ARG_JUSTIFICATION:
- text->justification = GTK_VALUE_INT (*arg);
+ case PROP_JUSTIFICATION:
+ text->justification = g_value_get_enum (value);
text->needs_redraw = 1;
needs_update = 1;
break;
- case ARG_CLIP_WIDTH:
- text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg));
+ case PROP_CLIP_WIDTH:
+ text->clip_width = fabs (g_value_get_double (value));
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
@@ -1034,14 +1039,14 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_CLIP_HEIGHT:
- text->clip_height = fabs (GTK_VALUE_DOUBLE (*arg));
+ case PROP_CLIP_HEIGHT:
+ text->clip_height = fabs (g_value_get_double (value));
text->needs_recalc_bounds = 1;
needs_reflow = 1;
break;
- case ARG_CLIP:
- text->clip = GTK_VALUE_BOOL (*arg);
+ case PROP_CLIP:
+ text->clip = g_value_get_boolean (value);
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
@@ -1052,26 +1057,26 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_FILL_CLIP_RECTANGLE:
- text->fill_clip_rectangle = GTK_VALUE_BOOL (*arg);
+ case PROP_FILL_CLIP_RECTANGLE:
+ text->fill_clip_rectangle = g_value_get_boolean (value);
needs_update = 1;
break;
- case ARG_X_OFFSET:
- text->xofs = GTK_VALUE_DOUBLE (*arg);
+ case PROP_X_OFFSET:
+ text->xofs = g_value_get_double (value);
text->needs_recalc_bounds = 1;
needs_update = 1;
break;
- case ARG_Y_OFFSET:
- text->yofs = GTK_VALUE_DOUBLE (*arg);
+ case PROP_Y_OFFSET:
+ text->yofs = g_value_get_double (value);
text->needs_recalc_bounds = 1;
needs_update = 1;
break;
- case ARG_FILL_COLOR:
- if (GTK_VALUE_STRING (*arg))
- gdk_color_parse (GTK_VALUE_STRING (*arg), &color);
+ case PROP_FILL_COLOR:
+ if (g_value_get_string (value))
+ gdk_color_parse (g_value_get_string (value), &color);
text->rgba = ((color.red & 0xff00) << 16 |
(color.green & 0xff00) << 8 |
@@ -1080,8 +1085,8 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
color_changed = TRUE;
break;
- case ARG_FILL_COLOR_GDK:
- pcolor = GTK_VALUE_BOXED (*arg);
+ case PROP_FILL_COLOR_GDK:
+ pcolor = g_value_get_pointer (value);
if (pcolor) {
color = *pcolor;
}
@@ -1093,67 +1098,67 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
color_changed = TRUE;
break;
- case ARG_FILL_COLOR_RGBA:
- text->rgba = GTK_VALUE_UINT (*arg);
+ case PROP_FILL_COLOR_RGBA:
+ text->rgba = g_value_get_uint (value);
color.red = ((text->rgba >> 24) & 0xff) * 0x101;
color.green = ((text->rgba >> 16) & 0xff) * 0x101;
color.blue = ((text->rgba >> 8) & 0xff) * 0x101;
color_changed = TRUE;
break;
- case ARG_FILL_STIPPLE:
- set_stipple (text, GTK_VALUE_BOXED (*arg), FALSE);
+ case PROP_FILL_STIPPLE:
+ set_stipple (text, g_value_get_object (value), FALSE);
text->needs_redraw = 1;
needs_update = 1;
break;
- case ARG_EDITABLE:
- text->editable = GTK_VALUE_BOOL (*arg);
+ case PROP_EDITABLE:
+ text->editable = g_value_get_boolean (value);
text->needs_redraw = 1;
needs_update = 1;
break;
- case ARG_USE_ELLIPSIS:
- text->use_ellipsis = GTK_VALUE_BOOL (*arg);
+ case PROP_USE_ELLIPSIS:
+ text->use_ellipsis = g_value_get_boolean (value);
text->needs_calc_line_widths = 1;
needs_reflow = 1;
break;
- case ARG_ELLIPSIS:
+ case PROP_ELLIPSIS:
if (text->ellipsis)
g_free (text->ellipsis);
- text->ellipsis = g_strdup (GTK_VALUE_STRING (*arg));
+ text->ellipsis = g_strdup (g_value_get_string (value));
calc_ellipsis (text);
text->needs_calc_line_widths = 1;
needs_reflow = 1;
break;
- case ARG_LINE_WRAP:
- text->line_wrap = GTK_VALUE_BOOL (*arg);
+ case PROP_LINE_WRAP:
+ text->line_wrap = g_value_get_boolean (value);
text->needs_split_into_lines = 1;
needs_reflow = 1;
break;
- case ARG_BREAK_CHARACTERS:
+ case PROP_BREAK_CHARACTERS:
if ( text->break_characters ) {
g_free(text->break_characters);
text->break_characters = NULL;
}
- if ( GTK_VALUE_STRING (*arg) )
- text->break_characters = g_strdup( GTK_VALUE_STRING (*arg) );
+ if ( g_value_get_string (value) )
+ text->break_characters = g_strdup( g_value_get_string (value) );
text->needs_split_into_lines = 1;
needs_reflow = 1;
break;
- case ARG_MAX_LINES:
- text->max_lines = GTK_VALUE_INT (*arg);
+ case PROP_MAX_LINES:
+ text->max_lines = g_value_get_int (value);
text->needs_split_into_lines = 1;
needs_reflow = 1;
break;
- case ARG_WIDTH:
- text->clip_width = fabs (GTK_VALUE_DOUBLE (*arg));
+ case PROP_WIDTH:
+ text->clip_width = fabs (g_value_get_double (value));
calc_ellipsis (text);
if ( text->line_wrap )
text->needs_split_into_lines = 1;
@@ -1164,9 +1169,9 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
needs_reflow = 1;
break;
- case ARG_DRAW_BORDERS:
- if (text->draw_borders != GTK_VALUE_BOOL (*arg)) {
- text->draw_borders = GTK_VALUE_BOOL (*arg);
+ case PROP_DRAW_BORDERS:
+ if (text->draw_borders != g_value_get_boolean (value)) {
+ text->draw_borders = g_value_get_boolean (value);
text->needs_calc_height = 1;
text->needs_redraw = 1;
needs_reflow = 1;
@@ -1174,34 +1179,34 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
}
break;
- case ARG_DRAW_BACKGROUND:
- if (text->draw_background != GTK_VALUE_BOOL (*arg)){
- text->draw_background = GTK_VALUE_BOOL (*arg);
+ case PROP_DRAW_BACKGROUND:
+ if (text->draw_background != g_value_get_boolean (value)) {
+ text->draw_background = g_value_get_boolean (value);
text->needs_redraw = 1;
}
break;
- case ARG_DRAW_BUTTON:
- if (text->draw_button != GTK_VALUE_BOOL (*arg)){
- text->draw_button = GTK_VALUE_BOOL (*arg);
+ case PROP_DRAW_BUTTON:
+ if (text->draw_button != g_value_get_boolean (value)) {
+ text->draw_button = g_value_get_boolean (value);
text->needs_redraw = 1;
}
break;
- case ARG_ALLOW_NEWLINES:
- text->allow_newlines = GTK_VALUE_BOOL (*arg);
+ case PROP_ALLOW_NEWLINES:
+ text->allow_newlines = g_value_get_boolean (value);
_get_tep(text);
- gtk_object_set (GTK_OBJECT (text->tep),
- "allow_newlines", GTK_VALUE_BOOL (*arg),
- NULL);
+ g_object_set (text->tep,
+ "allow_newlines", g_value_get_boolean (value),
+ NULL);
break;
- case ARG_CURSOR_POS: {
+ case PROP_CURSOR_POS: {
ETextEventProcessorCommand command;
command.action = E_TEP_MOVE;
command.position = E_TEP_VALUE;
- command.value = GTK_VALUE_INT (*arg);
+ command.value = g_value_get_int (value);
command.time = GDK_CURRENT_TIME;
e_text_command (text->tep, &command, text);
break;
@@ -1237,144 +1242,147 @@ e_text_set_arg (GtkObject *object, GtkArg *arg, guint arg_id)
/* Get_arg handler for the text item */
static void
-e_text_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
+e_text_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
{
EText *text;
text = E_TEXT (object);
- switch (arg_id) {
- case ARG_MODEL:
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->model);
+ switch (prop_id) {
+ case PROP_MODEL:
+ g_value_set_object (value, text->model);
break;
- case ARG_EVENT_PROCESSOR:
+ case PROP_EVENT_PROCESSOR:
_get_tep(text);
- GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(text->tep);
+ g_value_set_object (value, text->tep);
break;
- case ARG_TEXT:
- GTK_VALUE_STRING (*arg) = g_strdup (text->text);
+ case PROP_TEXT:
+ g_value_set_string (value, g_strdup (text->text));
break;
- case ARG_FONT_E:
- GTK_VALUE_BOXED (*arg) = text->font;
+ case PROP_FONT_E:
+ g_value_set_pointer (value, text->font);
break;
- case ARG_BOLD:
- GTK_VALUE_BOOL (*arg) = text->bold;
+ case PROP_BOLD:
+ g_value_set_boolean (value, text->bold);
break;
- case ARG_STRIKEOUT:
- GTK_VALUE_BOOL (*arg) = text->strikeout;
+ case PROP_STRIKEOUT:
+ g_value_set_boolean (value, text->strikeout);
break;
- case ARG_ANCHOR:
- GTK_VALUE_INT (*arg) = text->anchor;
+ case PROP_ANCHOR:
+ g_value_set_enum (value, text->anchor);
break;
- case ARG_JUSTIFICATION:
- GTK_VALUE_INT (*arg) = text->justification;
+ case PROP_JUSTIFICATION:
+ g_value_set_enum (value, text->justification);
break;
- case ARG_CLIP_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = text->clip_width;
+ case PROP_CLIP_WIDTH:
+ g_value_set_double (value, text->clip_width);
break;
- case ARG_CLIP_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = text->clip_height;
+ case PROP_CLIP_HEIGHT:
+ g_value_set_double (value, text->clip_height);
break;
- case ARG_CLIP:
- GTK_VALUE_BOOL (*arg) = text->clip;
+ case PROP_CLIP:
+ g_value_set_boolean (value, text->clip);
break;
- case ARG_FILL_CLIP_RECTANGLE:
- GTK_VALUE_BOOL (*arg) = text->fill_clip_rectangle;
+ case PROP_FILL_CLIP_RECTANGLE:
+ g_value_set_boolean (value, text->fill_clip_rectangle);
break;
- case ARG_X_OFFSET:
- GTK_VALUE_DOUBLE (*arg) = text->xofs;
+ case PROP_X_OFFSET:
+ g_value_set_double (value, text->xofs);
break;
- case ARG_Y_OFFSET:
- GTK_VALUE_DOUBLE (*arg) = text->yofs;
+ case PROP_Y_OFFSET:
+ g_value_set_double (value, text->yofs);
break;
- case ARG_FILL_COLOR_GDK:
- GTK_VALUE_BOXED (*arg) = gdk_color_copy (&text->color);
+ case PROP_FILL_COLOR_GDK:
+ g_value_set_pointer (value, gdk_color_copy (&text->color));
break;
- case ARG_FILL_COLOR_RGBA:
- GTK_VALUE_UINT (*arg) = text->rgba;
+ case PROP_FILL_COLOR_RGBA:
+ g_value_set_uint (value, text->rgba);
break;
- case ARG_FILL_STIPPLE:
- GTK_VALUE_BOXED (*arg) = text->stipple;
+ case PROP_FILL_STIPPLE:
+ g_value_set_object (value, text->stipple);
break;
- case ARG_TEXT_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = text->max_width / text->item.canvas->pixels_per_unit;
+ case PROP_TEXT_WIDTH:
+ g_value_set_double (value, text->max_width / text->item.canvas->pixels_per_unit);
break;
- case ARG_TEXT_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = text->height / text->item.canvas->pixels_per_unit;
+ case PROP_TEXT_HEIGHT:
+ g_value_set_double (value, text->height / text->item.canvas->pixels_per_unit);
break;
- case ARG_EDITABLE:
- GTK_VALUE_BOOL (*arg) = text->editable;
+ case PROP_EDITABLE:
+ g_value_set_boolean (value, text->editable);
break;
- case ARG_USE_ELLIPSIS:
- GTK_VALUE_BOOL (*arg) = text->use_ellipsis;
+ case PROP_USE_ELLIPSIS:
+ g_value_set_boolean (value, text->use_ellipsis);
break;
- case ARG_ELLIPSIS:
- GTK_VALUE_STRING (*arg) = g_strdup (text->ellipsis);
+ case PROP_ELLIPSIS:
+ g_value_set_string (value, g_strdup (text->ellipsis));
break;
- case ARG_LINE_WRAP:
- GTK_VALUE_BOOL (*arg) = text->line_wrap;
+ case PROP_LINE_WRAP:
+ g_value_set_boolean (value, text->line_wrap);
break;
- case ARG_BREAK_CHARACTERS:
- GTK_VALUE_STRING (*arg) = g_strdup (text->break_characters);
+ case PROP_BREAK_CHARACTERS:
+ g_value_set_string (value, g_strdup (text->break_characters));
break;
- case ARG_MAX_LINES:
- GTK_VALUE_INT (*arg) = text->max_lines;
+ case PROP_MAX_LINES:
+ g_value_set_int (value, text->max_lines);
break;
- case ARG_WIDTH:
- GTK_VALUE_DOUBLE (*arg) = text->clip_width;
+ case PROP_WIDTH:
+ g_value_set_double (value, text->clip_width);
break;
- case ARG_HEIGHT:
- GTK_VALUE_DOUBLE (*arg) = text->clip && text->clip_height != -1 ? text->clip_height : text->height / text->item.canvas->pixels_per_unit;
+ case PROP_HEIGHT:
+ g_value_set_double (value, text->clip && text->clip_height != -1 ? text->clip_height : text->height / text->item.canvas->pixels_per_unit);
break;
- case ARG_DRAW_BORDERS:
- GTK_VALUE_BOOL (*arg) = text->draw_borders;
+ case PROP_DRAW_BORDERS:
+ g_value_set_boolean (value, text->draw_borders);
break;
- case ARG_DRAW_BACKGROUND:
- GTK_VALUE_BOOL (*arg) = text->draw_background;
+ case PROP_DRAW_BACKGROUND:
+ g_value_set_boolean (value, text->draw_background);
break;
- case ARG_DRAW_BUTTON:
- GTK_VALUE_BOOL (*arg) = text->draw_button;
+ case PROP_DRAW_BUTTON:
+ g_value_set_boolean (value, text->draw_button);
break;
- case ARG_ALLOW_NEWLINES:
- GTK_VALUE_BOOL (*arg) = text->allow_newlines;
+ case PROP_ALLOW_NEWLINES:
+ g_value_set_boolean (value, text->allow_newlines);
break;
- case ARG_CURSOR_POS:
- GTK_VALUE_INT (*arg) = text->selection_start;
+ case PROP_CURSOR_POS:
+ g_value_set_int (value, text->selection_start);
break;
default:
- arg->type = GTK_TYPE_INVALID;
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
}
}
@@ -1671,13 +1679,13 @@ _get_tep(EText *text)
{
if (!text->tep) {
text->tep = e_text_event_processor_emacs_like_new();
- gtk_object_ref (GTK_OBJECT (text->tep));
+ g_object_ref (text->tep);
gtk_object_sink (GTK_OBJECT (text->tep));
text->tep_command_id =
- gtk_signal_connect(GTK_OBJECT(text->tep),
- "command",
- GTK_SIGNAL_FUNC(e_text_command),
- (gpointer) text);
+ g_signal_connect (text->tep,
+ "command",
+ G_CALLBACK(e_text_command),
+ (gpointer) text);
}
}
@@ -1715,10 +1723,10 @@ e_text_draw (GnomeCanvasItem *item, GdkDrawable *drawable,
gdouble thiswidth, thisheight;
GtkWidget *widget = GTK_WIDGET(item->canvas);
- gtk_object_get(GTK_OBJECT(text),
- "width", &thiswidth,
- "height", &thisheight,
- NULL);
+ g_object_get(text,
+ "width", &thiswidth,
+ "height", &thisheight,
+ NULL);
if (text->draw_borders){
@@ -2530,8 +2538,8 @@ tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text)
e_canvas_hide_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas));
}
/* Forward events to the text item */
- gtk_signal_emit_by_name (GTK_OBJECT (text), "event", event,
- &ret_val);
+ g_signal_emit_by_name (text, "event", event,
+ &ret_val);
if (!ret_val)
gtk_propagate_event (GTK_WIDGET(GNOME_CANVAS_ITEM(text)->canvas), event);
ret_val = TRUE;
@@ -2542,10 +2550,11 @@ tooltip_event(GtkWidget *tooltip, GdkEvent *event, EText *text)
}
static void
-tooltip_destroy(GtkWidget *tooltip, EText *text)
+tooltip_destroy(gpointer data, GObject *where_object_was)
{
+ EText *text = data;
text->tooltip_owner = FALSE;
- gtk_object_unref (GTK_OBJECT (text));
+ g_object_unref (text);
}
static gboolean
@@ -2723,11 +2732,11 @@ _do_tooltip (gpointer data)
(double)tooltip_height + (text->draw_borders ? BORDER_INDENT * 2 : 0));
gtk_widget_show (canvas);
gtk_widget_realize (tooltip_window);
- gtk_signal_connect (GTK_OBJECT(tooltip_window), "event",
- GTK_SIGNAL_FUNC(tooltip_event), text);
- gtk_signal_connect (GTK_OBJECT(tooltip_window), "destroy",
- GTK_SIGNAL_FUNC(tooltip_destroy), text);
- gtk_object_ref (GTK_OBJECT (text));
+ g_signal_connect (tooltip_window, "event",
+ G_CALLBACK(tooltip_event), text);
+ g_object_weak_ref (G_OBJECT (tooltip_window),
+ tooltip_destroy, text);
+ g_object_ref (text);
e_canvas_popup_tooltip (E_CANVAS(GNOME_CANVAS_ITEM(text)->canvas),
tooltip_window,
@@ -2861,8 +2870,8 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
ret = e_text_event_processor_handle_event (text->tep, &e_tep_event);
if (event->type == GDK_KEY_PRESS)
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_KEYPRESS],
- e_tep_event.key.keyval, e_tep_event.key.state);
+ g_signal_emit (text, e_text_signals[E_TEXT_KEYPRESS], 0,
+ e_tep_event.key.keyval, e_tep_event.key.state);
if (e_tep_event.key.string)
@@ -2912,10 +2921,10 @@ e_text_event (GnomeCanvasItem *item, GdkEvent *event)
/* We follow convention and emit popup events on right-clicks. */
if (event->type == GDK_BUTTON_PRESS && event->button.button == 3) {
- gtk_signal_emit (GTK_OBJECT (text),
- e_text_signals[E_TEXT_POPUP],
- &(event->button),
- _get_position_from_xy (text, event->button.x, event->button.y));
+ g_signal_emit (text,
+ e_text_signals[E_TEXT_POPUP], 0,
+ &(event->button),
+ _get_position_from_xy (text, event->button.x, event->button.y));
break;
}
@@ -3444,7 +3453,7 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
e_text_get_selection (text, GDK_SELECTION_PRIMARY, command->time);
break;
case E_TEP_ACTIVATE:
- gtk_signal_emit (GTK_OBJECT (text), e_text_signals[E_TEXT_ACTIVATE]);
+ g_signal_emit (text, e_text_signals[E_TEXT_ACTIVATE], 0);
if (text->timer) {
g_timer_reset(text->timer);
}
@@ -3530,9 +3539,9 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp
}
static void
-_invisible_destroy (GtkInvisible *invisible,
- EText *text)
+_invisible_destroy (gpointer data, GObject *where_object_was)
{
+ EText *text = data;
text->invisible = NULL;
}
@@ -3562,19 +3571,18 @@ e_text_get_invisible(EText *text)
clipboard_atom,
targets, n_targets);
- gtk_signal_connect (GTK_OBJECT(invisible), "selection_get",
- GTK_SIGNAL_FUNC (_selection_get),
- text);
- gtk_signal_connect (GTK_OBJECT(invisible), "selection_clear_event",
- GTK_SIGNAL_FUNC (_selection_clear_event),
- text);
- gtk_signal_connect (GTK_OBJECT(invisible), "selection_received",
- GTK_SIGNAL_FUNC (_selection_received),
- text);
+ g_signal_connect (invisible, "selection_get",
+ G_CALLBACK (_selection_get),
+ text);
+ g_signal_connect (invisible, "selection_clear_event",
+ G_CALLBACK (_selection_clear_event),
+ text);
+ g_signal_connect (invisible, "selection_received",
+ G_CALLBACK (_selection_received),
+ text);
- gtk_signal_connect (GTK_OBJECT(invisible), "destroy",
- GTK_SIGNAL_FUNC (_invisible_destroy),
- text);
+ g_object_weak_ref (G_OBJECT (invisible),
+ _invisible_destroy, text);
}
return invisible;
}
@@ -3968,133 +3976,20 @@ e_suck_font_free (ETextSuckFont *suckfont)
static void
e_text_class_init (ETextClass *klass)
{
- GtkObjectClass *object_class;
+ GObjectClass *object_class;
GnomeCanvasItemClass *item_class;
- object_class = (GtkObjectClass *) klass;
+ object_class = (GObjectClass *) klass;
item_class = (GnomeCanvasItemClass *) klass;
- parent_class = gtk_type_class (gnome_canvas_item_get_type ());
-
- e_text_signals[E_TEXT_CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_text_signals[E_TEXT_ACTIVATE] =
- gtk_signal_new ("activate",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, activate),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- e_text_signals[E_TEXT_KEYPRESS] =
- gtk_signal_new ("keypress",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, keypress),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_UINT, GTK_TYPE_UINT);
-
- e_text_signals[E_TEXT_POPUP] =
- gtk_signal_new ("popup",
- GTK_RUN_LAST,
- E_OBJECT_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (ETextClass, popup),
- e_marshal_NONE__POINTER_INT,
- GTK_TYPE_NONE, 2, GTK_TYPE_POINTER, GTK_TYPE_INT);
-
- E_OBJECT_CLASS_ADD_SIGNALS (object_class, e_text_signals, E_TEXT_LAST_SIGNAL);
-
-
- gtk_object_add_arg_type ("EText::model",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_MODEL);
- gtk_object_add_arg_type ("EText::event_processor",
- GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_EVENT_PROCESSOR);
- gtk_object_add_arg_type ("EText::text",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_TEXT);
- gtk_object_add_arg_type ("EText::font",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONT);
- gtk_object_add_arg_type ("EText::fontset",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FONTSET);
- gtk_object_add_arg_type ("EText::font_gdk",
- GDK_TYPE_FONT, GTK_ARG_WRITABLE, ARG_FONT_GDK);
- gtk_object_add_arg_type ("EText::font_e",
- GTK_TYPE_POINTER, GTK_ARG_READWRITE, ARG_FONT_E);
- gtk_object_add_arg_type ("EText::bold",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_BOLD);
- gtk_object_add_arg_type ("EText::strikeout",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_STRIKEOUT);
- gtk_object_add_arg_type ("EText::anchor",
- GTK_TYPE_ANCHOR_TYPE, GTK_ARG_READWRITE, ARG_ANCHOR);
- gtk_object_add_arg_type ("EText::justification",
- GTK_TYPE_JUSTIFICATION, GTK_ARG_READWRITE, ARG_JUSTIFICATION);
- gtk_object_add_arg_type ("EText::clip_width",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_WIDTH);
- gtk_object_add_arg_type ("EText::clip_height",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_CLIP_HEIGHT);
- gtk_object_add_arg_type ("EText::clip",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_CLIP);
- gtk_object_add_arg_type ("EText::fill_clip_rectangle",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_FILL_CLIP_RECTANGLE);
- gtk_object_add_arg_type ("EText::x_offset",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_X_OFFSET);
- gtk_object_add_arg_type ("EText::y_offset",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_Y_OFFSET);
- gtk_object_add_arg_type ("EText::fill_color",
- GTK_TYPE_STRING, GTK_ARG_WRITABLE, ARG_FILL_COLOR);
- gtk_object_add_arg_type ("EText::fill_color_gdk",
- GDK_TYPE_COLOR, GTK_ARG_READWRITE, ARG_FILL_COLOR_GDK);
- gtk_object_add_arg_type ("EText::fill_color_rgba",
- GTK_TYPE_UINT, GTK_ARG_READWRITE, ARG_FILL_COLOR_RGBA);
- gtk_object_add_arg_type ("EText::fill_stipple",
- GDK_TYPE_WINDOW, GTK_ARG_READWRITE, ARG_FILL_STIPPLE);
- gtk_object_add_arg_type ("EText::text_width",
- GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_WIDTH);
- gtk_object_add_arg_type ("EText::text_height",
- GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_TEXT_HEIGHT);
- gtk_object_add_arg_type ("EText::editable",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_EDITABLE);
- gtk_object_add_arg_type ("EText::use_ellipsis",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_USE_ELLIPSIS);
- gtk_object_add_arg_type ("EText::ellipsis",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_ELLIPSIS);
- gtk_object_add_arg_type ("EText::line_wrap",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_LINE_WRAP);
- gtk_object_add_arg_type ("EText::break_characters",
- GTK_TYPE_STRING, GTK_ARG_READWRITE, ARG_BREAK_CHARACTERS);
- gtk_object_add_arg_type ("EText::max_lines",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_MAX_LINES);
- gtk_object_add_arg_type ("EText::width",
- GTK_TYPE_DOUBLE, GTK_ARG_READWRITE, ARG_WIDTH);
- gtk_object_add_arg_type ("EText::height",
- GTK_TYPE_DOUBLE, GTK_ARG_READABLE, ARG_HEIGHT);
- gtk_object_add_arg_type ("EText::draw_borders",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BORDERS);
- gtk_object_add_arg_type ("EText::allow_newlines",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_ALLOW_NEWLINES);
- gtk_object_add_arg_type ("EText::draw_background",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BACKGROUND);
- gtk_object_add_arg_type ("EText::draw_button",
- GTK_TYPE_BOOL, GTK_ARG_READWRITE, ARG_DRAW_BUTTON);
- gtk_object_add_arg_type ("EText::cursor_pos",
- GTK_TYPE_INT, GTK_ARG_READWRITE, ARG_CURSOR_POS);
-
- if (!clipboard_atom)
- clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
-
-
+ parent_class = g_type_class_ref (PARENT_TYPE);
klass->changed = NULL;
klass->activate = NULL;
- object_class->destroy = e_text_destroy;
- object_class->set_arg = e_text_set_arg;
- object_class->get_arg = e_text_get_arg;
+ object_class->dispose = e_text_dispose;
+ object_class->set_property = e_text_set_property;
+ object_class->get_property = e_text_get_property;
item_class->update = e_text_update;
item_class->realize = e_text_realize;
@@ -4104,6 +3999,300 @@ e_text_class_init (ETextClass *klass)
item_class->bounds = e_text_bounds;
item_class->render = e_text_render;
item_class->event = e_text_event;
+
+ e_text_signals[E_TEXT_CHANGED] =
+ g_signal_new ("changed",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextClass, changed),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
+
+ e_text_signals[E_TEXT_ACTIVATE] =
+ g_signal_new ("activate",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextClass, activate),
+ NULL, NULL,
+ e_marshal_NONE__NONE,
+ G_TYPE_NONE, 0);
+
+ e_text_signals[E_TEXT_KEYPRESS] =
+ g_signal_new ("keypress",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextClass, keypress),
+ NULL, NULL,
+ e_marshal_NONE__INT_INT,
+ G_TYPE_NONE, 2, G_TYPE_UINT, G_TYPE_UINT);
+
+ e_text_signals[E_TEXT_POPUP] =
+ g_signal_new ("popup",
+ G_OBJECT_CLASS_TYPE (object_class),
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (ETextClass, popup),
+ NULL, NULL,
+ e_marshal_NONE__POINTER_INT,
+ G_TYPE_NONE, 2, G_TYPE_POINTER, G_TYPE_INT);
+
+ g_object_class_install_property (object_class, PROP_MODEL,
+ g_param_spec_object ("model",
+ _( "Model" ),
+ _( "Model" ),
+ E_TYPE_TEXT_MODEL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_EVENT_PROCESSOR,
+ g_param_spec_object ("event_processor",
+ _( "Event Processor" ),
+ _( "Event Processor" ),
+ E_TEXT_EVENT_PROCESSOR_TYPE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_TEXT,
+ g_param_spec_string ("text",
+ _( "Text" ),
+ _( "Text" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FONT,
+ g_param_spec_string ("font",
+ _( "Font" ),
+ _( "Font" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FONTSET,
+ g_param_spec_string ("fontset",
+ _( "Fontset" ),
+ _( "Fontset" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FONT_GDK,
+ g_param_spec_boxed ("font_gdk",
+ _( "GDKFont" ),
+ _( "GDKFont" ),
+ GDK_TYPE_FONT,
+ G_PARAM_WRITABLE));
+
+ g_object_class_install_property (object_class, PROP_FONT_E,
+ g_param_spec_pointer ("font_e",
+ _( "EFont" ),
+ _( "EFont" ),
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_BOLD,
+ g_param_spec_boolean ("bold",
+ _( "Bold" ),
+ _( "Bold" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_STRIKEOUT,
+ g_param_spec_boolean ("strikeout",
+ _( "Strikeout" ),
+ _( "Strikeout" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_ANCHOR,
+ g_param_spec_enum ("anchor",
+ _( "Anchor" ),
+ _( "Anchor" ),
+ GTK_TYPE_ANCHOR_TYPE, GTK_ANCHOR_CENTER,
+ G_PARAM_READWRITE));
+
+
+ g_object_class_install_property (object_class, PROP_JUSTIFICATION,
+ g_param_spec_enum ("justification",
+ _( "Justification" ),
+ _( "Justification" ),
+ GTK_TYPE_JUSTIFICATION, GTK_JUSTIFY_LEFT,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_CLIP_WIDTH,
+ g_param_spec_double ("clip_width",
+ _( "Clip Width" ),
+ _( "Clip Width" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_CLIP_HEIGHT,
+ g_param_spec_double ("clip_height",
+ _( "Clip Height" ),
+ _( "Clip Height" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_CLIP,
+ g_param_spec_boolean ("clip",
+ _( "Clip" ),
+ _( "Clip" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_CLIP_RECTANGLE,
+ g_param_spec_boolean ("fill_clip_rectangle",
+ _( "Fill clip rectangle" ),
+ _( "Fill clip rectangle" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_X_OFFSET,
+ g_param_spec_double ("x_offset",
+ _( "X Offset" ),
+ _( "X Offset" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_Y_OFFSET,
+ g_param_spec_double ("y_offset",
+ _( "Y Offset" ),
+ _( "Y Offset" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_COLOR,
+ g_param_spec_string ("fill_color",
+ _( "Fill color" ),
+ _( "Fill color" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_COLOR_GDK,
+ g_param_spec_pointer ("fill_color_gdk",
+ _( "GDK fill color" ),
+ _( "GDK fill color" ),
+ G_PARAM_READWRITE));
+
+
+ g_object_class_install_property (object_class, PROP_FILL_COLOR_RGBA,
+ g_param_spec_uint ("fill_color_rgba",
+ _( "GDK fill color" ),
+ _( "GDK fill color" ),
+ 0, G_MAXUINT, 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_FILL_STIPPLE,
+ g_param_spec_object ("fill_stipple",
+ _( "Fill stipple" ),
+ _( "FIll stipple" ),
+ GDK_TYPE_WINDOW,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_TEXT_WIDTH,
+ g_param_spec_double ("text_width",
+ _( "Text width" ),
+ _( "Text width" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READABLE));
+
+ g_object_class_install_property (object_class, PROP_TEXT_HEIGHT,
+ g_param_spec_double ("text_height",
+ _( "Text height" ),
+ _( "Text height" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READABLE));
+
+
+ g_object_class_install_property (object_class, PROP_EDITABLE,
+ g_param_spec_boolean ("editable",
+ _( "Editable" ),
+ _( "Editable" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_USE_ELLIPSIS,
+ g_param_spec_boolean ("use_ellipsis",
+ _( "Use ellipsis" ),
+ _( "Use ellipsis" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_ELLIPSIS,
+ g_param_spec_string ("ellipsis",
+ _( "Ellipsis" ),
+ _( "Ellipsis" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_LINE_WRAP,
+ g_param_spec_boolean ("line_wrap",
+ _( "Line wrap" ),
+ _( "Line wrap" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_BREAK_CHARACTERS,
+ g_param_spec_string ("break_characters",
+ _( "Break characters" ),
+ _( "Break characters" ),
+ NULL,
+ G_PARAM_READWRITE));
+
+
+ g_object_class_install_property (object_class, PROP_MAX_LINES,
+ g_param_spec_int ("max_lines",
+ _( "Max lines" ),
+ _( "Max lines" ),
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_WIDTH,
+ g_param_spec_double ("width",
+ _( "Width" ),
+ _( "Width" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE));
+
+
+ g_object_class_install_property (object_class, PROP_HEIGHT,
+ g_param_spec_double ("height",
+ _( "Height" ),
+ _( "Height" ),
+ 0.0, G_MAXDOUBLE, 0.0,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_DRAW_BORDERS,
+ g_param_spec_boolean ("draw_borders",
+ _( "Draw borders" ),
+ _( "Draw borders" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_ALLOW_NEWLINES,
+ g_param_spec_boolean ("allow_newlines",
+ _( "Allow newlines" ),
+ _( "Allow newlines" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_DRAW_BACKGROUND,
+ g_param_spec_boolean ("draw_background",
+ _( "Draw background" ),
+ _( "Draw background" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_DRAW_BUTTON,
+ g_param_spec_boolean ("draw_button",
+ _( "Draw button" ),
+ _( "Draw button" ),
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class, PROP_CURSOR_POS,
+ g_param_spec_int ("cursor_pos",
+ _( "Cursor position" ),
+ _( "Cursor position" ),
+ 0, G_MAXINT, 0,
+ G_PARAM_READWRITE));
+
+ if (!clipboard_atom)
+ clipboard_atom = gdk_atom_intern ("CLIPBOARD", FALSE);
}
/* Object initialization function for the text item */
@@ -4115,19 +4304,19 @@ e_text_init (EText *text)
text->revert = NULL;
- gtk_object_ref (GTK_OBJECT (text->model));
+ g_object_ref (text->model);
gtk_object_sink (GTK_OBJECT (text->model));
text->model_changed_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "changed",
- GTK_SIGNAL_FUNC (e_text_text_model_changed),
- text);
+ g_signal_connect (text->model,
+ "changed",
+ G_CALLBACK (e_text_text_model_changed),
+ text);
text->model_repos_signal_id =
- gtk_signal_connect (GTK_OBJECT (text->model),
- "reposition",
- GTK_SIGNAL_FUNC (e_text_text_model_reposition),
- text);
+ g_signal_connect (text->model,
+ "reposition",
+ G_CALLBACK (e_text_text_model_reposition),
+ text);
text->anchor = GTK_ANCHOR_CENTER;
text->justification = GTK_JUSTIFY_LEFT;
@@ -4208,26 +4397,9 @@ e_text_init (EText *text)
*
* Return value: The type ID of the &EText class.
**/
-GtkType
-e_text_get_type (void)
-{
- static GtkType text_type = 0;
-
- if (!text_type) {
- GtkTypeInfo text_info = {
- "EText",
- sizeof (EText),
- sizeof (ETextClass),
- (GtkClassInitFunc) e_text_class_init,
- (GtkObjectInitFunc) e_text_init,
- NULL, /* reserved_1 */
- NULL, /* reserved_2 */
- (GtkClassInitFunc) NULL
- };
-
- text_type = gtk_type_unique (gnome_canvas_item_get_type (), &text_info);
- }
-
- return text_type;
-}
-
+E_MAKE_TYPE (e_text,
+ "EText",
+ EText,
+ e_text_class_init,
+ e_text_init,
+ PARENT_TYPE)
diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h
index 911edcd046..32d3e539b4 100644
--- a/widgets/text/e-text.h
+++ b/widgets/text/e-text.h
@@ -95,10 +95,10 @@ G_BEGIN_DECLS
*/
#define E_TYPE_TEXT (e_text_get_type ())
-#define E_TEXT(obj) (GTK_CHECK_CAST ((obj), E_TYPE_TEXT, EText))
-#define E_TEXT_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass))
-#define E_IS_TEXT(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_TEXT))
-#define E_IS_TEXT_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT))
+#define E_TEXT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), E_TYPE_TEXT, EText))
+#define E_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), E_TYPE_TEXT, ETextClass))
+#define E_IS_TEXT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_TYPE_TEXT))
+#define E_IS_TEXT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), E_TYPE_TEXT))
typedef struct _EText EText;