From 74b77f6caf3fe1bc738e43fc6edf67b20f9b6d88 Mon Sep 17 00:00:00 2001 From: "Dirk-Jan C. Binnema" Date: Tue, 20 Feb 2007 08:38:01 +0000 Subject: [PATCH] * modest-ui-actions.c: - make reply/forward work for msg view windows * cleanups, cosmetics pmo-trunk-r841 --- src/modest-defs.h | 3 +++ src/modest-main.c | 7 ++++++- src/modest-runtime.c | 5 ++--- src/modest-runtime.h | 30 +++++++++++++++++++++++++-- src/modest-tny-account-store.c | 4 ++++ src/modest-ui-actions.c | 44 ++++++++++++++++++++++++---------------- 6 files changed, 70 insertions(+), 23 deletions(-) diff --git a/src/modest-defs.h b/src/modest-defs.h index a0ffd7a..2dda28b 100644 --- a/src/modest-defs.h +++ b/src/modest-defs.h @@ -90,4 +90,7 @@ #define MODEST_ACCOUNT_PREFERRED_CNX "preferred_cnx" /* string */ #define MODEST_ACCOUNT_OPTIONS "options" /* list */ + + + #endif /*__MODEST_DEFS_H__*/ diff --git a/src/modest-main.c b/src/modest-main.c index 6dd8fa5..46d49af 100644 --- a/src/modest-main.c +++ b/src/modest-main.c @@ -138,7 +138,7 @@ main (int argc, char *argv[]) g_printerr ("modest: no account has been defined yet\n"); retval = MODEST_ERR_CONF; goto cleanup; - } + } retval = send_mail (account_or_default, mailto, cc, bcc, subject, body); } @@ -258,6 +258,11 @@ send_mail (const gchar* account_name, g_return_val_if_fail (account_name, MODEST_ERR_SEND); + ////////////////////// FIXME //////// + modest_runtime_not_implemented (NULL); + return MODEST_ERR_NONE; + ////////////////////////////////////// + account = TNY_TRANSPORT_ACCOUNT (modest_tny_account_store_get_tny_account_by_account (modest_runtime_get_account_store(), account_name, TNY_ACCOUNT_TYPE_TRANSPORT)); diff --git a/src/modest-runtime.c b/src/modest-runtime.c index 592dcd4..f4036ce 100644 --- a/src/modest-runtime.c +++ b/src/modest-runtime.c @@ -59,10 +59,10 @@ static void init_debug_logging (void); static ModestSingletons *_singletons = NULL; + /* * defaults for the column headers */ - typedef struct { ModestHeaderViewColumn col; guint width; @@ -187,8 +187,7 @@ modest_runtime_uninit (void) g_object_unref (G_OBJECT(_singletons)); _singletons = NULL; } - if (G_IS_OBJECT(_singletons)) - g_warning ("BUG: _singletons is still alive\n"); + modest_runtime_verify_object_death (_singletons, "_singletons"); return TRUE; } diff --git a/src/modest-runtime.h b/src/modest-runtime.h index 2509e4c..e0d9ee8 100644 --- a/src/modest-runtime.h +++ b/src/modest-runtime.h @@ -87,6 +87,7 @@ gboolean modest_runtime_init_ui (gint argc, gchar** argv); */ gboolean modest_runtime_uninit (void); + /** * modest_runtime_get_debug_flags @@ -197,8 +198,9 @@ ModestTnySendQueue* modest_runtime_get_send_queue (TnyTransportAccount *a /** * modest_runtime_verify_object_death - * @obj: some (GObject) ptr - * + * @OBJ: some (GObject) ptr + * @NAME: name of @OBJ + * * macro to check whether @obj is 'dead', ie, it is no longer a valid GObject. If * not, a g_warning will be issued on stderr. NOTE: this is only active * when MODEST_DEBUG contains "debug-objects". @@ -214,6 +216,30 @@ ModestTnySendQueue* modest_runtime_get_send_queue (TnyTransportAccount *a } while (0) + +/** + * modest_runtime_not_implemented + * @WIN: the parent GtkWindow, or NULL + * + * give a not-implemented-yet warning popup or g_warning + * + ***/ +#define modest_runtime_not_implemented(WIN) \ + do { \ + if (gtk_main_level() > 0) { \ + GtkWidget *popup; \ + popup = gtk_message_dialog_new (WIN,\ + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT,\ + GTK_MESSAGE_WARNING, \ + GTK_BUTTONS_OK, \ + "Not yet implemented");\ + gtk_dialog_run (GTK_DIALOG(popup)); \ + gtk_widget_destroy (popup); \ + } else \ + g_warning ("%s:%d: Not yet implemented",__FILE__,__LINE__); \ + } while (0) \ + + G_END_DECLS #endif /*__MODEST_RUNTIME_H__*/ diff --git a/src/modest-tny-account-store.c b/src/modest-tny-account-store.c index bfe6814..a057685 100644 --- a/src/modest-tny-account-store.c +++ b/src/modest-tny-account-store.c @@ -173,6 +173,8 @@ modest_tny_account_store_instance_init (ModestTnyAccountStore *obj) g_free, g_free); } + + static void account_list_free (GSList *accounts) { @@ -200,6 +202,8 @@ on_account_removed (ModestAccountMgr *acc_mgr, const gchar *account, gboolean se /* FIXME: make this more finegrained; changes do not really affect _all_ * accounts, and some do not affect tny accounts at all (such as 'last_update') */ + + account_list_free (priv->store_accounts); priv->store_accounts = NULL; diff --git a/src/modest-ui-actions.c b/src/modest-ui-actions.c index a3ecf47..490b9bd 100644 --- a/src/modest-ui-actions.c +++ b/src/modest-ui-actions.c @@ -276,13 +276,11 @@ cleanup: void modest_ui_actions_on_open (GtkWidget *widget, ModestWindow *win) { - /* FIXME */ - + modest_runtime_not_implemented (GTK_WINDOW(win)); /* FIXME */ } - static void reply_forward_func (gpointer data, gpointer user_data) { @@ -402,27 +400,39 @@ reply_forward (GtkWidget *widget, ReplyForwardAction action, ModestWindow *win) rf_helper->account_name = g_strdup (modest_window_get_active_account (win)); if (!rf_helper->account_name) - rf_helper->account_name = modest_account_mgr_get_default_account (modest_runtime_get_account_mgr()); + rf_helper->account_name = + modest_account_mgr_get_default_account (modest_runtime_get_account_mgr()); helper = g_slice_new0 (GetMsgAsyncHelper); helper->window = win; helper->func = reply_forward_func; helper->iter = tny_list_create_iterator (header_list); helper->user_data = rf_helper; - - header = TNY_HEADER (tny_iterator_get_current (helper->iter)); - folder = tny_header_get_folder (header); - if (folder) { - /* The callback will call it per each header */ - tny_folder_get_msg_async (folder, header, get_msg_cb, helper); - g_object_unref (G_OBJECT (folder)); - } else - g_printerr ("modest: no folder for header\n"); - - /* Clean */ - g_object_unref (G_OBJECT (header)); + + if (MODEST_IS_MSG_VIEW_WINDOW(win)) { + TnyMsg *msg; + msg = modest_msg_view_window_get_message(MODEST_MSG_VIEW_WINDOW(win)); + if (!msg) { + g_printerr ("modest: no message found\n"); + return; + } else + reply_forward_func (msg, helper); + } else { + header = TNY_HEADER (tny_iterator_get_current (helper->iter)); + folder = tny_header_get_folder (header); + if (folder) { + /* The callback will call it per each header */ + tny_folder_get_msg_async (folder, header, get_msg_cb, helper); + g_object_unref (G_OBJECT (folder)); + } else + g_printerr ("modest: no folder for header\n"); + + /* Clean */ + g_object_unref (G_OBJECT (header)); + } } + void modest_ui_actions_on_reply (GtkWidget *widget, ModestWindow *win) { @@ -812,7 +822,7 @@ statusbar_push (ModestMainWindow *main_window, guint context_id, const gchar *ms if (status_bar) { gtk_widget_show (status_bar); gtk_statusbar_push (GTK_STATUSBAR(status_bar), 0, msg); - g_timeout_add (1500, (GSourceFunc)statusbar_clean, status_bar); + g_timeout_add (2500, (GSourceFunc)statusbar_clean, status_bar); } } -- 1.7.9.5