diff options
author | Jeffrey Stedfast <fejj@ximian.com> | 2002-11-12 01:34:05 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2002-11-12 01:34:05 +0800 |
commit | cca2134ea95e69ce80a83cabde16c9e8818c8b15 (patch) | |
tree | 19246eb7d084bec19e307fa684de283210a32784 | |
parent | f2b2d6abb5f56436fcb06a62d73a728b4eda462b (diff) | |
download | gsoc2013-evolution-cca2134ea95e69ce80a83cabde16c9e8818c8b15.tar.gz gsoc2013-evolution-cca2134ea95e69ce80a83cabde16c9e8818c8b15.tar.zst gsoc2013-evolution-cca2134ea95e69ce80a83cabde16c9e8818c8b15.zip |
Ported.
2002-11-11 Jeffrey Stedfast <fejj@ximian.com>
* folder-browser.c: Ported.
* e-searching-tokenizer.c: Roughly ported.
svn path=/trunk/; revision=18697
-rw-r--r-- | mail/ChangeLog | 6 | ||||
-rw-r--r-- | mail/component-factory.c | 37 | ||||
-rw-r--r-- | mail/e-searching-tokenizer.c | 141 | ||||
-rw-r--r-- | mail/e-searching-tokenizer.h | 15 | ||||
-rw-r--r-- | mail/folder-browser.c | 429 |
5 files changed, 311 insertions, 317 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog index 03760f16d8..8786c608be 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,9 @@ +2002-11-11 Jeffrey Stedfast <fejj@ximian.com> + + * folder-browser.c: Ported. + + * e-searching-tokenizer.c: Roughly ported. + 2002-11-10 Jeffrey Stedfast <fejj@ximian.com> * *.glade: Converted to libglade-2's format. diff --git a/mail/component-factory.c b/mail/component-factory.c index b85f7e287d..188b4c8302 100644 --- a/mail/component-factory.c +++ b/mail/component-factory.c @@ -155,14 +155,14 @@ create_view (EvolutionShellComponent *shell_component, url = camel_url_new (physical_uri, NULL); noselect = url ? camel_url_get_param (url, "noselect") : NULL; - if (noselect && !g_strcasecmp (noselect, "yes")) + if (noselect && !strcasecmp (noselect, "yes")) control = create_noselect_control (); else control = folder_browser_factory_new_control (physical_uri, corba_shell); camel_url_free (url); } else if (type_is_vtrash (folder_type)) { - if (!g_strncasecmp (physical_uri, "file:", 5)) + if (!strncasecmp (physical_uri, "file:", 5)) control = folder_browser_factory_new_control ("vtrash:file:/", corba_shell); else control = folder_browser_factory_new_control (physical_uri, corba_shell); @@ -341,7 +341,7 @@ xfer_folder (EvolutionShellComponent *shell_component, if (remove && strcmp(src->protocol, dst->protocol) == 0) { char *sname, *dname; CamelStore *store; - + if (src->fragment) sname = src->fragment; else { @@ -350,7 +350,7 @@ xfer_folder (EvolutionShellComponent *shell_component, else sname = ""; } - + if (dst->fragment) dname = dst->fragment; else { @@ -359,11 +359,11 @@ xfer_folder (EvolutionShellComponent *shell_component, else dname = ""; } - + store = camel_session_get_store(session, source_physical_uri, &ex); if (store != NULL) camel_store_rename_folder(store, sname, dname, &ex); - + if (camel_exception_is_set(&ex)) GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); else { @@ -375,7 +375,7 @@ xfer_folder (EvolutionShellComponent *shell_component, camel_object_unref((CamelObject *)store); } else { source = mail_tool_uri_to_folder (source_physical_uri, 0, &ex); - + if (source) { xfer_folder_data *xfd; @@ -383,17 +383,17 @@ xfer_folder (EvolutionShellComponent *shell_component, xfd->remove_source = remove_source; xfd->source_uri = g_strdup (source_physical_uri); xfd->listener = CORBA_Object_duplicate (listener, &ev); - + uids = camel_folder_get_uids (source); mail_transfer_messages (source, uids, remove_source, destination_physical_uri, CAMEL_STORE_FOLDER_CREATE, xfer_folder_done, xfd); camel_object_unref (CAMEL_OBJECT (source)); } else GNOME_Evolution_ShellComponentListener_notifyResult (listener, GNOME_Evolution_ShellComponentListener_INVALID_URI, &ev); } - + CORBA_exception_free (&ev); camel_exception_clear (&ex); - + camel_url_free(src); camel_url_free(dst); } @@ -402,13 +402,12 @@ static void configure_folder_popup(BonoboUIComponent *component, void *user_data, const char *cname) { char *uri = user_data; - - + if (strncmp(uri, "vfolder:", 8) == 0) vfolder_edit_rule(uri); else { FolderBrowser *fb = folder_browser_factory_get_browser(uri); - + if (fb) configure_folder(component, fb, cname); else @@ -432,9 +431,9 @@ populate_folder_context_menu (EvolutionShellComponent *shell_component, if (!type_is_mail (type)) return; - + /* FIXME: handle other types */ - + /* the unmatched test is a bit of a hack but it works */ if ((strncmp(physical_uri, "vfolder:", 8) == 0 && strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) == NULL) @@ -453,9 +452,9 @@ unpopulate_folder_context_menu (EvolutionShellComponent *shell_component, { if (!type_is_mail (type)) return; - + /* FIXME: handle other types */ - + /* the unmatched test is a bit of a hack but it works */ if ((strncmp(physical_uri, "vfolder:", 8) == 0 && strstr(physical_uri, "#" CAMEL_UNMATCHED_NAME) == NULL) @@ -493,7 +492,7 @@ destination_folder_handle_motion (EvolutionShellComponentDndDestinationFolder *f url = camel_url_new (physical_uri, NULL); noselect = url ? camel_url_get_param (url, "noselect") : NULL; - if (noselect && !g_strcasecmp (noselect, "yes")) + if (noselect && !strcasecmp (noselect, "yes")) /* uh, no way to say "illegal" */ *suggested_action_return = GNOME_Evolution_ShellComponentDnd_ACTION_DEFAULT; else @@ -567,7 +566,7 @@ destination_folder_handle_drop (EvolutionShellComponentDndDestinationFolder *des uri = camel_url_new (physical_uri, NULL); noselect = uri ? camel_url_get_param (uri, "noselect") : NULL; - if (noselect && !g_strcasecmp (noselect, "yes")) { + if (noselect && !strcasecmp (noselect, "yes")) { camel_url_free (uri); return FALSE; } diff --git a/mail/e-searching-tokenizer.c b/mail/e-searching-tokenizer.c index 0c1e090cb5..ec77a2be4c 100644 --- a/mail/e-searching-tokenizer.c +++ b/mail/e-searching-tokenizer.c @@ -35,7 +35,6 @@ #include <string.h> #include <ctype.h> -#include <gal/unicode/gunicode.h> #include "e-searching-tokenizer.h" #include "e-util/e-memory.h" @@ -44,15 +43,16 @@ #define d(x) enum { - EST_MATCH_SIGNAL, - EST_LAST_SIGNAL + MATCH_SIGNAL, + LAST_SIGNAL }; -guint e_searching_tokenizer_signals[EST_LAST_SIGNAL] = { 0 }; -static void e_searching_tokenizer_begin (HTMLTokenizer *, gchar *); +static guint signals[LAST_SIGNAL] = { 0, }; + +static void e_searching_tokenizer_begin (HTMLTokenizer *, char *); static void e_searching_tokenizer_end (HTMLTokenizer *); -static gchar *e_searching_tokenizer_peek_token (HTMLTokenizer *); -static gchar *e_searching_tokenizer_next_token (HTMLTokenizer *); +static char *e_searching_tokenizer_peek_token (HTMLTokenizer *); +static char *e_searching_tokenizer_next_token (HTMLTokenizer *); static gboolean e_searching_tokenizer_has_more (HTMLTokenizer *); static HTMLTokenizer *e_searching_tokenizer_clone (HTMLTokenizer *); @@ -60,7 +60,7 @@ static HTMLTokenizer *e_searching_tokenizer_clone (HTMLTokenizer *); /* static const gchar *space_tags[] = { "br", NULL };*/ -GtkObjectClass *parent_class = NULL; +static HTMLTokenizerClass *parent_class = NULL; /** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** **/ @@ -969,20 +969,20 @@ e_searching_tokenizer_destroy (GtkObject *obj) { ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (obj); struct _ESearchingTokenizerPrivate *p = st->priv; - + search_info_free (p->primary); search_info_free (p->secondary); if (p->engine) searcher_free(p->engine); - + /* again wtf? shared_state_unref (st->priv->shared); */ - - g_free(p); - - if (parent_class->destroy) - parent_class->destroy (obj); + + g_free (p); + + if (GTK_OBJECT_CLASS (parent_class)->destroy) + GTK_OBJECT_CLASS (parent_class)->destroy (obj); } static void @@ -990,28 +990,28 @@ e_searching_tokenizer_class_init (ESearchingTokenizerClass *klass) { GtkObjectClass *obj_class = (GtkObjectClass *) klass; HTMLTokenizerClass *tok_class = HTML_TOKENIZER_CLASS (klass); - - e_searching_tokenizer_signals[EST_MATCH_SIGNAL] = - gtk_signal_new ("match", - GTK_RUN_LAST, - obj_class->type, - GTK_SIGNAL_OFFSET (ESearchingTokenizerClass, match), - gtk_marshal_NONE__NONE, - GTK_TYPE_NONE, - 0); - gtk_object_class_add_signals (obj_class, e_searching_tokenizer_signals, EST_LAST_SIGNAL); - + + parent_class = g_type_class_ref (HTML_TYPE_TOKENIZER); + + signals[MATCH_SIGNAL] = + g_signal_new ("match", + E_TYPE_SEARCHING_TOKENIZER, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (ESearchingTokenizerClass, match), + NULL, + NULL, + gtk_marshal_NONE__NONE, + G_TYPE_NONE, 0); + obj_class->destroy = e_searching_tokenizer_destroy; - - tok_class->begin = e_searching_tokenizer_begin; - tok_class->end = e_searching_tokenizer_end; - + + tok_class->begin = e_searching_tokenizer_begin; + tok_class->end = e_searching_tokenizer_end; + tok_class->peek_token = e_searching_tokenizer_peek_token; tok_class->next_token = e_searching_tokenizer_next_token; - tok_class->has_more = e_searching_tokenizer_has_more; - tok_class->clone = e_searching_tokenizer_clone; - - parent_class = gtk_type_class (HTML_TYPE_TOKENIZER); + tok_class->has_more = e_searching_tokenizer_has_more; + tok_class->clone = e_searching_tokenizer_clone; } static void @@ -1033,22 +1033,24 @@ e_searching_tokenizer_init (ESearchingTokenizer *st) GtkType e_searching_tokenizer_get_type (void) { - static GtkType e_searching_tokenizer_type = 0; - - if (! e_searching_tokenizer_type) { - static GtkTypeInfo e_searching_tokenizer_info = { + static GtkType type = 0; + + if (!type) { + static const GtkTypeInfo info = { "ESearchingTokenizer", sizeof (ESearchingTokenizer), sizeof (ESearchingTokenizerClass), (GtkClassInitFunc) e_searching_tokenizer_class_init, (GtkObjectInitFunc) e_searching_tokenizer_init, - NULL, NULL, - (GtkClassInitFunc) NULL + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, }; - e_searching_tokenizer_type = gtk_type_unique (HTML_TYPE_TOKENIZER, - &e_searching_tokenizer_info); + + type = gtk_type_unique (HTML_TYPE_TOKENIZER, &info); } - return e_searching_tokenizer_type; + + return type; } HTMLTokenizer * @@ -1064,12 +1066,12 @@ e_searching_tokenizer_new (void) static char *get_token(HTMLTokenizer *t) { HTMLTokenizerClass *klass = HTML_TOKENIZER_CLASS (parent_class); - + return klass->has_more(t) ? klass->next_token(t) : NULL; } static void -e_searching_tokenizer_begin (HTMLTokenizer *t, gchar *content_type) +e_searching_tokenizer_begin (HTMLTokenizer *t, char *content_type) { ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (t); struct _ESearchingTokenizerPrivate *p = st->priv; @@ -1111,7 +1113,7 @@ e_searching_tokenizer_end (HTMLTokenizer *t) HTML_TOKENIZER_CLASS (parent_class)->end (t); } -static gchar * +static char * e_searching_tokenizer_peek_token (HTMLTokenizer *tok) { ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok); @@ -1123,25 +1125,25 @@ e_searching_tokenizer_peek_token (HTMLTokenizer *tok) return searcher_peek_token(st->priv->engine); } -static gchar * +static char * e_searching_tokenizer_next_token (HTMLTokenizer *tok) { ESearchingTokenizer *st = E_SEARCHING_TOKENIZER (tok); int oldmatched; char *token; - + /* If no search is active, just use the default method. */ if (st->priv->engine == NULL) return HTML_TOKENIZER_CLASS (parent_class)->next_token (tok); - + oldmatched = st->priv->engine->matchcount; - + token = searcher_next_token(st->priv->engine); - + /* not sure if this has to be accurate or just say we had some matches */ if (oldmatched != st->priv->engine->matchcount) - gtk_signal_emit (GTK_OBJECT (st), e_searching_tokenizer_signals[EST_MATCH_SIGNAL]); - + g_signal_emit (st, signals[MATCH_SIGNAL], 0); + return token; } @@ -1159,7 +1161,7 @@ static void matched (ESearchingTokenizer *st) { /*++st->priv->match_count;*/ - gtk_signal_emit (GTK_OBJECT (st), e_searching_tokenizer_signals[EST_MATCH_SIGNAL]); + g_signal_emit (st, signals[MATCH_SIGNAL], 0); } static HTMLTokenizer * @@ -1167,25 +1169,22 @@ e_searching_tokenizer_clone (HTMLTokenizer *tok) { ESearchingTokenizer *orig_st = E_SEARCHING_TOKENIZER (tok); ESearchingTokenizer *new_st = E_SEARCHING_TOKENIZER (e_searching_tokenizer_new ()); - + search_info_free(new_st->priv->primary); search_info_free(new_st->priv->secondary); - + new_st->priv->primary = search_info_clone(orig_st->priv->primary); new_st->priv->secondary = search_info_clone(orig_st->priv->secondary); - + /* what the fucking what???? */ #if 0 shared_state_ref (orig_st->priv->shared); shared_state_unref (new_st->priv->shared); new_st->priv->shared = orig_st->priv->shared; #endif - - gtk_signal_connect_object (GTK_OBJECT (new_st), - "match", - GTK_SIGNAL_FUNC (matched), - GTK_OBJECT (orig_st)); - + + g_signal_connect_swapped (new_st, "match", GTK_SIGNAL_FUNC (matched), orig_st); + return HTML_TOKENIZER (new_st); } /* ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** ** */ @@ -1194,7 +1193,7 @@ void e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_clear(st->priv->primary); search_info_add_string(st->priv->primary, search_str); } @@ -1203,7 +1202,7 @@ void e_searching_tokenizer_add_primary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_add_string(st->priv->primary, search_str); } @@ -1211,7 +1210,7 @@ void e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *st, gboolean iscase) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_set_flags(st->priv->primary, iscase?SEARCH_CASE:0, SEARCH_CASE); } @@ -1219,7 +1218,7 @@ void e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_clear(st->priv->secondary); search_info_add_string(st->priv->secondary, search_str); } @@ -1228,7 +1227,7 @@ void e_searching_tokenizer_add_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_add_string(st->priv->secondary, search_str); } @@ -1236,7 +1235,7 @@ void e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *st, gboolean iscase) { g_return_if_fail (st && E_IS_SEARCHING_TOKENIZER (st)); - + search_info_set_flags(st->priv->secondary, iscase?SEARCH_CASE:0, SEARCH_CASE); } @@ -1244,9 +1243,9 @@ gint e_searching_tokenizer_match_count (ESearchingTokenizer *st) { g_return_val_if_fail (st && E_IS_SEARCHING_TOKENIZER (st), -1); - + if (st->priv->engine) return st->priv->engine->matchcount; - + return 0; } diff --git a/mail/e-searching-tokenizer.h b/mail/e-searching-tokenizer.h index 1af48d619b..8dbcf83e17 100644 --- a/mail/e-searching-tokenizer.h +++ b/mail/e-searching-tokenizer.h @@ -43,13 +43,13 @@ struct _ESearchingTokenizerPrivate; struct _ESearchingTokenizer { HTMLTokenizer parent; - + struct _ESearchingTokenizerPrivate *priv; }; struct _ESearchingTokenizerClass { HTMLTokenizerClass parent_class; - + void (*match) (ESearchingTokenizer *); }; @@ -59,17 +59,16 @@ HTMLTokenizer *e_searching_tokenizer_new (void); /* For now, just a simple API */ -void e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *, const gchar *); -void e_searching_tokenizer_add_primary_search_string (ESearchingTokenizer *, const gchar *); +void e_searching_tokenizer_set_primary_search_string (ESearchingTokenizer *, const char *); +void e_searching_tokenizer_add_primary_search_string (ESearchingTokenizer *, const char *); void e_searching_tokenizer_set_primary_case_sensitivity (ESearchingTokenizer *, gboolean is_case_sensitive); -void e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *, const gchar *); -void e_searching_tokenizer_add_secondary_search_string (ESearchingTokenizer *st, const gchar *search_str); +void e_searching_tokenizer_set_secondary_search_string (ESearchingTokenizer *, const char *); +void e_searching_tokenizer_add_secondary_search_string (ESearchingTokenizer *st, const char *search_str); void e_searching_tokenizer_set_secondary_case_sensitivity (ESearchingTokenizer *, gboolean is_case_sensitive); -gint e_searching_tokenizer_match_count (ESearchingTokenizer *); +int e_searching_tokenizer_match_count (ESearchingTokenizer *); #endif /* __E_SEARCHING_TOKENIZER_H__ */ - diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 342f2ab529..b62b31940e 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -36,7 +36,6 @@ #include <gal/util/e-util.h> #include <gal/widgets/e-gui-utils.h> #include <gal/widgets/e-popup-menu.h> -#include <gal/widgets/e-unicode.h> #include <libgnomeui/gnome-dialog-util.h> #include <libgnomeui/gnome-pixmap.h> @@ -117,7 +116,7 @@ static const int num_paste_types = sizeof (paste_types) / sizeof (paste_types[0] static GdkAtom clipboard_atom = GDK_NONE; -static GtkObjectClass *folder_browser_parent_class; +static GtkTableClass *parent_class = NULL; enum { FOLDER_LOADED, @@ -128,7 +127,7 @@ enum { static guint folder_browser_signals [LAST_SIGNAL] = {0, }; static void -folder_browser_finalise (GtkObject *object) +folder_browser_finalise (GObject *object) { FolderBrowser *folder_browser; CORBA_Environment ev; @@ -143,7 +142,7 @@ folder_browser_finalise (GtkObject *object) g_free (folder_browser->loaded_uid); if (folder_browser->search_full) - gtk_object_unref (GTK_OBJECT (folder_browser->search_full)); + g_object_unref (folder_browser->search_full); if (folder_browser->sensitize_timeout_id) g_source_remove (folder_browser->sensitize_timeout_id); @@ -154,7 +153,7 @@ folder_browser_finalise (GtkObject *object) } if (folder_browser->shell_view != CORBA_OBJECT_NIL) { - CORBA_Object_release(folder_browser->shell_view, &ev); + CORBA_Object_release (folder_browser->shell_view, &ev); folder_browser->shell_view = CORBA_OBJECT_NIL; } @@ -167,27 +166,27 @@ folder_browser_finalise (GtkObject *object) CORBA_exception_free (&ev); if (folder_browser->view_instance) { - gtk_object_unref (GTK_OBJECT (folder_browser->view_instance)); + g_object_unref (folder_browser->view_instance); folder_browser->view_instance = NULL; } if (folder_browser->view_menus) { - gtk_object_unref (GTK_OBJECT (folder_browser->view_menus)); + g_object_unref (folder_browser->view_menus); folder_browser->view_menus = NULL; } - gtk_object_unref (GTK_OBJECT (folder_browser->invisible)); + g_object_unref (folder_browser->invisible); folder_browser->invisible = NULL; if (folder_browser->clipboard_selection) g_byte_array_free (folder_browser->clipboard_selection, TRUE); if (folder_browser->sensitise_state) { - g_hash_table_destroy(folder_browser->sensitise_state); + g_hash_table_destroy (folder_browser->sensitise_state); folder_browser->sensitise_state = NULL; } - folder_browser_parent_class->finalize (object); + G_OBJECT_CLASS (parent_class)->finalize (object); } static void @@ -221,7 +220,7 @@ folder_browser_destroy (GtkObject *object) mail_async_event_destroy (folder_browser->async_event); if (folder_browser->get_id != -1) { - mail_msg_cancel(folder_browser->get_id); + mail_msg_cancel (folder_browser->get_id); folder_browser->get_id = -1; } @@ -231,38 +230,43 @@ folder_browser_destroy (GtkObject *object) camel_object_unhook_event (CAMEL_OBJECT (folder_browser->folder), "message_changed", folder_changed, folder_browser); mail_sync_folder (folder_browser->folder, NULL, NULL); - camel_object_unref (CAMEL_OBJECT (folder_browser->folder)); + camel_object_unref (folder_browser->folder); folder_browser->folder = NULL; } - folder_browser_parent_class->destroy (object); + GTK_OBJECT_CLASS (parent_class)->destroy (object); } static void -folder_browser_class_init (GtkObjectClass *object_class) +folder_browser_class_init (FolderBrowserClass *klass) { - object_class->destroy = folder_browser_destroy; - object_class->finalize = folder_browser_finalise; + GObjectClass *gobject_class = G_OBJECT_CLASS (klass); + GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); + + parent_class = gtk_type_class (PARENT_TYPE); - folder_browser_parent_class = gtk_type_class (PARENT_TYPE); + object_class->destroy = folder_browser_destroy; + gobject_class->finalize = folder_browser_finalise; folder_browser_signals[FOLDER_LOADED] = - gtk_signal_new ("folder_loaded", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (FolderBrowserClass, folder_loaded), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + g_signal_new ("folder_loaded", + FOLDER_BROWSER_TYPE, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (FolderBrowserClass, folder_loaded), + NULL, + NULL, + gtk_marshal_NONE__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); folder_browser_signals[MESSAGE_LOADED] = - gtk_signal_new ("message_loaded", - GTK_RUN_LAST, - object_class->type, - GTK_SIGNAL_OFFSET (FolderBrowserClass, message_loaded), - gtk_marshal_NONE__STRING, - GTK_TYPE_NONE, 1, GTK_TYPE_STRING); - - gtk_object_class_add_signals (object_class, folder_browser_signals, LAST_SIGNAL); + g_signal_new ("message_loaded", + FOLDER_BROWSER_TYPE, + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (FolderBrowserClass, message_loaded), + NULL, + NULL, + gtk_marshal_NONE__STRING, + G_TYPE_NONE, 1, G_TYPE_STRING); /* clipboard atom */ if (!clipboard_atom) @@ -832,17 +836,19 @@ static void main_folder_changed(CamelObject *o, void *event_data, void *data) gtk_object_unref((GtkObject *)fb); } -static void folder_changed(CamelObject *o, void *event_data, void *data) +static void folder_changed (CamelObject *obj, void *event_data, void *user_data) { - FolderBrowser *fb = data; + FolderBrowser *fb = user_data; - mail_async_event_emit(fb->async_event, MAIL_ASYNC_GUI, (MailAsyncFunc)main_folder_changed, o, NULL, data); + mail_async_event_emit (fb->async_event, MAIL_ASYNC_GUI, + (MailAsyncFunc) main_folder_changed, + obj, NULL, user_data); } static void -got_folder (char *uri, CamelFolder *folder, void *data) +got_folder (char *uri, CamelFolder *folder, void *user_data) { - FolderBrowser *fb = data; + FolderBrowser *fb = user_data; fb->get_id = -1; @@ -852,16 +858,16 @@ got_folder (char *uri, CamelFolder *folder, void *data) goto done; if (fb->folder) { - camel_object_unhook_event(fb->folder, "folder_changed", folder_changed, fb); - camel_object_unhook_event(fb->folder, "message_changed", folder_changed, fb); - camel_object_unref(fb->folder); + camel_object_unhook_event (fb->folder, "folder_changed", folder_changed, fb); + camel_object_unhook_event (fb->folder, "message_changed", folder_changed, fb); + camel_object_unref (fb->folder); } fb->folder = folder; if (folder == NULL) goto done; - camel_object_ref (CAMEL_OBJECT (folder)); + camel_object_ref (folder); gtk_widget_set_sensitive (GTK_WIDGET (fb->search), camel_folder_has_search_capability (folder)); message_list_set_folder (fb->message_list, folder, @@ -885,8 +891,8 @@ got_folder (char *uri, CamelFolder *folder, void *data) folder_browser_ui_set_selection_state (fb, FB_SELSTATE_NONE); done: - gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [FOLDER_LOADED], fb->uri); - gtk_object_unref (GTK_OBJECT (fb)); + g_signal_emit (fb, folder_browser_signals[FOLDER_LOADED], 0, fb->uri); + g_object_unref (fb); } @@ -898,7 +904,7 @@ folder_browser_reload (FolderBrowser *fb) if (fb->folder) { mail_refresh_folder (fb->folder, NULL, NULL); } else if (fb->uri) { - gtk_object_ref (GTK_OBJECT (fb)); + g_object_ref (fb); fb->get_id = mail_get_folder (fb->uri, 0, got_folder, fb, mail_thread_new); } } @@ -916,7 +922,7 @@ folder_browser_set_folder (FolderBrowser *fb, CamelFolder *folder, const char *u g_free (fb->uri); fb->uri = g_strdup (uri); - gtk_object_ref (GTK_OBJECT (fb)); + g_object_ref (fb); got_folder (NULL, folder, fb); } @@ -924,23 +930,23 @@ void folder_browser_set_ui_component (FolderBrowser *fb, BonoboUIComponent *uicomp) { g_return_if_fail (IS_FOLDER_BROWSER (fb)); - + if (fb->sensitize_timeout_id) { g_source_remove (fb->sensitize_timeout_id); fb->sensitize_timeout_id = 0; } - + if (fb->sensitise_state) { - g_hash_table_destroy(fb->sensitise_state); + g_hash_table_destroy (fb->sensitise_state); fb->sensitise_state = NULL; } if (fb->uicomp) bonobo_object_unref (BONOBO_OBJECT (fb->uicomp)); - + if (uicomp) bonobo_object_ref (BONOBO_OBJECT (uicomp)); - + fb->uicomp = uicomp; } @@ -948,18 +954,18 @@ void folder_browser_set_shell_view(FolderBrowser *fb, GNOME_Evolution_ShellView shell_view) { CORBA_Environment ev; - + CORBA_exception_init(&ev); if (fb->shell_view != CORBA_OBJECT_NIL) - CORBA_Object_release(fb->shell_view, &ev); - CORBA_exception_free(&ev); + CORBA_Object_release (fb->shell_view, &ev); + CORBA_exception_free (&ev); + + fb->shell_view = CORBA_Object_duplicate (shell_view, &ev); + CORBA_exception_free (&ev); - fb->shell_view = CORBA_Object_duplicate(shell_view, &ev); - CORBA_exception_free(&ev); - /* small hack, at this point we've just been activated */ if (fb->shell_view != CORBA_OBJECT_NIL) - update_status_bar(fb); + update_status_bar (fb); } extern CamelFolder *drafts_folder, *sent_folder, *outbox_folder; @@ -978,13 +984,13 @@ folder_browser_is_drafts (FolderBrowser *fb) MailConfigAccount *account; g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE); - + if (fb->uri == NULL || fb->folder == NULL) return FALSE; if (fb->folder == drafts_folder) return TRUE; - + accounts = mail_config_get_accounts (); while (accounts) { account = accounts->data; @@ -1010,10 +1016,10 @@ folder_browser_is_sent (FolderBrowser *fb) MailConfigAccount *account; g_return_val_if_fail (IS_FOLDER_BROWSER (fb), FALSE); - + if (fb->uri == NULL || fb->folder == NULL) return FALSE; - + if (fb->folder == sent_folder) return TRUE; @@ -1048,19 +1054,19 @@ save_cursor_pos (FolderBrowser *fb) ETreePath node; GtkAdjustment *adj; int row, y, height; - + node = e_tree_get_cursor (fb->message_list->tree); if (!node) return -1; - + row = e_tree_row_of_node (fb->message_list->tree, node); - + if (row == -1) return 0; - + e_tree_get_cell_geometry (fb->message_list->tree, row, 0, NULL, &y, NULL, &height); - + adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (fb->message_list)); y += adj->value - ((mail_config_get_paned_size () - height) / 2); @@ -1071,10 +1077,10 @@ static void set_cursor_pos (FolderBrowser *fb, int y) { GtkAdjustment *adj; - + if (y == -1) return; - + adj = e_scroll_frame_get_vadjustment (E_SCROLL_FRAME (fb->message_list)); gtk_adjustment_set_value (adj, (gfloat)y); } @@ -1084,14 +1090,15 @@ static gboolean do_message_selected(FolderBrowser *fb); void folder_browser_set_message_preview (FolderBrowser *folder_browser, gboolean show_message_preview) { + int y; + if (folder_browser->preview_shown == show_message_preview || folder_browser->message_list == NULL) return; - + folder_browser->preview_shown = show_message_preview; - + if (show_message_preview) { - int y; y = save_cursor_pos (folder_browser); e_paned_set_position (E_PANED (folder_browser->vpaned), mail_config_get_paned_size ()); gtk_widget_show (GTK_WIDGET (folder_browser->mail_display)); @@ -1132,13 +1139,13 @@ folder_browser_search_menu_activated (ESearchBar *esb, int id, FolderBrowser *fb if (efb->current_query) { FilterRule *rule = vfolder_clone_rule(efb->current_query); char *name, *text; - + text = e_search_bar_get_text(esb); name = g_strdup_printf("%s %s", rule->name, (text&&text[0])?text:"''"); g_free(text); filter_rule_set_name(rule, name); g_free(name); - + filter_rule_set_source(rule, FILTER_SOURCE_INCOMING); vfolder_rule_add_source((VfolderRule *)rule, fb->uri); vfolder_gui_add_rule((VfolderRule *)rule); @@ -1155,16 +1162,16 @@ folder_browser_config_search (EFilterBar *efb, FilterRule *rule, int id, const c GList *partl; struct _camel_search_words *words; int i; - + st = E_SEARCHING_TOKENIZER (fb->mail_display->html->engine->ht); - + e_searching_tokenizer_set_secondary_search_string (st, NULL); /* we scan the parts of a rule, and set all the types we know about to the query string */ partl = rule->parts; while (partl) { FilterPart *part = partl->data; - + if (!strcmp(part->name, "subject")) { FilterInput *input = (FilterInput *)filter_part_find_element(part, "subject"); if (input) @@ -1173,12 +1180,11 @@ folder_browser_config_search (EFilterBar *efb, FilterRule *rule, int id, const c FilterInput *input = (FilterInput *)filter_part_find_element(part, "word"); if (input) filter_input_set_value(input, query); - + words = camel_search_words_split(query); for (i=0;i<words->len;i++) e_searching_tokenizer_add_secondary_search_string (st, words->words[i]->word); camel_search_words_free(words); - } else if(!strcmp(part->name, "sender")) { FilterInput *input = (FilterInput *)filter_part_find_element(part, "sender"); if (input) @@ -1201,21 +1207,18 @@ static void folder_browser_search_do_search (ESearchBar *esb, FolderBrowser *fb) { char *search_word; - + if (fb->message_list == NULL) return; d(printf("do search\n")); - gtk_object_get (GTK_OBJECT (esb), - "query", &search_word, - NULL); - + g_object_get (esb, "query", &search_word, NULL); + message_list_set_search (fb->message_list, search_word); d(printf("query is %s\n", search_word)); - g_free(search_word); - return; + g_free (search_word); } static void @@ -1254,14 +1257,14 @@ folder_browser_toggle_threads (BonoboUIComponent *component, { FolderBrowser *fb = user_data; int prev_state; - + if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL) return; mail_config_set_thread_list (fb->uri, atoi (state)); message_list_set_threaded (fb->message_list, atoi (state)); - + prev_state = fb->selection_state; fb->selection_state = FB_SELSTATE_UNDEFINED; folder_browser_ui_set_selection_state (fb, prev_state); @@ -1275,11 +1278,11 @@ folder_browser_toggle_hide_deleted (BonoboUIComponent *component, gpointer user_data) { FolderBrowser *fb = user_data; - + if (type != Bonobo_UIComponent_STATE_CHANGED || fb->message_list == NULL) return; - + if (!(fb->folder && (fb->folder->folder_flags & CAMEL_FOLDER_IS_TRASH))) mail_config_set_hide_deleted (atoi (state)); message_list_set_hidedeleted (fb->message_list, atoi (state)); @@ -1295,17 +1298,17 @@ folder_browser_set_message_display_style (BonoboUIComponent *component extern char *message_display_styles[]; FolderBrowser *fb = user_data; int i; - + if (type != Bonobo_UIComponent_STATE_CHANGED - || atoi(state) == 0 + || atoi (state) == 0 || fb->message_list == NULL) return; - + for (i = 0; i < MAIL_CONFIG_DISPLAY_MAX; i++) { if (strstr (message_display_styles[i], path)) { fb->mail_display->display_style = i; mail_display_redisplay (fb->mail_display, TRUE); - + if (fb->pref_master) mail_config_set_message_display_style (i); return; @@ -1344,17 +1347,17 @@ vfolder_type_current(FolderBrowser *fb, int type) { GPtrArray *uids; int i; - + /* get uid */ - uids = g_ptr_array_new(); - message_list_foreach(fb->message_list, enumerate_msg, uids); - + uids = g_ptr_array_new (); + message_list_foreach (fb->message_list, enumerate_msg, uids); + if (uids->len == 1) - vfolder_type_uid(fb->folder, (char *)uids->pdata[0], fb->uri, type); - - for (i=0; i<uids->len; i++) - g_free(uids->pdata[i]); - g_ptr_array_free(uids, TRUE); + vfolder_type_uid (fb->folder, (char *)uids->pdata[0], fb->uri, type); + + for (i = 0; i < uids->len; i++) + g_free (uids->pdata[i]); + g_ptr_array_free (uids, TRUE); } /* external api to vfolder/filter on X, based on current message */ @@ -1371,22 +1374,22 @@ filter_type_current(FolderBrowser *fb, int type) GPtrArray *uids; int i; const char *source; - + if (folder_browser_is_sent (fb) || folder_browser_is_outbox (fb)) source = FILTER_SOURCE_OUTGOING; else source = FILTER_SOURCE_INCOMING; - + /* get uid */ - uids = g_ptr_array_new(); - message_list_foreach(fb->message_list, enumerate_msg, uids); - + uids = g_ptr_array_new (); + message_list_foreach (fb->message_list, enumerate_msg, uids); + if (uids->len == 1) - filter_type_uid(fb->folder, (char *)uids->pdata[0], source, type); - - for (i=0; i<uids->len; i++) - g_free(uids->pdata[i]); - g_ptr_array_free(uids, TRUE); + filter_type_uid (fb->folder, (char *)uids->pdata[0], source, type); + + for (i = 0; i < uids->len; i++) + g_free (uids->pdata[i]); + g_ptr_array_free (uids, TRUE); } void filter_subject(GtkWidget *w, FolderBrowser *fb) { filter_type_current(fb, AUTO_SUBJECT); } @@ -1409,12 +1412,12 @@ struct _filter_data { static void filter_data_free(struct _filter_data *fdata) { - g_free(fdata->uid); - g_free(fdata->uri); + g_free (fdata->uid); + g_free (fdata->uri); if (fdata->folder) - camel_object_unref((CamelObject *)fdata->folder); - g_free(fdata->mlist); - g_free(fdata); + camel_object_unref (fdata->folder); + g_free (fdata->mlist); + g_free (fdata); } static void @@ -1432,7 +1435,7 @@ static void vfolder_type_uid(CamelFolder *folder, const char *uid, const char *uri, int type) { struct _filter_data *data; - + data = g_malloc0(sizeof(*data)); data->type = type; data->uri = g_strdup(uri); @@ -1448,10 +1451,10 @@ static void filter_type_got_message(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *d) { struct _filter_data *data = d; - + if (msg) filter_gui_add_from_message(msg, data->source, data->type); - + filter_data_free(data); } @@ -1459,7 +1462,7 @@ static void filter_type_uid(CamelFolder *folder, const char *uid, const char *source, int type) { struct _filter_data *data; - + data = g_malloc0(sizeof(*data)); data->type = type; data->source = source; @@ -1483,19 +1486,19 @@ hide_selected(GtkWidget *w, FolderBrowser *fb) GPtrArray *uids; int i; - uids = g_ptr_array_new(); - message_list_foreach(fb->message_list, enumerate_msg, uids); - message_list_hide_uids(fb->message_list, uids); - for (i=0; i<uids->len; i++) - g_free(uids->pdata[i]); - g_ptr_array_free(uids, TRUE); + uids = g_ptr_array_new (); + message_list_foreach (fb->message_list, enumerate_msg, uids); + message_list_hide_uids (fb->message_list, uids); + for (i = 0; i < uids->len; i++) + g_free (uids->pdata[i]); + g_ptr_array_free (uids, TRUE); } void hide_deleted(GtkWidget *w, FolderBrowser *fb) { MessageList *ml = fb->message_list; - + message_list_hide_add(ml, "(match-all (system-flag \"deleted\"))", ML_HIDE_SAME, ML_HIDE_SAME); } @@ -1503,7 +1506,7 @@ void hide_read(GtkWidget *w, FolderBrowser *fb) { MessageList *ml = fb->message_list; - + message_list_hide_add(ml, "(match-all (system-flag \"seen\"))", ML_HIDE_SAME, ML_HIDE_SAME); } @@ -1540,7 +1543,7 @@ hide_subject(GtkWidget *w, FolderBrowser *fb) { const char *subject; GString *expr; - + if (fb->mail_display->current_message) { subject = camel_mime_message_get_subject(fb->mail_display->current_message); if (subject) { @@ -1563,7 +1566,7 @@ hide_sender(GtkWidget *w, FolderBrowser *fb) const CamelInternetAddress *from; const char *real, *addr; GString *expr; - + if (fb->mail_display->current_message) { from = camel_mime_message_get_from(fb->mail_display->current_message); if (camel_internet_address_get(from, 0, &real, &addr)) { @@ -1615,7 +1618,7 @@ colour_closures_free (GPtrArray *closures) for (i = 0; i < closures->len; i++) { data = closures->pdata[i]; - gtk_object_unref (GTK_OBJECT (data->fb)); + g_object_unref (data->fb); g_free (data); } g_ptr_array_free (closures, TRUE); @@ -1633,7 +1636,7 @@ set_msg_label (GtkWidget *widget, gpointer user_data) struct _label_data *data = user_data; GPtrArray *uids; int i; - + uids = g_ptr_array_new (); message_list_foreach (data->fb->message_list, enumerate_msg, uids); for (i = 0; i < uids->len; i++) @@ -1649,7 +1652,7 @@ label_closures_free (GPtrArray *closures) for (i = 0; i < closures->len; i++) { data = closures->pdata[i]; - gtk_object_unref (GTK_OBJECT (data->fb)); + g_object_unref (data->fb); g_free (data); } g_ptr_array_free (closures, TRUE); @@ -1926,7 +1929,7 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event fdata->mlist = g_strdup(mname); /* Escape the mailing list name before showing it */ - mlist = alloca ((strlen (mname) * 2) + 1); + mlist = g_alloca ((strlen (mname) * 2) + 1); p = mname; o = mlist; while ((c = *p++)) { @@ -2047,7 +2050,9 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event ((struct _label_data *) label_menu[0].closure)->fb = fb; ((struct _label_data *) label_menu[0].closure)->label = NULL; - for (i = 0; i < filter_label_count(); i++) { + /* FIXME: don't hard code the label values */ +#define NUM_LABELS (sizeof (label_defaults) / sizeof (label_defaults[0])) + for (i = 0; i < NUM_LABELS; i++) { struct _label_data *closure; GdkPixmap *pixmap; GdkColormap *map; @@ -2071,13 +2076,13 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event gdk_gc_unref (gc); closure = g_new (struct _label_data, 1); - gtk_object_ref (GTK_OBJECT (fb)); + g_object_ref (fb); closure->fb = fb; - closure->label = filter_label_label(i); + closure->label = mail_config_get_label_name (i); g_ptr_array_add (closures, closure); - label_menu[i + 2].name = e_utf8_to_locale_string (mail_config_get_label_name (i)); + label_menu[i + 2].name = mail_config_get_label_name (i); label_menu[i + 2].pixmap_widget = gtk_pixmap_new (pixmap, NULL); label_menu[i + 2].closure = closure; } @@ -2090,12 +2095,12 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event menu = e_popup_menu_create (context_menu, enable_mask, hide_mask, fb); e_auto_kill_popup_menu_on_hide (menu); - gtk_object_set_data_full (GTK_OBJECT (menu), "label_closures", - closures, (GtkDestroyNotify) label_closures_free); + g_object_set_data_full (menu, "label_closures", closures, + (GtkDestroyNotify) label_closures_free); if (fdata) - gtk_object_set_data_full (GTK_OBJECT (menu), "filter_data", - fdata, (GtkDestroyNotify) filter_data_free); + g_object_set_data_full (menu, "filter_data", fdata, + (GtkDestroyNotify) filter_data_free); if (event->type == GDK_KEY_PRESS) { struct cmpf_data closure; @@ -2113,11 +2118,6 @@ on_right_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *event g_free (filter_menu[MLIST_FILTER].name); g_free (filter_menu[MLIST_VFOLDER].name); - /* free the label/colour menu */ - for (i = 0; i < 5; i++) { - g_free (label_menu[i + 2].name); - } - return TRUE; } @@ -2200,13 +2200,13 @@ etree_key (ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, FolderBr { GtkAdjustment *vadj; gfloat page_size; - + if ((ev->key.state & GDK_CONTROL_MASK) != 0) return FALSE; - + vadj = e_scroll_frame_get_vadjustment (fb->mail_display->scroll); page_size = vadj->page_size - vadj->step_increment; - + switch (ev->key.keyval) { case GDK_space: /* Work around Ximian 4939 */ @@ -2233,7 +2233,7 @@ etree_key (ETree *tree, int row, ETreePath path, int col, GdkEvent *ev, FolderBr default: return on_key_press ((GtkWidget *)tree, (GdkEventKey *)ev, fb); } - + return TRUE; } @@ -2254,13 +2254,13 @@ on_selection_changed (GtkObject *obj, gpointer user_data) { FolderBrowser *fb = FOLDER_BROWSER (user_data); FolderBrowserSelectionState state; - + /* we can get this signal at strange times... * if no uicomp, don't even bother */ - + if (fb->uicomp == NULL) return; - + switch (e_selection_model_selected_count (E_SELECTION_MODEL (obj))) { case 0: state = FB_SELSTATE_NONE; @@ -2272,17 +2272,17 @@ on_selection_changed (GtkObject *obj, gpointer user_data) state = FB_SELSTATE_MULTIPLE; break; } - + folder_browser_ui_set_selection_state (fb, state); - - update_status_bar_idle(fb); + + update_status_bar_idle (fb); } static void -on_cursor_activated(ETree *tree, int row, ETreePath path, gpointer user_data) +on_cursor_activated (ETree *tree, int row, ETreePath path, gpointer user_data) { - on_selection_changed((GtkObject *)tree, user_data); + on_selection_changed ((GtkObject *)tree, user_data); } static void @@ -2297,7 +2297,7 @@ folder_browser_gui_init (FolderBrowser *fb) { extern RuleContext *search_context; ESelectionModel *esm; - + /* The panned container */ fb->vpaned = e_vpaned_new (); gtk_widget_show (fb->vpaned); @@ -2320,30 +2320,29 @@ folder_browser_gui_init (FolderBrowser *fb) gtk_widget_show (GTK_WIDGET (fb->search)); - gtk_signal_connect (GTK_OBJECT (fb->search), "menu_activated", - GTK_SIGNAL_FUNC (folder_browser_search_menu_activated), fb); - gtk_signal_connect (GTK_OBJECT (fb->search), "search_activated", - GTK_SIGNAL_FUNC (folder_browser_search_do_search), fb); - gtk_signal_connect (GTK_OBJECT (fb->search), "query_changed", - GTK_SIGNAL_FUNC (folder_browser_query_changed), fb); - + g_signal_connect (fb->search, "menu_activated", + GTK_SIGNAL_FUNC (folder_browser_search_menu_activated), fb); + g_signal_connect (fb->search, "search_activated", + GTK_SIGNAL_FUNC (folder_browser_search_do_search), fb); + g_signal_connect (fb->search, "query_changed", + GTK_SIGNAL_FUNC (folder_browser_query_changed), fb); gtk_table_attach (GTK_TABLE (fb), GTK_WIDGET (fb->search), 0, 1, 0, 1, GTK_FILL | GTK_EXPAND, 0, 0, 0); - + esm = e_tree_get_selection_model (E_TREE (fb->message_list->tree)); - gtk_signal_connect (GTK_OBJECT (esm), "selection_changed", on_selection_changed, fb); - gtk_signal_connect (GTK_OBJECT (esm), "cursor_activated", on_cursor_activated, fb); + g_signal_connect (esm, "selection_changed", GTK_SIGNAL_FUNC (on_selection_changed), fb); + g_signal_connect (esm, "cursor_activated", GTK_SIGNAL_FUNC (on_cursor_activated), fb); fb->selection_state = FB_SELSTATE_NONE; /* default to none */ - + e_paned_add1 (E_PANED (fb->vpaned), GTK_WIDGET (fb->message_list)); gtk_widget_show (GTK_WIDGET (fb->message_list)); - gtk_signal_connect (GTK_OBJECT (fb->message_list), "size_allocate", - GTK_SIGNAL_FUNC (fb_resize_cb), fb); + g_signal_connect (fb->message_list, "size_allocate", + GTK_SIGNAL_FUNC (fb_resize_cb), fb); e_paned_add2 (E_PANED (fb->vpaned), GTK_WIDGET (fb->mail_display)); e_paned_set_position (E_PANED (fb->vpaned), mail_config_get_paned_size ()); @@ -2358,7 +2357,8 @@ do_mark_seen (gpointer data) FolderBrowser *fb = FOLDER_BROWSER (data); if (fb->new_uid && fb->loaded_uid && !strcmp (fb->new_uid, fb->loaded_uid)) { - camel_folder_set_message_flags (fb->folder, fb->new_uid, CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); + camel_folder_set_message_flags (fb->folder, fb->new_uid, + CAMEL_MESSAGE_SEEN, CAMEL_MESSAGE_SEEN); } return FALSE; @@ -2383,7 +2383,7 @@ done_message_selected (CamelFolder *folder, const char *uid, CamelMimeMessage *m camel_folder_free_message_info (fb->folder, info); /* FIXME: should this signal be emitted here?? */ - gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [MESSAGE_LOADED], uid); + g_signal_emit (fb, folder_browser_signals[MESSAGE_LOADED], 0, uid); /* pain, if we have pending stuff, re-run */ if (fb->pending_uid) { @@ -2476,18 +2476,15 @@ on_message_list_focus_out (GtkWidget *widget, GdkEventFocus *event, gpointer use } static void -folder_browser_init (GtkObject *object) +folder_browser_init (FolderBrowser *fb) { - FolderBrowser *fb = (FolderBrowser *)object; - - fb->async_event = mail_async_event_new(); + fb->async_event = mail_async_event_new (); fb->get_id = -1; } static void -my_folder_browser_init (GtkObject *object) +my_folder_browser_init (FolderBrowser *fb) { - FolderBrowser *fb = FOLDER_BROWSER (object); int i; fb->view_instance = NULL; @@ -2509,41 +2506,41 @@ my_folder_browser_init (GtkObject *object) fb->preview_shown = TRUE; - gtk_signal_connect (GTK_OBJECT (fb->mail_display->html), - "key_press_event", GTK_SIGNAL_FUNC (on_key_press), fb); - gtk_signal_connect (GTK_OBJECT (fb->mail_display->html), - "button_press_event", GTK_SIGNAL_FUNC (html_button_press_event), fb); + g_signal_connect (fb->mail_display->html, "key_press_event", + GTK_SIGNAL_FUNC (on_key_press), fb); + g_signal_connect (fb->mail_display->html, "button_press_event", + GTK_SIGNAL_FUNC (html_button_press_event), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), - "key_press", GTK_SIGNAL_FUNC (etree_key), fb); + g_signal_connect (fb->message_list->tree, "key_press", + GTK_SIGNAL_FUNC (etree_key), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), - "right_click", GTK_SIGNAL_FUNC (on_right_click), fb); + g_signal_connect (fb->message_list->tree, "right_click", + GTK_SIGNAL_FUNC (on_right_click), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), - "double_click", GTK_SIGNAL_FUNC (on_double_click), fb); + g_signal_connect (fb->message_list->tree, "double_click", + GTK_SIGNAL_FUNC (on_double_click), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list), "focus_in_event", - GTK_SIGNAL_FUNC (on_message_list_focus_in), fb); + g_signal_connect (fb->message_list, "focus_in_event", + GTK_SIGNAL_FUNC (on_message_list_focus_in), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list), "focus_out_event", - GTK_SIGNAL_FUNC (on_message_list_focus_out), fb); + g_signal_connect (fb->message_list, "focus_out_event", + GTK_SIGNAL_FUNC (on_message_list_focus_out), fb); - gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_selected", - on_message_selected, fb); + g_signal_connect (fb->message_list, "message_selected", + GTK_SIGNAL_FUNC (on_message_selected), fb); /* drag & drop */ e_tree_drag_source_set (fb->message_list->tree, GDK_BUTTON1_MASK, drag_types, num_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "tree_drag_data_get", - GTK_SIGNAL_FUNC (message_list_drag_data_get), fb); + g_signal_connect (fb->message_list->tree, "tree_drag_data_get", + GTK_SIGNAL_FUNC (message_list_drag_data_get), fb); e_tree_drag_dest_set (fb->message_list->tree, GTK_DEST_DEFAULT_ALL, drag_types, num_drag_types, GDK_ACTION_MOVE | GDK_ACTION_COPY); - gtk_signal_connect (GTK_OBJECT (fb->message_list->tree), "tree_drag_data_received", - GTK_SIGNAL_FUNC (message_list_drag_data_received), fb); + g_signal_connect (fb->message_list->tree, "tree_drag_data_received", + GTK_SIGNAL_FUNC (message_list_drag_data_received), fb); /* cut, copy & paste */ fb->invisible = gtk_invisible_new (); @@ -2553,18 +2550,12 @@ my_folder_browser_init (GtkObject *object) paste_types[i].target, paste_types[i].info); - gtk_signal_connect (GTK_OBJECT (fb->invisible), - "selection_get", - GTK_SIGNAL_FUNC (selection_get), - (gpointer) fb); - gtk_signal_connect (GTK_OBJECT (fb->invisible), - "selection_clear_event", - GTK_SIGNAL_FUNC (selection_clear_event), - (gpointer) fb); - gtk_signal_connect (GTK_OBJECT (fb->invisible), - "selection_received", - GTK_SIGNAL_FUNC (selection_received), - (gpointer) fb); + g_signal_connect (fb->invisible, "selection_get", + GTK_SIGNAL_FUNC (selection_get), fb); + g_signal_connect (fb->invisible, "selection_clear_event", + GTK_SIGNAL_FUNC (selection_clear_event), fb); + g_signal_connect (fb->invisible, "selection_received", + GTK_SIGNAL_FUNC (selection_received), fb); folder_browser_gui_init (fb); } @@ -2576,11 +2567,11 @@ folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri) FolderBrowser *folder_browser; CORBA_exception_init (&ev); - + folder_browser = gtk_type_new (folder_browser_get_type ()); - - my_folder_browser_init (GTK_OBJECT (folder_browser)); - + + my_folder_browser_init (folder_browser); + folder_browser->shell = CORBA_Object_duplicate (shell, &ev); if (ev._major != CORBA_NO_EXCEPTION) { folder_browser->shell = CORBA_OBJECT_NIL; @@ -2588,12 +2579,12 @@ folder_browser_new (const GNOME_Evolution_Shell shell, const char *uri) CORBA_exception_free (&ev); return NULL; } - + CORBA_exception_free (&ev); if (uri) { folder_browser->uri = g_strdup (uri); - gtk_object_ref (GTK_OBJECT (folder_browser)); + g_object_ref (folder_browser); folder_browser->get_id = mail_get_folder (folder_browser->uri, 0, got_folder, folder_browser, mail_thread_new); } |