aboutsummaryrefslogtreecommitdiffstats
path: root/widgets/text
diff options
context:
space:
mode:
Diffstat (limited to 'widgets/text')
-rw-r--r--widgets/text/e-text-model.c50
-rw-r--r--widgets/text/e-text-model.h13
-rw-r--r--widgets/text/e-text.c2
3 files changed, 28 insertions, 37 deletions
diff --git a/widgets/text/e-text-model.c b/widgets/text/e-text-model.c
index b7287156f5..0233f14aa7 100644
--- a/widgets/text/e-text-model.c
+++ b/widgets/text/e-text-model.c
@@ -32,8 +32,6 @@
#include "e-text-model.h"
#include "gal/util/e-util.h"
-#define CLASS(obj) (E_TEXT_MODEL_CLASS (GTK_OBJECT_GET_CLASS (obj)))
-
#define MAX_LENGTH (2047)
enum {
@@ -63,8 +61,8 @@ 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;
+#define PARENT_TYPE G_TYPE_OBJECT
+static GObject *parent_class;
@@ -354,8 +352,8 @@ e_text_model_changed (ETextModel *model)
While this method could, in theory, do pretty much anything, it is meant
for scanning objects and converting substrings into embedded objects.
*/
- if (CLASS (model)->objectify)
- CLASS (model)->objectify (model);
+ if (E_TEXT_MODEL_GET_CLASS (model)->objectify)
+ E_TEXT_MODEL_GET_CLASS (model)->objectify (model);
g_signal_emit (model,
e_text_model_signals[E_TEXT_MODEL_CHANGED], 0);
@@ -387,8 +385,8 @@ e_text_model_validate_position (ETextModel *model, gint pos)
g_return_val_if_fail (model != NULL, 0);
g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
- if (CLASS (model)->validate_pos)
- pos = CLASS (model)->validate_pos (model, pos);
+ if (E_TEXT_MODEL_GET_CLASS (model)->validate_pos)
+ pos = E_TEXT_MODEL_GET_CLASS (model)->validate_pos (model, pos);
return pos;
}
@@ -399,8 +397,8 @@ e_text_model_get_text (ETextModel *model)
g_return_val_if_fail (model != NULL, NULL);
g_return_val_if_fail (E_IS_TEXT_MODEL (model), NULL);
- if (CLASS (model)->get_text)
- return CLASS (model)->get_text (model);
+ if (E_TEXT_MODEL_GET_CLASS (model)->get_text)
+ return E_TEXT_MODEL_GET_CLASS (model)->get_text (model);
return "";
}
@@ -411,9 +409,9 @@ e_text_model_get_text_length (ETextModel *model)
g_return_val_if_fail (model != NULL, 0);
g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
- if (CLASS (model)->get_text_len (model)) {
+ if (E_TEXT_MODEL_GET_CLASS (model)->get_text_len (model)) {
- gint len = CLASS (model)->get_text_len (model);
+ gint len = E_TEXT_MODEL_GET_CLASS (model)->get_text_len (model);
#ifdef PARANOID_DEBUGGING
const gchar *str = e_text_model_get_text (model);
@@ -437,8 +435,8 @@ e_text_model_set_text (ETextModel *model, const gchar *text)
g_return_if_fail (model != NULL);
g_return_if_fail (E_IS_TEXT_MODEL (model));
- if (CLASS (model)->set_text)
- CLASS (model)->set_text (model, text);
+ if (E_TEXT_MODEL_GET_CLASS (model)->set_text)
+ E_TEXT_MODEL_GET_CLASS (model)->set_text (model, text);
}
void
@@ -450,8 +448,8 @@ e_text_model_insert (ETextModel *model, gint position, const gchar *text)
if (text == NULL)
return;
- if (CLASS (model)->insert)
- CLASS (model)->insert (model, position, text);
+ if (E_TEXT_MODEL_GET_CLASS (model)->insert)
+ E_TEXT_MODEL_GET_CLASS (model)->insert (model, position, text);
}
void
@@ -465,8 +463,8 @@ e_text_model_insert_length (ETextModel *model, gint position, const gchar *text,
if (text == NULL || length == 0)
return;
- if (CLASS (model)->insert_length)
- CLASS (model)->insert_length (model, position, text, length);
+ if (E_TEXT_MODEL_GET_CLASS (model)->insert_length)
+ E_TEXT_MODEL_GET_CLASS (model)->insert_length (model, position, text, length);
}
void
@@ -509,8 +507,8 @@ e_text_model_delete (ETextModel *model, gint position, gint length)
if (length <= 0)
return;
- if (CLASS (model)->delete)
- CLASS (model)->delete (model, position, length);
+ if (E_TEXT_MODEL_GET_CLASS (model)->delete)
+ E_TEXT_MODEL_GET_CLASS (model)->delete (model, position, length);
}
gint
@@ -519,8 +517,8 @@ e_text_model_object_count (ETextModel *model)
g_return_val_if_fail (model != NULL, 0);
g_return_val_if_fail (E_IS_TEXT_MODEL (model), 0);
- if (CLASS (model)->obj_count)
- return CLASS (model)->obj_count (model);
+ if (E_TEXT_MODEL_GET_CLASS (model)->obj_count)
+ return E_TEXT_MODEL_GET_CLASS (model)->obj_count (model);
return 0;
}
@@ -534,8 +532,8 @@ e_text_model_get_nth_object (ETextModel *model, gint n, gint *len)
if (n < 0 || n >= e_text_model_object_count (model))
return NULL;
- if (CLASS (model)->get_nth_obj)
- return CLASS (model)->get_nth_obj (model, n, len);
+ if (E_TEXT_MODEL_GET_CLASS (model)->get_nth_obj)
+ return E_TEXT_MODEL_GET_CLASS (model)->get_nth_obj (model, n, len);
return NULL;
}
@@ -584,9 +582,9 @@ e_text_model_get_object_at_offset (ETextModel *model, gint offset)
return -1;
/* If an optimized version has been provided, we use it. */
- if (CLASS (model)->obj_at_offset) {
+ if (E_TEXT_MODEL_GET_CLASS (model)->obj_at_offset) {
- return CLASS (model)->obj_at_offset (model, offset);
+ return E_TEXT_MODEL_GET_CLASS (model)->obj_at_offset (model, offset);
} else {
/* If not, we fake it.*/
diff --git a/widgets/text/e-text-model.h b/widgets/text/e-text-model.h
index c79376d9d0..2e472ead44 100644
--- a/widgets/text/e-text-model.h
+++ b/widgets/text/e-text-model.h
@@ -34,6 +34,7 @@ G_BEGIN_DECLS
#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))
+#define E_TEXT_MODEL_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), E_TYPE_TEXT_MODEL_TYPE, ETextModelClass))
typedef struct _ETextModel ETextModel;
typedef struct _ETextModelClass ETextModelClass;
@@ -43,13 +44,13 @@ struct _ETextModelPrivate;
typedef gint (*ETextModelReposFn) (gint, gpointer);
struct _ETextModel {
- GtkObject item;
+ GObject item;
struct _ETextModelPrivate *priv;
};
struct _ETextModelClass {
- GtkObjectClass parent_class;
+ GObjectClass parent_class;
/* Signal */
void (* changed) (ETextModel *model);
@@ -74,7 +75,7 @@ struct _ETextModelClass {
gint (* obj_at_offset) (ETextModel *model, gint offset);
};
-GtkType e_text_model_get_type (void);
+GType e_text_model_get_type (void);
ETextModel *e_text_model_new (void);
@@ -107,12 +108,6 @@ gint e_text_model_get_object_at_offset (ETextModel *model, gint offset)
gint e_text_model_get_object_at_pointer (ETextModel *model, const gchar *c);
void e_text_model_activate_nth_object (ETextModel *model, gint n);
-
-
-
-
-
-
G_END_DECLS
#endif
diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c
index 237818f624..937812d0c6 100644
--- a/widgets/text/e-text.c
+++ b/widgets/text/e-text.c
@@ -1680,7 +1680,6 @@ _get_tep(EText *text)
if (!text->tep) {
text->tep = e_text_event_processor_emacs_like_new();
g_object_ref (text->tep);
- gtk_object_sink (GTK_OBJECT (text->tep));
text->tep_command_id =
g_signal_connect (text->tep,
"command",
@@ -4305,7 +4304,6 @@ e_text_init (EText *text)
text->revert = NULL;
g_object_ref (text->model);
- gtk_object_sink (GTK_OBJECT (text->model));
text->model_changed_signal_id =
g_signal_connect (text->model,