diff options
author | Not Zed <NotZed@Ximian.com> | 2002-11-08 14:49:14 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2002-11-08 14:49:14 +0800 |
commit | 234540a383de150f0a79df466aa76dae4096d09c (patch) | |
tree | ce8697e153cefd8ce95644370392c874c443b33a | |
parent | ab44fe3e1d962e7876693929c940121e2954379d (diff) | |
download | gsoc2013-evolution-234540a383de150f0a79df466aa76dae4096d09c.tar gsoc2013-evolution-234540a383de150f0a79df466aa76dae4096d09c.tar.gz gsoc2013-evolution-234540a383de150f0a79df466aa76dae4096d09c.tar.bz2 gsoc2013-evolution-234540a383de150f0a79df466aa76dae4096d09c.tar.lz gsoc2013-evolution-234540a383de150f0a79df466aa76dae4096d09c.tar.xz gsoc2013-evolution-234540a383de150f0a79df466aa76dae4096d09c.tar.zst gsoc2013-evolution-234540a383de150f0a79df466aa76dae4096d09c.zip |
Fix bonobo object setup.
2002-11-08 Not Zed <NotZed@Ximian.com>
* listener.c: Fix bonobo object setup.
* e-msg-composer-hdrs.c: Remove oaf stuff, fix destroy to be
multi-call safe.
* e-msg-composer-attachment.c (e_msg_composer_attachment_new):
Remove utf8 from locale conversions, & glib api changes.
(ok_cb): "
* e-msg-composer-attachment-bar.c (add_from_file): gtk message
dialog.
(pixbuf_for_mime_type): glib,gnome-vfs api changes.
(init): Estimate the icon_height based on the pango font
description size, this is probably not correct.
(properties_cb):
(remove_cb): Changed signature for gnomeui callbacks.
(popup_icon_context_menu):
(popup_context_menu): popup_menu api change
(destroy): Protect from multiple calls.
(e_msg_composer_attachment_bar_new): Remove push/pop
visual/colormap stuff.
* composer-marshal.list: The list of marshallers used by the
composer.
* Makefile.am (composer-marshal.h): Added composer marshal builder.
* evolution-composer.c (class_init): bonobo object epv setup change.
(factory_fn): Fix changes to factory callback.
* e-icon-list.c: (icon_get_height): Use bounding box to calc
height.
(icon_event): drop gtk_selection_extended.
(e_icon_list_remove): "
(select_icon):
(unselect_icon): "
* e-msg-composer.c (autosave_save_draft): Dup fd rather than poke
camel_stream_fd's data. Also, use camel_stream_close() rather
than flush.
(autosave_manager_query_load_orphans): Port to gtk dialog.
(autosave_query_cb): Removed, redundant.
(save): Port to gtkdialog.
(prepare_engine): Fix bonobo-object-client code.
(get_file_content): gtk dialog
(do_exit): gtk dialog.
(setup_signatures_menu): dump gtkutf8 stuff.
(marshal_NONE__NONE_INT): What WAS jeff thinking? Removed :)
(class_init): g object setup.
(e_msg_composer_get_type): "
(create_composer): remove bonobo_window_construct, use create
property instead. g_signal stuff. bonobo stuff.
(is_special_header): Use ascii_strncasecmp
(e_msg_composer_set_pending_body): gtk->g_object_get/set_data.
(e_msg_composer_set_body): use ascii_strncasecmp
(e_msg_composer_add_inline_image_from_mime_part): make cid const.
(autosave_manager_register):
(autosave_manager_unregister): Use g_path_get_basename() & account
for differences.
(composer_shutdown): rename to finalise/etc.
(class_init): Use object:finalize instead of shutdown.
(e_msg_composer_set_body): Use _() rather than U_().
(build_message): gtk dialog.
2002-11-06 Not Zed <NotZed@Ximian.com>
* e-msg-composer-attachment-bar.c (pixbuf_for_mime_type): Add
error return to gdk_pixbuf_new_from_file().
svn path=/trunk/; revision=18659
-rw-r--r-- | composer/ChangeLog | 71 | ||||
-rw-r--r-- | composer/Makefile.am | 19 | ||||
-rw-r--r-- | composer/composer-marshal.list | 4 | ||||
-rw-r--r-- | composer/e-icon-list.c | 245 | ||||
-rw-r--r-- | composer/e-icon-list.h | 4 | ||||
-rw-r--r-- | composer/e-msg-composer-attachment-bar.c | 156 | ||||
-rw-r--r-- | composer/e-msg-composer-attachment.c | 136 | ||||
-rw-r--r-- | composer/e-msg-composer-attachment.h | 6 | ||||
-rw-r--r-- | composer/e-msg-composer-hdrs.c | 201 | ||||
-rw-r--r-- | composer/e-msg-composer-select-file.c | 18 | ||||
-rw-r--r-- | composer/e-msg-composer.c | 480 | ||||
-rw-r--r-- | composer/e-msg-composer.h | 4 | ||||
-rw-r--r-- | composer/evolution-composer.c | 50 | ||||
-rw-r--r-- | composer/evolution-composer.h | 2 | ||||
-rw-r--r-- | composer/listener.c | 96 | ||||
-rw-r--r-- | composer/listener.h | 3 |
16 files changed, 745 insertions, 750 deletions
diff --git a/composer/ChangeLog b/composer/ChangeLog index e3b2f67253..fbf72522bf 100644 --- a/composer/ChangeLog +++ b/composer/ChangeLog @@ -1,3 +1,74 @@ +2002-11-08 Not Zed <NotZed@Ximian.com> + + * listener.c: Fix bonobo object setup. + + * e-msg-composer-hdrs.c: Remove oaf stuff, fix destroy to be + multi-call safe. + + * e-msg-composer-attachment.c (e_msg_composer_attachment_new): + Remove utf8 from locale conversions, & glib api changes. + (ok_cb): " + + * e-msg-composer-attachment-bar.c (add_from_file): gtk message + dialog. + (pixbuf_for_mime_type): glib,gnome-vfs api changes. + (init): Estimate the icon_height based on the pango font + description size, this is probably not correct. + (properties_cb): + (remove_cb): Changed signature for gnomeui callbacks. + (popup_icon_context_menu): + (popup_context_menu): popup_menu api change + (destroy): Protect from multiple calls. + (e_msg_composer_attachment_bar_new): Remove push/pop + visual/colormap stuff. + + * composer-marshal.list: The list of marshallers used by the + composer. + + * Makefile.am (composer-marshal.h): Added composer marshal builder. + + * evolution-composer.c (class_init): bonobo object epv setup change. + (factory_fn): Fix changes to factory callback. + + * e-icon-list.c: (icon_get_height): Use bounding box to calc + height. + (icon_event): drop gtk_selection_extended. + (e_icon_list_remove): " + (select_icon): + (unselect_icon): " + + * e-msg-composer.c (autosave_save_draft): Dup fd rather than poke + camel_stream_fd's data. Also, use camel_stream_close() rather + than flush. + (autosave_manager_query_load_orphans): Port to gtk dialog. + (autosave_query_cb): Removed, redundant. + (save): Port to gtkdialog. + (prepare_engine): Fix bonobo-object-client code. + (get_file_content): gtk dialog + (do_exit): gtk dialog. + (setup_signatures_menu): dump gtkutf8 stuff. + (marshal_NONE__NONE_INT): What WAS jeff thinking? Removed :) + (class_init): g object setup. + (e_msg_composer_get_type): " + (create_composer): remove bonobo_window_construct, use create + property instead. g_signal stuff. bonobo stuff. + (is_special_header): Use ascii_strncasecmp + (e_msg_composer_set_pending_body): gtk->g_object_get/set_data. + (e_msg_composer_set_body): use ascii_strncasecmp + (e_msg_composer_add_inline_image_from_mime_part): make cid const. + (autosave_manager_register): + (autosave_manager_unregister): Use g_path_get_basename() & account + for differences. + (composer_shutdown): rename to finalise/etc. + (class_init): Use object:finalize instead of shutdown. + (e_msg_composer_set_body): Use _() rather than U_(). + (build_message): gtk dialog. + +2002-11-06 Not Zed <NotZed@Ximian.com> + + * e-msg-composer-attachment-bar.c (pixbuf_for_mime_type): Add + error return to gdk_pixbuf_new_from_file(). + 2002-11-01 Jeffrey Stedfast <fejj@ximian.com> * e-msg-composer.c (e_msg_composer_new_from_url): Add support for diff --git a/composer/Makefile.am b/composer/Makefile.am index 22334d3eeb..0f893f46a8 100644 --- a/composer/Makefile.am +++ b/composer/Makefile.am @@ -19,13 +19,26 @@ HTML_EDITOR_GENERATED = \ selectnamesdir = $(top_srcdir)/addressbook/gui/component/select-names $(IDL_GENERATED): $(IDLS) $(selectnamesdir)/Evolution-Addressbook-SelectNames.idl - $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl `$(GNOME_CONFIG) --cflags idl` \ + $(ORBIT_IDL) -I $(srcdir) -I $(datadir)/idl $(IDL_INCLUDES) \ -I $(selectnamesdir) $(srcdir)/Composer.idl Editor-commmon.c: $(GTKHTML_DATADIR)/Editor.idl $(HTML_EDITOR_GENERATED): $(GTKHTML_DATADIR)/Editor.idl - $(ORBIT_IDL) -I $(srcdir) `$(GNOME_CONFIG) --cflags idl` -I $(GTKHTML_DATADIR)/gtkhtml $(GTKHTML_DATADIR)/Editor.idl + $(ORBIT_IDL) -I $(srcdir) $(IDL_INCLUDES) -I $(GTKHTML_DATADIR)/gtkhtml $(GTKHTML_DATADIR)/Editor.idl + +## + +composer-marshal.h: composer-marshal.list + ( @GLIB_GENMARSHAL@ --prefix=e_msg_composer_marshal composer-marshal.list --header > composer-marshal.tmp \ + && mv composer-marshal.tmp composer-marshal.h ) \ + || ( rm -f composer-marshal.tmp && exit 1 ) +composer-marshal.c: composer-marshal.h + ( @GLIB_GENMARSHAL@ --prefix=e_msg_composer_marshal composer-marshal.list --body > composer-marshal.tmp \ + && mv composer-marshal.tmp composer-marshal.c ) \ + || ( rm -f composer-marshal.tmp && exit 1 ) + +$(libcomposer_la_OBJECTS): composer-marshal.h ## @@ -63,6 +76,7 @@ INCLUDES = \ libcomposer_a_SOURCES = \ $(IDL_GENERATED) \ $(HTML_EDITOR_GENERATED) \ + composer-marshal.c \ e-msg-composer-attachment-bar.c \ e-msg-composer-attachment-bar.h \ e-msg-composer-attachment.c \ @@ -83,6 +97,7 @@ libcomposer_a_SOURCES = \ EXTRA_DIST = \ $(glade_DATA) \ $(IDLS) \ + composer-marshal.list \ bad-icon.xpm BUILT_SOURCES = $(IDL_GENERATED) $(HTML_EDITOR_GENERATED) diff --git a/composer/composer-marshal.list b/composer/composer-marshal.list new file mode 100644 index 0000000000..a449f32486 --- /dev/null +++ b/composer/composer-marshal.list @@ -0,0 +1,4 @@ + +# for e-icon-list +VOID:INT,BOXED +BOOLEAN:INT,POINTER diff --git a/composer/e-icon-list.c b/composer/e-icon-list.c index 9b5f80bff0..ee3e22628d 100644 --- a/composer/e-icon-list.c +++ b/composer/e-icon-list.c @@ -50,10 +50,12 @@ #include <gtk/gtksignal.h> #include <gtk/gtkwidget.h> #include <libgnomeui/gnome-icon-item.h> -#include <libgnomeui/gnome-canvas-rect-ellipse.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> +#include <libgnomecanvas/gnome-canvas-rect-ellipse.h> +#include <libgnomecanvas/gnome-canvas-pixbuf.h> #include "e-icon-list.h" +#include "composer-marshal.h" + #include "bad-icon.xpm" /* Aliases to minimize screen use in my laptop */ @@ -101,6 +103,7 @@ static GnomeCanvasClass *parent_class; /* Icon structure */ typedef struct { /* Icon image and text items */ + GnomeCanvasPixbuf *image; GnomeIconTextItem *text; @@ -228,9 +231,10 @@ static void icon_get_height (Icon *icon, int *icon_height, int *text_height) { double d_icon_height; - gtk_object_get(GTK_OBJECT(icon->image), "height", &d_icon_height, NULL); + + g_object_get(icon->image, "height", &d_icon_height, NULL); *icon_height = d_icon_height; - *text_height = icon->text->ti->height; + *text_height = ((GnomeCanvasItem *)(icon->text))->y2 - ((GnomeCanvasItem *)(icon->text))->y1; } static int @@ -275,7 +279,7 @@ eil_place_icon (Eil *eil, Icon *icon, int x, int y, int icon_height) priv = eil->_priv; - gtk_object_get(GTK_OBJECT(icon->image), "height", &d_icon_image_height, NULL); + g_object_get(icon->image, "height", &d_icon_image_height, NULL); icon_image_height = d_icon_image_height; g_assert(icon_image_height != 0); if (icon_height > icon_image_height) @@ -283,7 +287,7 @@ eil_place_icon (Eil *eil, Icon *icon, int x, int y, int icon_height) else y_offset = 0; - gtk_object_get(GTK_OBJECT(icon->image), "width", &d_icon_image_width, NULL); + g_object_get(icon->image, "width", &d_icon_image_width, NULL); icon_image_width = d_icon_image_width; g_assert(icon_image_width != 0); if (priv->icon_width > icon_image_width) @@ -524,10 +528,10 @@ eil_scrollbar_adjust (Eil *eil) static void emit_select (Eil *eil, int sel, int i, GdkEvent *event) { - gtk_signal_emit (GTK_OBJECT (eil), - eil_signals[sel ? SELECT_ICON : UNSELECT_ICON], - i, - event); + g_signal_emit (eil, + eil_signals[sel ? SELECT_ICON : UNSELECT_ICON], + i, + event); } static int @@ -622,7 +626,7 @@ selection_one_icon_event (Eil *eil, Icon *icon, int idx, int on_text, GdkEvent * * destroyed by one of the signal handlers. */ text = icon->text; - gtk_object_ref (GTK_OBJECT (text)); + g_object_ref(text); switch (event->type) { case GDK_BUTTON_PRESS: @@ -676,9 +680,8 @@ selection_one_icon_event (Eil *eil, Icon *icon, int idx, int on_text, GdkEvent * * icon text item's own handler from executing. */ if (on_text && retval) - gtk_signal_emit_stop_by_name (GTK_OBJECT (text), "event"); - - gtk_object_unref (GTK_OBJECT (text)); + g_signal_stop_emission_by_name(text, "event"); + g_object_unref(text); return retval; } @@ -765,7 +768,7 @@ selection_many_icon_event (Eil *eil, Icon *icon, int idx, int on_text, GdkEvent * destroyed by one of the signal handlers. */ text = icon->text; - gtk_object_ref (GTK_OBJECT (text)); + g_object_ref(text); range = (event->button.state & GDK_SHIFT_MASK) != 0; additive = (event->button.state & GDK_CONTROL_MASK) != 0; @@ -818,7 +821,7 @@ selection_many_icon_event (Eil *eil, Icon *icon, int idx, int on_text, GdkEvent retval = TRUE; break; - case GDK_2BUTTON_PRESS: + case GDK_2BUTTON_PRESS: case GDK_3BUTTON_PRESS: /* Ignore wheel mouse clicks for now */ if (event->button.button > 3) @@ -864,9 +867,9 @@ selection_many_icon_event (Eil *eil, Icon *icon, int idx, int on_text, GdkEvent * icon text item's own handler from executing. */ if (on_text && retval) - gtk_signal_emit_stop_by_name (GTK_OBJECT (text), "event"); + g_signal_stop_emission_by_name (text, "event"); - gtk_object_unref (GTK_OBJECT (text)); + g_object_unref(text); return retval; } @@ -893,7 +896,6 @@ icon_event (GnomeCanvasItem *item, GdkEvent *event, gpointer data) return selection_one_icon_event (eil, icon, idx, on_text, event); case GTK_SELECTION_MULTIPLE: - case GTK_SELECTION_EXTENDED: return selection_many_icon_event (eil, icon, idx, on_text, event); default: @@ -911,7 +913,7 @@ editing_started (GnomeIconTextItem *iti, gpointer data) Icon *icon; icon = data; - gtk_signal_handler_block (GTK_OBJECT (iti), icon->text_event_id); + g_signal_handler_block(iti, icon->text_event_id); eil_unselect_all (EIL (GNOME_CANVAS_ITEM (iti)->canvas), NULL, icon); } @@ -924,7 +926,7 @@ editing_stopped (GnomeIconTextItem *iti, gpointer data) Icon *icon; icon = data; - gtk_signal_handler_unblock (GTK_OBJECT (iti), icon->text_event_id); + g_signal_handler_unblock(iti, icon->text_event_id); } static gboolean @@ -938,10 +940,10 @@ text_changed (GnomeCanvasItem *item, Icon *icon) accept = TRUE; idx = eil_icon_to_index (eil, icon); - gtk_signal_emit (GTK_OBJECT (eil), - eil_signals[TEXT_CHANGED], - idx, gnome_icon_text_item_get_text (icon->text), - &accept); + g_signal_emit (GTK_OBJECT (eil), + eil_signals[TEXT_CHANGED], + idx, gnome_icon_text_item_get_text (icon->text), + &accept); return accept; } @@ -992,7 +994,7 @@ icon_new_from_pixbuf (EIconList *eil, GdkPixbuf *im, if (im == NULL) im = gdk_pixbuf_new_from_xpm_data ((const char**) bad_icon_xpm); else - gdk_pixbuf_ref (im); + g_object_ref (im); icon->image = GNOME_CANVAS_PIXBUF (gnome_canvas_item_new ( group, @@ -1003,7 +1005,7 @@ icon_new_from_pixbuf (EIconList *eil, GdkPixbuf *im, "height", (double) gdk_pixbuf_get_height (im), "pixbuf", im, NULL)); - gdk_pixbuf_unref (im); + g_object_unref (im); icon->text = GNOME_ICON_TEXT_ITEM (gnome_canvas_item_new ( group, @@ -1020,26 +1022,26 @@ icon_new_from_pixbuf (EIconList *eil, GdkPixbuf *im, "-adobe-helvetica-medium-r-normal-*-*-120-*-*-p-*-iso8859-1", text, priv->is_editable, priv->static_text); - gtk_signal_connect (GTK_OBJECT (icon->image), "event", - GTK_SIGNAL_FUNC (icon_event), - icon); - icon->text_event_id = gtk_signal_connect (GTK_OBJECT (icon->text), "event", - GTK_SIGNAL_FUNC (icon_event), - icon); - - gtk_signal_connect (GTK_OBJECT (icon->text), "editing_started", - GTK_SIGNAL_FUNC (editing_started), - icon); - gtk_signal_connect (GTK_OBJECT (icon->text), "editing_stopped", - GTK_SIGNAL_FUNC (editing_stopped), - icon); - - gtk_signal_connect (GTK_OBJECT (icon->text), "text_changed", - GTK_SIGNAL_FUNC (text_changed), - icon); - gtk_signal_connect (GTK_OBJECT (icon->text), "height_changed", - GTK_SIGNAL_FUNC (height_changed), - icon); + g_signal_connect (icon->image, "event", + G_CALLBACK (icon_event), + icon); + icon->text_event_id = g_signal_connect (icon->text, "event", + G_CALLBACK (icon_event), + icon); + + g_signal_connect (icon->text, "editing_started", + G_CALLBACK (editing_started), + icon); + g_signal_connect (icon->text, "editing_stopped", + G_CALLBACK (editing_stopped), + icon); + + g_signal_connect (icon->text, "text_changed", + G_CALLBACK (text_changed), + icon); + g_signal_connect (icon->text, "height_changed", + G_CALLBACK (height_changed), + icon); return icon; } @@ -1051,7 +1053,7 @@ icon_new (Eil *eil, const char *icon_filename, const char *text) Icon *retval; if (icon_filename) { - im = gdk_pixbuf_new_from_file (icon_filename); + im = gdk_pixbuf_new_from_file (icon_filename, NULL); /* Bad icon image Fixme. Need a better graphic. */ @@ -1063,7 +1065,7 @@ icon_new (Eil *eil, const char *icon_filename, const char *text) retval = icon_new_from_pixbuf (eil, im, icon_filename, text); if(im) - gdk_pixbuf_unref(im); + g_object_unref(im); return retval; } @@ -1272,7 +1274,6 @@ e_icon_list_remove (EIconList *eil, int pos) case GTK_SELECTION_SINGLE: case GTK_SELECTION_BROWSE: case GTK_SELECTION_MULTIPLE: - case GTK_SELECTION_EXTENDED: e_icon_list_unselect_icon (eil, pos); break; @@ -1385,7 +1386,7 @@ eil_destroy (GtkObject *object) } static void -eil_finalize (GtkObject *object) +eil_finalize (GObject *object) { Eil *eil; @@ -1394,8 +1395,8 @@ eil_finalize (GtkObject *object) g_free (eil->_priv); eil->_priv = NULL; - if (GTK_OBJECT_CLASS (parent_class)->finalize) - (*GTK_OBJECT_CLASS (parent_class)->finalize) (object); + if (G_OBJECT_CLASS (parent_class)->finalize) + (*G_OBJECT_CLASS (parent_class)->finalize) (object); } @@ -1424,7 +1425,6 @@ select_icon (Eil *eil, int pos, GdkEvent *event) break; case GTK_SELECTION_MULTIPLE: - case GTK_SELECTION_EXTENDED: emit_select (eil, TRUE, pos, event); break; @@ -1461,7 +1461,6 @@ unselect_icon (Eil *eil, int pos, GdkEvent *event) case GTK_SELECTION_SINGLE: case GTK_SELECTION_BROWSE: case GTK_SELECTION_MULTIPLE: - case GTK_SELECTION_EXTENDED: emit_select (eil, FALSE, pos, event); break; @@ -1666,7 +1665,7 @@ eil_button_press (GtkWidget *widget, GdkEventButton *event) "width_pixels", 1, "outline_stipple", stipple, NULL); - gdk_bitmap_unref (stipple); + g_object_unref (stipple); gnome_canvas_item_grab (priv->sel_rect, GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, NULL, event->time); @@ -1881,52 +1880,26 @@ eil_motion_notify (GtkWidget *widget, GdkEventMotion *event) return TRUE; } -typedef gboolean (*xGtkSignal_BOOL__INT_POINTER) (GtkObject * object, - gint arg1, - gpointer arg2, - gpointer user_data); -static void -xgtk_marshal_BOOL__INT_POINTER (GtkObject *object, GtkSignalFunc func, gpointer func_data, - GtkArg *args) -{ - xGtkSignal_BOOL__INT_POINTER rfunc; - gboolean *return_val; - - return_val = GTK_RETLOC_BOOL (args[2]); - rfunc = (xGtkSignal_BOOL__INT_POINTER) func; - *return_val = (*rfunc) (object, - GTK_VALUE_INT (args[0]), - GTK_VALUE_POINTER (args[1]), - func_data); -} - +/* ??? i dont know if this is needed to override other properties, or it was + just here because it was taken from a template? */ static void -eil_set_arg (GtkObject *object, GtkArg *arg, guint arg_id) +eil_set_property (GObject *gobject, guint arg_id, const GValue *value, GParamSpec *pspec) { EIconList *eil; - eil = E_ICON_LIST (object); + eil = E_ICON_LIST (gobject); - switch (arg_id) { - default: - break; - } + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, arg_id, pspec); } static void -eil_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +eil_get_property (GObject *gobject, guint arg_id, GValue *value, GParamSpec *pspec) { EIconList *eil; - EIconListPrivate *priv; - eil = E_ICON_LIST (object); - priv = eil->_priv; + eil = E_ICON_LIST (gobject); - switch (arg_id) { - default: - arg->type = GTK_TYPE_INVALID; - break; - } + G_OBJECT_WARN_INVALID_PROPERTY_ID (gobject, arg_id, pspec); } static void @@ -1936,53 +1909,51 @@ eil_class_init (EilClass *eil_class) GtkWidgetClass *widget_class; GtkLayoutClass *layout_class; GnomeCanvasClass *canvas_class; + GObjectClass *klass; + klass = (GObjectClass *)eil_class; object_class = (GtkObjectClass *) eil_class; widget_class = (GtkWidgetClass *) eil_class; layout_class = (GtkLayoutClass *) eil_class; canvas_class = (GnomeCanvasClass *) eil_class; - parent_class = gtk_type_class (gnome_canvas_get_type ()); + parent_class = g_type_class_ref(gnome_canvas_get_type()); eil_signals[SELECT_ICON] = - gtk_signal_new ( - "select_icon", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconListClass, select_icon), - gtk_marshal_NONE__INT_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_INT, - GTK_TYPE_GDK_EVENT); + g_signal_new("select_icon", E_TYPE_ICON_LIST, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(EIconListClass, select_icon), + NULL, + NULL, + e_msg_composer_marshal_VOID__INT_BOXED, + G_TYPE_NONE, + 2, G_TYPE_INT, GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); eil_signals[UNSELECT_ICON] = - gtk_signal_new ( - "unselect_icon", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconListClass, unselect_icon), - gtk_marshal_NONE__INT_POINTER, - GTK_TYPE_NONE, 2, - GTK_TYPE_INT, - GTK_TYPE_GDK_EVENT); + g_signal_new("unselect_icon", E_TYPE_ICON_LIST, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(EIconListClass, unselect_icon), + NULL, + NULL, + e_msg_composer_marshal_VOID__INT_BOXED, + G_TYPE_NONE, + 2, G_TYPE_INT, GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE); eil_signals[TEXT_CHANGED] = - gtk_signal_new ( - "text_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EIconListClass, text_changed), - xgtk_marshal_BOOL__INT_POINTER, - GTK_TYPE_BOOL, 2, - GTK_TYPE_INT, - GTK_TYPE_POINTER); - - gtk_object_class_add_signals (object_class, eil_signals, LAST_SIGNAL); + g_signal_new("text_changed", E_TYPE_ICON_LIST, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EIconListClass, text_changed), + NULL, + NULL, + e_msg_composer_marshal_BOOLEAN__INT_POINTER, + G_TYPE_BOOLEAN, + 2, G_TYPE_INT, G_TYPE_POINTER); + + klass->finalize = eil_finalize; + klass->set_property = eil_set_property; + klass->get_property = eil_get_property; object_class->destroy = eil_destroy; - object_class->finalize = eil_finalize; - object_class->set_arg = eil_set_arg; - object_class->get_arg = eil_get_arg; widget_class->size_request = eil_size_request; widget_class->size_allocate = eil_size_allocate; @@ -2022,25 +1993,25 @@ eil_init (Eil *eil) * * Returns: The type ID of the &EIconList class. */ -guint +GType e_icon_list_get_type (void) { - static guint eil_type = 0; + static GType eil_type = 0; if (!eil_type) { - GtkTypeInfo eil_info = { - "EIconList", - sizeof (EIconList), + GTypeInfo eil_info = { sizeof (EIconListClass), - (GtkClassInitFunc) eil_class_init, - (GtkObjectInitFunc) eil_init, NULL, NULL, - NULL + (GClassInitFunc) eil_class_init, + NULL, + NULL, + sizeof (EIconList), + 0, + (GInstanceInitFunc) eil_init, }; - eil_type = gtk_type_unique (gnome_canvas_get_type (), - &eil_info); + eil_type = g_type_register_static(gnome_canvas_get_type (), "EIconList", &eil_info, 0); } return eil_type; @@ -2126,9 +2097,7 @@ e_icon_list_new (guint icon_width, int flags) { Eil *eil; - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - eil = EIL (gtk_type_new (e_icon_list_get_type ())); - gtk_widget_pop_colormap (); + eil = EIL (g_type_new (e_icon_list_get_type (), NULL, NULL)); e_icon_list_construct (eil, icon_width, flags); @@ -2562,7 +2531,7 @@ e_icon_list_get_icon_at (EIconList *eil, int x, int y) GnomeCanvasItem *text = GNOME_CANVAS_ITEM (icon->text); if (wx >= image->x1 && wx <= image->x2 && wy >= image->y1 && wy <= image->y2) { - dist = (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (image)->klass)->point) ( + dist = (* GNOME_CANVAS_ITEM_GET_CLASS (image)->point) ( image, wx, wy, cx, cy, @@ -2574,7 +2543,7 @@ e_icon_list_get_icon_at (EIconList *eil, int x, int y) } if (wx >= text->x1 && wx <= text->x2 && wy >= text->y1 && wy <= text->y2) { - dist = (* GNOME_CANVAS_ITEM_CLASS (GTK_OBJECT (text)->klass)->point) ( + dist = (* GNOME_CANVAS_ITEM_GET_CLASS (text)->point) ( text, wx, wy, cx, cy, diff --git a/composer/e-icon-list.h b/composer/e-icon-list.h index 7cdaf6e85f..90697185c7 100644 --- a/composer/e-icon-list.h +++ b/composer/e-icon-list.h @@ -36,7 +36,7 @@ #define _E_ICON_LIST_H_ #include <libgnome/gnome-defs.h> -#include <libgnomeui/gnome-canvas.h> +#include <libgnomecanvas/gnome-canvas.h> #include <gdk-pixbuf/gdk-pixbuf.h> BEGIN_GNOME_DECLS @@ -83,7 +83,7 @@ enum { E_ICON_LIST_STATIC_TEXT = 1 << 1 }; -guint e_icon_list_get_type (void) G_GNUC_CONST; +GType e_icon_list_get_type (void) G_GNUC_CONST; GtkWidget *e_icon_list_new (guint icon_width, int flags); diff --git a/composer/e-msg-composer-attachment-bar.c b/composer/e-msg-composer-attachment-bar.c index b5ddc9232b..e6b1666df1 100644 --- a/composer/e-msg-composer-attachment-bar.c +++ b/composer/e-msg-composer-attachment-bar.c @@ -35,10 +35,9 @@ #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-dialog.h> #include <glade/glade.h> -#include <libgnomevfs/gnome-vfs-mime-info.h> +#include <libgnomevfs/gnome-vfs-mime-handlers.h> #include <gdk-pixbuf/gdk-pixbuf.h> #include <gdk-pixbuf/gdk-pixbuf-loader.h> -#include <gdk-pixbuf/gnome-canvas-pixbuf.h> #include "e-msg-composer.h" #include "e-msg-composer-select-file.h" @@ -128,7 +127,7 @@ free_attachment_list (EMsgComposerAttachmentBar *bar) priv = bar->priv; for (p = priv->attachments; p != NULL; p = p->next) - gtk_object_unref (GTK_OBJECT (p->data)); + g_object_unref(p->data); priv->attachments = NULL; } @@ -146,9 +145,9 @@ add_common (EMsgComposerAttachmentBar *bar, { g_return_if_fail (attachment != NULL); - gtk_signal_connect (GTK_OBJECT (attachment), "changed", - GTK_SIGNAL_FUNC (attachment_changed_cb), - bar); + g_signal_connect(attachment, "changed", + G_CALLBACK (attachment_changed_cb), + bar); bar->priv->attachments = g_list_append (bar->priv->attachments, attachment); @@ -156,7 +155,7 @@ add_common (EMsgComposerAttachmentBar *bar, update (bar); - gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]); + g_signal_emit (bar, 0, signals[CHANGED]); } static void @@ -182,12 +181,13 @@ add_from_file (EMsgComposerAttachmentBar *bar, add_common (bar, attachment); } else { composer = E_MSG_COMPOSER (gtk_widget_get_toplevel (GTK_WIDGET (bar))); - - dialog = gnome_error_dialog_parented (camel_exception_get_description (&ex), - GTK_WINDOW (composer)); - - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - + dialog = gtk_message_dialog_new(GTK_WINDOW(composer), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "%s", camel_exception_get_description (&ex)); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_object_unref(dialog); camel_exception_clear (&ex); } } @@ -200,9 +200,9 @@ remove_attachment (EMsgComposerAttachmentBar *bar, attachment); bar->priv->num_attachments--; - gtk_object_unref (GTK_OBJECT (attachment)); + g_object_unref(attachment); - gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]); + g_signal_emit (GTK_OBJECT (bar), 0, signals[CHANGED]); } @@ -223,31 +223,31 @@ pixbuf_for_mime_type (const char *mime_type) || strcmp (mime_type, "message/rfc822") == 0) { char *name; - name = g_concat_dir_and_file (EVOLUTION_ICONSDIR, "mail.png"); - pixbuf = gdk_pixbuf_new_from_file (name); + name = g_build_filename(EVOLUTION_ICONSDIR, "mail.png", NULL); + pixbuf = gdk_pixbuf_new_from_file (name, NULL); g_free (name); if (pixbuf != NULL) return pixbuf; } - icon_name = gnome_vfs_mime_get_value (mime_type, "icon-filename"); + icon_name = gnome_vfs_mime_get_icon(mime_type); if (icon_name) { if (*icon_name == '/') { - pixbuf = gdk_pixbuf_new_from_file (icon_name); + pixbuf = gdk_pixbuf_new_from_file (icon_name, NULL); if (pixbuf) return pixbuf; } - filename = gnome_pixmap_file (icon_name); + filename = gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_PIXMAP, icon_name, TRUE, NULL); if (!filename) { char *fm_icon; fm_icon = g_strdup_printf ("nautilus/%s", icon_name); - filename = gnome_pixmap_file (fm_icon); + filename = gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_PIXMAP, fm_icon, TRUE, NULL); if (!filename) { fm_icon = g_strdup_printf ("mc/%s", icon_name); - filename = gnome_pixmap_file (fm_icon); + filename = gnome_program_locate_file(NULL, GNOME_FILE_DOMAIN_PIXMAP, fm_icon, TRUE, NULL); } g_free (fm_icon); } @@ -256,7 +256,7 @@ pixbuf_for_mime_type (const char *mime_type) if (!filename) filename = gnome_pixmap_file ("gnome-unknown.png"); - pixbuf = gdk_pixbuf_new_from_file (filename); + pixbuf = gdk_pixbuf_new_from_file (filename, NULL); g_free (filename); return pixbuf; @@ -283,7 +283,7 @@ update (EMsgComposerAttachmentBar *bar) CamelContentType *content_type; GdkPixbuf *pixbuf; gboolean image; - char *desc; + const char *desc; attachment = p->data; content_type = camel_mime_part_get_content_type (attachment->body); @@ -311,8 +311,7 @@ update (EMsgComposerAttachmentBar *bar) do { t = camel_stream_read (mstream, tmp, 4096); if (t > 0) { - error = !gdk_pixbuf_loader_write (loader, - tmp, t); + error = !gdk_pixbuf_loader_write (loader, tmp, t, NULL); if (error) { break; } @@ -357,27 +356,22 @@ update (EMsgComposerAttachmentBar *bar) } /* Destroy everything */ - gdk_pixbuf_loader_close (loader); - gtk_object_unref (GTK_OBJECT (loader)); + gdk_pixbuf_loader_close (loader, NULL); + g_object_unref (loader); camel_stream_close (mstream); } - desc = e_utf8_to_gtk_string (GTK_WIDGET (icon_list), camel_mime_part_get_description (attachment->body)); + desc = camel_mime_part_get_description (attachment->body); if (!desc || *desc == '\0') - desc = e_utf8_to_gtk_string (GTK_WIDGET (icon_list), - camel_mime_part_get_filename (attachment->body)); + desc = camel_mime_part_get_filename (attachment->body); if (!desc) - desc = g_strdup (_("attachment")); + desc = _("attachment"); - if (attachment->size) { - size_string = size_to_string (attachment->size); - if (size_string == NULL) { - label = g_strdup (desc); - } else { - label = g_strdup_printf ("%s (%s)", desc, size_string); - g_free (size_string); - } + if (attachment->size + && (size_string = size_to_string (attachment->size))) { + label = g_strdup_printf ("%s (%s)", desc, size_string); + g_free (size_string); } else label = g_strdup (desc); @@ -392,10 +386,9 @@ update (EMsgComposerAttachmentBar *bar) e_icon_list_append_pixbuf (icon_list, pixbuf, NULL, label); if (pixbuf) - gdk_pixbuf_unref (pixbuf); + g_object_unref (pixbuf); } - g_free (desc); g_free (label); } @@ -480,8 +473,7 @@ add_from_user (EMsgComposerAttachmentBar *bar) /* Callbacks. */ static void -add_cb (GtkWidget *widget, - gpointer data) +add_cb (GtkWidget *widget, gpointer data, GtkWidget *for_widget) { g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT_BAR (data)); @@ -489,8 +481,7 @@ add_cb (GtkWidget *widget, } static void -properties_cb (GtkWidget *widget, - gpointer data) +properties_cb (GtkWidget *widget, gpointer data, GtkWidget *for_widget) { EMsgComposerAttachmentBar *bar; @@ -501,8 +492,7 @@ properties_cb (GtkWidget *widget, } static void -remove_cb (GtkWidget *widget, - gpointer data) +remove_cb (GtkWidget *widget, gpointer data, GtkWidget *for_widget) { EMsgComposerAttachmentBar *bar; @@ -544,7 +534,7 @@ popup_icon_context_menu (EMsgComposerAttachmentBar *bar, GtkWidget *menu; menu = get_icon_context_menu (bar); - gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar); + gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar, NULL); } static GnomeUIInfo context_menu_info[] = { @@ -573,7 +563,7 @@ popup_context_menu (EMsgComposerAttachmentBar *bar, GtkWidget *menu; menu = get_context_menu (bar); - gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar); + gnome_popup_menu_do_popup (menu, NULL, NULL, event, bar, NULL); } @@ -585,11 +575,13 @@ destroy (GtkObject *object) EMsgComposerAttachmentBar *bar; bar = E_MSG_COMPOSER_ATTACHMENT_BAR (object); - - free_attachment_list (bar); - - g_free (bar->priv); - + + if (bar->priv) { + free_attachment_list (bar); + g_free (bar->priv); + bar->priv = NULL; + } + if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -638,7 +630,7 @@ class_init (EMsgComposerAttachmentBarClass *class) widget_class = GTK_WIDGET_CLASS (class); icon_list_class = E_ICON_LIST_CLASS (class); - parent_class = gtk_type_class (e_icon_list_get_type ()); + parent_class = g_type_class_ref(e_icon_list_get_type ()); object_class->destroy = destroy; @@ -647,15 +639,13 @@ class_init (EMsgComposerAttachmentBarClass *class) /* Setup signals. */ signals[CHANGED] = - gtk_signal_new ("changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMsgComposerAttachmentBarClass, - changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); + g_signal_new ("changed", + E_TYPE_MSG_COMPOSER_ATTACHMENT_BAR, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMsgComposerAttachmentBarClass, changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -679,32 +669,33 @@ init (EMsgComposerAttachmentBar *bar) allow at least 2 lines for every item. */ icon_size = ICON_WIDTH + ICON_SPACING + ICON_BORDER + ICON_TEXT_SPACING; - font = GTK_WIDGET (bar)->style->font; - icon_height = icon_size + ((font->ascent + font->descent) * 2); + /*font = GTK_WIDGET (bar)->style->font; + icon_height = icon_size + ((font->ascent + font->descent) * 2);*/ +#warning "FIXME: check icon_hight calculation with pango_font" + icon_height = icon_size + pango_font_description_get_size(GTK_WIDGET (bar)->style->font_desc)*2; icon_size += 24; - gtk_widget_set_usize (GTK_WIDGET (bar), icon_size * 4, icon_height); + gtk_widget_set_size_request (GTK_WIDGET (bar), icon_size * 4, icon_height); } -GtkType +GType e_msg_composer_attachment_bar_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (type == 0) { - static const GtkTypeInfo info = { - "EMsgComposerAttachmentBar", - sizeof (EMsgComposerAttachmentBar), + static const GTypeInfo info = { sizeof (EMsgComposerAttachmentBarClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, NULL, + (GClassInitFunc) class_init, + NULL, NULL, + sizeof (EMsgComposerAttachmentBar), + 0, + (GInstanceInitFunc) init, }; - type = gtk_type_unique (e_icon_list_get_type (), &info); + type = g_type_register_static(e_icon_list_get_type(), "EMsgComposerAttachmentBar", &info, 0); } return type; @@ -716,12 +707,7 @@ e_msg_composer_attachment_bar_new (GtkAdjustment *adj) EMsgComposerAttachmentBar *new; EIconList *icon_list; - gdk_rgb_init (); - gtk_widget_push_visual (gdk_rgb_get_visual ()); - gtk_widget_push_colormap (gdk_rgb_get_cmap ()); - new = gtk_type_new (e_msg_composer_attachment_bar_get_type ()); - gtk_widget_pop_visual (); - gtk_widget_pop_colormap (); + new = g_object_new (e_msg_composer_attachment_bar_get_type (), NULL); icon_list = E_ICON_LIST (new); diff --git a/composer/e-msg-composer-attachment.c b/composer/e-msg-composer-attachment.c index 5903fc3928..0f7c06ff26 100644 --- a/composer/e-msg-composer-attachment.c +++ b/composer/e-msg-composer-attachment.c @@ -35,7 +35,7 @@ #include <gtk/gtktogglebutton.h> #include <camel/camel.h> #include <gal/widgets/e-unicode.h> -#include <libgnomevfs/gnome-vfs-mime.h> +#include <libgnomevfs/gnome-vfs-mime-utils.h> #include "e-msg-composer.h" #include "e-msg-composer-attachment.h" @@ -53,22 +53,24 @@ static GtkObjectClass *parent_class = NULL; static void changed (EMsgComposerAttachment *attachment) { - gtk_signal_emit (GTK_OBJECT (attachment), signals[CHANGED]); + g_signal_emit(attachment, signals[CHANGED], 0); } /* GtkObject methods. */ static void -destroy (GtkObject *object) +finalise(GObject *object) { EMsgComposerAttachment *attachment; attachment = E_MSG_COMPOSER_ATTACHMENT (object); - camel_object_unref (CAMEL_OBJECT (attachment->body)); + camel_object_unref(attachment->body); if (attachment->pixbuf_cache != NULL) - gdk_pixbuf_unref (attachment->pixbuf_cache); + g_object_unref(attachment->pixbuf_cache); + + G_OBJECT_CLASS(parent_class)->finalize(object); } @@ -85,27 +87,22 @@ real_changed (EMsgComposerAttachment *msg_composer_attachment) static void class_init (EMsgComposerAttachmentClass *klass) { - GtkObjectClass *object_class; - - object_class = (GtkObjectClass*) klass; - - parent_class = gtk_type_class (gtk_object_get_type ()); - - object_class->destroy = destroy; - - signals[CHANGED] = gtk_signal_new ("changed", - GTK_RUN_FIRST, - object_class->type, - GTK_SIGNAL_OFFSET - (EMsgComposerAttachmentClass, - changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + GObjectClass *object_class; + object_class = (GObjectClass*) klass; + parent_class = g_type_class_ref(G_TYPE_OBJECT); - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); - + object_class->finalize = finalise; klass->changed = real_changed; + + signals[CHANGED] = g_signal_new ("changed", + E_TYPE_MSG_COMPOSER_ATTACHMENT, + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET(EMsgComposerAttachmentClass, changed), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -117,24 +114,25 @@ init (EMsgComposerAttachment *msg_composer_attachment) msg_composer_attachment->pixbuf_cache = NULL; } -GtkType +GType e_msg_composer_attachment_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (type == 0) { - static const GtkTypeInfo info = { - "EMsgComposerAttachment", - sizeof (EMsgComposerAttachment), + static const GTypeInfo info = { sizeof (EMsgComposerAttachmentClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof (EMsgComposerAttachment), + 0, + (GInstanceInitFunc) init, }; - type = gtk_type_unique (gtk_object_get_type (), &info); + type = g_type_register_static(G_TYPE_OBJECT, "EMsgComposerAttachment", &info, 0); } return type; @@ -161,7 +159,7 @@ e_msg_composer_attachment_new (const char *file_name, struct stat statbuf; char *mime_type; char *filename; - + g_return_val_if_fail (file_name != NULL, NULL); if (stat (file_name, &statbuf) < 0) { @@ -205,14 +203,14 @@ e_msg_composer_attachment_new (const char *file_name, } else camel_data_wrapper_set_mime_type (wrapper, "application/octet-stream"); - camel_object_unref (CAMEL_OBJECT (stream)); + camel_object_unref (stream); part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (CAMEL_OBJECT (wrapper)); + camel_object_unref (wrapper); camel_mime_part_set_disposition (part, disposition); - filename = e_utf8_from_locale_string (g_basename (file_name)); + filename = g_path_get_basename(file_name); camel_mime_part_set_filename (part, filename); g_free (filename); @@ -227,7 +225,7 @@ e_msg_composer_attachment_new (const char *file_name, g_free (content_id); #endif - new = gtk_type_new (e_msg_composer_attachment_get_type ()); + new = g_object_new(E_TYPE_MSG_COMPOSER_ATTACHMENT, NULL); new->editor_gui = NULL; new->body = part; new->size = statbuf.st_size; @@ -269,7 +267,7 @@ e_msg_composer_attachment_new_from_mime_part (CamelMimePart *part) camel_object_unref (stream); - new = gtk_type_new (e_msg_composer_attachment_get_type ()); + new = g_object_new(E_TYPE_MSG_COMPOSER_ATTACHMENT, NULL); new->editor_gui = NULL; new->body = mime_part; new->guessed_type = FALSE; @@ -306,18 +304,20 @@ destroy_dialog_data (DialogData *data) static void update_mime_type (DialogData *data) { - const gchar *mime_type; - gchar *file_name; + gchar *mime_type; + const gchar *file_name; if (!data->attachment->guessed_type) return; - file_name = e_utf8_gtk_entry_get_text (data->file_name_entry); - mime_type = gnome_vfs_mime_type_from_name_or_default (file_name, NULL); - g_free (file_name); + file_name = gtk_entry_get_text(data->file_name_entry); +#warning "do we need to create file uri for gnome-vfs-get-mime-type" + mime_type = gnome_vfs_get_mime_type (file_name); - if (mime_type) - e_utf8_gtk_entry_set_text (data->mime_type_entry, mime_type); + if (mime_type) { + gtk_entry_set_text (data->mime_type_entry, mime_type); + g_free(mime_type); + } } static void @@ -331,20 +331,20 @@ set_entry (GladeXML *xml, if (entry == NULL) g_warning ("Entry for `%s' not found.", widget_name); else - e_utf8_gtk_entry_set_text (entry, value ? value : ""); + gtk_entry_set_text (entry, value ? value : ""); } static void connect_widget (GladeXML *gui, const gchar *name, const gchar *signal_name, - GtkSignalFunc func, + GCallback func, gpointer data) { GtkWidget *widget; widget = glade_xml_get_widget (gui, name); - gtk_signal_connect (GTK_OBJECT (widget), signal_name, func, data); + g_signal_connect(widget, signal_name, func, data); } static void @@ -355,9 +355,10 @@ close_cb (GtkWidget *widget, gpointer data) dialog_data = (DialogData *) data; attachment = dialog_data->attachment; - + + /* need to unref dialog? */ gtk_widget_destroy (dialog_data->dialog); - gtk_object_unref (GTK_OBJECT (attachment->editor_gui)); + g_object_unref(attachment->editor_gui); attachment->editor_gui = NULL; destroy_dialog_data (dialog_data); @@ -368,25 +369,21 @@ ok_cb (GtkWidget *widget, gpointer data) { DialogData *dialog_data; EMsgComposerAttachment *attachment; - char *str; + const gchar *str; dialog_data = (DialogData *) data; attachment = dialog_data->attachment; - str = e_utf8_gtk_entry_get_text (dialog_data->file_name_entry); + str = gtk_entry_get_text (dialog_data->file_name_entry); camel_mime_part_set_filename (attachment->body, str); - g_free (str); - str = e_utf8_gtk_entry_get_text (dialog_data->description_entry); + str = gtk_entry_get_text (dialog_data->description_entry); camel_mime_part_set_description (attachment->body, str); - g_free (str); - str = e_utf8_gtk_entry_get_text (dialog_data->mime_type_entry); + str = gtk_entry_get_text (dialog_data->mime_type_entry); camel_mime_part_set_content_type (attachment->body, str); - camel_data_wrapper_set_mime_type ( - camel_medium_get_content_object (CAMEL_MEDIUM (attachment->body)), str); - g_free (str); + camel_data_wrapper_set_mime_type(camel_medium_get_content_object(CAMEL_MEDIUM (attachment->body)), str); switch (gtk_toggle_button_get_active (dialog_data->disposition_checkbox)) { case 0: @@ -436,7 +433,7 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment, } editor_gui = glade_xml_new (E_GLADEDIR "/e-msg-composer-attachment.glade", - NULL); + NULL, NULL); if (editor_gui == NULL) { g_warning ("Cannot load `e-msg-composer-attachment.glade'"); return; @@ -476,19 +473,20 @@ e_msg_composer_attachment_edit (EMsgComposerAttachment *attachment, disposition = camel_mime_part_get_disposition (attachment->body); gtk_toggle_button_set_active (dialog_data->disposition_checkbox, - disposition && !g_strcasecmp (disposition, "inline")); + disposition && !g_ascii_strcasecmp (disposition, "inline")); } - connect_widget (editor_gui, "ok_button", "clicked", ok_cb, dialog_data); - connect_widget (editor_gui, "close_button", "clicked", close_cb, dialog_data); + connect_widget (editor_gui, "ok_button", "clicked", (GCallback)ok_cb, dialog_data); + connect_widget (editor_gui, "close_button", "clicked", (GCallback)close_cb, dialog_data); connect_widget (editor_gui, "file_name_entry", "focus_out_event", - file_name_focus_out_cb, dialog_data); - + (GCallback)file_name_focus_out_cb, dialog_data); + +#warning "signal connect while alive" /* make sure that when the composer gets hidden/closed that our windows also close */ parent = gtk_widget_get_toplevel (parent); - gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy", close_cb, dialog_data, + gtk_signal_connect_while_alive (GTK_OBJECT (parent), "destroy", (GCallback)close_cb, dialog_data, GTK_OBJECT (dialog_data->dialog)); - gtk_signal_connect_while_alive (GTK_OBJECT (parent), "hide", close_cb, dialog_data, + gtk_signal_connect_while_alive (GTK_OBJECT (parent), "hide", (GCallback)close_cb, dialog_data, GTK_OBJECT (dialog_data->dialog)); } diff --git a/composer/e-msg-composer-attachment.h b/composer/e-msg-composer-attachment.h index a966acaa82..d3cdd72214 100644 --- a/composer/e-msg-composer-attachment.h +++ b/composer/e-msg-composer-attachment.h @@ -44,7 +44,7 @@ typedef struct _EMsgComposerAttachment EMsgComposerAttachment; typedef struct _EMsgComposerAttachmentClass EMsgComposerAttachmentClass; struct _EMsgComposerAttachment { - GtkObject parent; + GObject parent; GladeXML *editor_gui; @@ -56,13 +56,13 @@ struct _EMsgComposerAttachment { }; struct _EMsgComposerAttachmentClass { - GtkObjectClass parent_class; + GObjectClass parent_class; void (*changed) (EMsgComposerAttachment *msg_composer_attachment); }; -GtkType e_msg_composer_attachment_get_type (void); +GType e_msg_composer_attachment_get_type (void); EMsgComposerAttachment *e_msg_composer_attachment_new (const char *file_name, const char *disposition, CamelException *ex); diff --git a/composer/e-msg-composer-hdrs.c b/composer/e-msg-composer-hdrs.c index 46bcbd1f46..13cc49cf59 100644 --- a/composer/e-msg-composer-hdrs.c +++ b/composer/e-msg-composer-hdrs.c @@ -33,7 +33,7 @@ #include <gtk/gtkoptionmenu.h> #include <gtk/gtktooltips.h> #include <libgnomeui/gnome-uidefs.h> -#include <liboaf/liboaf.h> +/*#include <liboaf/liboaf.h>*/ #include "Composer.h" @@ -111,7 +111,7 @@ setup_corba (EMsgComposerHdrs *hdrs) CORBA_exception_init (&ev); - priv->corba_select_names = oaf_activate_from_id (SELECT_NAMES_OAFIID, 0, NULL, &ev); + priv->corba_select_names = bonobo_activation_activate_from_id (SELECT_NAMES_OAFIID, 0, NULL, &ev); /* OAF seems to be broken -- it can return a CORBA_OBJECT_NIL without raising an exception in `ev'. */ @@ -134,7 +134,7 @@ static void e_msg_composer_hdrs_and_string_free (EMsgComposerHdrsAndString *emchas) { if (emchas->hdrs) - gtk_object_unref (GTK_OBJECT (emchas->hdrs)); + g_object_unref(emchas->hdrs); g_free (emchas->string); } @@ -147,7 +147,7 @@ e_msg_composer_hdrs_and_string_create (EMsgComposerHdrs *hdrs, const char *strin emchas->hdrs = hdrs; emchas->string = g_strdup (string); if (emchas->hdrs) - gtk_object_ref (GTK_OBJECT (emchas->hdrs)); + g_object_ref(emchas->hdrs); return emchas; } @@ -178,14 +178,14 @@ from_changed (GtkWidget *item, gpointer data) EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (data); const char *reply_to; - hdrs->account = gtk_object_get_data (GTK_OBJECT (item), "account"); + hdrs->account = g_object_get_data(G_OBJECT(item), "account"); /* we do this rather than calling e_msg_composer_hdrs_set_reply_to() because we don't want to change the visibility of the header */ reply_to = hdrs->account->id->reply_to; e_entry_set_text (E_ENTRY (hdrs->priv->reply_to.entry), reply_to ? reply_to : ""); - gtk_signal_emit (GTK_OBJECT (hdrs), signals [FROM_CHANGED]); + g_signal_emit(hdrs, signals [FROM_CHANGED], 0); } static GtkWidget * @@ -215,7 +215,6 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs) while (accounts) { char *label; - char *native_label; account = accounts->data; @@ -240,14 +239,12 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs) else label = g_strdup_printf ("%s <%s>", account->id->name, account->id->address); - native_label = e_utf8_to_gtk_string (GTK_WIDGET (menu), label); - item = gtk_menu_item_new_with_label (native_label); - g_free (native_label); + item = gtk_menu_item_new_with_label (label); g_free (label); - gtk_object_set_data (GTK_OBJECT (item), "account", account_copy (account)); - gtk_signal_connect (GTK_OBJECT (item), "activate", - GTK_SIGNAL_FUNC (from_changed), hdrs); + g_object_set_data(G_OBJECT(item), "account", account_copy (account)); + g_signal_connect(G_OBJECT (item), "activate", + G_CALLBACK (from_changed), hdrs); if (i == default_account) { first = item; @@ -270,7 +267,7 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs) if (first) { gtk_option_menu_set_history (GTK_OPTION_MENU (omenu), history); - gtk_signal_emit_by_name (GTK_OBJECT (first), "activate", hdrs); + g_signal_emit_by_name(first, "activate", hdrs); } hbox = gtk_hbox_new (FALSE, 3); @@ -278,21 +275,21 @@ create_from_optionmenu (EMsgComposerHdrs *hdrs) gtk_widget_show (omenu); gtk_widget_show (hbox); - gtk_object_set_data (GTK_OBJECT (hbox), "from_menu", omenu); + g_object_set_data(G_OBJECT(hbox), "from_menu", omenu); return hbox; } static void addressbook_entry_changed (BonoboListener *listener, - char *event_name, - CORBA_any *arg, + const char *event_name, + const CORBA_any *arg, CORBA_Environment *ev, gpointer user_data) { EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (user_data); - gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]); + g_signal_emit(hdrs, signals[HDRS_CHANGED], 0); } static GtkWidget * @@ -355,7 +352,7 @@ header_new_recipient (EMsgComposerHdrs *hdrs, const char *name, const char *tip) GTK_OBJECT_UNSET_FLAGS (ret.label, GTK_CAN_FOCUS); gtk_signal_connect_full ( GTK_OBJECT (ret.label), "clicked", - GTK_SIGNAL_FUNC (address_button_clicked_cb), NULL, + G_CALLBACK (address_button_clicked_cb), NULL, e_msg_composer_hdrs_and_string_create(hdrs, name), (GtkDestroyNotify) e_msg_composer_hdrs_and_string_free, FALSE, FALSE); @@ -376,12 +373,9 @@ entry_changed (GtkWidget *entry, EMsgComposerHdrs *hdrs) char *subject, *tmp; tmp = e_msg_composer_hdrs_get_subject (hdrs); - subject = e_utf8_to_gtk_string (GTK_WIDGET (entry), tmp); - - gtk_signal_emit (GTK_OBJECT (hdrs), signals[SUBJECT_CHANGED], subject); + g_signal_emit(hdrs, signals[SUBJECT_CHANGED], 0, subject); g_free (tmp); - - gtk_signal_emit (GTK_OBJECT (hdrs), signals[HDRS_CHANGED]); + g_signal_emit(hdrs, signals[HDRS_CHANGED], 0); } static void @@ -421,8 +415,8 @@ create_headers (EMsgComposerHdrs *hdrs) "use_ellipsis", TRUE, "allow_newlines", FALSE, NULL); - gtk_signal_connect (GTK_OBJECT (priv->subject.entry), "changed", - GTK_SIGNAL_FUNC (entry_changed), hdrs); + g_signal_connect(priv->subject.entry, "changed", + G_CALLBACK (entry_changed), hdrs); /* * To, CC, and Bcc @@ -578,29 +572,37 @@ destroy (GtkObject *object) hdrs = E_MSG_COMPOSER_HDRS (object); priv = hdrs->priv; - if (priv->corba_select_names != CORBA_OBJECT_NIL) { - CORBA_Environment ev; - CORBA_exception_init (&ev); - bonobo_object_release_unref (priv->corba_select_names, &ev); - CORBA_exception_free (&ev); - } - - gtk_object_destroy (GTK_OBJECT (priv->tooltips)); - gtk_object_unref (GTK_OBJECT (priv->tooltips)); - - l = priv->from_options; - while (l) { - MailConfigAccount *account; - GtkWidget *item = l->data; - - account = gtk_object_get_data (GTK_OBJECT (item), "account"); - account_destroy (account); + if (priv) { + if (priv->corba_select_names != CORBA_OBJECT_NIL) { + CORBA_Environment ev; + CORBA_exception_init (&ev); + bonobo_object_release_unref (priv->corba_select_names, &ev); + CORBA_exception_free (&ev); + priv->corba_select_names = CORBA_OBJECT_NIL; + } + + if (priv->tooltips) { + gtk_object_destroy (GTK_OBJECT (priv->tooltips)); + g_object_unref(priv->tooltips); + priv->tooltips = NULL; + } + + l = priv->from_options; + while (l) { + MailConfigAccount *account; + GtkWidget *item = l->data; + + account = g_object_get_data(G_OBJECT(item), "account"); + account_destroy (account); + + l = l->next; + } + g_slist_free (priv->from_options); + priv->from_options = NULL; - l = l->next; + g_free (priv); + hdrs->priv = NULL; } - g_slist_free (priv->from_options); - - g_free (priv); if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); @@ -615,46 +617,44 @@ class_init (EMsgComposerHdrsClass *class) object_class = GTK_OBJECT_CLASS (class); object_class->destroy = destroy; - parent_class = gtk_type_class (gtk_table_get_type ()); + parent_class = g_type_class_ref(gtk_table_get_type ()); signals[SHOW_ADDRESS_DIALOG] = - gtk_signal_new ("show_address_dialog", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass, - show_address_dialog), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("show_address_dialog", + E_TYPE_MSG_COMPOSER_HDRS, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(EMsgComposerHdrsClass, show_address_dialog), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[SUBJECT_CHANGED] = - gtk_signal_new ("subject_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass, - subject_changed), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, - 1, GTK_TYPE_STRING); + g_signal_new ("subject_changed", + E_TYPE_MSG_COMPOSER_HDRS, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(EMsgComposerHdrsClass, subject_changed), + NULL, NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, G_TYPE_STRING); signals[HDRS_CHANGED] = - gtk_signal_new ("hdrs_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass, - hdrs_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("hdrs_changed", + E_TYPE_MSG_COMPOSER_HDRS, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(EMsgComposerHdrsClass, hdrs_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[FROM_CHANGED] = - gtk_signal_new ("from_changed", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMsgComposerHdrsClass, - from_changed), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); + g_signal_new ("from_changed", + E_TYPE_MSG_COMPOSER_HDRS, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET(EMsgComposerHdrsClass, from_changed), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); } static void @@ -673,21 +673,22 @@ init (EMsgComposerHdrs *hdrs) GtkType e_msg_composer_hdrs_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (type == 0) { - static const GtkTypeInfo info = { - "EMsgComposerHdrs", - sizeof (EMsgComposerHdrs), + static const GTypeInfo info = { sizeof (EMsgComposerHdrsClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, + NULL, + (GClassInitFunc) class_init, + NULL, + NULL, + sizeof (EMsgComposerHdrs), + 0, + (GInstanceInitFunc) init, }; - type = gtk_type_unique (gtk_table_get_type (), &info); + type = g_type_register_static(gtk_table_get_type(), "EMsgComposerHdrs", &info, 0); } return type; @@ -699,12 +700,12 @@ e_msg_composer_hdrs_new (BonoboUIComponent *uic, int visible_mask, int visible_f EMsgComposerHdrs *new; EMsgComposerHdrsPrivate *priv; - new = gtk_type_new (e_msg_composer_hdrs_get_type ()); + new = g_object_new (e_msg_composer_hdrs_get_type (), NULL); priv = new->priv; priv->uic = uic; if (!setup_corba (new)) { - gtk_widget_destroy (GTK_WIDGET (new)); + g_object_unref(new); return NULL; } @@ -793,9 +794,9 @@ set_recipients_from_destv (CamelMimeMessage *msg, camel_mime_message_set_recipients (msg, header, bcc_addr); } - camel_object_unref (CAMEL_OBJECT (to_addr)); - camel_object_unref (CAMEL_OBJECT (cc_addr)); - camel_object_unref (CAMEL_OBJECT (bcc_addr)); + camel_object_unref(to_addr); + camel_object_unref(cc_addr); + camel_object_unref(bcc_addr); } static void @@ -822,12 +823,12 @@ e_msg_composer_hdrs_to_message_internal (EMsgComposerHdrs *hdrs, } else { camel_mime_message_set_from (msg, addr); } - camel_object_unref (CAMEL_OBJECT (addr)); + camel_object_unref(addr); addr = e_msg_composer_hdrs_get_reply_to (hdrs); if (addr) { camel_mime_message_set_reply_to (msg, addr); - camel_object_unref (CAMEL_OBJECT (addr)); + camel_object_unref(addr); } if (hdrs->visible_mask & E_MSG_COMPOSER_VISIBLE_MASK_RECIPIENTS) { @@ -894,19 +895,19 @@ e_msg_composer_hdrs_set_from_account (EMsgComposerHdrs *hdrs, MailConfigAccount *account; item = l->data; - account = gtk_object_get_data (GTK_OBJECT (item), "account"); + account = g_object_get_data(G_OBJECT(item), "account"); if (account_name) { if (account->name && !strcmp (account_name, account->name)) { /* set the correct optionlist item */ gtk_option_menu_set_history (omenu, i); - gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", hdrs); + g_signal_emit_by_name (G_OBJECT (item), "activate", hdrs); return; } } else if (i == default_account) { /* set the default optionlist item */ gtk_option_menu_set_history (omenu, i); - gtk_signal_emit_by_name (GTK_OBJECT (item), "activate", hdrs); + g_signal_emit_by_name (G_OBJECT (item), "activate", hdrs); return; } @@ -1221,5 +1222,5 @@ e_msg_composer_hdrs_get_from_omenu (EMsgComposerHdrs *hdrs) { g_return_val_if_fail (E_IS_MSG_COMPOSER_HDRS (hdrs), NULL); - return GTK_WIDGET (gtk_object_get_data (GTK_OBJECT (hdrs->priv->from.entry), "from_menu")); + return GTK_WIDGET (g_object_get_data(G_OBJECT(hdrs->priv->from.entry), "from_menu")); } diff --git a/composer/e-msg-composer-select-file.c b/composer/e-msg-composer-select-file.c index 38f0e1e561..ab6878871c 100644 --- a/composer/e-msg-composer-select-file.c +++ b/composer/e-msg-composer-select-file.c @@ -150,15 +150,15 @@ create_file_selection (EMsgComposer *composer, gboolean multiple) ok_button = GTK_FILE_SELECTION (widget)->ok_button; cancel_button = GTK_FILE_SELECTION (widget)->cancel_button; - gtk_signal_connect (GTK_OBJECT (ok_button), - "clicked", GTK_SIGNAL_FUNC (ok_clicked_cb), info); - gtk_signal_connect (GTK_OBJECT (cancel_button), - "clicked", GTK_SIGNAL_FUNC (cancel_clicked_cb), info); - gtk_signal_connect (GTK_OBJECT (widget), "delete_event", - GTK_SIGNAL_FUNC (delete_event_cb), info); - - gtk_signal_connect (GTK_OBJECT (composer), "hide", - GTK_SIGNAL_FUNC (composer_hide_cb), info); + g_signal_connect((ok_button), + "clicked", G_CALLBACK (ok_clicked_cb), info); + g_signal_connect((cancel_button), + "clicked", G_CALLBACK (cancel_clicked_cb), info); + g_signal_connect((widget), "delete_event", + G_CALLBACK (delete_event_cb), info); + + g_signal_connect((composer), "hide", + G_CALLBACK (composer_hide_cb), info); inline_checkbox = gtk_check_button_new_with_label (_("Suggest automatic display of attachment")); box = gtk_widget_get_ancestor (GTK_FILE_SELECTION (widget)->selection_entry, GTK_TYPE_BOX); diff --git a/composer/e-msg-composer.c b/composer/e-msg-composer.c index 60e06c0006..cabd5929a7 100644 --- a/composer/e-msg-composer.c +++ b/composer/e-msg-composer.c @@ -51,23 +51,19 @@ #include <sys/wait.h> #include <unistd.h> +#include <glib/gunicode.h> + #include <gtk/gtkoptionmenu.h> -#include <gal/unicode/gunicode.h> -#include <gal/util/e-unicode-i18n.h> -#include <gal/widgets/e-unicode.h> +/*#include <gal/widgets/e-unicode.h>*/ #include <libgnome/gnome-defs.h> #include <libgnome/gnome-exec.h> -#include <libgnomeui/gnome-app.h> +/*#include <libgnomeui/gnome-app.h>*/ #include <libgnomeui/gnome-uidefs.h> -#include <libgnomeui/gnome-dialog.h> -#include <libgnomeui/gnome-dialog-util.h> -#include <libgnomeui/gnome-stock.h> #include <libgnomeui/gnome-window-icon.h> #include <bonobo/bonobo-exception.h> #include <bonobo/bonobo-moniker-util.h> -#include <bonobo/bonobo-object-client.h> #include <bonobo/bonobo-stream-memory.h> #include <bonobo/bonobo-ui-util.h> #include <bonobo/bonobo-widget.h> @@ -80,16 +76,15 @@ #include <gal/widgets/e-scroll-frame.h> #include <gal/e-text/e-entry.h> -#include <gtkhtml/gtkhtml.h> -#include <gtkhtml/htmlselection.h> - #include "widgets/misc/e-charset-picker.h" #include "camel/camel.h" #include "camel/camel-charset-map.h" #include "camel/camel-session.h" -#include "mail/mail.h" +#warning "need to re-add mail.h" +/*#include "mail.h"*/ +#include "mail/mail-callbacks.h" #include "mail/mail-crypto.h" #include "mail/mail-tools.h" #include "mail/mail-ops.h" @@ -342,7 +337,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) /* evil kludgy hack for Redirect */ if (composer->redirect) { e_msg_composer_hdrs_to_redirect (hdrs, composer->redirect); - camel_object_ref (CAMEL_OBJECT (composer->redirect)); + camel_object_ref (composer->redirect); return composer->redirect; } @@ -383,7 +378,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) plain = camel_data_wrapper_new (); stream = camel_stream_mem_new_with_byte_array (data); camel_data_wrapper_construct_from_stream (plain, stream); - camel_object_unref (CAMEL_OBJECT (stream)); + camel_object_unref (stream); camel_data_wrapper_set_mime_type_field (plain, type); header_content_type_unref (type); @@ -403,14 +398,14 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) if (!data) { /* The component has probably died */ - camel_object_unref (CAMEL_OBJECT (new)); - camel_object_unref (CAMEL_OBJECT (plain)); + camel_object_unref (new); + camel_object_unref (plain); return NULL; } html = camel_data_wrapper_new (); stream = camel_stream_mem_new_with_byte_array (data); camel_data_wrapper_construct_from_stream (html, stream); - camel_object_unref (CAMEL_OBJECT (stream)); + camel_object_unref (stream); camel_data_wrapper_set_mime_type (html, "text/html; charset=utf-8"); /* Build the multipart/alternative */ @@ -421,16 +416,16 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), plain); - camel_object_unref (CAMEL_OBJECT (plain)); + camel_object_unref (plain); camel_mime_part_set_encoding (part, plain_encoding); camel_multipart_add_part (body, part); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (part); part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), html); - camel_object_unref (CAMEL_OBJECT (html)); + camel_object_unref (html); camel_multipart_add_part (body, part); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (part); /* If there are inlined images, construct a * multipart/related containing the @@ -447,9 +442,9 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), CAMEL_DATA_WRAPPER (body)); - camel_object_unref (CAMEL_OBJECT (body)); + camel_object_unref (body); camel_multipart_add_part (html_with_images, part); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (part); add_inlined_images (composer, html_with_images); clear_current_images (composer); @@ -475,9 +470,9 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_medium_set_content_object (CAMEL_MEDIUM (part), current); if (current == plain) camel_mime_part_set_encoding (part, plain_encoding); - camel_object_unref (CAMEL_OBJECT (current)); + camel_object_unref (current); camel_multipart_add_part (multipart, part); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (part); e_msg_composer_attachment_bar_to_multipart (attachment_bar, multipart, composer->charset); @@ -500,7 +495,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) camel_medium_set_content_object (CAMEL_MEDIUM (part), current); if (current == plain) camel_mime_part_set_encoding (part, plain_encoding); - camel_object_unref (CAMEL_OBJECT (current)); + camel_object_unref (current); if (composer->pgp_sign) { CamelInternetAddress *from = NULL; @@ -631,14 +626,14 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) } current = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - camel_object_ref (CAMEL_OBJECT (current)); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_ref (current); + camel_object_unref (part); } camel_medium_set_content_object (CAMEL_MEDIUM (new), current); if (current == plain) camel_mime_part_set_encoding (CAMEL_MIME_PART (new), plain_encoding); - camel_object_unref (CAMEL_OBJECT (current)); + camel_object_unref (current); #if defined (HAVE_NSS) && defined (SMIME_SUPPORTED) if (composer->smime_sign) { @@ -659,12 +654,12 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) smime_mesg = mail_crypto_smime_sign (new, certname, TRUE, TRUE, &ex); if (from) - camel_object_unref (CAMEL_OBJECT (from)); + camel_object_unref (from); if (camel_exception_is_set (&ex)) goto exception; - camel_object_unref (CAMEL_OBJECT (new)); + camel_object_unref (new); new = smime_mesg; } @@ -693,7 +688,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) g_ptr_array_add (recipients, g_strdup (address)); if (from) - camel_object_unref (CAMEL_OBJECT (addr)); + camel_object_unref (addr); } addr = camel_mime_message_get_recipients (new, CAMEL_RECIPIENT_TYPE_TO); @@ -722,7 +717,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) smime_mesg = mail_crypto_smime_encrypt (new, address, recipients, &ex); - camel_object_unref (CAMEL_OBJECT (from)); + camel_object_unref (from); for (i = 0; i < recipients->len; i++) g_free (recipients->pdata[i]); @@ -731,7 +726,7 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) if (camel_exception_is_set (&ex)) goto exception; - camel_object_unref (CAMEL_OBJECT (new)); + camel_object_unref (new); new = smime_mesg; } @@ -750,16 +745,20 @@ build_message (EMsgComposer *composer, gboolean save_html_object_data) exception: if (part != CAMEL_MIME_PART (new)) - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (part); - camel_object_unref (CAMEL_OBJECT (new)); + camel_object_unref (new); if (camel_exception_is_set (&ex)) { GtkWidget *dialog; - - dialog = gnome_error_dialog_parented (camel_exception_get_description (&ex), - GTK_WINDOW (composer)); - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + + dialog = gtk_message_dialog_new(GTK_WINDOW(composer), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + "%s", camel_exception_get_description (&ex)); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_object_unref(dialog); camel_exception_clear (&ex); } @@ -781,13 +780,17 @@ get_file_content (EMsgComposer *composer, const char *file_name, gboolean want_h fd = open (file_name, O_RDONLY); if (fd == -1) { - char *msg; - if (warn) { - msg = g_strdup_printf (_("Error while reading file %s:\n%s"), - file_name, g_strerror (errno)); - gnome_error_dialog (msg); - g_free (msg); + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(GTK_WINDOW(composer), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, + _("Error while reading file %s:\n%s"), + file_name, g_strerror (errno)); + gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_object_unref(dialog); } return g_strdup (""); } @@ -866,8 +869,8 @@ prepare_engine (EMsgComposer *composer) /* printf ("prepare_engine\n"); */ CORBA_exception_init (&ev); - composer->editor_engine = (GNOME_GtkHTML_Editor_Engine) bonobo_object_client_query_interface - (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev); + composer->editor_engine = (GNOME_GtkHTML_Editor_Engine) Bonobo_Unknown_queryInterface + (bonobo_widget_get_objref (BONOBO_WIDGET (composer->editor)), "IDL:GNOME/GtkHTML/Editor/Engine:1.0", &ev); if ((composer->editor_engine != CORBA_OBJECT_NIL) && (ev._major == CORBA_NO_EXCEPTION)) { /* printf ("trying set listener\n"); */ @@ -1109,9 +1112,11 @@ set_config (EMsgComposer *composer, char *key, int val) return; full_key = g_strconcat ("/Mail/Composer/", key, NULL); - + +#warning "bonobo config" +#if 0 bonobo_config_set_long (composer->config_db, full_key, val, NULL); - +#endif g_free (full_key); } @@ -1155,25 +1160,19 @@ save (EMsgComposer *composer, const char *file_name) /* check to see if we already have the file */ if ((fd = open (my_file_name, O_RDONLY | O_CREAT | O_EXCL, 0777)) == -1) { - GtkWidget *dialog, *label; - - dialog = gnome_dialog_new (_("Warning!"), - GNOME_STOCK_BUTTON_YES, - GNOME_STOCK_BUTTON_NO, - NULL); - label = gtk_label_new (_("File exists, overwrite?")); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox), label, TRUE, TRUE, 0); - - switch (gnome_dialog_run_and_close (GNOME_DIALOG (dialog))) { - case -1: - gtk_widget_destroy (dialog); - return; - case 1: + GtkWidget *dialog; + int resp; + + dialog = gtk_message_dialog_new(GTK_WINDOW(composer), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, GTK_BUTTONS_YES_NO, + _("File exists, overwrite?")); + resp = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_object_unref(dialog); + if (resp != GTK_RESPONSE_YES) { + g_free(my_file_name); return; - default: - /* ie, the user hit "Yes" so just continue as normal */ - break; } } else close (fd); @@ -1183,8 +1182,12 @@ save (EMsgComposer *composer, const char *file_name) Bonobo_PersistFile_save (composer->persist_file_interface, my_file_name, &ev); if (ev._major != CORBA_NO_EXCEPTION) { +#warning "e_notice??" + char *tmp = g_path_get_basename(my_file_name); + e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR, - _("Error saving file: %s"), g_basename (my_file_name)); + _("Error saving file: %s"), tmp); + g_free(tmp); } else GNOME_GtkHTML_Editor_Engine_runCommand (composer->editor_engine, "saved", &ev); @@ -1202,9 +1205,13 @@ load (EMsgComposer *composer, const char *file_name) Bonobo_PersistFile_load (composer->persist_file_interface, file_name, &ev); - if (ev._major != CORBA_NO_EXCEPTION) + if (ev._major != CORBA_NO_EXCEPTION) { + char *tmp = g_path_get_basename(file_name); + e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR, - _("Error loading file: %s"), g_basename (file_name)); + _("Error loading file: %s"), tmp); + g_free(tmp); + } CORBA_exception_free (&ev); } @@ -1229,7 +1236,7 @@ autosave_save_draft (EMsgComposer *composer) CamelMimeMessage *message; CamelStream *stream; char *file; - int fd; + int fd, camelfd; gboolean success = TRUE; fd = composer->autosave_fd; @@ -1250,34 +1257,41 @@ autosave_save_draft (EMsgComposer *composer) } if (lseek (fd, (off_t)0, SEEK_SET) == -1) { - camel_object_unref (CAMEL_OBJECT (message)); + camel_object_unref (message); e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR, _("Unable to seek on file: %s\n%s"), file, g_strerror (errno)); return FALSE; } if (ftruncate (fd, (off_t)0) == -1) { - camel_object_unref (CAMEL_OBJECT (message)); + camel_object_unref (message); e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR, _("Unable to truncate file: %s\n%s"), file, g_strerror (errno)); return FALSE; } + + /* dup the fd because we dont want camel to close it when done */ + camelfd = dup(fd); + if (fd == -1) { + camel_object_unref (message); + e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR, + _("Unable to copy file descriptor: %s\n%s"), file, g_strerror (errno)); + return FALSE; + } /* this does an lseek so we don't have to */ - stream = camel_stream_fs_new_with_fd (fd); + stream = camel_stream_fs_new_with_fd (camelfd); if (camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message), stream) == -1 - || camel_stream_flush (CAMEL_STREAM (stream)) == -1) { + || camel_stream_close (CAMEL_STREAM (stream)) == -1) { e_notice (GTK_WINDOW (composer), GNOME_MESSAGE_BOX_ERROR, _("Error autosaving message: %s\n %s"), file, strerror(errno)); success = FALSE; } - /* set the fd to -1 in the stream so camel doesn't close it we want to keep it open */ - CAMEL_STREAM_FS (stream)->fd = -1; - camel_object_unref (CAMEL_OBJECT (stream)); + camel_object_unref (stream); - camel_object_unref (CAMEL_OBJECT (message)); + camel_object_unref (message); return success; } @@ -1306,13 +1320,13 @@ autosave_load_draft (const char *filename) if (composer) { autosave_save_draft (composer); - gtk_signal_connect (GTK_OBJECT (composer), "send", - GTK_SIGNAL_FUNC (composer_send_cb), NULL); + g_signal_connect (GTK_OBJECT (composer), "send", + G_CALLBACK (composer_send_cb), NULL); gtk_widget_show (GTK_WIDGET (composer)); } - camel_object_unref ((CamelObject *)stream); + camel_object_unref (stream); return composer; } @@ -1323,14 +1337,6 @@ autosave_is_owned (AutosaveManager *am, const char *file) } static void -autosave_query_cb (gint reply, gpointer data) -{ - int *yes = data; - - *yes = !reply; -} - -static void autosave_manager_query_load_orphans (AutosaveManager *am, EMsgComposer *composer) { GtkWidget *dialog; @@ -1356,7 +1362,7 @@ autosave_manager_query_load_orphans (AutosaveManager *am, EMsgComposer *composer * check if the file has any length, It is a valid case if it doesn't * so we simply don't ask then. */ - if (stat (filename, &st) < 0 || st.st_size == 0) { + if (stat (filename, &st) == -1 || st.st_size == 0) { unlink (filename); g_free (filename); continue; @@ -1368,11 +1374,16 @@ autosave_manager_query_load_orphans (AutosaveManager *am, EMsgComposer *composer closedir (dir); if (match != NULL) { - dialog = gnome_question_dialog_parented (_("Ximian Evolution has found unsaved files from a previous session.\n" - "Would you like to try to recover them?"), - autosave_query_cb, &load, GTK_WINDOW (composer)); - - gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); + GtkWidget *dialog; + + dialog = gtk_message_dialog_new(GTK_WINDOW(composer), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO, + _("Ximian Evolution has found unsaved files from a previous session.\n" + "Would you like to try to recover them?")); + load = gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_YES; + gtk_widget_destroy(dialog); + g_object_unref(dialog); } while (match != NULL) { @@ -1462,7 +1473,7 @@ autosave_manager_register (AutosaveManager *am, EMsgComposer *composer) g_return_if_fail (composer != NULL); if (autosave_init_file (composer)) { - key = g_basename (composer->autosave_file); + key = g_path_get_basename (composer->autosave_file); g_hash_table_insert (am->table, key, composer); if (am->ask) { /* keep recursion out of our bedrooms. */ @@ -1477,10 +1488,18 @@ autosave_manager_register (AutosaveManager *am, EMsgComposer *composer) static void autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer) { + char *key, *oldkey; + void *olddata; + if (!composer->autosave_file) return; - g_hash_table_remove (am->table, g_basename (composer->autosave_file)); + key = g_path_get_basename(composer->autosave_file); + if (g_hash_table_lookup_extended(am->table, key, (void **)&oldkey, &olddata)) { + g_hash_table_remove(am->table, oldkey); + g_free(oldkey); + g_free(key); + } /* only remove the file if we can successfully save it */ /* FIXME this test could probably be more efficient */ @@ -1498,7 +1517,7 @@ autosave_manager_unregister (AutosaveManager *am, EMsgComposer *composer) static void menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path) { - gtk_signal_emit (GTK_OBJECT (data), signals[SAVE_DRAFT], FALSE); + g_signal_emit (data, signals[SAVE_DRAFT], 0, FALSE); e_msg_composer_unset_changed (E_MSG_COMPOSER (data)); } @@ -1507,7 +1526,7 @@ menu_file_save_draft_cb (BonoboUIComponent *uic, void *data, const char *path) static void do_exit (EMsgComposer *composer) { - char *subject, *subject_utf8, *label; + char *subject; GtkWidget *dialog; int button; @@ -1517,39 +1536,32 @@ do_exit (EMsgComposer *composer) } gdk_window_raise (GTK_WIDGET (composer)->window); - - subject_utf8 = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs)); - subject = e_utf8_to_locale_string (subject_utf8); - g_free (subject_utf8); - - label = g_strdup_printf (_("The message \"%s\" has not been sent.\n\nDo you wish to save your changes?"), subject); - g_free (subject); - - dialog = gnome_message_box_new (label, GNOME_MESSAGE_BOX_QUESTION, - GNOME_STOCK_BUTTON_YES, /* Save */ - GNOME_STOCK_BUTTON_NO, /* Don't save */ - GNOME_STOCK_BUTTON_CANCEL, /* Cancel */ - NULL); - - g_free (label); - + + subject = e_msg_composer_hdrs_get_subject (E_MSG_COMPOSER_HDRS (composer->hdrs)); + dialog = gtk_message_dialog_new(GTK_WINDOW(composer), + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_ERROR, GTK_BUTTONS_YES_NO, + _("The message \"%s\" has not been sent.\n\nDo you wish to save your changes?"), + subject); + g_free(subject); + gtk_dialog_add_button (GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); gtk_window_set_title (GTK_WINDOW (dialog), _("Warning: Modified Message")); - gnome_dialog_set_parent (GNOME_DIALOG (dialog), GTK_WINDOW (composer)); - gnome_dialog_set_default (GNOME_DIALOG (dialog), 0); - button = gnome_dialog_run_and_close (GNOME_DIALOG (dialog)); - - switch (button) { - case 0: + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_YES); + button = gtk_dialog_run(GTK_DIALOG(dialog)); + gtk_widget_destroy(dialog); + g_object_unref(dialog); + + switch(button) { + case GTK_RESPONSE_YES: /* Save */ - gtk_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], TRUE); + g_signal_emit (GTK_OBJECT (composer), signals[SAVE_DRAFT], 0, TRUE); e_msg_composer_unset_changed (composer); break; - case 1: + case GTK_RESPONSE_NO: /* Don't save */ gtk_widget_destroy (GTK_WIDGET (composer)); break; - default: - /* Cancel */ + case GTK_RESPONSE_CANCEL: break; } } @@ -1970,11 +1982,7 @@ setup_signatures_menu (EMsgComposer *composer) list = mail_config_get_signature_list (); if (list) for (l = list; l; len ++, l = l->next) { - gchar *gtk_str; - - gtk_str = e_utf8_to_gtk_string (menu, ((MailConfigSignature *)l->data)->name); - ADD (gtk_str); - g_free (gtk_str); + ADD(((MailConfigSignature *)l->data)->name); } #undef ADD @@ -1982,7 +1990,7 @@ setup_signatures_menu (EMsgComposer *composer) gtk_option_menu_set_menu (GTK_OPTION_MENU (composer->sig_omenu), menu); sig_select_item (composer); - gtk_signal_connect (GTK_OBJECT (menu), "selection-done", signature_cb, composer); + g_signal_connect (menu, "selection-done", (GCallback)signature_cb, composer); } static void @@ -1996,7 +2004,8 @@ setup_ui (EMsgComposer *composer) bonobo_ui_container_set_win (container, BONOBO_WINDOW (composer)); composer->uic = bonobo_ui_component_new_default (); - bonobo_ui_component_set_container (composer->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container))); + /* FIXME: handle bonobo exceptions */ + bonobo_ui_component_set_container (composer->uic, bonobo_object_corba_objref (BONOBO_OBJECT (container)), NULL); bonobo_ui_component_add_verb_list_with_data (composer->uic, verbs, composer); @@ -2004,15 +2013,20 @@ setup_ui (EMsgComposer *composer) bonobo_ui_util_set_ui (composer->uic, EVOLUTION_DATADIR, "evolution-message-composer.xml", - "evolution-message-composer"); + "evolution-message-composer", NULL); e_pixmaps_update (composer->uic, pixcache); /* Populate the Charset Encoding menu and default it to whatever the user chose as his default charset in the mailer */ +#warning "bonobo_config" +#if 0 default_charset = bonobo_config_get_string (composer->config_db, "/Mail/Format/default_charset", NULL); +#else + default_charset = g_strdup("iso-8859-1"); +#endif e_charset_picker_bonobo_ui_populate (composer->uic, "/menu/Edit/EncodingPlaceholder", default_charset, menu_changed_charset_cb, @@ -2218,7 +2232,7 @@ update_auto_recipients (EMsgComposerHdrs *hdrs, int mode, const char *auto_addrs } } - camel_object_unref (CAMEL_OBJECT (iaddr)); + camel_object_unref (iaddr); } switch (mode) { @@ -2302,15 +2316,15 @@ from_changed_cb (EMsgComposerHdrs *hdrs, void *data) /* GtkObject methods. */ static void -composer_shutdown (GtkObject *object) +composer_finalise (GObject *object) { /* When destroy() is called, the contents of the window * (including the remote editor control) will already have * been destroyed, so we have to do this here. */ autosave_manager_unregister (am, E_MSG_COMPOSER (object)); - if (GTK_OBJECT_CLASS (parent_class)->shutdown != NULL) - (* GTK_OBJECT_CLASS (parent_class)->shutdown) (object); + if (G_OBJECT_CLASS (parent_class)->finalize != NULL) + (* G_OBJECT_CLASS (parent_class)->finalize) (object); } static void @@ -2421,7 +2435,7 @@ message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream) message = camel_mime_message_new (); if (camel_mime_part_construct_from_parser (CAMEL_MIME_PART (message), mp) == -1) { - camel_object_unref (CAMEL_OBJECT (message)); + camel_object_unref (message); break; } @@ -2432,15 +2446,15 @@ message_rfc822_dnd (EMsgComposer *composer, CamelStream *stream) camel_mime_part_set_content_type (part, "message/rfc822"); e_msg_composer_attachment_bar_attach_mime_part (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), part); - camel_object_unref (CAMEL_OBJECT (message)); - camel_object_unref (CAMEL_OBJECT (part)); + camel_object_unref (message); + camel_object_unref (part); camel_exception_clear (ex); /* skip over the FROM_END state */ camel_mime_parser_step (mp, 0, 0); } - camel_object_unref (CAMEL_OBJECT (mp)); + camel_object_unref (mp); camel_exception_free (ex); } @@ -2464,7 +2478,7 @@ drag_data_received (EMsgComposer *composer, GdkDragContext *context, camel_stream_reset (stream); message_rfc822_dnd (composer, stream); - camel_object_unref (CAMEL_OBJECT (stream)); + camel_object_unref (stream); break; case DND_TYPE_TEXT_URI_LIST: d(printf ("dropping a text/uri-list\n")); @@ -2501,58 +2515,48 @@ drag_data_received (EMsgComposer *composer, GdkDragContext *context, (E_MSG_COMPOSER_ATTACHMENT_BAR (composer->attachment_bar), mime_part); - camel_object_unref (CAMEL_OBJECT (mime_part)); + camel_object_unref (mime_part); default: d(printf ("dropping an unknown\n")); break; } } -typedef void (*GtkSignal_NONE__NONE_INT) (GtkObject *, int, gpointer); - -static void marshal_NONE__NONE_INT (GtkObject *object, GtkSignalFunc func, - gpointer func_data, GtkArg *args) -{ - GtkSignal_NONE__NONE_INT rfunc; - - rfunc = (GtkSignal_NONE__NONE_INT) func; - (*rfunc)(object, GTK_VALUE_INT (args[0]), func_data); -} - - static void class_init (EMsgComposerClass *klass) { GtkObjectClass *object_class; GtkWidgetClass *widget_class; - + GObjectClass *gobject_class; + + gobject_class = G_OBJECT_CLASS(klass); object_class = GTK_OBJECT_CLASS (klass); widget_class = GTK_WIDGET_CLASS (klass); - object_class->shutdown = composer_shutdown; + gobject_class->finalize = composer_finalise; object_class->destroy = destroy; - widget_class->delete_event = delete_event; - parent_class = gtk_type_class (bonobo_window_get_type ()); + parent_class = g_type_class_ref(bonobo_window_get_type ()); signals[SEND] = - gtk_signal_new ("send", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMsgComposerClass, send), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, 0); + g_signal_new ("send", + E_TYPE_MSG_COMPOSER, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMsgComposerClass, send), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); signals[SAVE_DRAFT] = - gtk_signal_new ("save-draft", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (EMsgComposerClass, save_draft), - marshal_NONE__NONE_INT, - GTK_TYPE_NONE, 1, GTK_TYPE_INT); - - gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); + g_signal_new ("save-draft", + E_TYPE_MSG_COMPOSER, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (EMsgComposerClass, save_draft), + NULL, NULL, + g_cclosure_marshal_VOID__BOOLEAN, + G_TYPE_NONE, + 1, G_TYPE_BOOLEAN); } static void @@ -2601,21 +2605,20 @@ init (EMsgComposer *composer) GtkType e_msg_composer_get_type (void) { - static GtkType type = 0; + static GType type = 0; if (type == 0) { - static const GtkTypeInfo info = { - "EMsgComposer", - sizeof (EMsgComposer), + static const GTypeInfo info = { sizeof (EMsgComposerClass), - (GtkClassInitFunc) class_init, - (GtkObjectInitFunc) init, - /* reserved_1 */ NULL, - /* reserved_2 */ NULL, - (GtkClassInitFunc) NULL, + NULL, NULL, + (GClassInitFunc) class_init, + NULL, NULL, + sizeof (EMsgComposer), + 0, + (GInstanceInitFunc) init, }; - - type = gtk_type_unique (bonobo_window_get_type (), &info); + + type = g_type_register_static (bonobo_window_get_type (), "EMsgComposer", &info, 0); } return type; @@ -2624,6 +2627,7 @@ e_msg_composer_get_type (void) static void load_from_config_db (EMsgComposer *composer) { +#if 0 Bonobo_ConfigDatabase db = composer->config_db; composer->view_from = bonobo_config_get_long_with_default ( @@ -2636,6 +2640,7 @@ load_from_config_db (EMsgComposer *composer) db, "Mail/Composer/ViewBCC", 0, NULL); composer->view_subject = bonobo_config_get_long_with_default ( db, "Mail/Composer/ViewSubject", 1, NULL); +#endif } static void @@ -2698,7 +2703,7 @@ map_default_cb (EMsgComposer *composer, gpointer user_data) to = e_msg_composer_hdrs_get_to_entry (E_MSG_COMPOSER_HDRS (composer->hdrs)); cf = bonobo_widget_get_control_frame (BONOBO_WIDGET (to)); pb = bonobo_control_frame_get_control_property_bag (cf, NULL); - text = bonobo_property_bag_client_get_value_string (pb, "text", NULL); + text = bonobo_pbclient_get_string (pb, "text", NULL); bonobo_object_release_unref (pb, NULL); if (!text || text[0] == '\0') { @@ -2743,7 +2748,7 @@ composer_key_pressed (GtkWidget *widget, GdkEventKey *event, gpointer user_data) if (event->keyval == GDK_Escape) { do_exit (E_MSG_COMPOSER (widget)); - gtk_signal_emit_stop_by_name (GTK_OBJECT (widget), "key-press-event"); + g_signal_stop_emission_by_name(widget, "key-press-event"); return TRUE; /* Handled. */ } @@ -2755,34 +2760,34 @@ create_composer (int visible_mask) { EMsgComposer *composer; GtkWidget *vbox; - BonoboObject *editor_server; + Bonobo_Unknown editor_server; + CORBA_Environment ev; int vis; g_return_val_if_fail (gtk_main_level () > 0, NULL); - - composer = gtk_type_new (E_TYPE_MSG_COMPOSER); + +#warning " does win_name need qualifying? " + composer = g_object_new (E_TYPE_MSG_COMPOSER, "win_name", _("Compose a message"), NULL); all_composers = g_slist_prepend (all_composers, composer); - gtk_signal_connect (GTK_OBJECT (composer), "key-press-event", - GTK_SIGNAL_FUNC (composer_key_pressed), - NULL); - gtk_signal_connect (GTK_OBJECT (composer), "destroy", - GTK_SIGNAL_FUNC (msg_composer_destroy_notify), - NULL); + g_signal_connect (composer, "key-press-event", + G_CALLBACK (composer_key_pressed), + NULL); + g_signal_connect (composer, "destroy", + G_CALLBACK (msg_composer_destroy_notify), + NULL); gtk_window_set_default_size (GTK_WINDOW (composer), DEFAULT_WIDTH, DEFAULT_HEIGHT); gnome_window_icon_set_from_file (GTK_WINDOW (composer), EVOLUTION_DATADIR "/images/evolution/compose-message.png"); - bonobo_window_construct (BONOBO_WINDOW (composer), "e-msg-composer", - _("Compose a message")); /* DND support */ gtk_drag_dest_set (GTK_WIDGET (composer), GTK_DEST_DEFAULT_ALL, drop_types, num_drop_types, GDK_ACTION_COPY); - gtk_signal_connect (GTK_OBJECT (composer), "drag_data_received", - GTK_SIGNAL_FUNC (drag_data_received), NULL); + g_signal_connect (composer, "drag_data_received", + G_CALLBACK (drag_data_received), NULL); e_msg_composer_load_config (composer); setup_ui (composer); @@ -2802,12 +2807,12 @@ create_composer (int visible_mask) } gtk_box_pack_start (GTK_BOX (vbox), composer->hdrs, FALSE, FALSE, 0); - gtk_signal_connect (GTK_OBJECT (composer->hdrs), "subject_changed", - GTK_SIGNAL_FUNC (subject_changed_cb), composer); - gtk_signal_connect (GTK_OBJECT (composer->hdrs), "hdrs_changed", - GTK_SIGNAL_FUNC (hdrs_changed_cb), composer); - gtk_signal_connect (GTK_OBJECT (composer->hdrs), "from_changed", - GTK_SIGNAL_FUNC (from_changed_cb), composer); + g_signal_connect (composer->hdrs, "subject_changed", + G_CALLBACK (subject_changed_cb), composer); + g_signal_connect (composer->hdrs, "hdrs_changed", + G_CALLBACK (hdrs_changed_cb), composer); + g_signal_connect (composer->hdrs, "from_changed", + G_CALLBACK (from_changed_cb), composer); gtk_widget_show (composer->hdrs); prepare_signatures_menu (composer); @@ -2834,13 +2839,16 @@ create_composer (int visible_mask) "FormatHTML", composer->send_html, NULL); - editor_server = BONOBO_OBJECT (bonobo_widget_get_server (BONOBO_WIDGET (composer->editor))); - + editor_server = bonobo_widget_get_objref (BONOBO_WIDGET (composer->editor)); + + /* FIXME: handle exceptions */ + CORBA_exception_init(&ev); composer->persist_file_interface - = bonobo_object_query_interface (editor_server, "IDL:Bonobo/PersistFile:1.0"); + = Bonobo_Unknown_queryInterface (editor_server, "IDL:Bonobo/PersistFile:1.0", &ev); composer->persist_stream_interface - = bonobo_object_query_interface (editor_server, "IDL:Bonobo/PersistStream:1.0"); - + = Bonobo_Unknown_queryInterface (editor_server, "IDL:Bonobo/PersistStream:1.0", &ev); + CORBA_exception_free (&ev); + gtk_box_pack_start (GTK_BOX (vbox), composer->editor, TRUE, TRUE, 0); /* Attachment editor, wrapped into an EScrollFrame. We don't @@ -2860,8 +2868,8 @@ create_composer (int visible_mask) composer->attachment_scroll_frame, FALSE, FALSE, GNOME_PAD_SMALL); - gtk_signal_connect (GTK_OBJECT (composer->attachment_bar), "changed", - GTK_SIGNAL_FUNC (attachment_bar_changed_cb), composer); + g_signal_connect (composer->attachment_bar, "changed", + G_CALLBACK (attachment_bar_changed_cb), composer); bonobo_window_set_contents (BONOBO_WINDOW (composer), vbox); gtk_widget_show (vbox); @@ -2884,7 +2892,7 @@ create_composer (int visible_mask) return NULL; } - gtk_signal_connect (GTK_OBJECT (composer), "map", map_default_cb, NULL); + g_signal_connect (composer, "map", (GCallback)map_default_cb, NULL); if (am == NULL) { am = autosave_manager_new (); @@ -2967,10 +2975,10 @@ is_special_header (const char *hdr_name) 1. it's not a X-* header or 2. it's an X-Evolution* header */ - if (g_strncasecmp (hdr_name, "X-", 2)) + if (g_ascii_strncasecmp (hdr_name, "X-", 2)) return TRUE; - if (!g_strncasecmp (hdr_name, "X-Evolution", 11)) + if (!g_ascii_strncasecmp (hdr_name, "X-Evolution", 11)) return TRUE; /* we can keep all other X-* headers */ @@ -2983,9 +2991,9 @@ e_msg_composer_set_pending_body (EMsgComposer *composer, char *text) { char *old; - old = gtk_object_get_data (GTK_OBJECT (composer), "body:text"); + old = g_object_get_data (G_OBJECT(composer), "body:text"); g_free (old); - gtk_object_set_data (GTK_OBJECT (composer), "body:text", text); + g_object_set_data (G_OBJECT(composer), "body:text", text); } static void @@ -2993,12 +3001,12 @@ e_msg_composer_flush_pending_body (EMsgComposer *composer, gboolean apply) { char *body; - body = gtk_object_get_data (GTK_OBJECT (composer), "body:text"); + body = g_object_get_data (G_OBJECT(composer), "body:text"); if (body) { if (apply) set_editor_text (composer, body); - gtk_object_set_data (GTK_OBJECT (composer), "body:text", NULL); + g_object_set_data (G_OBJECT(composer), "body:text", NULL); g_free (body); } } @@ -3617,7 +3625,7 @@ e_msg_composer_new_redirect (CamelMimeMessage *message, const char *resent_from) subject = camel_mime_message_get_subject (message); composer->redirect = message; - camel_object_ref (CAMEL_OBJECT (message)); + camel_object_ref (message); e_msg_composer_set_headers (composer, resent_from, NULL, NULL, NULL, subject); @@ -3859,9 +3867,9 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body, { g_return_if_fail (E_IS_MSG_COMPOSER (composer)); - set_editor_text (composer, U_("<b>(The composer contains a non-text " - "message body, which cannot be " - "edited.)<b>")); + set_editor_text (composer, _("<b>(The composer contains a non-text " + "message body, which cannot be " + "edited.)<b>")); e_msg_composer_set_send_html (composer, FALSE); disable_editor (composer); @@ -3870,7 +3878,7 @@ e_msg_composer_set_body (EMsgComposer *composer, const char *body, g_free (composer->mime_type); composer->mime_type = g_strdup (mime_type); - if (g_strncasecmp (composer->mime_type, "text/calendar", 13) == 0) { + if (g_ascii_strncasecmp (composer->mime_type, "text/calendar", 13) == 0) { EMsgComposerHdrs *hdrs = E_MSG_COMPOSER_HDRS (composer->hdrs); if (hdrs->account && hdrs->account->pgp_no_imip_sign) e_msg_composer_set_pgp_sign (composer, FALSE); @@ -3936,7 +3944,7 @@ CamelMimePart * e_msg_composer_add_inline_image_from_file (EMsgComposer *composer, const char *file_name) { - char *mime_type, *cid, *url; + char *mime_type, *cid, *url, *name; CamelStream *stream; CamelDataWrapper *wrapper; CamelMimePart *part; @@ -3960,11 +3968,13 @@ e_msg_composer_add_inline_image_from_file (EMsgComposer *composer, part = camel_mime_part_new (); camel_medium_set_content_object (CAMEL_MEDIUM (part), wrapper); - camel_object_unref (CAMEL_OBJECT (wrapper)); + camel_object_unref (wrapper); cid = header_msgid_generate (); camel_mime_part_set_content_id (part, cid); - camel_mime_part_set_filename (part, g_basename (file_name)); + name = g_path_get_basename(file_name); + camel_mime_part_set_filename (part, name); + g_free(name); camel_mime_part_set_encoding (part, CAMEL_MIME_PART_ENCODING_BASE64); url = g_strdup_printf ("file:%s", file_name); @@ -3990,18 +4000,18 @@ void e_msg_composer_add_inline_image_from_mime_part (EMsgComposer *composer, CamelMimePart *part) { - char *cid, *url; - const char *location; - - cid = (char *)camel_mime_part_get_content_id (part); + char *url; + const char *location, *cid; + + cid = camel_mime_part_get_content_id (part); if (!cid) { camel_mime_part_set_content_id (part, NULL); - cid = (char *)camel_mime_part_get_content_id (part); + cid = camel_mime_part_get_content_id (part); } url = g_strdup_printf ("cid:%s", cid); g_hash_table_insert (composer->inline_images, url, part); - camel_object_ref (CAMEL_OBJECT (part)); + camel_object_ref (part); location = camel_mime_part_get_content_location (part); if (location) { diff --git a/composer/e-msg-composer.h b/composer/e-msg-composer.h index f8f6c4850d..b8fe6937a1 100644 --- a/composer/e-msg-composer.h +++ b/composer/e-msg-composer.h @@ -28,9 +28,9 @@ typedef struct _EMsgComposer EMsgComposer; typedef struct _EMsgComposerClass EMsgComposerClass; -#include <bonobo/bonobo-win.h> +#include <bonobo/bonobo-window.h> #include <bonobo/bonobo-ui-component.h> -#include <bonobo-conf/bonobo-config-database.h> +/*#include <bonobo-conf/bonobo-config-database.h>*/ #include "e-msg-composer-attachment-bar.h" #include "e-msg-composer-hdrs.h" diff --git a/composer/evolution-composer.c b/composer/evolution-composer.c index a8d8f154a5..cf435665a6 100644 --- a/composer/evolution-composer.c +++ b/composer/evolution-composer.c @@ -172,7 +172,7 @@ impl_Composer_attach_MIME (PortableServer_Servant servant, attachment = camel_mime_part_new (); status = camel_data_wrapper_construct_from_stream ( CAMEL_DATA_WRAPPER (attachment), mem_stream); - camel_object_unref (CAMEL_OBJECT (mem_stream)); + camel_object_unref (mem_stream); if (status == -1) { CORBA_exception_set (ev, CORBA_USER_EXCEPTION, @@ -213,7 +213,7 @@ impl_Composer_attach_data (PortableServer_Servant servant, "inline" : "attachment"); e_msg_composer_attach (composer->composer, attachment); - camel_object_unref (CAMEL_OBJECT (attachment)); + camel_object_unref (attachment); } static void @@ -267,38 +267,49 @@ destroy (GtkObject *object) { EvolutionComposer *composer = EVOLUTION_COMPOSER (object); - if (composer->composer) - gtk_object_unref (GTK_OBJECT (composer->composer)); + if (composer->composer) { + g_object_unref((composer->composer)); + composer->composer = NULL; + } GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void -class_init (EvolutionComposerClass *klass) +evolution_composer_class_init (EvolutionComposerClass *klass) { GtkObjectClass *object_class; + POA_GNOME_Evolution_Composer__epv *epv; object_class = GTK_OBJECT_CLASS (klass); object_class->destroy = destroy; - parent_class = gtk_type_class (bonobo_object_get_type ()); + parent_class = g_type_class_ref(bonobo_object_get_type ()); + + epv = &klass->epv; - Composer_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - Composer_vepv.GNOME_Evolution_Composer_epv = evolution_composer_get_epv (); + epv->setHeaders = impl_Composer_set_headers; + epv->setMultipartType = impl_Composer_set_multipart_type; + epv->setBody = impl_Composer_set_body; + epv->attachMIME = impl_Composer_attach_MIME; + epv->attachData = impl_Composer_attach_data; + epv->show = impl_Composer_show; + epv->send = impl_Composer_send; } static void -init (EvolutionComposer *composer) +evolution_composer_init (EvolutionComposer *composer) { const MailConfigAccount *account; + BonoboObject *item_handler; account = mail_config_get_default_account (); composer->composer = e_msg_composer_new (); - gtk_signal_connect (GTK_OBJECT (composer->composer), "send", - GTK_SIGNAL_FUNC (send_cb), NULL); - gtk_signal_connect (GTK_OBJECT (composer->composer), "save-draft", - GTK_SIGNAL_FUNC (save_draft_cb), NULL); + g_signal_connect (composer->composer, "send", + G_CALLBACK (send_cb), NULL); + g_signal_connect (composer->composer, "save-draft", + G_CALLBACK (save_draft_cb), NULL); } #if 0 @@ -345,7 +356,7 @@ evolution_composer_construct (EvolutionComposer *composer, g_return_if_fail (EVOLUTION_IS_COMPOSER (composer)); g_return_if_fail (corba_object != CORBA_OBJECT_NIL); - bonobo_object_construct (BONOBO_OBJECT (composer), corba_object); + /*bonobo_object_construct (BONOBO_OBJECT (composer), corba_object);*/ item_handler = BONOBO_OBJECT ( bonobo_item_handler_new (NULL, get_object, composer)); @@ -356,10 +367,11 @@ EvolutionComposer * evolution_composer_new (void) { EvolutionComposer *new; +#if 0 POA_GNOME_Evolution_Composer *servant; CORBA_Environment ev; GNOME_Evolution_Composer corba_object; - + servant = (POA_GNOME_Evolution_Composer *) g_new0 (BonoboObjectServant, 1); servant->vepv = &Composer_vepv; @@ -375,18 +387,20 @@ evolution_composer_new (void) new = gtk_type_new (evolution_composer_get_type ()); corba_object = bonobo_object_activate_servant (BONOBO_OBJECT (new), servant); - evolution_composer_construct (new, corba_object); +#endif + new = g_object_new(EVOLUTION_TYPE_COMPOSER, NULL); + evolution_composer_construct (new, NULL); return new; } -E_MAKE_TYPE (evolution_composer, "EvolutionComposer", EvolutionComposer, class_init, init, PARENT_TYPE) +BONOBO_TYPE_FUNC_FULL(EvolutionComposer, GNOME_Evolution_Composer, BONOBO_TYPE_OBJECT, evolution_composer) #define GNOME_EVOLUTION_MAIL_COMPOSER_FACTORY_ID "OAFIID:GNOME_Evolution_Mail_ComposerFactory" static BonoboObject * -factory_fn (BonoboGenericFactory *factory, void *closure) +factory_fn (BonoboGenericFactory *factory, const char *id, void *closure) { if (!mail_config_is_configured ()) { e_notice (NULL, GNOME_MESSAGE_BOX_ERROR, diff --git a/composer/evolution-composer.h b/composer/evolution-composer.h index e3fc21a4b3..424a623a82 100644 --- a/composer/evolution-composer.h +++ b/composer/evolution-composer.h @@ -51,6 +51,8 @@ struct _EvolutionComposer { struct _EvolutionComposerClass { BonoboObjectClass parent_class; + + POA_GNOME_Evolution_Composer__epv epv; }; POA_GNOME_Evolution_Composer__epv *evolution_composer_get_epv (void); diff --git a/composer/listener.c b/composer/listener.c index 9f609c3fd3..2e04623f1c 100644 --- a/composer/listener.c +++ b/composer/listener.c @@ -184,7 +184,7 @@ impl_event (PortableServer_Servant _servant, gchar *url; if ((url = resolve_image_url (l, BONOBO_ARG_GET_STRING (arg)))) { - rv = bonobo_arg_new (TC_string); + rv = bonobo_arg_new (BONOBO_ARG_STRING); BONOBO_ARG_SET_STRING (rv, url); /* printf ("new url: %s\n", url); */ g_free (url); @@ -233,98 +233,29 @@ impl_event (PortableServer_Servant _servant, bonobo_stream_client_write (e->stream, ba->data, ba->len, ev); - camel_object_unref (CAMEL_OBJECT (cstream)); + camel_object_unref (cstream); } return rv ? rv : get_any_null (); } -POA_GNOME_GtkHTML_Editor_Listener__epv * -listener_get_epv (void) +static void +listener_class_init (EditorListenerClass *klass) { POA_GNOME_GtkHTML_Editor_Listener__epv *epv; - epv = g_new0 (POA_GNOME_GtkHTML_Editor_Listener__epv, 1); + listener_parent_class = g_type_class_ref(bonobo_object_get_type ()); + epv = &klass->epv; epv->event = impl_event; - - return epv; } static void -init_listener_corba_class (void) +listener_init(EditorListener *object) { - listener_vepv.Bonobo_Unknown_epv = bonobo_object_get_epv (); - listener_vepv.GNOME_GtkHTML_Editor_Listener_epv = listener_get_epv (); -} - -static void -listener_class_init (EditorListenerClass *klass) -{ - listener_parent_class = gtk_type_class (bonobo_object_get_type ()); - - init_listener_corba_class (); } -GtkType -listener_get_type (void) -{ - static GtkType type = 0; - - if (!type){ - GtkTypeInfo info = { - "EditorListener", - sizeof (EditorListener), - sizeof (EditorListenerClass), - (GtkClassInitFunc) listener_class_init, - (GtkObjectInitFunc) NULL, - NULL, /* reserved 1 */ - NULL, /* reserved 2 */ - (GtkClassInitFunc) NULL - }; - - type = gtk_type_unique (bonobo_object_get_type (), &info); - } - - return type; -} - -EditorListener * -listener_construct (EditorListener *listener, GNOME_GtkHTML_Editor_Listener corba_listener) -{ - g_return_val_if_fail (listener != NULL, NULL); - g_return_val_if_fail (IS_EDITOR_LISTENER (listener), NULL); - g_return_val_if_fail (corba_listener != CORBA_OBJECT_NIL, NULL); - - if (!bonobo_object_construct (BONOBO_OBJECT (listener), (CORBA_Object) corba_listener)) - return NULL; - - return listener; -} - -static GNOME_GtkHTML_Editor_Listener -create_listener (BonoboObject *listener) -{ - POA_GNOME_GtkHTML_Editor_Listener *servant; - CORBA_Environment ev; - - servant = (POA_GNOME_GtkHTML_Editor_Listener *) g_new0 (BonoboObjectServant, 1); - servant->vepv = &listener_vepv; - - CORBA_exception_init (&ev); - POA_GNOME_GtkHTML_Editor_Listener__init ((PortableServer_Servant) servant, &ev); - ORBIT_OBJECT_KEY(servant->_private)->object = NULL; - - if (ev._major != CORBA_NO_EXCEPTION){ - g_free (servant); - CORBA_exception_free (&ev); - return CORBA_OBJECT_NIL; - } - - CORBA_exception_free (&ev); - - return (GNOME_GtkHTML_Editor_Listener) bonobo_object_activate_servant (listener, servant); -} +BONOBO_TYPE_FUNC_FULL(EditorListener, GNOME_GtkHTML_Editor_Listener, BONOBO_TYPE_OBJECT, listener); EditorListener * listener_new (EMsgComposer *composer) @@ -332,15 +263,8 @@ listener_new (EMsgComposer *composer) EditorListener *listener; GNOME_GtkHTML_Editor_Listener corba_listener; - listener = gtk_type_new (EDITOR_LISTENER_TYPE); + listener = g_object_new (EDITOR_LISTENER_TYPE, NULL); listener->composer = composer; - - corba_listener = create_listener (BONOBO_OBJECT (listener)); - - if (corba_listener == CORBA_OBJECT_NIL) { - bonobo_object_unref (BONOBO_OBJECT (listener)); - return NULL; - } - return listener_construct (listener, corba_listener); + return listener; } diff --git a/composer/listener.h b/composer/listener.h index 00ce8a0e01..ce1eefa746 100644 --- a/composer/listener.h +++ b/composer/listener.h @@ -42,13 +42,14 @@ typedef struct { typedef struct { BonoboObjectClass parent_class; + + POA_GNOME_GtkHTML_Editor_Listener__epv epv; } EditorListenerClass; GtkType listener_get_type (void); EditorListener *listener_construct (EditorListener *listener, GNOME_GtkHTML_Editor_Listener corba_listener); EditorListener *listener_new (EMsgComposer *composer); -POA_GNOME_GtkHTML_Editor_Listener__epv *listener_get_epv (void); END_GNOME_DECLS |