Re: #59803: patch
- From: Kristian Rietveld <kristian planet nl>
- To: Owen Taylor <otaylor redhat com>
- Cc: GTK Development list <gtk-devel-list gnome org>
- Subject: Re: #59803: patch
- Date: Tue, 2 Oct 2001 22:19:14 +0200 (CEST)
On 2 Oct 2001, Owen Taylor wrote:
>
> No. I mean a change to remove the insert_text/delete_text/changed
> signals for GtkOldEditable, and the miscellaneous changes related
> to that.
Here's a patch for the GtkOldEditable part (didn't touch the old part):
regards,
Kris
Index: gtkoldeditable.h
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkoldeditable.h,v
retrieving revision 1.4
diff -u -r1.4 gtkoldeditable.h
--- gtkoldeditable.h 2001/03/09 20:28:14 1.4
+++ gtkoldeditable.h 2001/10/02 20:13:28
@@ -74,16 +74,6 @@
{
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,
Index: gtkoldeditable.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtkoldeditable.c,v
retrieving revision 1.7
diff -u -r1.7 gtkoldeditable.c
--- gtkoldeditable.c 2001/07/20 18:05:32 1.7
+++ gtkoldeditable.c 2001/10/02 20:13:28
@@ -39,9 +39,6 @@
#define INNER_BORDER 2
enum {
- CHANGED,
- INSERT_TEXT,
- DELETE_TEXT,
/* Binding actions */
ACTIVATE,
SET_EDITABLE,
@@ -182,9 +179,6 @@
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 @@
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 @@
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 @@
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_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 @@
{
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");
}
Index: gtktext.c
===================================================================
RCS file: /cvs/gnome/gtk+/gtk/gtktext.c,v
retrieving revision 1.105
diff -u -r1.105 gtktext.c
--- gtktext.c 2001/09/18 20:06:46 1.105
+++ gtktext.c 2001/10/02 20:13:33
@@ -204,6 +204,7 @@
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 @@
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 @@
/* 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 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
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)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]