summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKristian Rietveld <kristian@planet.nl>2001-10-03 21:50:58 +0000
committerKristian Rietveld <kristian@src.gnome.org>2001-10-03 21:50:58 +0000
commit3c09d348d307f4dc61de16ef8163856ebc34022f (patch)
treecd2fc72b41f2d4a57109436b6ed7c2717bb2ea95
parent77dc57e96019d5badb9292e03edead804bc6d8ec (diff)
downloadgtk+-3c09d348d307f4dc61de16ef8163856ebc34022f.tar.gz
move insert_text and delete_text virtual functions to do_insert_text and
Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl> * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual functions to do_insert_text and do_delete_text, add signals insert_text, delete_text and changed * gtk/gtkentry.[ch]: remove signals insert_text, delete_text and changed. Updates to match new situation. * gtk/gtkspinbutton.c: updates to match new situation * gtk/gtkoldeditable.h: remove signals changed, insert_text and delete_text * gtk/gtkoldeditable.c: updates to match new situation * gtk/gtktext.c: updates to match new situation Fixes bug #59803
-rw-r--r--ChangeLog20
-rw-r--r--ChangeLog.pre-2-020
-rw-r--r--ChangeLog.pre-2-1020
-rw-r--r--ChangeLog.pre-2-220
-rw-r--r--ChangeLog.pre-2-420
-rw-r--r--ChangeLog.pre-2-620
-rw-r--r--ChangeLog.pre-2-820
-rw-r--r--gtk/gtkeditable.c48
-rw-r--r--gtk/gtkeditable.h13
-rw-r--r--gtk/gtkentry.c68
-rw-r--r--gtk/gtkentry.h11
-rw-r--r--gtk/gtkoldeditable.c56
-rw-r--r--gtk/gtkoldeditable.h10
-rw-r--r--gtk/gtkspinbutton.c31
-rw-r--r--gtk/gtktext.c32
15 files changed, 274 insertions, 135 deletions
diff --git a/ChangeLog b/ChangeLog
index 4e48578c54..afe3d37a83 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,23 @@
+Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
+
+ * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
+ functions to do_insert_text and do_delete_text, add signals
+ insert_text, delete_text and changed
+
+ * gtk/gtkentry.[ch]: remove signals insert_text, delete_text
+ and changed. Updates to match new situation.
+
+ * gtk/gtkspinbutton.c: updates to match new situation
+
+ * gtk/gtkoldeditable.h: remove signals changed, insert_text
+ and delete_text
+
+ * gtk/gtkoldeditable.c: updates to match new situation
+
+ * gtk/gtktext.c: updates to match new situation
+
+ Fixes bug #59803
+
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 4e48578c54..afe3d37a83 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,23 @@
+Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
+
+ * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
+ functions to do_insert_text and do_delete_text, add signals
+ insert_text, delete_text and changed
+
+ * gtk/gtkentry.[ch]: remove signals insert_text, delete_text
+ and changed. Updates to match new situation.
+
+ * gtk/gtkspinbutton.c: updates to match new situation
+
+ * gtk/gtkoldeditable.h: remove signals changed, insert_text
+ and delete_text
+
+ * gtk/gtkoldeditable.c: updates to match new situation
+
+ * gtk/gtktext.c: updates to match new situation
+
+ Fixes bug #59803
+
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 4e48578c54..afe3d37a83 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,23 @@
+Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
+
+ * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
+ functions to do_insert_text and do_delete_text, add signals
+ insert_text, delete_text and changed
+
+ * gtk/gtkentry.[ch]: remove signals insert_text, delete_text
+ and changed. Updates to match new situation.
+
+ * gtk/gtkspinbutton.c: updates to match new situation
+
+ * gtk/gtkoldeditable.h: remove signals changed, insert_text
+ and delete_text
+
+ * gtk/gtkoldeditable.c: updates to match new situation
+
+ * gtk/gtktext.c: updates to match new situation
+
+ Fixes bug #59803
+
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 4e48578c54..afe3d37a83 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,23 @@
+Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
+
+ * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
+ functions to do_insert_text and do_delete_text, add signals
+ insert_text, delete_text and changed
+
+ * gtk/gtkentry.[ch]: remove signals insert_text, delete_text
+ and changed. Updates to match new situation.
+
+ * gtk/gtkspinbutton.c: updates to match new situation
+
+ * gtk/gtkoldeditable.h: remove signals changed, insert_text
+ and delete_text
+
+ * gtk/gtkoldeditable.c: updates to match new situation
+
+ * gtk/gtktext.c: updates to match new situation
+
+ Fixes bug #59803
+
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 4e48578c54..afe3d37a83 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,23 @@
+Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
+
+ * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
+ functions to do_insert_text and do_delete_text, add signals
+ insert_text, delete_text and changed
+
+ * gtk/gtkentry.[ch]: remove signals insert_text, delete_text
+ and changed. Updates to match new situation.
+
+ * gtk/gtkspinbutton.c: updates to match new situation
+
+ * gtk/gtkoldeditable.h: remove signals changed, insert_text
+ and delete_text
+
+ * gtk/gtkoldeditable.c: updates to match new situation
+
+ * gtk/gtktext.c: updates to match new situation
+
+ Fixes bug #59803
+
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 4e48578c54..afe3d37a83 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,23 @@
+Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
+
+ * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
+ functions to do_insert_text and do_delete_text, add signals
+ insert_text, delete_text and changed
+
+ * gtk/gtkentry.[ch]: remove signals insert_text, delete_text
+ and changed. Updates to match new situation.
+
+ * gtk/gtkspinbutton.c: updates to match new situation
+
+ * gtk/gtkoldeditable.h: remove signals changed, insert_text
+ and delete_text
+
+ * gtk/gtkoldeditable.c: updates to match new situation
+
+ * gtk/gtktext.c: updates to match new situation
+
+ Fixes bug #59803
+
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 4e48578c54..afe3d37a83 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,23 @@
+Wed Oct 3 23:47:25 Kristian Rietveld <kristian@planet.nl>
+
+ * gtk/gtkeditable.[ch]: move insert_text and delete_text virtual
+ functions to do_insert_text and do_delete_text, add signals
+ insert_text, delete_text and changed
+
+ * gtk/gtkentry.[ch]: remove signals insert_text, delete_text
+ and changed. Updates to match new situation.
+
+ * gtk/gtkspinbutton.c: updates to match new situation
+
+ * gtk/gtkoldeditable.h: remove signals changed, insert_text
+ and delete_text
+
+ * gtk/gtkoldeditable.c: updates to match new situation
+
+ * gtk/gtktext.c: updates to match new situation
+
+ Fixes bug #59803
+
2001-10-03 Havoc Pennington <hp@redhat.com>
* gtk/gtktextiter.c (test_log_attrs): allow testing the end
diff --git a/gtk/gtkeditable.c b/gtk/gtkeditable.c
index d12e1d5183..8b41572e1c 100644
--- a/gtk/gtkeditable.c
+++ b/gtk/gtkeditable.c
@@ -29,6 +29,10 @@
#include "gtkeditable.h"
#include "gtksignal.h"
+
+static void gtk_editable_base_init (gpointer g_class);
+
+
GtkType
gtk_editable_get_type (void)
{
@@ -39,7 +43,7 @@ gtk_editable_get_type (void)
static const GTypeInfo editable_info =
{
sizeof (GtkEditableClass), /* class_size */
- NULL, /* base_init */
+ gtk_editable_base_init, /* base_init */
NULL, /* base_finalize */
};
@@ -49,6 +53,44 @@ gtk_editable_get_type (void)
return editable_type;
}
+static void
+gtk_editable_base_init (gpointer g_class)
+{
+ static gboolean initialized = FALSE;
+
+ if (! initialized)
+ {
+ g_signal_new ("insert_text",
+ GTK_TYPE_EDITABLE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkEditableClass, insert_text),
+ NULL, NULL,
+ gtk_marshal_VOID__STRING_INT_POINTER,
+ G_TYPE_NONE, 3,
+ GTK_TYPE_STRING,
+ GTK_TYPE_INT,
+ GTK_TYPE_POINTER);
+ g_signal_new ("delete_text",
+ GTK_TYPE_EDITABLE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkEditableClass, delete_text),
+ NULL, NULL,
+ gtk_marshal_VOID__INT_INT,
+ GTK_TYPE_NONE, 2,
+ GTK_TYPE_INT,
+ GTK_TYPE_INT);
+ g_signal_new ("changed",
+ GTK_TYPE_EDITABLE,
+ G_SIGNAL_RUN_LAST,
+ G_STRUCT_OFFSET (GtkEditableClass, changed),
+ NULL, NULL,
+ gtk_marshal_VOID__VOID,
+ GTK_TYPE_NONE, 0);
+
+ initialized = TRUE;
+ }
+}
+
void
gtk_editable_insert_text (GtkEditable *editable,
const gchar *new_text,
@@ -61,7 +103,7 @@ gtk_editable_insert_text (GtkEditable *editable,
if (new_text_length < 0)
new_text_length = strlen (new_text);
- GTK_EDITABLE_GET_CLASS (editable)->insert_text (editable, new_text, new_text_length, position);
+ GTK_EDITABLE_GET_CLASS (editable)->do_insert_text (editable, new_text, new_text_length, position);
}
void
@@ -71,7 +113,7 @@ gtk_editable_delete_text (GtkEditable *editable,
{
g_return_if_fail (GTK_IS_EDITABLE (editable));
- GTK_EDITABLE_GET_CLASS (editable)->delete_text (editable, start_pos, end_pos);
+ GTK_EDITABLE_GET_CLASS (editable)->do_delete_text (editable, start_pos, end_pos);
}
gchar *
diff --git a/gtk/gtkeditable.h b/gtk/gtkeditable.h
index 1411cf49c7..41615be943 100644
--- a/gtk/gtkeditable.h
+++ b/gtk/gtkeditable.h
@@ -50,7 +50,7 @@ struct _GtkEditableClass
{
GTypeInterface base_iface;
- /* Signals for notification/filtering of changes */
+ /* signals */
void (* insert_text) (GtkEditable *editable,
const gchar *text,
gint length,
@@ -58,6 +58,17 @@ struct _GtkEditableClass
void (* delete_text) (GtkEditable *editable,
gint start_pos,
gint end_pos);
+ void (* changed) (GtkEditable *editable);
+
+ /* vtable */
+ void (* do_insert_text) (GtkEditable *editable,
+ const gchar *text,
+ gint length,
+ gint *position);
+ void (* do_delete_text) (GtkEditable *editable,
+ gint start_pos,
+ gint end_pos);
+
gchar* (* get_chars) (GtkEditable *editable,
gint start_pos,
gint end_pos);
diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c
index 5e48c489af..6bd66e1222 100644
--- a/gtk/gtkentry.c
+++ b/gtk/gtkentry.c
@@ -56,9 +56,6 @@
#define MAX_SIZE G_MAXUSHORT
enum {
- INSERT_TEXT,
- DELETE_TEXT,
- CHANGED,
ACTIVATE,
POPULATE_POPUP,
MOVE_CURSOR,
@@ -203,11 +200,11 @@ static void gtk_entry_start_editing (GtkCellEditable *cell_editable,
/* Default signal handlers
*/
-static void gtk_entry_real_insert_text (GtkEntry *entry,
+static void gtk_entry_real_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position);
-static void gtk_entry_real_delete_text (GtkEntry *entry,
+static void gtk_entry_real_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos);
static void gtk_entry_move_cursor (GtkEntry *entry,
@@ -393,9 +390,7 @@ gtk_entry_class_init (GtkEntryClass *class)
widget_class->drag_data_delete = gtk_entry_drag_data_delete;
widget_class->popup_menu = gtk_entry_popup_menu;
-
- class->insert_text = gtk_entry_real_insert_text;
- class->delete_text = gtk_entry_real_delete_text;
+
class->move_cursor = gtk_entry_move_cursor;
class->insert_at_cursor = gtk_entry_insert_at_cursor;
class->delete_from_cursor = gtk_entry_delete_from_cursor;
@@ -492,37 +487,6 @@ gtk_entry_class_init (GtkEntryClass *class)
GDK_TYPE_COLOR,
G_PARAM_READABLE));
- signals[INSERT_TEXT] =
- gtk_signal_new ("insert_text",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkEntryClass, insert_text),
- gtk_marshal_VOID__STRING_INT_POINTER,
- GTK_TYPE_NONE,
- 3,
- GTK_TYPE_STRING,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER);
-
- signals[DELETE_TEXT] =
- gtk_signal_new ("delete_text",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkEntryClass, delete_text),
- gtk_marshal_VOID__INT_INT,
- GTK_TYPE_NONE,
- 2,
- GTK_TYPE_INT,
- GTK_TYPE_INT);
-
- signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkEntryClass, changed),
- gtk_marshal_VOID__VOID,
- GTK_TYPE_NONE, 0);
-
signals[POPULATE_POPUP] =
gtk_signal_new ("populate_popup",
GTK_RUN_LAST,
@@ -777,8 +741,10 @@ gtk_entry_class_init (GtkEntryClass *class)
static void
gtk_entry_editable_init (GtkEditableClass *iface)
{
- iface->insert_text = gtk_entry_insert_text;
- iface->delete_text = gtk_entry_delete_text;
+ iface->do_insert_text = gtk_entry_insert_text;
+ iface->do_delete_text = gtk_entry_delete_text;
+ iface->insert_text = gtk_entry_real_insert_text;
+ iface->delete_text = gtk_entry_real_delete_text;
iface->get_chars = gtk_entry_get_chars;
iface->set_selection_bounds = gtk_entry_set_selection_bounds;
iface->get_selection_bounds = gtk_entry_get_selection_bounds;
@@ -1688,8 +1654,8 @@ gtk_entry_insert_text (GtkEditable *editable,
text[new_text_length] = '\0';
strncpy (text, new_text, new_text_length);
- gtk_signal_emit (GTK_OBJECT (editable), signals[INSERT_TEXT], text, new_text_length, position);
- gtk_signal_emit (GTK_OBJECT (editable), signals[CHANGED]);
+ g_signal_emit_by_name (editable, "insert_text", text, new_text_length, position);
+ g_signal_emit_by_name (editable, "changed");
if (new_text_length > 63)
g_free (text);
@@ -1713,8 +1679,8 @@ gtk_entry_delete_text (GtkEditable *editable,
g_object_ref (G_OBJECT (editable));
- gtk_signal_emit (GTK_OBJECT (editable), signals[DELETE_TEXT], start_pos, end_pos);
- gtk_signal_emit (GTK_OBJECT (editable), signals[CHANGED]);
+ g_signal_emit_by_name (editable, "delete_text", start_pos, end_pos);
+ g_signal_emit_by_name (editable, "changed");
g_object_unref (G_OBJECT (editable));
}
@@ -1857,7 +1823,7 @@ gtk_entry_start_editing (GtkCellEditable *cell_editable,
/* Default signal handlers
*/
static void
-gtk_entry_real_insert_text (GtkEntry *entry,
+gtk_entry_real_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position)
@@ -1865,6 +1831,8 @@ gtk_entry_real_insert_text (GtkEntry *entry,
gint index;
gint n_chars;
+ GtkEntry *entry = GTK_ENTRY (editable);
+
if (new_text_length < 0)
new_text_length = strlen (new_text);
@@ -1922,10 +1890,12 @@ gtk_entry_real_insert_text (GtkEntry *entry,
}
static void
-gtk_entry_real_delete_text (GtkEntry *entry,
- gint start_pos,
- gint end_pos)
+gtk_entry_real_delete_text (GtkEditable *editable,
+ gint start_pos,
+ gint end_pos)
{
+ GtkEntry *entry = GTK_ENTRY (editable);
+
if (start_pos < 0)
start_pos = 0;
if (end_pos < 0 || end_pos > entry->text_length)
diff --git a/gtk/gtkentry.h b/gtk/gtkentry.h
index 90b7bf5b5a..c4c04efb89 100644
--- a/gtk/gtkentry.h
+++ b/gtk/gtkentry.h
@@ -115,17 +115,6 @@ struct _GtkEntry
struct _GtkEntryClass
{
GtkWidgetClass parent_class;
-
- /* Notification of changes
- */
- void (* changed) (GtkEntry *entry);
- void (* insert_text) (GtkEntry *entry,
- const gchar *text,
- gint length,
- gint *position);
- void (* delete_text) (GtkEntry *entry,
- gint start_pos,
- gint end_pos);
/* Hook to customize right-click popup */
void (* populate_popup) (GtkEntry *entry,
diff --git a/gtk/gtkoldeditable.c b/gtk/gtkoldeditable.c
index f048659392..827efddd0a 100644
--- a/gtk/gtkoldeditable.c
+++ b/gtk/gtkoldeditable.c
@@ -39,9 +39,6 @@
#define INNER_BORDER 2
enum {
- CHANGED,
- INSERT_TEXT,
- DELETE_TEXT,
/* Binding actions */
ACTIVATE,
SET_EDITABLE,
@@ -182,9 +179,6 @@ gtk_old_editable_class_init (GtkOldEditableClass *class)
widget_class->selection_received = gtk_old_editable_selection_received;
widget_class->selection_get = gtk_old_editable_selection_get;
- class->insert_text = NULL;
- class->delete_text = NULL;
-
class->activate = NULL;
class->set_editable = gtk_old_editable_real_set_editable;
@@ -207,37 +201,6 @@ gtk_old_editable_class_init (GtkOldEditableClass *class)
class->set_selection = NULL;
class->set_position = NULL;
- editable_signals[CHANGED] =
- gtk_signal_new ("changed",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkOldEditableClass, changed),
- gtk_marshal_NONE__NONE,
- GTK_TYPE_NONE, 0);
-
- editable_signals[INSERT_TEXT] =
- gtk_signal_new ("insert_text",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkOldEditableClass, insert_text),
- gtk_marshal_NONE__STRING_INT_POINTER,
- GTK_TYPE_NONE,
- 3,
- GTK_TYPE_STRING,
- GTK_TYPE_INT,
- GTK_TYPE_POINTER);
-
- editable_signals[DELETE_TEXT] =
- gtk_signal_new ("delete_text",
- GTK_RUN_LAST,
- GTK_CLASS_TYPE (object_class),
- GTK_SIGNAL_OFFSET (GtkOldEditableClass, delete_text),
- gtk_marshal_NONE__INT_INT,
- GTK_TYPE_NONE,
- 2,
- GTK_TYPE_INT,
- GTK_TYPE_INT);
-
editable_signals[ACTIVATE] =
gtk_signal_new ("activate",
GTK_RUN_LAST | GTK_RUN_ACTION,
@@ -361,8 +324,8 @@ gtk_old_editable_class_init (GtkOldEditableClass *class)
static void
gtk_old_editable_editable_init (GtkEditableClass *iface)
{
- iface->insert_text = gtk_old_editable_insert_text;
- iface->delete_text = gtk_old_editable_delete_text;
+ iface->do_insert_text = gtk_old_editable_insert_text;
+ iface->do_delete_text = gtk_old_editable_delete_text;
iface->get_chars = gtk_old_editable_get_chars;
iface->set_selection_bounds = gtk_old_editable_set_selection_bounds;
iface->get_selection_bounds = gtk_old_editable_get_selection_bounds;
@@ -455,10 +418,11 @@ gtk_old_editable_insert_text (GtkEditable *editable,
text[new_text_length] = '\0';
strncpy (text, new_text, new_text_length);
-
- gtk_signal_emit (GTK_OBJECT (editable), editable_signals[INSERT_TEXT], text, new_text_length, position);
- gtk_signal_emit (GTK_OBJECT (editable), editable_signals[CHANGED]);
-
+
+ g_signal_emit_by_name (editable, "insert_text", text, new_text_length,
+ position);
+ g_signal_emit_by_name (editable, "changed");
+
if (new_text_length > 63)
g_free (text);
@@ -474,8 +438,8 @@ gtk_old_editable_delete_text (GtkEditable *editable,
gtk_widget_ref (GTK_WIDGET (old_editable));
- gtk_signal_emit (GTK_OBJECT (old_editable), editable_signals[DELETE_TEXT], start_pos, end_pos);
- gtk_signal_emit (GTK_OBJECT (old_editable), editable_signals[CHANGED]);
+ g_signal_emit_by_name (editable, "delete_text", start_pos, end_pos);
+ g_signal_emit_by_name (editable, "changed");
if (old_editable->selection_start_pos == old_editable->selection_end_pos &&
old_editable->has_selection)
@@ -847,5 +811,5 @@ gtk_old_editable_changed (GtkOldEditable *old_editable)
{
g_return_if_fail (GTK_IS_OLD_EDITABLE (old_editable));
- gtk_signal_emit (GTK_OBJECT (old_editable), editable_signals[CHANGED]);
+ g_signal_emit_by_name (old_editable, "changed");
}
diff --git a/gtk/gtkoldeditable.h b/gtk/gtkoldeditable.h
index 896f1d8ec2..f0d181352b 100644
--- a/gtk/gtkoldeditable.h
+++ b/gtk/gtkoldeditable.h
@@ -74,16 +74,6 @@ struct _GtkOldEditableClass
{
GtkWidgetClass parent_class;
- /* Signals for notification/filtering of changes */
- void (* changed) (GtkOldEditable *editable);
- void (* insert_text) (GtkOldEditable *editable,
- const gchar *text,
- gint length,
- gint *position);
- void (* delete_text) (GtkOldEditable *editable,
- gint start_pos,
- gint end_pos);
-
/* Bindings actions */
void (* activate) (GtkOldEditable *editable);
void (* set_editable) (GtkOldEditable *editable,
diff --git a/gtk/gtkspinbutton.c b/gtk/gtkspinbutton.c
index df40ea5e5a..a767d88994 100644
--- a/gtk/gtkspinbutton.c
+++ b/gtk/gtkspinbutton.c
@@ -69,6 +69,7 @@ enum
};
static void gtk_spin_button_class_init (GtkSpinButtonClass *klass);
+static void gtk_spin_button_editable_init (GtkEditableClass *iface);
static void gtk_spin_button_init (GtkSpinButton *spin_button);
static void gtk_spin_button_finalize (GObject *object);
static void gtk_spin_button_set_property (GObject *object,
@@ -115,7 +116,7 @@ static gint gtk_spin_button_scroll (GtkWidget *widget,
static void gtk_spin_button_activate (GtkEntry *entry);
static void gtk_spin_button_snap (GtkSpinButton *spin_button,
gdouble val);
-static void gtk_spin_button_insert_text (GtkEntry *entry,
+static void gtk_spin_button_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position);
@@ -150,7 +151,17 @@ gtk_spin_button_get_type (void)
(GtkClassInitFunc) NULL,
};
+ static const GInterfaceInfo editable_info =
+ {
+ (GInterfaceInitFunc) gtk_spin_button_editable_init, /* interface_init */
+ NULL, /* interface_finalize */
+ NULL /* interface_data */
+ };
+
spin_button_type = gtk_type_unique (GTK_TYPE_ENTRY, &spin_button_info);
+ g_type_add_interface_static (spin_button_type,
+ GTK_TYPE_EDITABLE,
+ &editable_info);
}
return spin_button_type;
}
@@ -165,7 +176,7 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
object_class = (GtkObjectClass*) class;
widget_class = (GtkWidgetClass*) class;
- entry_class = (GtkEntryClass*) class;
+ entry_class = (GtkEntryClass*) class;
parent_class = gtk_type_class (GTK_TYPE_ENTRY);
@@ -191,7 +202,6 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
widget_class->leave_notify_event = gtk_spin_button_leave_notify;
widget_class->focus_out_event = gtk_spin_button_focus_out;
- entry_class->insert_text = gtk_spin_button_insert_text;
entry_class->activate = gtk_spin_button_activate;
class->input = NULL;
@@ -301,6 +311,12 @@ gtk_spin_button_class_init (GtkSpinButtonClass *class)
}
static void
+gtk_spin_button_editable_init (GtkEditableClass *iface)
+{
+ iface->insert_text = gtk_spin_button_insert_text;
+}
+
+static void
gtk_spin_button_set_property (GObject *object,
guint prop_id,
const GValue *value,
@@ -1309,13 +1325,14 @@ gtk_spin_button_activate (GtkEntry *entry)
}
static void
-gtk_spin_button_insert_text (GtkEntry *entry,
+gtk_spin_button_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position)
{
- GtkEditable *editable = GTK_EDITABLE (entry);
+ GtkEntry *entry = GTK_ENTRY (editable);
GtkSpinButton *spin = GTK_SPIN_BUTTON (editable);
+ GtkEditableClass *parent_editable_iface = g_type_interface_peek (parent_class, GTK_TYPE_EDITABLE);
if (spin->numeric)
{
@@ -1385,8 +1402,8 @@ gtk_spin_button_insert_text (GtkEntry *entry,
}
}
- GTK_ENTRY_CLASS (parent_class)->insert_text (entry, new_text,
- new_text_length, position);
+ parent_editable_iface->insert_text (editable, new_text,
+ new_text_length, position);
}
static void
diff --git a/gtk/gtktext.c b/gtk/gtktext.c
index f573091977..d5b5987abe 100644
--- a/gtk/gtktext.c
+++ b/gtk/gtktext.c
@@ -204,6 +204,7 @@ static void gtk_text_get_property (GObject *object,
guint prop_id,
GValue *value,
GParamSpec *pspec);
+static void gtk_text_editable_init (GtkEditableClass *iface);
static void gtk_text_init (GtkText *text);
static void gtk_text_destroy (GtkObject *object);
static void gtk_text_finalize (GObject *object);
@@ -220,11 +221,11 @@ static void gtk_text_size_allocate (GtkWidget *widget,
GtkAllocation *allocation);
static void gtk_text_adjustment (GtkAdjustment *adjustment,
GtkText *text);
-static void gtk_text_insert_text (GtkOldEditable *old_editable,
+static void gtk_text_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position);
-static void gtk_text_delete_text (GtkOldEditable *old_editable,
+static void gtk_text_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos);
static void gtk_text_update_text (GtkOldEditable *old_editable,
@@ -526,8 +527,18 @@ gtk_text_get_type (void)
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
+
+ static const GInterfaceInfo editable_info =
+ {
+ (GInterfaceInitFunc) gtk_text_editable_init, /* interface_init */
+ NULL, /* interface_finalize */
+ NULL /* interface_data */
+ };
text_type = gtk_type_unique (GTK_TYPE_OLD_EDITABLE, &text_info);
+ g_type_add_interface_static (text_type,
+ GTK_TYPE_EDITABLE,
+ &editable_info);
}
return text_type;
@@ -568,8 +579,6 @@ gtk_text_class_init (GtkTextClass *class)
widget_class->focus_out_event = gtk_text_focus_out;
old_editable_class->set_editable = gtk_text_real_set_editable;
- old_editable_class->insert_text = gtk_text_insert_text;
- old_editable_class->delete_text = gtk_text_delete_text;
old_editable_class->move_cursor = gtk_text_move_cursor;
old_editable_class->move_word = gtk_text_move_word;
@@ -694,6 +703,13 @@ gtk_text_get_property (GObject *object,
}
static void
+gtk_text_editable_init (GtkEditableClass *iface)
+{
+ iface->insert_text = gtk_text_insert_text;
+ iface->delete_text = gtk_text_delete_text;
+}
+
+static void
gtk_text_init (GtkText *text)
{
GTK_WIDGET_SET_FLAGS (text, GTK_CAN_FOCUS);
@@ -1861,12 +1877,12 @@ gtk_text_motion_notify (GtkWidget *widget,
}
static void
-gtk_text_insert_text (GtkOldEditable *old_editable,
+gtk_text_insert_text (GtkEditable *editable,
const gchar *new_text,
gint new_text_length,
gint *position)
{
- GtkText *text = GTK_TEXT (old_editable);
+ GtkText *text = GTK_TEXT (editable);
GdkFont *font;
GdkColor *fore, *back;
@@ -1885,7 +1901,7 @@ gtk_text_insert_text (GtkOldEditable *old_editable,
}
static void
-gtk_text_delete_text (GtkOldEditable *old_editable,
+gtk_text_delete_text (GtkEditable *editable,
gint start_pos,
gint end_pos)
{
@@ -1893,7 +1909,7 @@ gtk_text_delete_text (GtkOldEditable *old_editable,
g_return_if_fail (start_pos >= 0);
- text = GTK_TEXT (old_editable);
+ text = GTK_TEXT (editable);
gtk_text_set_point (text, start_pos);
if (end_pos < 0)