aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/groupwise-features/status-track.c
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2009-09-23 00:44:48 +0800
committerMilan Crha <mcrha@redhat.com>2009-09-23 00:46:33 +0800
commitffe9df88b271e52aa8934762e73ed70b01464a60 (patch)
tree4eb70294042e441cf611b4115b49a73d2e841164 /plugins/groupwise-features/status-track.c
parent7c80528594c272e3295dae6a4e11e27fd1763466 (diff)
downloadgsoc2013-evolution-ffe9df88b271e52aa8934762e73ed70b01464a60.tar.gz
gsoc2013-evolution-ffe9df88b271e52aa8934762e73ed70b01464a60.tar.zst
gsoc2013-evolution-ffe9df88b271e52aa8934762e73ed70b01464a60.zip
GN-bug #593617 - GroupWise plugins are not built
Diffstat (limited to 'plugins/groupwise-features/status-track.c')
-rw-r--r--plugins/groupwise-features/status-track.c109
1 files changed, 53 insertions, 56 deletions
diff --git a/plugins/groupwise-features/status-track.c b/plugins/groupwise-features/status-track.c
index 5507568809..e38497823b 100644
--- a/plugins/groupwise-features/status-track.c
+++ b/plugins/groupwise-features/status-track.c
@@ -32,17 +32,17 @@
#include <time.h>
#include <gtk/gtk.h>
-#include "camel/camel-folder.h"
-#include "camel/camel-mime-utils.h"
-#include "camel/camel-medium.h"
-#include "camel/camel-mime-message.h"
-#include <mail/em-popup.h>
-#include <mail/em-folder-view.h>
+#include <camel/camel-folder.h>
+#include <camel/camel-mime-utils.h>
+#include <camel/camel-medium.h>
+#include <camel/camel-mime-message.h>
+
+#include <mail/e-mail-reader.h>
#include <e-gw-connection.h>
-#include "share-folder.h"
-void org_gnome_track_status (gpointer ep, EMPopupTargetSelect *t);
+#include "gw-ui.h"
+#include "share-folder.h"
static gchar *
format_date (const gchar * value)
@@ -57,11 +57,40 @@ format_date (const gchar * value)
return str;
}
-static void
-track_status (EPopup *ep, EPopupItem *item, gpointer data)
+static CamelMimeMessage *
+get_selected_message (EShellView *shell_view, CamelFolder **folder, gchar **selected_uid)
{
- EMPopupTargetSelect *t = (EMPopupTargetSelect *)data;
CamelMimeMessage *msg = NULL;
+ EShellContent *shell_content;
+ EMailReader *reader;
+ MessageList *message_list;
+ GPtrArray *selected;
+
+ shell_content = e_shell_view_get_shell_content (shell_view);
+
+ reader = (EMailReader *) (shell_content);
+ message_list = e_mail_reader_get_message_list (reader);
+ g_return_val_if_fail (message_list != NULL, NULL);
+
+ selected = message_list_get_selected (message_list);
+ if (selected && selected->len == 1) {
+ *folder = message_list->folder;
+ *selected_uid = g_strdup (g_ptr_array_index (selected, 0));
+
+ msg = camel_folder_get_message (*folder, *selected_uid, NULL);
+ }
+
+ message_list_free_uids (message_list, selected);
+
+ return msg;
+}
+
+void
+gw_track_message_status_cb (GtkAction *action, EShellView *shell_view)
+{
+ CamelMimeMessage *msg = NULL;
+ CamelFolder *folder = NULL;
+ gchar *selected_uid = NULL;
const CamelInternetAddress *from;
const gchar *namep, *addp;
@@ -81,14 +110,15 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data)
EGwConnection *cnc;
EGwItem *gwitem;
- /*Get message*/
- msg = camel_folder_get_message (t->folder, g_ptr_array_index (t->uids, 0), NULL);
+ /* Get message */
+ msg = get_selected_message (shell_view, &folder, &selected_uid);
if (!msg) {
g_print ("Error!! No message\n");
+ g_free (selected_uid);
return;
}
- /*Create the dialog*/
+ /* Create the dialog */
d = (GtkDialog *) gtk_dialog_new ();
gtk_dialog_add_button (d, GTK_STOCK_OK, GTK_RESPONSE_OK);
gtk_window_set_title (GTK_WINDOW (d), _("Message Status"));
@@ -104,7 +134,7 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data)
gtk_table_set_col_spacings (table ,12);
gtk_table_set_row_spacings (table, 6);
- /*Subject*/
+ /* Subject */
boldmsg = g_strdup_printf ("<b>%s</b>", _("Subject:"));
widget = gtk_label_new (boldmsg);
g_free (boldmsg);
@@ -116,7 +146,7 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data)
gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
row++;
- /*From*/
+ /* From */
from = camel_mime_message_get_from (msg);
camel_internet_address_get (from, 0, &namep, &addp);
boldmsg = g_strdup_printf ("<b>%s</b>", _("From:"));
@@ -130,7 +160,7 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data)
gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
row++;
- /*creation date*/
+ /* creation date */
time = camel_mime_message_get_date (msg, NULL);
time_str = ctime (&time);
time_str[strlen(time_str)-1] = '\0' ;
@@ -145,22 +175,22 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data)
gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0);
row++;
- /*spacing*/
+ /* spacing */
widget = gtk_label_new ("");
gtk_table_attach (table, widget, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0);
row++;
- /*Table headers*/
+ /* Table headers */
row = 0;
table = (GtkTable *) gtk_table_new (1, 3, FALSE);
gtk_table_set_col_spacings (table ,12);
gtk_table_set_row_spacings (table, 6);
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0);
- cnc = get_cnc (t->folder->parent_store);
+ cnc = get_cnc (folder->parent_store);
if (E_IS_GW_CONNECTION(cnc)) {
GSList *recipient_list;
- e_gw_connection_get_item (cnc, get_container_id (cnc, "Sent Items"), g_ptr_array_index (t->uids, 0), "distribution recipientStatus", &gwitem);
+ e_gw_connection_get_item (cnc, get_container_id (cnc, "Sent Items"), selected_uid, "distribution recipientStatus", &gwitem);
recipient_list = e_gw_item_get_recipient_list (gwitem);
for (;recipient_list != NULL; recipient_list = recipient_list->next)
{
@@ -225,46 +255,13 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data)
}
}
- /*set size and display the dialog*/
+ /* set size and display the dialog */
gtk_widget_set_size_request (GTK_WIDGET (win), 400, 300);
gtk_widget_show_all (GTK_WIDGET (d));
if (gtk_dialog_run (d) == GTK_RESPONSE_OK)
gtk_widget_destroy (GTK_WIDGET (d));
else
gtk_widget_destroy (GTK_WIDGET (d));
-}
-
-static EPopupItem popup_items[] = {
- { E_POPUP_ITEM, (gchar * ) "20.emfv.02", (gchar *) N_("Track Message Status..."), track_status, NULL, NULL, 0, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY}
-};
-
-static void
-popup_free (EPopup *ep, GSList *items, gpointer data)
-{
- g_slist_free (items);
-}
-
-void org_gnome_track_status (gpointer ep, EMPopupTargetSelect *t)
-{
- GSList *menus = NULL;
-
- gint i = 0;
- static gint first = 0;
-
- if (! g_strrstr (t->uri, "groupwise://") || g_ascii_strncasecmp ((t->folder)->full_name, "Sent Items", 10))
- return;
-
- /* for translation*/
- if (!first) {
- popup_items[0].label = _(popup_items[0].label);
-
- }
-
- first++;
-
- for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++)
- menus = g_slist_prepend (menus, &popup_items[i]);
-
- e_popup_add_items (t->target.popup, menus, NULL, popup_free, t);
+ g_free (selected_uid);
}