diff options
author | Chris Lahey <clahey@src.gnome.org> | 2000-01-17 17:13:45 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-01-17 17:13:45 +0800 |
commit | 804e7e17bf0ae0c3880e7aed3746dafcf183acad (patch) | |
tree | 48a61155bed596eaf66dd28d50efba860e9d0536 | |
parent | 4d4bcd89d8403e8ee275f8c4695f45c82e2dd9f9 (diff) | |
download | gsoc2013-evolution-804e7e17bf0ae0c3880e7aed3746dafcf183acad.tar.gz gsoc2013-evolution-804e7e17bf0ae0c3880e7aed3746dafcf183acad.tar.zst gsoc2013-evolution-804e7e17bf0ae0c3880e7aed3746dafcf183acad.zip |
Finishing previous commit.
svn path=/trunk/; revision=1582
-rw-r--r-- | ChangeLog | 32 | ||||
-rw-r--r-- | Makefile.am | 3 | ||||
-rw-r--r-- | addressbook/.cvsignore | 6 | ||||
-rw-r--r-- | addressbook/Makefile.am | 2 | ||||
-rw-r--r-- | configure.in | 3 | ||||
-rw-r--r-- | widgets/.cvsignore | 1 | ||||
-rw-r--r-- | widgets/Makefile.am | 2 | ||||
-rw-r--r-- | widgets/e-text.c | 139 | ||||
-rw-r--r-- | widgets/e-text.h | 2 | ||||
-rw-r--r-- | widgets/e-text/e-text.c | 139 | ||||
-rw-r--r-- | widgets/e-text/e-text.h | 2 | ||||
-rw-r--r-- | widgets/shortcut-bar/Makefile.am | 2 | ||||
-rw-r--r-- | widgets/text/e-text.c | 139 | ||||
-rw-r--r-- | widgets/text/e-text.h | 2 |
14 files changed, 236 insertions, 238 deletions
@@ -1,3 +1,35 @@ +2000-01-17 Chrsitopher James Lahey <clahey@helixcode.com> + + * head.png, phone.png, email.png, web.png, snailmail.png: Images + for e-contact-editor.c. + + * addressbook/contact-editor/text-editor.c: Test program + for contact editor widget. + + * addressbook/contact-editor/e-contact-editor.c, + addressbook/contact-editor/e-contact-editor.h: Contact editor + widget files. + + * addressbook/contact-editor/.cvsignore, + addressbook/contact-editor/Makefile.am: New directory for contact + editor files. + + * addressbook/.cvsignore, addressbook/Makefile.am: New directory + for addressbook files. + + * widgets/.cvsignore: Added reflow-test. + + * Makefile.am (SUBDIRS): Added addressbook subdirectory. + + * configure.in, widgets/Makefile.am: Removed widgets/toolbar from + SUBDIRS since the lack of content was preventing it from + compiling. + + * widgets/shortcut-bar/Makefile.am: Added gnomecanvaspixbuf to the + list of libraries used. + + * widgets/e-text.c, widgets/e-text.h: Fixed a crashing bug. + 2000-01-17 bertrand <bertrand@helixcode.com> * tests/test9.c (main): test for the mbox utils. diff --git a/Makefile.am b/Makefile.am index 6a9c335cc5..46d9add621 100644 --- a/Makefile.am +++ b/Makefile.am @@ -5,7 +5,8 @@ SUBDIRS = \ e-util \ widgets \ composer \ - tests + tests \ + addressbook dist-hook: for subdir in intl ; do \ diff --git a/addressbook/.cvsignore b/addressbook/.cvsignore new file mode 100644 index 0000000000..09980ae6ba --- /dev/null +++ b/addressbook/.cvsignore @@ -0,0 +1,6 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.la diff --git a/addressbook/Makefile.am b/addressbook/Makefile.am new file mode 100644 index 0000000000..5080457fe2 --- /dev/null +++ b/addressbook/Makefile.am @@ -0,0 +1,2 @@ +SUBDIRS = \ + contact-editor diff --git a/configure.in b/configure.in index 4ef3f68804..29136aaff7 100644 --- a/configure.in +++ b/configure.in @@ -141,6 +141,7 @@ widgets/Makefile widgets/meeting-time-sel/Makefile widgets/shortcut-bar/Makefile widgets/e-table/Makefile -widgets/toolbar/Makefile +addressbook/Makefile +addressbook/contact-editor/Makefile shell/Makefile ]) diff --git a/widgets/.cvsignore b/widgets/.cvsignore index d32593e1fd..d5b3a2ad62 100644 --- a/widgets/.cvsignore +++ b/widgets/.cvsignore @@ -6,3 +6,4 @@ Makefile.in *.la minicard-test minicard-label-test +reflow-test diff --git a/widgets/Makefile.am b/widgets/Makefile.am index 0c8142ede2..1e2016ef3c 100644 --- a/widgets/Makefile.am +++ b/widgets/Makefile.am @@ -1,6 +1,6 @@ SUBDIRS = \ - meeting-time-sel shortcut-bar e-table toolbar + meeting-time-sel shortcut-bar e-table INCLUDES = \ -I$(top_srcdir)/camel \ diff --git a/widgets/e-text.c b/widgets/e-text.c index cb3456cd24..f4d6dddf55 100644 --- a/widgets/e-text.c +++ b/widgets/e-text.c @@ -112,6 +112,20 @@ static guint32 e_text_get_event_time (EText *text); static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time); static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length); +static GtkWidget *e_text_get_invisible(EText *text); +static void _selection_clear_event (GtkInvisible *invisible, + GdkEventSelection *event, + EText *text); +static void _selection_get (GtkInvisible *invisible, + GtkSelectionData *selection_data, + guint info, + guint time_stamp, + EText *text); +static void _selection_received (GtkInvisible *invisible, + GtkSelectionData *selection_data, + guint time, + EText *text); + static ETextSuckFont *e_suck_font (GdkFont *font); static void e_suck_font_free (ETextSuckFont *suckfont); @@ -290,9 +304,9 @@ e_text_init (EText *text) text->tep = NULL; - text->invisible = NULL; text->has_selection = FALSE; - + + text->invisible = NULL; text->primary_selection = NULL; text->primary_length = 0; text->clipboard_selection = NULL; @@ -315,6 +329,9 @@ e_text_destroy (GtkObject *object) if (text->tep) gtk_object_unref (GTK_OBJECT(text->tep)); + + if (text->invisible) + gtk_object_unref (GTK_OBJECT(text->invisible)); if (text->lines) g_free (text->lines); @@ -1985,6 +2002,47 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); } +static void _invisible_destroy (GtkInvisible *invisible, + EText *text) +{ + text->invisible = NULL; +} + +static GtkWidget *e_text_get_invisible(EText *text) +{ + GtkWidget *invisible; + if (text->invisible) { + invisible = text->invisible; + } else { + invisible = gtk_invisible_new(); + text->invisible = invisible; + + gtk_selection_add_target (invisible, + GDK_SELECTION_PRIMARY, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_PRIMARY); + gtk_selection_add_target (invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_CLIPBOARD); + + 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); + + gtk_signal_connect (GTK_OBJECT(invisible), "destroy", + GTK_SIGNAL_FUNC (_invisible_destroy), + text); + } + return invisible; +} + static void _selection_clear_event (GtkInvisible *invisible, GdkEventSelection *event, @@ -1994,7 +2052,6 @@ _selection_clear_event (GtkInvisible *invisible, g_free (text->primary_selection); text->primary_selection = NULL; text->primary_length = 0; - gtk_object_unref (GTK_OBJECT(invisible)); text->has_selection = FALSE; gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); @@ -2003,7 +2060,6 @@ _selection_clear_event (GtkInvisible *invisible, g_free (text->clipboard_selection); text->clipboard_selection = NULL; text->clipboard_length = 0; - gtk_object_unref (GTK_OBJECT(invisible)); } } @@ -2033,7 +2089,6 @@ _selection_received (GtkInvisible *invisible, EText *text) { if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - gtk_object_unref (GTK_OBJECT(invisible)); return; } else { ETextEventProcessorCommand command; @@ -2043,62 +2098,24 @@ _selection_received (GtkInvisible *invisible, command.value = selection_data->length; command.time = time; e_text_command(text->tep, &command, text); - gtk_object_unref (GTK_OBJECT(invisible)); } } -static void _invisible_destroy (GtkInvisible *invisible, - EText *text) -{ - text->invisible = NULL; -} - static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length) { gboolean successful; GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - gtk_object_ref (GTK_OBJECT(invisible)); - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - 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); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } + invisible = e_text_get_invisible(text); if (selection == GDK_SELECTION_PRIMARY ) { if (text->primary_selection) { - gtk_object_unref (GTK_OBJECT(invisible)); g_free (text->primary_selection); } text->primary_selection = g_strndup(data, length); text->primary_length = length; } else if (selection == clipboard_atom) { if (text->clipboard_selection) { - gtk_object_unref (GTK_OBJECT(invisible)); g_free (text->clipboard_selection); } text->clipboard_selection = g_strndup(data, length); @@ -2111,45 +2128,13 @@ static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, if (selection == GDK_SELECTION_PRIMARY) text->has_selection = successful; - - if (!successful) - gtk_object_unref(GTK_OBJECT(invisible)); } static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time) { GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - gtk_object_ref (GTK_OBJECT(invisible)); - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - 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); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } + invisible = e_text_get_invisible(text); gtk_selection_convert(invisible, selection, GDK_SELECTION_TYPE_STRING, diff --git a/widgets/e-text.h b/widgets/e-text.h index 11a7a42375..e1f250c678 100644 --- a/widgets/e-text.h +++ b/widgets/e-text.h @@ -59,7 +59,7 @@ BEGIN_GNOME_DECLS * text_width double R Used to query the width of the rendered text * text_height double R Used to query the rendered height of the text * - * These are ignored in the AA version: + * These are currently ignored in the AA version: * editable boolean RW Can this item be edited * use_ellipsis boolean RW Whether to use ellipsises if text gets cut off. Meaningless if clip == false. * ellipsis string RW The characters to use as ellipsis. NULL = "...". diff --git a/widgets/e-text/e-text.c b/widgets/e-text/e-text.c index cb3456cd24..f4d6dddf55 100644 --- a/widgets/e-text/e-text.c +++ b/widgets/e-text/e-text.c @@ -112,6 +112,20 @@ static guint32 e_text_get_event_time (EText *text); static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time); static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length); +static GtkWidget *e_text_get_invisible(EText *text); +static void _selection_clear_event (GtkInvisible *invisible, + GdkEventSelection *event, + EText *text); +static void _selection_get (GtkInvisible *invisible, + GtkSelectionData *selection_data, + guint info, + guint time_stamp, + EText *text); +static void _selection_received (GtkInvisible *invisible, + GtkSelectionData *selection_data, + guint time, + EText *text); + static ETextSuckFont *e_suck_font (GdkFont *font); static void e_suck_font_free (ETextSuckFont *suckfont); @@ -290,9 +304,9 @@ e_text_init (EText *text) text->tep = NULL; - text->invisible = NULL; text->has_selection = FALSE; - + + text->invisible = NULL; text->primary_selection = NULL; text->primary_length = 0; text->clipboard_selection = NULL; @@ -315,6 +329,9 @@ e_text_destroy (GtkObject *object) if (text->tep) gtk_object_unref (GTK_OBJECT(text->tep)); + + if (text->invisible) + gtk_object_unref (GTK_OBJECT(text->invisible)); if (text->lines) g_free (text->lines); @@ -1985,6 +2002,47 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); } +static void _invisible_destroy (GtkInvisible *invisible, + EText *text) +{ + text->invisible = NULL; +} + +static GtkWidget *e_text_get_invisible(EText *text) +{ + GtkWidget *invisible; + if (text->invisible) { + invisible = text->invisible; + } else { + invisible = gtk_invisible_new(); + text->invisible = invisible; + + gtk_selection_add_target (invisible, + GDK_SELECTION_PRIMARY, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_PRIMARY); + gtk_selection_add_target (invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_CLIPBOARD); + + 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); + + gtk_signal_connect (GTK_OBJECT(invisible), "destroy", + GTK_SIGNAL_FUNC (_invisible_destroy), + text); + } + return invisible; +} + static void _selection_clear_event (GtkInvisible *invisible, GdkEventSelection *event, @@ -1994,7 +2052,6 @@ _selection_clear_event (GtkInvisible *invisible, g_free (text->primary_selection); text->primary_selection = NULL; text->primary_length = 0; - gtk_object_unref (GTK_OBJECT(invisible)); text->has_selection = FALSE; gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); @@ -2003,7 +2060,6 @@ _selection_clear_event (GtkInvisible *invisible, g_free (text->clipboard_selection); text->clipboard_selection = NULL; text->clipboard_length = 0; - gtk_object_unref (GTK_OBJECT(invisible)); } } @@ -2033,7 +2089,6 @@ _selection_received (GtkInvisible *invisible, EText *text) { if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - gtk_object_unref (GTK_OBJECT(invisible)); return; } else { ETextEventProcessorCommand command; @@ -2043,62 +2098,24 @@ _selection_received (GtkInvisible *invisible, command.value = selection_data->length; command.time = time; e_text_command(text->tep, &command, text); - gtk_object_unref (GTK_OBJECT(invisible)); } } -static void _invisible_destroy (GtkInvisible *invisible, - EText *text) -{ - text->invisible = NULL; -} - static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length) { gboolean successful; GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - gtk_object_ref (GTK_OBJECT(invisible)); - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - 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); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } + invisible = e_text_get_invisible(text); if (selection == GDK_SELECTION_PRIMARY ) { if (text->primary_selection) { - gtk_object_unref (GTK_OBJECT(invisible)); g_free (text->primary_selection); } text->primary_selection = g_strndup(data, length); text->primary_length = length; } else if (selection == clipboard_atom) { if (text->clipboard_selection) { - gtk_object_unref (GTK_OBJECT(invisible)); g_free (text->clipboard_selection); } text->clipboard_selection = g_strndup(data, length); @@ -2111,45 +2128,13 @@ static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, if (selection == GDK_SELECTION_PRIMARY) text->has_selection = successful; - - if (!successful) - gtk_object_unref(GTK_OBJECT(invisible)); } static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time) { GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - gtk_object_ref (GTK_OBJECT(invisible)); - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - 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); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } + invisible = e_text_get_invisible(text); gtk_selection_convert(invisible, selection, GDK_SELECTION_TYPE_STRING, diff --git a/widgets/e-text/e-text.h b/widgets/e-text/e-text.h index 11a7a42375..e1f250c678 100644 --- a/widgets/e-text/e-text.h +++ b/widgets/e-text/e-text.h @@ -59,7 +59,7 @@ BEGIN_GNOME_DECLS * text_width double R Used to query the width of the rendered text * text_height double R Used to query the rendered height of the text * - * These are ignored in the AA version: + * These are currently ignored in the AA version: * editable boolean RW Can this item be edited * use_ellipsis boolean RW Whether to use ellipsises if text gets cut off. Meaningless if clip == false. * ellipsis string RW The characters to use as ellipsis. NULL = "...". diff --git a/widgets/shortcut-bar/Makefile.am b/widgets/shortcut-bar/Makefile.am index bf41fcfc15..ac81f2e2e6 100644 --- a/widgets/shortcut-bar/Makefile.am +++ b/widgets/shortcut-bar/Makefile.am @@ -30,4 +30,4 @@ test_shortcut_bar_LDADD = \ $(EXTRA_GNOME_LIBS) test_shortcut_bar_LDFLAGS = \ - `gnome-config --libs gdk_pixbuf` + `gnome-config --libs gdk_pixbuf gnomecanvaspixbuf` diff --git a/widgets/text/e-text.c b/widgets/text/e-text.c index cb3456cd24..f4d6dddf55 100644 --- a/widgets/text/e-text.c +++ b/widgets/text/e-text.c @@ -112,6 +112,20 @@ static guint32 e_text_get_event_time (EText *text); static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time); static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length); +static GtkWidget *e_text_get_invisible(EText *text); +static void _selection_clear_event (GtkInvisible *invisible, + GdkEventSelection *event, + EText *text); +static void _selection_get (GtkInvisible *invisible, + GtkSelectionData *selection_data, + guint info, + guint time_stamp, + EText *text); +static void _selection_received (GtkInvisible *invisible, + GtkSelectionData *selection_data, + guint time, + EText *text); + static ETextSuckFont *e_suck_font (GdkFont *font); static void e_suck_font_free (ETextSuckFont *suckfont); @@ -290,9 +304,9 @@ e_text_init (EText *text) text->tep = NULL; - text->invisible = NULL; text->has_selection = FALSE; - + + text->invisible = NULL; text->primary_selection = NULL; text->primary_length = 0; text->clipboard_selection = NULL; @@ -315,6 +329,9 @@ e_text_destroy (GtkObject *object) if (text->tep) gtk_object_unref (GTK_OBJECT(text->tep)); + + if (text->invisible) + gtk_object_unref (GTK_OBJECT(text->invisible)); if (text->lines) g_free (text->lines); @@ -1985,6 +2002,47 @@ e_text_command(ETextEventProcessor *tep, ETextEventProcessorCommand *command, gp gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); } +static void _invisible_destroy (GtkInvisible *invisible, + EText *text) +{ + text->invisible = NULL; +} + +static GtkWidget *e_text_get_invisible(EText *text) +{ + GtkWidget *invisible; + if (text->invisible) { + invisible = text->invisible; + } else { + invisible = gtk_invisible_new(); + text->invisible = invisible; + + gtk_selection_add_target (invisible, + GDK_SELECTION_PRIMARY, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_PRIMARY); + gtk_selection_add_target (invisible, + clipboard_atom, + GDK_SELECTION_TYPE_STRING, + E_SELECTION_CLIPBOARD); + + 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); + + gtk_signal_connect (GTK_OBJECT(invisible), "destroy", + GTK_SIGNAL_FUNC (_invisible_destroy), + text); + } + return invisible; +} + static void _selection_clear_event (GtkInvisible *invisible, GdkEventSelection *event, @@ -1994,7 +2052,6 @@ _selection_clear_event (GtkInvisible *invisible, g_free (text->primary_selection); text->primary_selection = NULL; text->primary_length = 0; - gtk_object_unref (GTK_OBJECT(invisible)); text->has_selection = FALSE; gnome_canvas_item_request_update (GNOME_CANVAS_ITEM(text)); @@ -2003,7 +2060,6 @@ _selection_clear_event (GtkInvisible *invisible, g_free (text->clipboard_selection); text->clipboard_selection = NULL; text->clipboard_length = 0; - gtk_object_unref (GTK_OBJECT(invisible)); } } @@ -2033,7 +2089,6 @@ _selection_received (GtkInvisible *invisible, EText *text) { if (selection_data->length < 0 || selection_data->type != GDK_SELECTION_TYPE_STRING) { - gtk_object_unref (GTK_OBJECT(invisible)); return; } else { ETextEventProcessorCommand command; @@ -2043,62 +2098,24 @@ _selection_received (GtkInvisible *invisible, command.value = selection_data->length; command.time = time; e_text_command(text->tep, &command, text); - gtk_object_unref (GTK_OBJECT(invisible)); } } -static void _invisible_destroy (GtkInvisible *invisible, - EText *text) -{ - text->invisible = NULL; -} - static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, guchar *data, gint length) { gboolean successful; GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - gtk_object_ref (GTK_OBJECT(invisible)); - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - 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); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } + invisible = e_text_get_invisible(text); if (selection == GDK_SELECTION_PRIMARY ) { if (text->primary_selection) { - gtk_object_unref (GTK_OBJECT(invisible)); g_free (text->primary_selection); } text->primary_selection = g_strndup(data, length); text->primary_length = length; } else if (selection == clipboard_atom) { if (text->clipboard_selection) { - gtk_object_unref (GTK_OBJECT(invisible)); g_free (text->clipboard_selection); } text->clipboard_selection = g_strndup(data, length); @@ -2111,45 +2128,13 @@ static void e_text_supply_selection (EText *text, guint time, GdkAtom selection, if (selection == GDK_SELECTION_PRIMARY) text->has_selection = successful; - - if (!successful) - gtk_object_unref(GTK_OBJECT(invisible)); } static void e_text_get_selection(EText *text, GdkAtom selection, guint32 time) { GtkWidget *invisible; - if (text->invisible) { - invisible = text->invisible; - gtk_object_ref (GTK_OBJECT(invisible)); - } else { - invisible = gtk_invisible_new(); - text->invisible = invisible; - - gtk_selection_add_target (invisible, - GDK_SELECTION_PRIMARY, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_PRIMARY); - gtk_selection_add_target (invisible, - clipboard_atom, - GDK_SELECTION_TYPE_STRING, - E_SELECTION_CLIPBOARD); - - 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); - - gtk_signal_connect (GTK_OBJECT(invisible), "destroy", - GTK_SIGNAL_FUNC (_invisible_destroy), - text); - } + invisible = e_text_get_invisible(text); gtk_selection_convert(invisible, selection, GDK_SELECTION_TYPE_STRING, diff --git a/widgets/text/e-text.h b/widgets/text/e-text.h index 11a7a42375..e1f250c678 100644 --- a/widgets/text/e-text.h +++ b/widgets/text/e-text.h @@ -59,7 +59,7 @@ BEGIN_GNOME_DECLS * text_width double R Used to query the width of the rendered text * text_height double R Used to query the rendered height of the text * - * These are ignored in the AA version: + * These are currently ignored in the AA version: * editable boolean RW Can this item be edited * use_ellipsis boolean RW Whether to use ellipsises if text gets cut off. Meaningless if clip == false. * ellipsis string RW The characters to use as ellipsis. NULL = "...". |