From: Dirk-Jan C. Binnema Date: Wed, 5 Jul 2006 09:39:50 +0000 (+0000) Subject: * renamed gtk-glade => gtk X-Git-Tag: git_migration_finished~4525 X-Git-Url: http://git.maemo.org/git/?p=modest;a=commitdiff_plain;h=6eb21a13a54773294a98603f0d11310b33f4ecda * renamed gtk-glade => gtk pmo-trunk-r351 --- diff --git a/src/gtk/Makefile.am b/src/gtk/Makefile.am new file mode 100644 index 0000000..a53db65 --- /dev/null +++ b/src/gtk/Makefile.am @@ -0,0 +1,50 @@ +# +# Makefile.am +# Time-stamp: <2006-06-06 14:27:48 (djcb)> +# +# +# use Automake 'trick' ==> convenience static libraries, which +# won't be installed, just for linking +# +INCLUDES=\ + $(MODEST_GSTUFF_CFLAGS) \ + $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_CFLAGS) \ + -DPREFIX=\"@prefix@\" \ + -Wall + +noinst_LTLIBRARIES=\ + libmodest-ui.la + +GLADE_FILES=\ + modest.glade\ + glade/*.png + +PIXMAP_FILES=\ + pixmaps/*.png + +libmodest_ui_la_SOURCES=\ + modest-ui.c\ + modest-ui-glade.h\ + modest-icon-names.h\ + modest-ui-main-view.c\ + modest-ui-main-view.h\ + modest-ui-message-editor.c\ + modest-ui-message-editor.h\ + modest-ui-message-viewer.c\ + modest-ui-message-viewer.h\ + modest-ui-wizard.h\ + modest-ui-wizard.c\ + modest-ui-account-setup.h\ + modest-ui-account-setup.c + +LDADD = \ + $(MODEST_GSTUFF_LIBS) \ + $(MODEST_LIBTINYMAIL_GNOME_DESKTOP_LIBS) + +EXTRA_DIST=pixmaps/* glade/* modest.glade modest.gladep + +gladedir = $(prefix)/share/modest/glade +glade_DATA = $(GLADE_FILES) + +pixmapdir = $(prefix)/share/modest/pixmaps +pixmap_DATA = $(PIXMAP_FILES) diff --git a/src/gtk/glade/qgn_list_gene_attacpap.png b/src/gtk/glade/qgn_list_gene_attacpap.png new file mode 100644 index 0000000..0448a7d Binary files /dev/null and b/src/gtk/glade/qgn_list_gene_attacpap.png differ diff --git a/src/gtk/glade/qgn_list_gene_bold.png b/src/gtk/glade/qgn_list_gene_bold.png new file mode 100644 index 0000000..5d10d3f Binary files /dev/null and b/src/gtk/glade/qgn_list_gene_bold.png differ diff --git a/src/gtk/glade/qgn_list_gene_contacts.png b/src/gtk/glade/qgn_list_gene_contacts.png new file mode 100644 index 0000000..350271d Binary files /dev/null and b/src/gtk/glade/qgn_list_gene_contacts.png differ diff --git a/src/gtk/glade/qgn_list_gene_italic.png b/src/gtk/glade/qgn_list_gene_italic.png new file mode 100644 index 0000000..638fa90 Binary files /dev/null and b/src/gtk/glade/qgn_list_gene_italic.png differ diff --git a/src/gtk/glade/qgn_list_messagin_mail.png b/src/gtk/glade/qgn_list_messagin_mail.png new file mode 100644 index 0000000..4038776 Binary files /dev/null and b/src/gtk/glade/qgn_list_messagin_mail.png differ diff --git a/src/gtk/glade/qgn_list_messagin_mail_unread.png b/src/gtk/glade/qgn_list_messagin_mail_unread.png new file mode 100644 index 0000000..3d15a38 Binary files /dev/null and b/src/gtk/glade/qgn_list_messagin_mail_unread.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin.png b/src/gtk/glade/qgn_toolb_messagin.png new file mode 100644 index 0000000..4c4899b Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_bullets.png b/src/gtk/glade/qgn_toolb_messagin_bullets.png new file mode 100644 index 0000000..aee5a70 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_bullets.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_delete.png b/src/gtk/glade/qgn_toolb_messagin_delete.png new file mode 100644 index 0000000..0f31b07 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_delete.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_fontcolor.png b/src/gtk/glade/qgn_toolb_messagin_fontcolor.png new file mode 100644 index 0000000..49304cd Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_fontcolor.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_forward.png b/src/gtk/glade/qgn_toolb_messagin_forward.png new file mode 100644 index 0000000..b286238 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_forward.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_moveto.png b/src/gtk/glade/qgn_toolb_messagin_moveto.png new file mode 100644 index 0000000..3497a2a Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_moveto.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_new.png b/src/gtk/glade/qgn_toolb_messagin_new.png new file mode 100644 index 0000000..b93921e Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_new.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_next.png b/src/gtk/glade/qgn_toolb_messagin_next.png new file mode 100644 index 0000000..6d70431 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_next.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_previous.png b/src/gtk/glade/qgn_toolb_messagin_previous.png new file mode 100644 index 0000000..184e319 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_previous.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_reply.png b/src/gtk/glade/qgn_toolb_messagin_reply.png new file mode 100644 index 0000000..5cdd7c2 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_reply.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_replytoall.png b/src/gtk/glade/qgn_toolb_messagin_replytoall.png new file mode 100644 index 0000000..78cde69 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_replytoall.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_saveattachment.png b/src/gtk/glade/qgn_toolb_messagin_saveattachment.png new file mode 100644 index 0000000..02d7eb1 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_saveattachment.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_send.png b/src/gtk/glade/qgn_toolb_messagin_send.png new file mode 100644 index 0000000..84a3420 Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_send.png differ diff --git a/src/gtk/glade/qgn_toolb_messagin_sendreceive.png b/src/gtk/glade/qgn_toolb_messagin_sendreceive.png new file mode 100644 index 0000000..0b794cd Binary files /dev/null and b/src/gtk/glade/qgn_toolb_messagin_sendreceive.png differ diff --git a/src/gtk/modest-icon-names.h b/src/gtk/modest-icon-names.h new file mode 100644 index 0000000..35745bd --- /dev/null +++ b/src/gtk/modest-icon-names.h @@ -0,0 +1,34 @@ +/* modest-tny-icon-names.h */ +/* FIXME: this should go the front-end dirs, + * with specific icons */ + +#ifndef __MODEST_TNY_ICON_NAMES_H__ +#define __MODEST_TNY_ICON_NAMES_H__ + +#define PIXMAP_PREFIX PREFIX "/share/modest/pixmaps/" + +/* icons */ + +#define MODEST_HEADER_ICON_READ PIXMAP_PREFIX "qgn_list_messagin_mail.png" +#define MODEST_HEADER_ICON_UNREAD PIXMAP_PREFIX "qgn_list_messagin_mail_unread.png" +#define MODEST_HEADER_ICON_DELETED PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png" +#define MODEST_HEADER_ICON_ATTACH PIXMAP_PREFIX "qgn_list_gene_attacpap.png" + +#define MODEST_FOLDER_ICON_OPEN PIXMAP_PREFIX "qgn_list_gene_fldr_opn.png" +#define MODEST_FOLDER_ICON_CLOSED PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png" + +#define MODEST_FOLDER_ICON_INBOX PIXMAP_PREFIX "qgn_list_messagin_inbox.png" +#define MODEST_FOLDER_ICON_OUTBOX PIXMAP_PREFIX "qgn_list_messagin_outbox.png" +#define MODEST_FOLDER_ICON_SENT PIXMAP_PREFIX "qgn_list_messagin_sent.png" +#define MODEST_FOLDER_ICON_TRASH PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png" +#define MODEST_FOLDER_ICON_JUNK PIXMAP_PREFIX "qgn_list_messagin_mail_deleted.png" +#define MODEST_FOLDER_ICON_DRAFTS PIXMAP_PREFIX "qgn_list_messagin_drafts.png" +#define MODEST_FOLDER_ICON_NORMAL PIXMAP_PREFIX "qgn_list_gene_fldr_cls.png" + +#define MODEST_FOLDER_ICON_CONTACTS PIXMAP_PREFIX "qgn_addr_icon_user_group.png" +#define MODEST_FOLDER_ICON_NOTES PIXMAP_PREFIX "qgn_list_messagin_viewer.png" +#define MODEST_FOLDER_ICON_CALENDAR PIXMAP_PREFIX "qgn_widg_datedit.png" + + + +#endif /*__MODEST_TNY_ICON_NAMES_H__*/ diff --git a/src/gtk/modest-ui-account-setup.c b/src/gtk/modest-ui-account-setup.c new file mode 100644 index 0000000..b13f5b7 --- /dev/null +++ b/src/gtk/modest-ui-account-setup.c @@ -0,0 +1,1114 @@ +/* modest-ui-wizard.c */ + +/* insert (c)/licensing information) */ + +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif /*HAVE_CONFIG_H*/ + +#include "../modest-account-mgr.h" +#include "../modest-identity-mgr.h" + +#include "modest-ui-glade.h" +#include "modest-ui-account-setup.h" + +enum { + IDENTITY_NAME, + IDENTITY_ADDRESS, + IDENTITY_VIA, + IDENTITY_COLUMNS +}; + +enum { + ACCOUNT_NAME, + ACCOUNT_HOST, + ACCOUNT_PROT, + ACCOUNT_COLUMNS +}; + +typedef struct _CallbackData CallbackData; + +struct _CallbackData { + GtkTreeView *id_tree_view; + GtkTreeView *acc_tree_view; + ModestUI *modest_ui; + GladeXML *glade_xml; +}; + +static void +identity_setup_dialog (ModestUI *, GtkTreeModel *, gchar *); + +static void +account_setup_dialog (ModestUI *, gchar *); + +static void +missing_notification(GtkWindow *, gchar *); + +static GtkTreeModel * +create_identities_model(ModestIdentityMgr *); + +static GtkTreeModel * +create_accounts_model(ModestAccountMgr *); + +static void +refresh_identities(ModestIdentityMgr *, + GladeXML *); + +static void +refresh_accounts(ModestAccountMgr *, GladeXML *glade_xml); + +/* CALLBACKS */ + +static gboolean +filter_transports (GtkTreeModel *model, + GtkTreeIter *iter, + gpointer userdata) { + + gchar *name; + gboolean retval; + + gtk_tree_model_get(model, + iter, + ACCOUNT_PROT, &name, + -1); + + retval = strcasecmp(name, "SMTP")==0; + g_free(name); + return retval; +} + + +static void +account_edit_action(GtkWidget *button, + gpointer userdata) { + + CallbackData *cb_data; + GtkTreeModel *acc_liststore; + GtkTreeSelection *selection; + GtkTreeIter selected_iter; + gchar *account_name; + + cb_data = (CallbackData *) userdata; + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(cb_data->acc_tree_view)); + + gtk_tree_selection_get_selected(selection, + &acc_liststore, + &selected_iter); + gtk_tree_model_get(GTK_TREE_MODEL(acc_liststore), + &selected_iter, + ACCOUNT_NAME, &account_name, + -1); + + account_setup_dialog (cb_data->modest_ui, account_name); + g_free(account_name); +} + +static void +account_create_action(GtkWidget *button, + gpointer userdata) { + CallbackData *cb_data; + + cb_data = (CallbackData *) userdata; + + account_setup_dialog(cb_data->modest_ui, NULL); +} + +static void +account_delete_action(GtkWidget *button, + gpointer userdata) { + CallbackData *cb_data; + GtkTreeSelection *selection; + GtkTreeIter selected_iter; + GtkTreeModel *acc_liststore; + GtkWidget *confirmation_dialog; + GtkWidget *confirmation_message; + ModestUIPrivate *priv; + gchar *account_name; + gchar *message; + gint result; + + cb_data = (CallbackData *) userdata; + priv = MODEST_UI_GET_PRIVATE(cb_data->modest_ui); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(cb_data->acc_tree_view)); + + gtk_tree_selection_get_selected(selection, + &acc_liststore, + &selected_iter); + gtk_tree_model_get(GTK_TREE_MODEL(acc_liststore), + &selected_iter, + ACCOUNT_NAME, &account_name, + -1); + + confirmation_dialog = gtk_dialog_new_with_buttons ("Confirm removal of account", + GTK_WINDOW(gtk_widget_get_toplevel(button)), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); + + message = g_strdup_printf("Remove selected account '%s'?", account_name); + confirmation_message = gtk_label_new_with_mnemonic (message); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(confirmation_dialog)->vbox), confirmation_message, FALSE, FALSE, 10); + + gtk_widget_show_all(confirmation_dialog); + + result=gtk_dialog_run(GTK_DIALOG(confirmation_dialog)); + if (result==GTK_RESPONSE_OK) + { + modest_account_mgr_remove_server_account(priv->modest_acc_mgr, + account_name, + NULL); + } + + gtk_widget_destroy(confirmation_dialog); + g_free(account_name); + g_free(message); +} + + +static void +identity_edit_action(GtkWidget *button, + gpointer userdata) +{ + CallbackData *cb_data; + GtkTreeModel *acc_liststore; + GtkTreeModel *id_liststore; + GtkTreeSelection *selection; + GtkTreeIter selected_iter; + gchar *identity_name; + + cb_data = (CallbackData *) userdata; + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(cb_data->id_tree_view)); + + gtk_tree_selection_get_selected(selection, + &id_liststore, + &selected_iter); + gtk_tree_model_get(GTK_TREE_MODEL(id_liststore), + &selected_iter, + IDENTITY_NAME, &identity_name, + -1); + /* We use the available tree model from the accounts page to display a selection + * of transports in the identities. Since we only want the transport accounts, + * we derive a gtk_tree_model_filter and apply filter_transports function. + */ + acc_liststore = gtk_tree_model_filter_new(gtk_tree_view_get_model(cb_data->acc_tree_view), + NULL); + gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(acc_liststore), + filter_transports, + NULL, + NULL); + + identity_setup_dialog (cb_data->modest_ui, acc_liststore, identity_name); + g_free(identity_name); +} + +static void +identity_create_action(GtkWidget *button, + gpointer userdata) +{ + CallbackData *cb_data; + GtkTreeModel *acc_liststore; + + cb_data = (CallbackData *) userdata; + + /* Works as in identity_edit_action. */ + acc_liststore = gtk_tree_model_filter_new(gtk_tree_view_get_model(cb_data->acc_tree_view), + NULL); + gtk_tree_model_filter_set_visible_func(GTK_TREE_MODEL_FILTER(acc_liststore), + filter_transports, + NULL, + NULL); + + identity_setup_dialog(cb_data->modest_ui, acc_liststore, NULL); + g_object_unref(acc_liststore); +} + +static void +identity_delete_action(GtkWidget *button, + gpointer userdata) +{ + CallbackData *cb_data; + GtkTreeSelection *selection; + GtkTreeIter selected_iter; + GtkTreeModel *id_liststore; + GtkWidget *confirmation_dialog; + GtkWidget *confirmation_message; + ModestUIPrivate *priv; + gchar *identity_name; + gchar *message; + gint result; + + cb_data = (CallbackData *) userdata; + priv = MODEST_UI_GET_PRIVATE(cb_data->modest_ui); + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(cb_data->id_tree_view)); + + gtk_tree_selection_get_selected(selection, + &id_liststore, + &selected_iter); + gtk_tree_model_get(GTK_TREE_MODEL(id_liststore), + &selected_iter, + ACCOUNT_NAME, &identity_name, + -1); + + confirmation_dialog = gtk_dialog_new_with_buttons ("Confirm removal of identity", + GTK_WINDOW(gtk_widget_get_toplevel(button)), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + GTK_RESPONSE_OK, + GTK_STOCK_CANCEL, + GTK_RESPONSE_CANCEL, + NULL); + + message = g_strdup_printf("Remove selected identity '%s'?", identity_name); + confirmation_message = gtk_label_new_with_mnemonic (message); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(confirmation_dialog)->vbox), confirmation_message, FALSE, FALSE, 10); + + gtk_widget_show_all(confirmation_dialog); + + result=gtk_dialog_run(GTK_DIALOG(confirmation_dialog)); + if (result==GTK_RESPONSE_OK) + { + modest_identity_mgr_remove_identity(priv->modest_id_mgr, + identity_name, + NULL); + } + + gtk_widget_destroy(confirmation_dialog); + g_free(identity_name); + g_free(message); +} + +static void +activate_buttons_on_identity(GtkTreeView *tree_view, + gpointer user_data) +{ + GtkWidget *button; + GladeXML *glade_xml; + + glade_xml=(GladeXML *) user_data; + + button = glade_xml_get_widget(GLADE_XML(glade_xml), "IdentityEditButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE); + button = glade_xml_get_widget(GLADE_XML(glade_xml), "IdentityDeleteButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE); +} + +static void +activate_buttons_on_account(GtkTreeView *tree_view, + gpointer user_data) +{ + GtkWidget *button; + GladeXML *glade_xml; + + glade_xml=(GladeXML *) user_data; + + button = glade_xml_get_widget(GLADE_XML(glade_xml), "AccountEditButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE); + button = glade_xml_get_widget(GLADE_XML(glade_xml), "AccountDeleteButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE); +} + +static void +use_sig_toggled(GtkToggleButton *button, + gpointer userdata) { + + GtkWidget *awidget; + GladeXML *glade_xml = (GladeXML *) userdata; + + awidget=glade_xml_get_widget(glade_xml, "ISSignatureTextView"); + gtk_widget_set_sensitive(awidget, gtk_toggle_button_get_active(button)); +} + +static void +refresh_accounts_on_add(ModestAccountMgr *modest_acc_mgr, + void *nu1, + gpointer userdata) +{ + refresh_accounts(modest_acc_mgr, (GladeXML *) userdata); +} + +static void +refresh_accounts_on_remove(ModestAccountMgr *modest_acc_mgr, + void *nu1, + gpointer userdata) { + + GladeXML *glade_xml = (GladeXML *) userdata; + GtkWidget *button; + + refresh_accounts(modest_acc_mgr, (GladeXML *) userdata); + /* Since we loose the selection through the delete operation, we need to + * change the buttons sensitivity . + */ + button = glade_xml_get_widget(GLADE_XML(glade_xml), "AccountEditButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); + button = glade_xml_get_widget(GLADE_XML(glade_xml), "AccountDeleteButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); +} + +static void +refresh_accounts_on_change(ModestAccountMgr *modest_acc_mgr, + void *nu1, + void *nu2, + void *nu3, + gpointer userdata) +{ + refresh_accounts(modest_acc_mgr, (GladeXML *) userdata); +} + +static void +refresh_identities_on_add(ModestIdentityMgr *modest_id_mgr, + void *nu1, + gpointer userdata) { + refresh_identities(modest_id_mgr, (GladeXML *) userdata); +} + +static void +refresh_identities_on_remove(ModestIdentityMgr *modest_id_mgr, + void *nu1, + gpointer userdata) { + + GladeXML *glade_xml = (GladeXML *) userdata; + GtkWidget *button; + + refresh_identities(modest_id_mgr, glade_xml); + + /* Since we loose the selection through the delete operation, we need to + * change the buttons sensitivity . + */ + button = glade_xml_get_widget(GLADE_XML(glade_xml), "IdentityEditButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); + button = glade_xml_get_widget(GLADE_XML(glade_xml), "IdentityDeleteButton"); + gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE); +} + +static void +refresh_identities_on_change(ModestIdentityMgr *modest_id_mgr, + void *nu1, + void *nu2, + void *nu3, + gpointer userdata) { + refresh_identities(modest_id_mgr, (GladeXML *) userdata); +} + +/* METHODS */ + +static gboolean +search_model_column_for_string_advanced(GtkTreeModel *model, GtkTreeIter *iter, gint ColNum, gchar *search, gboolean mcase) { + + gchar *tmptext; + gboolean iter_true; + + iter_true = gtk_tree_model_get_iter_first(model, iter); + while (iter_true) { + gtk_tree_model_get(model, + iter, + ColNum, &tmptext, + -1); + if ((mcase && strcasecmp(tmptext, search)==0) + || strcmp(tmptext, search)==0) { + g_free(tmptext); + break; + } + g_free(tmptext); + iter_true = gtk_tree_model_iter_next(model, iter); + if (!iter_true) { + break; + } + } + return iter_true; +} + +static gboolean +search_model_column_for_string(GtkTreeModel *model, GtkTreeIter *iter, gint ColNum, gchar *search) { + return search_model_column_for_string_advanced(model, iter, ColNum, search, FALSE); +} + +static gboolean +case_search_model_column_for_string(GtkTreeModel *model, GtkTreeIter *iter, gint ColNum, gchar *search) { + return search_model_column_for_string_advanced(model, iter, ColNum, search, TRUE); +} + +static void +refresh_identities(ModestIdentityMgr *modest_id_mgr, + GladeXML *glade_xml) { + + GtkTreeModel *id_liststore; + GtkTreeView *id_treeview; + + id_treeview = GTK_TREE_VIEW(glade_xml_get_widget(glade_xml, "IdentitiesTreeview")); + + id_liststore=create_identities_model(modest_id_mgr); + gtk_tree_view_set_model(GTK_TREE_VIEW(id_treeview), id_liststore); +} + +static void +refresh_accounts(ModestAccountMgr *modest_acc_mgr, + GladeXML *glade_xml) { + + GtkTreeModel *acc_liststore; + GtkTreeView *acc_treeview; + + acc_treeview = GTK_TREE_VIEW(glade_xml_get_widget(glade_xml, "AccountsTreeview")); + + acc_liststore=create_accounts_model(modest_acc_mgr); + gtk_tree_view_set_model(GTK_TREE_VIEW(acc_treeview), acc_liststore); +} + +static void +missing_notification(GtkWindow *parent, gchar *info_message) { + + GtkWidget *DenyDialog; + + DenyDialog=gtk_message_dialog_new(parent, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "%s", + info_message); + + gtk_dialog_run(GTK_DIALOG(DenyDialog)); + + gtk_widget_destroy(DenyDialog); +} + +static gboolean +write_identity(GladeXML *glade_xml, ModestUI *modest_ui, GtkTreeModel *accounts_model, gboolean newidentity) { + + GtkTextBuffer *sigbuff; + GtkTextIter start_iter; + GtkTextIter end_iter; + GtkTreeIter transport_iter; + ModestUIPrivate *priv; + const gchar *identity; + gchar *reply_to; + gchar *signature; + gchar *transport; + + priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui)); + + reply_to = g_strdup_printf("%s", gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ISReplyToEntry")))); + + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade_xml, "ISUseSignatureCheckButton")))) + { + sigbuff = gtk_text_view_get_buffer(GTK_TEXT_VIEW(glade_xml_get_widget(glade_xml, "ISSignatureTextView"))); + gtk_text_buffer_get_bounds(sigbuff, + &start_iter, + &end_iter); + signature = gtk_text_buffer_get_text(sigbuff, + &start_iter, + &end_iter, + FALSE); + } + else + signature = NULL; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(glade_xml_get_widget(glade_xml, "ISOutServerComboBox")), &transport_iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(accounts_model), + &transport_iter, + ACCOUNT_NAME, &transport, + -1); + } + else { + missing_notification(NULL, "Please select an outgoing server!"); + return FALSE; + } + + identity = gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ISIdentityEntry"))); + + if (newidentity) { + + if (modest_identity_mgr_add_identity (priv->modest_id_mgr, + identity, + NULL, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ISEMailAddress"))), + NULL, + NULL, + FALSE, + NULL, + FALSE)); + else + return FALSE; + } + if (!modest_identity_mgr_set_identity_string(priv->modest_id_mgr, + identity, + MODEST_IDENTITY_REALNAME, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ISNameEntry"))), + NULL)) + return FALSE; + if (!modest_identity_mgr_set_identity_string(priv->modest_id_mgr, + identity, + MODEST_IDENTITY_EMAIL, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ISEMailAddress"))), + NULL)) + return FALSE; + if (!modest_identity_mgr_set_identity_string(priv->modest_id_mgr, + identity, + MODEST_IDENTITY_REPLYTO, + reply_to, + NULL)) + return FALSE; + if (!modest_identity_mgr_set_identity_string(priv->modest_id_mgr, + identity, + MODEST_IDENTITY_SIGNATURE, + signature, + NULL)) + return FALSE; + if (!modest_identity_mgr_set_identity_bool(priv->modest_id_mgr, + identity, + MODEST_IDENTITY_USE_SIGNATURE, + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade_xml, + "ISUseSignatureCheckButton"))), + NULL)) + return FALSE; + if (!modest_identity_mgr_set_identity_string(priv->modest_id_mgr, + identity, + MODEST_IDENTITY_ID_VIA, + transport, + NULL)) + return FALSE; + if (!modest_identity_mgr_set_identity_bool(priv->modest_id_mgr, + identity, + MODEST_IDENTITY_USE_ID_VIA, + TRUE, /* FIXME: for now */ + NULL)) + return FALSE; + g_free(transport); + return TRUE; +} + +static gboolean +write_account(GladeXML *glade_xml, ModestUI *modest_ui, gboolean newaccount) { + + ModestUIPrivate *priv; + const gchar *account; + gchar *protocol; + gchar *tmptext; + gint retval; + + priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui)); + + account = gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASDisplaynameEntry"))); + + if (newaccount) { + tmptext = gtk_combo_box_get_active_text(GTK_COMBO_BOX(glade_xml_get_widget(glade_xml, "ASProtocolComboBox"))); + protocol = g_utf8_strdown(tmptext, -1); + g_free(tmptext); + + retval = modest_account_mgr_add_server_account (priv->modest_acc_mgr, + account, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASHostnameEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASUsernameEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASPasswordEntry"))), + protocol); + g_free(protocol); + return retval; + } + if (!modest_account_mgr_set_server_account_string(priv->modest_acc_mgr, + account, + MODEST_ACCOUNT_HOSTNAME, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASHostnameEntry"))), + NULL)) + return FALSE; + if (!modest_account_mgr_set_server_account_string(priv->modest_acc_mgr, + account, + MODEST_ACCOUNT_USERNAME, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASUsernameEntry"))), + NULL)) + return FALSE; + if (!modest_account_mgr_set_server_account_string(priv->modest_acc_mgr, + account, + MODEST_ACCOUNT_PASSWORD, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "ASPasswordEntry"))), + NULL)) + return FALSE; + return TRUE; +} + +static void +identity_setup_dialog (ModestUI *modest_ui, GtkTreeModel *accounts_model, gchar *identity) +{ + + GladeXML *glade_xml; + GtkWidget *id_dialog; + GtkWidget *outgoing_server; + GtkWidget *awidget; + GtkCellRenderer *renderer; + ModestIdentityMgr *id_mgr; + GtkTextBuffer *sigbuff; + GtkTreeIter out_iter; + gchar *outacc_name; + gchar *tmptext; + gint identity_added_successfully; + gint result; + gboolean newidentity; + + glade_xml = glade_xml_new(MODEST_GLADE, "IdentitySetupDialog", NULL); + id_dialog = glade_xml_get_widget(glade_xml, "IdentitySetupDialog"); + + outgoing_server = glade_xml_get_widget(glade_xml, "ISOutServerComboBox"); + gtk_combo_box_set_model(GTK_COMBO_BOX(outgoing_server), GTK_TREE_MODEL(accounts_model)); + renderer = gtk_cell_renderer_text_new (); + gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (outgoing_server), renderer, TRUE); + gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (outgoing_server), renderer, + "text", 0, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ISUseSignatureCheckButton"); + g_signal_connect(awidget, + "toggled", + G_CALLBACK(use_sig_toggled), + glade_xml); + + newidentity = identity==NULL; + if (!newidentity) { + id_mgr = MODEST_UI_GET_PRIVATE(modest_ui)->modest_id_mgr; + + outacc_name = modest_identity_mgr_get_identity_string(id_mgr, + identity, + MODEST_IDENTITY_ID_VIA, + NULL); + if (search_model_column_for_string(GTK_TREE_MODEL(accounts_model), + &out_iter, + ACCOUNT_NAME, + outacc_name)) + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(outgoing_server), &out_iter); + + awidget=glade_xml_get_widget(glade_xml, "ISIdentityEntry"); + gtk_widget_set_sensitive(awidget, FALSE); + gtk_entry_set_text(GTK_ENTRY(awidget), identity); + tmptext = modest_identity_mgr_get_identity_string(id_mgr, + identity, + MODEST_IDENTITY_EMAIL, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ISEMailAddress"); + gtk_entry_set_text(GTK_ENTRY(awidget), tmptext); + g_free(tmptext); + + if (modest_identity_mgr_get_identity_bool(id_mgr, + identity, + MODEST_IDENTITY_USE_SIGNATURE, + NULL)) { + awidget=glade_xml_get_widget(glade_xml, "ISUseSignatureCheckButton"); + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(awidget), TRUE); + awidget=glade_xml_get_widget(glade_xml, "ISSignatureTextView"); + gtk_widget_set_sensitive(awidget, TRUE); + } + + sigbuff=gtk_text_buffer_new(NULL); + tmptext = modest_identity_mgr_get_identity_string(id_mgr, + identity, + MODEST_IDENTITY_SIGNATURE, + NULL), + gtk_text_buffer_set_text(sigbuff, tmptext, -1); + gtk_text_view_set_buffer(GTK_TEXT_VIEW(glade_xml_get_widget(glade_xml, "ISSignatureTextView")), + sigbuff); + g_object_unref(sigbuff); + g_free(tmptext); + + tmptext = modest_identity_mgr_get_identity_string(id_mgr, + identity, + MODEST_IDENTITY_EMAIL, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ISEMailAddress"); + gtk_entry_set_text(GTK_ENTRY(awidget), tmptext); + g_free(tmptext); + + tmptext = modest_identity_mgr_get_identity_string(id_mgr, + identity, + MODEST_IDENTITY_REALNAME, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ISNameEntry"); + gtk_entry_set_text(GTK_ENTRY(awidget), tmptext); + g_free(tmptext); + + tmptext = modest_identity_mgr_get_identity_string(id_mgr, + identity, + MODEST_IDENTITY_REPLYTO, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ISReplyToEntry"); + gtk_entry_set_text(GTK_ENTRY(awidget), tmptext); + + g_free(tmptext); + g_free(outacc_name); + } + + gtk_widget_show_all(id_dialog); + + do { + result=gtk_dialog_run(GTK_DIALOG(id_dialog)); + + switch (result) { + case GTK_RESPONSE_OK: + identity_added_successfully = write_identity(glade_xml, modest_ui, accounts_model, newidentity); + break; + default: + identity_added_successfully = FALSE; + break; + } + } while(result!=GTK_RESPONSE_DELETE_EVENT && result!=GTK_RESPONSE_CANCEL && identity_added_successfully!=TRUE); + + gtk_widget_destroy(id_dialog); + g_object_unref(glade_xml); +} + +static void +account_setup_dialog (ModestUI *modest_ui, gchar *account) { + + GladeXML *glade_xml; + GtkWidget *acc_dialog; + GtkWidget *awidget; + ModestAccountMgr *acc_mgr; + GtkTreeModel *typemodel; + GtkTreeIter proto_iter; + gchar *tmptext; + gint account_added_successfully; + gint result; + gboolean newaccount; + + glade_xml = glade_xml_new(MODEST_GLADE, "AccountSetupDialog", NULL); + acc_dialog = glade_xml_get_widget(glade_xml, "AccountSetupDialog"); + + newaccount = account==NULL; + if (!newaccount) { + acc_mgr = MODEST_UI_GET_PRIVATE(modest_ui)->modest_acc_mgr; + + awidget=glade_xml_get_widget(glade_xml, "ASDisplaynameEntry"); + gtk_widget_set_sensitive(awidget, FALSE); + gtk_entry_set_text(GTK_ENTRY(awidget), account); + + tmptext = modest_account_mgr_get_server_account_string(acc_mgr, + account, + MODEST_ACCOUNT_PROTO, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ASProtocolComboBox"); + gtk_widget_set_sensitive(awidget, FALSE); + typemodel = gtk_combo_box_get_model(GTK_COMBO_BOX(awidget)); + if (case_search_model_column_for_string(typemodel, &proto_iter, 0, tmptext)) + gtk_combo_box_set_active_iter(GTK_COMBO_BOX(awidget), &proto_iter); + + g_free(tmptext); + + tmptext = modest_account_mgr_get_server_account_string(acc_mgr, + account, + MODEST_ACCOUNT_HOSTNAME, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ASHostnameEntry"); + gtk_entry_set_text(GTK_ENTRY(awidget), tmptext); + g_free(tmptext); + + tmptext = modest_account_mgr_get_server_account_string(acc_mgr, + account, + MODEST_ACCOUNT_USERNAME, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ASUsernameEntry"); + gtk_entry_set_text(GTK_ENTRY(awidget), tmptext); + g_free(tmptext); + + tmptext = modest_account_mgr_get_server_account_string(acc_mgr, + account, + MODEST_ACCOUNT_PASSWORD, + NULL); + awidget=glade_xml_get_widget(glade_xml, "ASPasswordEntry"); + gtk_entry_set_text(GTK_ENTRY(awidget), tmptext); + g_free(tmptext); + } + + gtk_widget_show_all(acc_dialog); + + do { + result=gtk_dialog_run(GTK_DIALOG(acc_dialog)); + + switch (result) { + case GTK_RESPONSE_OK: + account_added_successfully = write_account(glade_xml, modest_ui, newaccount); + + break; + default: + account_added_successfully = FALSE; + break; + } + } while(result!=GTK_RESPONSE_DELETE_EVENT && result!=GTK_RESPONSE_CANCEL && account_added_successfully!=TRUE); + + gtk_widget_destroy(acc_dialog); + g_object_unref(glade_xml); +} + + +static CallbackData * +setup_callback_data(GtkTreeView *id_tree_view, + GtkTreeView *acc_tree_view, + ModestUI *modest_ui, + GladeXML *glade_xml) +{ + CallbackData *self; + self = g_malloc(sizeof(CallbackData)); + self->modest_ui=modest_ui; + self->id_tree_view=id_tree_view; + self->acc_tree_view=acc_tree_view; + self->glade_xml=glade_xml; + return self; +} + +static void +free_callback_data(CallbackData *data) +{ + g_free(data); +} + +static GtkTreeModel * +create_identities_model(ModestIdentityMgr *id_mgr) { + + GSList *id_names_list; + GSList *id_names_list_iter; + GtkListStore *id_list_store; + GtkTreeIter id_list_store_iter; + gchar *tmptext1; + gchar *tmptext2; + + id_names_list = modest_identity_mgr_identity_names(id_mgr, NULL); + id_list_store = gtk_list_store_new(IDENTITY_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + + for (id_names_list_iter=id_names_list; + id_names_list_iter!=NULL; + id_names_list_iter=g_slist_next(id_names_list_iter)) { + gtk_list_store_append(id_list_store, &id_list_store_iter); + tmptext1=modest_identity_mgr_get_identity_string(id_mgr, + id_names_list_iter->data, + MODEST_IDENTITY_EMAIL, + NULL); + tmptext2=modest_identity_mgr_get_identity_string(id_mgr, + id_names_list_iter->data, + MODEST_IDENTITY_ID_VIA, + NULL); + gtk_list_store_set(id_list_store, &id_list_store_iter, + IDENTITY_NAME, id_names_list_iter->data, + IDENTITY_ADDRESS, tmptext1, + IDENTITY_VIA, tmptext2, + -1); + g_free(tmptext1); + g_free(tmptext2); + } + + g_slist_free(id_names_list); + + return GTK_TREE_MODEL(id_list_store); +} + +static GtkTreeModel * +create_accounts_model(ModestAccountMgr *acc_mgr) { + + GSList *acc_names_list; + GSList *acc_names_list_iter; + GtkListStore *acc_list_store; + GtkTreeIter acc_list_store_iter; + gchar *hostname; + gchar *protocol; + + acc_names_list = modest_account_mgr_server_account_names(acc_mgr, + NULL, + MODEST_PROTO_TYPE_ANY, + NULL, + FALSE); + acc_list_store = gtk_list_store_new(ACCOUNT_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING); + + for (acc_names_list_iter=acc_names_list; + acc_names_list_iter!=NULL; + acc_names_list_iter=g_slist_next(acc_names_list_iter)) { + gtk_list_store_append(acc_list_store, &acc_list_store_iter); + hostname=modest_account_mgr_get_server_account_string(acc_mgr, + acc_names_list_iter->data, + MODEST_ACCOUNT_HOSTNAME, + NULL); + protocol=modest_account_mgr_get_server_account_string(acc_mgr, + acc_names_list_iter->data, + MODEST_ACCOUNT_PROTO, + NULL); + gtk_list_store_set(acc_list_store, &acc_list_store_iter, + ACCOUNT_NAME, acc_names_list_iter->data, + ACCOUNT_HOST, hostname, + ACCOUNT_PROT, protocol, + -1); + g_free(hostname); + g_free(protocol); + } + + g_slist_free(acc_names_list); + + return GTK_TREE_MODEL(acc_list_store); +} + + +static void +accounts_and_identities_dialog (gpointer user_data) +{ + GladeXML *glade_xml; + GtkWidget *main_dialog; + GtkTreeView *identities_tree_view; + GtkTreeView *accounts_tree_view; + ModestUI *modest_ui; + ModestUIPrivate *priv; + gint sig_coll[6]; + gint retval; + GtkCellRenderer *renderer; + GtkTreeViewColumn *column; + CallbackData *cb_data; + GtkWidget *abutton; + + g_return_if_fail(MODEST_IS_UI(user_data)); + modest_ui = (ModestUI *) user_data; + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + glade_xml = glade_xml_new(MODEST_GLADE, "IdentitiesAndAccountsDialog", NULL); + main_dialog = glade_xml_get_widget(glade_xml, "IdentitiesAndAccountsDialog"); + + /* Accounts */ + accounts_tree_view = GTK_TREE_VIEW(glade_xml_get_widget(glade_xml, "AccountsTreeview")); + /* Account -> Accountname */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Account", + renderer, + "text", ACCOUNT_NAME, + NULL); + gtk_tree_view_append_column (accounts_tree_view, column); + /* Account -> Hostname */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Hostname", + renderer, + "text", ACCOUNT_HOST, + NULL); + gtk_tree_view_append_column (accounts_tree_view, column); + + /* Identities */ + identities_tree_view = GTK_TREE_VIEW(glade_xml_get_widget(glade_xml, "IdentitiesTreeview")); + + /* Identities -> Identityname */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Identity", + renderer, + "text", IDENTITY_NAME, + NULL); + gtk_tree_view_append_column (identities_tree_view, column); + + /* Identities -> E-mail address */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("E-mail address", + renderer, + "text", IDENTITY_ADDRESS, + NULL); + gtk_tree_view_append_column (identities_tree_view, column); + + /* Identities -> Relay */ + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Transport", + renderer, + "text", IDENTITY_VIA, + NULL); + gtk_tree_view_append_column (identities_tree_view, column); + + cb_data=setup_callback_data(identities_tree_view, accounts_tree_view, modest_ui, glade_xml); + + refresh_accounts(priv->modest_acc_mgr, + glade_xml); + + refresh_identities(priv->modest_id_mgr, + glade_xml); + + /* Identities */ + abutton=glade_xml_get_widget(glade_xml, "IdentityCreateButton"); + g_signal_connect(abutton, + "clicked", + G_CALLBACK(identity_create_action), + cb_data); + abutton=glade_xml_get_widget(glade_xml, "IdentityEditButton"); + g_signal_connect(abutton, + "clicked", + G_CALLBACK(identity_edit_action), + cb_data); + abutton=glade_xml_get_widget(glade_xml, "IdentityDeleteButton"); + g_signal_connect(abutton, + "clicked", + G_CALLBACK(identity_delete_action), + cb_data); + + /* Accounts */ + abutton=glade_xml_get_widget(glade_xml, "AccountCreateButton"); + g_signal_connect(abutton, + "clicked", + G_CALLBACK(account_create_action), + cb_data); + abutton=glade_xml_get_widget(glade_xml, "AccountEditButton"); + g_signal_connect(abutton, + "clicked", + G_CALLBACK(account_edit_action), + cb_data); + abutton=glade_xml_get_widget(glade_xml, "AccountDeleteButton"); + g_signal_connect(abutton, + "clicked", + G_CALLBACK(account_delete_action), + cb_data); + + g_signal_connect(glade_xml_get_widget(glade_xml, "IdentitiesTreeview"), + "cursor-changed", + G_CALLBACK(activate_buttons_on_identity), + glade_xml); + g_signal_connect(glade_xml_get_widget(glade_xml, "AccountsTreeview"), + "cursor-changed", + G_CALLBACK(activate_buttons_on_account), + glade_xml); + + sig_coll[0] = g_signal_connect(priv->modest_id_mgr, + "identity-change", + G_CALLBACK(refresh_identities_on_change), + glade_xml); + sig_coll[1] = g_signal_connect(priv->modest_id_mgr, + "identity-add", + G_CALLBACK(refresh_identities_on_add), + glade_xml); + sig_coll[2] = g_signal_connect(priv->modest_id_mgr, + "identity-remove", + G_CALLBACK(refresh_identities_on_remove), + glade_xml); + + sig_coll[3] = g_signal_connect(priv->modest_acc_mgr, + "account-change", + G_CALLBACK(refresh_accounts_on_change), + glade_xml); + sig_coll[4] = g_signal_connect(priv->modest_acc_mgr, + "account-add", + G_CALLBACK(refresh_accounts_on_add), + glade_xml); + sig_coll[5] = g_signal_connect(priv->modest_acc_mgr, + "account-remove", + G_CALLBACK(refresh_accounts_on_remove), + glade_xml); + + gtk_widget_show_all(GTK_WIDGET(main_dialog)); + + retval=gtk_dialog_run(GTK_DIALOG(main_dialog)); + + g_signal_handler_disconnect(priv->modest_id_mgr, sig_coll[0]); + g_signal_handler_disconnect(priv->modest_id_mgr, sig_coll[1]); + g_signal_handler_disconnect(priv->modest_id_mgr, sig_coll[2]); + g_signal_handler_disconnect(priv->modest_acc_mgr, sig_coll[3]); + g_signal_handler_disconnect(priv->modest_acc_mgr, sig_coll[4]); + g_signal_handler_disconnect(priv->modest_acc_mgr, sig_coll[5]); + + gtk_widget_destroy(GTK_WIDGET(main_dialog)); + free_callback_data(cb_data); + g_object_unref(glade_xml); +} + +void account_settings (GtkWidget *widget, + gpointer user_data) +{ + accounts_and_identities_dialog (MODEST_UI(user_data)); +} + diff --git a/src/gtk/modest-ui-account-setup.h b/src/gtk/modest-ui-account-setup.h new file mode 100644 index 0000000..cb2e80e --- /dev/null +++ b/src/gtk/modest-ui-account-setup.h @@ -0,0 +1,20 @@ +/* modest-ui-account-setup.h */ +/* insert (c)/licensing information) */ + +#ifndef __MODEST_UI_ACCOUNT_SETUP_H__ +#define __MODEST_UI_ACCOUNT_SETUP_H__ + +#include "modest-ui-glade.h" + +/** + * account_settings: + * @GtkWidget: The widget by which this CALLBACK is called. + * @gpointer: user data set when the signal handler was connected. A + * ModestUI is needed here. + */ +void +account_settings (GtkWidget *, + gpointer); + +#endif /* __MODEST_UI_ACCOUNT_SETUP_H__ */ + diff --git a/src/gtk/modest-ui-glade.h b/src/gtk/modest-ui-glade.h new file mode 100644 index 0000000..7c66c73 --- /dev/null +++ b/src/gtk/modest-ui-glade.h @@ -0,0 +1,39 @@ +/* modest-ui-glade.h */ +/* insert (c)/licensing information) */ + +#ifndef __MODEST_UI_GLADE_H__ +#define __MODEST_UI_GLADE_H__ + +#include "../modest-ui.h" +#include "../modest-account-mgr.h" +#include "../modest-identity-mgr.h" +#include "../modest-window-mgr.h" +#include "../modest-tny-account-store.h" + +#define MODEST_GLADE PREFIX "/share/modest/glade/modest.glade" +#define MODEST_GLADE_MAIN_WIN "main" +#define MODEST_GLADE_EDIT_WIN "new_mail" + +typedef struct _ModestUIPrivate ModestUIPrivate; +struct _ModestUIPrivate { + + ModestConf *modest_conf; + ModestAccountMgr *modest_acc_mgr; + ModestIdentityMgr *modest_id_mgr; + ModestWindowMgr *modest_window_mgr; + TnyAccountStoreIface *account_store; + GtkWidget *folder_view; + GtkWidget *header_view; + GtkWidget *message_view; + + GtkWindow *main_window; + GladeXML *glade_xml; + + TnyMsgFolderIface *current_folder; +}; + +#define MODEST_UI_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE((o), \ + MODEST_TYPE_UI, \ + ModestUIPrivate)) + +#endif /* __MODEST_UI_GLADE_H__ */ diff --git a/src/gtk/modest-ui-main-view.c b/src/gtk/modest-ui-main-view.c new file mode 100644 index 0000000..631c0cb --- /dev/null +++ b/src/gtk/modest-ui-main-view.c @@ -0,0 +1,602 @@ +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif /*HAVE_CONFIG_H*/ + +/* TODO: put in auto* */ +#include +#include + +#include "../modest-ui.h" +#include "../modest-window-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-identity-mgr.h" + +#include "../modest-tny-account-store.h" +#include "../modest-tny-folder-tree-view.h" +#include "../modest-tny-header-tree-view.h" +#include "../modest-tny-msg-view.h" +#include "../modest-tny-transport-actions.h" +#include "../modest-tny-store-actions.h" + +#include "../modest-text-utils.h" +#include "../modest-tny-msg-actions.h" + +#include "../modest-editor-window.h" + +#include "modest-ui-glade.h" +#include "modest-ui-wizard.h" +#include "modest-ui-account-setup.h" + +#include "modest-ui-main-view.h" +#include "modest-ui-message-editor.h" +#include "modest-ui-message-viewer.h" + + +static GtkWidget* modest_main_window_folder_tree (ModestAccountMgr *modest_acc_mgr, + TnyAccountStoreIface *account_store); + +static GtkWidget* modest_main_window_header_tree (TnyMsgFolderIface *folder); + +static void on_folder_clicked (ModestTnyFolderTreeView *folder_tree, + TnyMsgFolderIface *folder, + gpointer data); + +static void on_message_clicked (ModestTnyFolderTreeView *folder_tree, + TnyMsgIface *message, + gpointer data); + +static void on_reply_clicked (GtkWidget *widget, gpointer user_data); + +static void on_forward_clicked (GtkWidget *widget, gpointer user_data); + +static void on_delete_clicked (GtkWidget *widget, gpointer user_data); + +static void on_view_attachments_toggled(GtkWidget *widget, gpointer user_data); + +static void on_sendreceive_button_clicked (GtkWidget *widget, gpointer user_data); + +static void on_forward_attached_activated (GtkWidget *widget, gpointer user_data); + +static void on_headers_status_update (GtkWidget *header_view, const gchar *msg, gint status, + gpointer user_data); +static void on_status_cleanup (gpointer user_data); + +static void register_toolbar_callbacks (ModestUI *modest_ui); + + +static void +modest_ui_main_view_destroy (GtkWidget *win, GdkEvent *event, gpointer data) +{ + ModestUIPrivate *priv; + + g_return_if_fail (data); + g_return_if_fail(MODEST_IS_UI(data)); + priv = MODEST_UI_GET_PRIVATE((ModestUI *)data); + g_return_if_fail(priv); + if (!modest_window_mgr_unregister (priv->modest_window_mgr, G_OBJECT(win))) + g_warning ("modest window mgr: failed to unregister %p", + G_OBJECT(win)); + else + gtk_widget_hide(win); +} + + +gboolean +modest_ui_show_main_window (ModestUI *modest_ui) +{ + GtkWidget *win; + gint height, width; + ModestUIPrivate *priv; + GtkWidget *folder_view, *header_view; + GtkWidget *message_view; + GtkWidget *account_settings_item; + GtkWidget *forward_attached_menu_item; + GtkWidget *delete_item; + GtkWidget *open_item; + GtkWidget *view_attachments_item; + GtkWidget *new_account_item; + + GtkWidget *folder_view_holder, + *header_view_holder, + *mail_paned; + gboolean show_attachments_inline; + + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + height = modest_conf_get_int (priv->modest_conf, + MODEST_CONF_MAIN_WINDOW_HEIGHT,NULL); + width = modest_conf_get_int (priv->modest_conf, + MODEST_CONF_MAIN_WINDOW_WIDTH,NULL); + + win = glade_xml_get_widget (priv->glade_xml, "main"); + if (!win) { + g_warning ("could not create main window"); + return FALSE; + } + + folder_view = GTK_WIDGET(modest_main_window_folder_tree(priv->modest_acc_mgr, + priv->account_store)); + priv->folder_view = folder_view; + folder_view_holder = glade_xml_get_widget (priv->glade_xml, "folders"); + if (!folder_view||!folder_view_holder) { + g_warning ("failed to create folder tree"); + return FALSE; + } + gtk_container_add (GTK_CONTAINER(folder_view_holder), folder_view); + + header_view = GTK_WIDGET(modest_main_window_header_tree (NULL)); + priv->header_view = header_view; + header_view_holder = glade_xml_get_widget (priv->glade_xml, "mail_list"); + if (!header_view) { + g_warning ("failed to create header tree"); + return FALSE; + } + gtk_container_add (GTK_CONTAINER(header_view_holder), header_view); + + g_signal_connect (G_OBJECT(folder_view), "folder_selected", + G_CALLBACK(on_folder_clicked), modest_ui); + + show_attachments_inline = modest_conf_get_bool(priv->modest_conf, + MODEST_CONF_MSG_VIEW_SHOW_ATTACHMENTS_INLINE, + NULL); + + message_view = GTK_WIDGET(modest_tny_msg_view_new (NULL, show_attachments_inline)); + priv->message_view = message_view; + if (!message_view) { + g_warning ("failed to create message view"); + return FALSE; + } + g_signal_connect(G_OBJECT(message_view), "on_mailto_clicked", + G_CALLBACK(ui_on_mailto_clicked), modest_ui); + + mail_paned = glade_xml_get_widget (priv->glade_xml, "mail_paned"); + gtk_paned_add2 (GTK_PANED(mail_paned), message_view); + + g_signal_connect (header_view, "message_selected", + G_CALLBACK(on_message_clicked), + modest_ui); + + g_signal_connect (header_view, "status_update", + G_CALLBACK(on_headers_status_update), modest_ui); + + g_signal_connect (header_view, "row-activated", + G_CALLBACK(on_message_activated), + modest_ui); + + account_settings_item = glade_xml_get_widget (priv->glade_xml, "AccountSettingsMenuItem"); + if (!account_settings_item) { + g_warning ("The account settings item isn't available!\n"); + return FALSE; + } + + g_signal_connect (account_settings_item, "activate", + G_CALLBACK(account_settings), modest_ui); + + new_account_item = glade_xml_get_widget (priv->glade_xml, "NewAccountWizardMenuItem"); + if (!new_account_item) { + g_warning ("The new account item isn't available!\n"); + return FALSE; + } + + g_signal_connect (new_account_item, "activate", + G_CALLBACK(new_wizard_account), modest_ui); + + open_item = glade_xml_get_widget (priv->glade_xml, "open1"); + if (!open_item) { + g_warning ("The open item isn't available!\n"); + return FALSE; + } + g_signal_connect (open_item, "activate", G_CALLBACK(on_open_message_clicked), + modest_ui); + + delete_item = glade_xml_get_widget (priv->glade_xml, "delete1"); + if (!delete_item) { + g_warning ("The delete item isn't available!\n"); + return FALSE; + } + g_signal_connect (delete_item, "activate", G_CALLBACK(on_delete_clicked), + modest_ui); + + view_attachments_item = glade_xml_get_widget (priv->glade_xml, "menu_view_attachments"); + if (!view_attachments_item) { + g_warning ("The view_attachments_item isn't available!"); + return FALSE; + } + + forward_attached_menu_item = glade_xml_get_widget (priv->glade_xml, "forward_attached"); + if (!forward_attached_menu_item) { + g_warning ("The forward_attached_menu_item isn't available!"); + return FALSE; + } + g_signal_connect (forward_attached_menu_item, "activate", G_CALLBACK(on_forward_attached_activated), + modest_ui); + + gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(view_attachments_item), + modest_conf_get_bool(priv->modest_conf, + MODEST_CONF_MSG_VIEW_SHOW_ATTACHMENTS_INLINE, + NULL)); + + g_signal_connect (view_attachments_item, "toggled", + G_CALLBACK(on_view_attachments_toggled), modest_ui); + + register_toolbar_callbacks (modest_ui); + + modest_window_mgr_register (priv->modest_window_mgr, + G_OBJECT(win), MODEST_MAIN_WINDOW, 0); + g_signal_connect (win, "destroy-event", G_CALLBACK(modest_ui_main_view_destroy), + modest_ui); + g_signal_connect (win, "delete-event", G_CALLBACK(modest_ui_main_view_destroy), + modest_ui); + gtk_widget_set_usize (GTK_WIDGET(win), width, height); + gtk_window_set_title (GTK_WINDOW(win), PACKAGE_STRING); + + gtk_widget_show_all (win); + return TRUE; +} + + +static void +register_toolbar_callbacks (ModestUI *modest_ui) +{ + ModestUIPrivate *priv; + GtkWidget *button; + + g_return_if_fail (modest_ui); + + priv = MODEST_UI_GET_PRIVATE (modest_ui); + + button = glade_xml_get_widget (priv->glade_xml, "toolb_new_mail"); + if (button) + g_signal_connect (button, "clicked", + G_CALLBACK(on_new_mail_clicked), modest_ui); + + button = glade_xml_get_widget (priv->glade_xml, "toolb_reply"); + if (button) { + g_signal_connect (button, "clicked", + G_CALLBACK(on_reply_clicked), modest_ui); + gtk_widget_set_sensitive(button, FALSE); + } + + button = glade_xml_get_widget (priv->glade_xml, "toolb_reply_all"); + if (button) { + //g_signal_connect (button, "clicked", + // G_CALLBACK(on_reply_all_clicked), modest_ui); + gtk_widget_set_sensitive(button, FALSE); + } + + button = glade_xml_get_widget (priv->glade_xml, "toolb_forward"); + if (button) { + g_signal_connect (button, "clicked", + G_CALLBACK(on_forward_clicked), modest_ui); + gtk_widget_set_sensitive(button, FALSE); + } + + button = glade_xml_get_widget (priv->glade_xml, "toolb_move_to"); + if (button) { + //g_signal_connect (button, "clicked", + // G_CALLBACK(on_move_to_clicked), modest_ui); + gtk_widget_set_sensitive(button, FALSE); + } + + button = glade_xml_get_widget (priv->glade_xml, "toolb_delete"); + if (button) { + g_signal_connect (button, "clicked", + G_CALLBACK(on_delete_clicked), modest_ui); + gtk_widget_set_sensitive(button, FALSE); + } + + button = glade_xml_get_widget (priv->glade_xml, "toolb_send_receive"); + if (button) { + g_signal_connect (button, "clicked", + G_CALLBACK(on_sendreceive_button_clicked), modest_ui); + gtk_widget_set_sensitive(button, TRUE); + } +} + + +static void +on_folder_clicked (ModestTnyFolderTreeView *folder_tree, + TnyMsgFolderIface *folder, + gpointer data) +{ + GtkWidget *win; + GtkWidget *button; + ModestTnyHeaderTreeView *tree_view; + ModestTnyMsgView *msg_view; + ModestUIPrivate *priv; + GtkWidget *scrollview; + + g_return_if_fail (folder); + g_return_if_fail (data); + + priv = MODEST_UI_GET_PRIVATE(data); + scrollview = glade_xml_get_widget (priv->glade_xml,"mail_list"); + + tree_view = MODEST_TNY_HEADER_TREE_VIEW (priv->header_view); + + win = glade_xml_get_widget (priv->glade_xml, "main"); + gtk_window_set_title (GTK_WINDOW(win), + tny_msg_folder_iface_get_name(folder)); + + modest_tny_header_tree_view_set_folder (tree_view, folder); + priv->current_folder = folder; + + button = glade_xml_get_widget (priv->glade_xml, "toolb_reply"); + if (button) { + gtk_widget_set_sensitive(button, FALSE); + } + + button = glade_xml_get_widget (priv->glade_xml, "toolb_forward"); + if (button) { + gtk_widget_set_sensitive(button, FALSE); + } + + button = glade_xml_get_widget (priv->glade_xml, "toolb_delete"); + if (button) { + gtk_widget_set_sensitive(button, FALSE); + } + + msg_view = MODEST_TNY_MSG_VIEW (priv->message_view); + g_return_if_fail (msg_view); + + modest_tny_msg_view_set_message (msg_view, NULL); +} + + +static void +on_message_clicked (ModestTnyFolderTreeView *folder_tree, + TnyMsgIface *message, + gpointer data) +{ + GtkWidget *button; + ModestTnyMsgView *msg_view; + ModestUIPrivate *priv; + + g_return_if_fail (data); + + priv = MODEST_UI_GET_PRIVATE (data); + msg_view = MODEST_TNY_MSG_VIEW (priv->message_view); + + modest_tny_msg_view_set_message (msg_view, message); + + button = glade_xml_get_widget (priv->glade_xml, "toolb_reply"); + if (button) { + gtk_widget_set_sensitive(button, TRUE); + } + button = glade_xml_get_widget (priv->glade_xml, "toolb_forward"); + if (button) { + gtk_widget_set_sensitive(button, TRUE); + } + button = glade_xml_get_widget (priv->glade_xml, "toolb_delete"); + if (button) { + gtk_widget_set_sensitive(button, TRUE); + } +} + + +static GtkWidget* +modest_main_window_header_tree (TnyMsgFolderIface *folder) +{ + int i; + GSList *columns = NULL; + GtkWidget *header_tree; + ModestTnyHeaderTreeViewColumn cols[] = { + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_MSGTYPE, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_ATTACH, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_FROM, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_SUBJECT, + MODEST_TNY_HEADER_TREE_VIEW_COLUMN_RECEIVED_DATE + }; + + for (i = 0 ; i != sizeof(cols) / sizeof(ModestTnyHeaderTreeViewColumn); ++i) + columns = g_slist_append (columns, GINT_TO_POINTER(cols[i])); + + header_tree = GTK_WIDGET(modest_tny_header_tree_view_new(folder, columns, + MODEST_TNY_HEADER_TREE_VIEW_STYLE_NORMAL)); + g_slist_free (columns); + + if (!header_tree) { + g_warning ("could not create header tree"); + return NULL; + } + + return GTK_WIDGET(header_tree); +} + + +static GtkWidget* +modest_main_window_folder_tree (ModestAccountMgr *modest_acc_mgr, + TnyAccountStoreIface *account_store) +{ + GtkWidget *folder_tree; + + folder_tree = GTK_WIDGET (modest_tny_folder_tree_view_new (account_store)); + if (!folder_tree) { + g_warning ("could not create folder list"); + return NULL; + } + + return folder_tree; +} + + +static void +on_reply_clicked (GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + + quoted_send_msg (modest_ui, QUOTED_SEND_REPLY); +} + + +static void +on_forward_clicked (GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + + quoted_send_msg (modest_ui, QUOTED_SEND_FORWARD); +} + + +static void +on_view_attachments_toggled(GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + GtkWidget *view_attachments_item; + ModestTnyMsgView *msg_view; + ModestUIPrivate *priv; + gboolean view_attachments_inline; + + priv = MODEST_UI_GET_PRIVATE(modest_ui); + view_attachments_item = glade_xml_get_widget (priv->glade_xml, "menu_view_attachments"); + g_return_if_fail(view_attachments_item); + + msg_view = MODEST_TNY_MSG_VIEW(priv->message_view); + + view_attachments_inline = gtk_check_menu_item_get_active( + GTK_CHECK_MENU_ITEM(view_attachments_item)); + + modest_conf_set_bool(priv->modest_conf, + MODEST_CONF_MSG_VIEW_SHOW_ATTACHMENTS_INLINE, + view_attachments_inline, + NULL); + + modest_tny_msg_view_set_show_attachments_inline_flag(msg_view, view_attachments_inline); +} + + +static void +on_delete_clicked (GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + GtkTreeSelection *sel; + GtkTreeModel *model; + GtkTreeIter iter; + GtkTreeModel *mymodel; + + ModestTnyHeaderTreeView *header_view; + ModestTnyMsgView *msg_view; + ModestUIPrivate *priv; + + g_return_if_fail (modest_ui); + + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + msg_view = MODEST_TNY_MSG_VIEW(priv->message_view); + g_return_if_fail (msg_view); + + header_view = MODEST_TNY_HEADER_TREE_VIEW(priv->header_view); + g_return_if_fail (header_view); + + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(header_view)); + g_return_if_fail (sel); + + /* get all selected mails */ + if (G_LIKELY (gtk_tree_selection_get_selected (sel, &model, &iter))) { + TnyMsgHeaderIface *header; + + gtk_tree_model_get (model, &iter, TNY_MSG_HEADER_LIST_MODEL_INSTANCE_COLUMN, + &header, -1); + + if (G_LIKELY (header)) { + TnyMsgFolderIface *folder; + // const TnyMsgIface *msg; + + if (GTK_IS_TREE_MODEL_SORT (model)) { + mymodel = gtk_tree_model_sort_get_model + (GTK_TREE_MODEL_SORT (model)); + } else + mymodel = model; + + folder = (TnyMsgFolderIface*)tny_msg_header_iface_get_folder (header); + + /* this will make the message as deleted */ + /* tny_msg_folder_iface_expunge (folder); will finally delete messages */ + if (TNY_IS_MSG_FOLDER (folder)) + tny_msg_folder_iface_remove_message (folder, header); + gtk_widget_queue_draw (GTK_WIDGET (header_view)); + } + } +} + + +static void +on_sendreceive_button_clicked (GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + ModestUIPrivate *priv; + TnyAccountStoreIface *account_store; + const GList *store_accounts; + const GList *iter; + + g_return_if_fail (modest_ui); + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + account_store = priv->account_store; + store_accounts = + tny_account_store_iface_get_store_accounts (account_store); + + for (iter = store_accounts; iter; iter = iter->next) { + modest_tny_store_actions_update_folders (TNY_STORE_ACCOUNT_IFACE (iter->data)); + + } + + if (priv->header_view && priv->current_folder) { + + modest_tny_header_tree_view_set_folder (MODEST_TNY_HEADER_TREE_VIEW(priv->header_view), + priv->current_folder); + gtk_widget_queue_draw (priv->header_view); + } +} +static void +on_forward_attached_activated (GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + + quoted_send_msg (modest_ui, QUOTED_SEND_FORWARD_ATTACHED); +} + +static void +on_headers_status_update (GtkWidget *header_view, const gchar *msg, gint status_id, + gpointer user_data) +{ + ModestUIPrivate *priv; + ModestUI *modest_ui; + + GtkStatusbar *status_bar; + GtkProgressBar *progress_bar; + GtkWidget *status_box; + + modest_ui = MODEST_UI (user_data); + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + progress_bar = GTK_PROGRESS_BAR(glade_xml_get_widget + (priv->glade_xml, "progressbar")); + status_bar = GTK_STATUSBAR (glade_xml_get_widget + (priv->glade_xml, "statusbar")); + + + status_box = glade_xml_get_widget (priv->glade_xml, "statusbox"); + + + if (!status_bar || !progress_bar) { + g_warning ("failed to find status / progress bar"); + return; + } + + if (msg && status_id) { + gtk_widget_show (status_box); + gtk_progress_bar_pulse (progress_bar); + gtk_statusbar_push (status_bar, status_id, msg); + } else { + gtk_widget_hide (status_box); + gtk_statusbar_pop (status_bar, status_id); + } +} + diff --git a/src/gtk/modest-ui-main-view.h b/src/gtk/modest-ui-main-view.h new file mode 100644 index 0000000..e69de29 diff --git a/src/gtk/modest-ui-message-editor.c b/src/gtk/modest-ui-message-editor.c new file mode 100644 index 0000000..9a7feab --- /dev/null +++ b/src/gtk/modest-ui-message-editor.c @@ -0,0 +1,553 @@ +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif /*HAVE_CONFIG_H*/ + +/* TODO: put in auto* */ +#include +#include + +#include "../modest-ui.h" +#include "../modest-window-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-identity-mgr.h" + +#include "../modest-tny-account-store.h" +#include "../modest-tny-folder-tree-view.h" +#include "../modest-tny-header-tree-view.h" +#include "../modest-tny-msg-view.h" +#include "../modest-tny-transport-actions.h" +#include "../modest-tny-store-actions.h" + +#include "../modest-text-utils.h" +#include "../modest-tny-msg-actions.h" + +#include "../modest-tny-attachment.h" + +#include "../modest-editor-window.h" + +#include "modest-ui-glade.h" +#include "modest-ui-wizard.h" + +#include "modest-ui-message-editor.h" + + +static void on_attach_button_clicked (GtkWidget *widget, ModestEditorWindow *modest_editwin); + +static void on_send_button_clicked (GtkWidget *widget, ModestEditorWindow *modest_editwin); + + +typedef struct { + ModestUI *modest_ui; + ModestEditorWindow *edit_win; + GladeXML *glade_xml; + GList *attachments; +} EditWinData; + + +static gboolean close_edit_confirm_dialog(ModestEditorWindow *edit_win) +{ + GtkWidget *mdialog; + gint res; + + mdialog = gtk_message_dialog_new(GTK_WINDOW(edit_win), + GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + _("Message was modified.\nDiscard Changes?")); + gtk_widget_show_all (mdialog); + + res=gtk_dialog_run(GTK_DIALOG(mdialog)); + gtk_widget_destroy (mdialog); + if (res == GTK_RESPONSE_YES) + return TRUE; + else + return FALSE; +} + +static void +close_edit_window (GtkWidget *win, GdkEvent *event, gpointer data) +{ + ModestEditorWindow *edit_win; + ModestUIPrivate *priv; + EditWinData *win_data; + + edit_win = (ModestEditorWindow *)data; + win_data = modest_editor_window_get_data(edit_win); + priv = MODEST_UI_GET_PRIVATE(win_data->modest_ui); + + // g_message("window was %s modified", modest_editor_window_get_modified(edit_win) ? "" : "not"); + + if (modest_editor_window_get_modified(edit_win)) { + if (close_edit_confirm_dialog(edit_win)) { + gtk_widget_hide (GTK_WIDGET(edit_win)); + modest_window_mgr_unregister(priv->modest_window_mgr, G_OBJECT(edit_win)); + gtk_widget_destroy(GTK_WIDGET(edit_win)); + g_message("closing window"); + } else { + g_message("not closing window"); + } + } else { + gtk_widget_hide (GTK_WIDGET(edit_win)); + modest_window_mgr_unregister(priv->modest_window_mgr, G_OBJECT(edit_win)); + gtk_widget_destroy(GTK_WIDGET(edit_win)); + g_message("closing window"); + } +} + + +GtkContainer +*modest_ui_new_editor_window (ModestUI *modest_ui, gpointer *user_data) +{ + GtkWidget *top_container; + GladeXML *glade_xml; + EditWinData *win_data; + + glade_xml = glade_xml_new(MODEST_GLADE, "new_mail_top_container", NULL); + if (!glade_xml) + return NULL; + + win_data = g_malloc(sizeof(EditWinData)); + win_data->modest_ui = modest_ui; + win_data->glade_xml = glade_xml; + win_data->attachments = NULL; + + *user_data = win_data; + + top_container = glade_xml_get_widget(glade_xml, "new_mail_top_container"); + if (!top_container) { + g_object_unref(G_OBJECT(glade_xml)); + return NULL; + } + + return GTK_CONTAINER(top_container); +} + + +gboolean +modest_ui_editor_window_set_to_header(const gchar *to, gpointer window_data) +{ + GladeXML *glade_xml; + GtkWidget *w; + EditWinData *win_data; + + win_data = (EditWinData *)window_data; + glade_xml = win_data->glade_xml; + w = glade_xml_get_widget(glade_xml, "to_entry"); + gtk_entry_set_text(GTK_ENTRY(w), to); + + return TRUE; +} + + +gboolean +modest_ui_editor_window_set_cc_header(const gchar *cc, gpointer window_data) +{ + GladeXML *glade_xml; + // GtkWidget *w; + EditWinData *win_data; + + win_data = (EditWinData *)window_data; + glade_xml = win_data->glade_xml; +/* + w = glade_xml_get_widget(glade_xml, "cc_entry"); + gtk_entry_set_text(GTK_ENTRY(w), cc); +*/ + return TRUE; +} + + +gboolean +modest_ui_editor_window_set_bcc_header(const gchar *bcc, gpointer window_data) +{ + GladeXML *glade_xml; + // GtkWidget *w; + EditWinData *win_data; + + win_data = (EditWinData *)window_data; + glade_xml = win_data->glade_xml; +/* + w = glade_xml_get_widget(glade_xml, "bcc_entry"); + gtk_entry_set_text(GTK_ENTRY(w), bcc); +*/ + return TRUE; +} + + +gboolean +modest_ui_editor_window_set_subject_header(const gchar *subject, gpointer window_data) +{ + GladeXML *glade_xml; + GtkWidget *w; + EditWinData *win_data; + + win_data = (EditWinData *)window_data; + glade_xml = win_data->glade_xml; + + w = glade_xml_get_widget(glade_xml, "subject_entry"); + gtk_entry_set_text(GTK_ENTRY(w), subject); + + return TRUE; +} + + +gboolean +modest_ui_editor_window_set_body(const gchar *body, gpointer window_data) +{ + GladeXML *glade_xml; + GtkWidget *body_view; + GtkTextBuffer *buf; + EditWinData *win_data; + + win_data = (EditWinData *)window_data; + glade_xml = win_data->glade_xml; + + body_view = glade_xml_get_widget(glade_xml, "body_view"); + buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(body_view)); + + gtk_text_buffer_set_text(GTK_TEXT_BUFFER(buf), body, -1); + + return TRUE; +} + + +gboolean +modest_ui_editor_window_update_attachments(gpointer window_data) +{ + GladeXML *glade_xml; + + glade_xml = ((EditWinData *) window_data)->glade_xml; + + //body_view = glade_xml_get_widget(glade_xml, "body_view"); + + return TRUE; +} + + +static +void on_editor_entry_changed(GtkEditable *editable, + gpointer user_data) +{ + GtkWidget *edit_win; + EditWinData *windata; + + edit_win = (GtkWidget *)user_data; + windata = (EditWinData *)modest_editor_window_get_data(MODEST_EDITOR_WINDOW(edit_win)); + + modest_editor_window_set_modified(MODEST_EDITOR_WINDOW(edit_win), TRUE); +} + + +static +void on_editor_buffer_changed (GtkTextBuffer *textbuffer, + gpointer user_data) +{ + GtkWidget *edit_win; + + edit_win = (GtkWidget *)user_data; + modest_editor_window_set_modified(MODEST_EDITOR_WINDOW(edit_win), TRUE); +} + + +static void +new_editor_with_presets (ModestUI *modest_ui, const gchar *to_header, + const gchar *cc_header, const gchar *bcc_header, + const gchar *subject_header, const gchar *body, + const GList *attachments) +{ + GtkWidget *edit_win; + GladeXML *glade_xml; + GtkWidget *btn, *w; + GtkTextBuffer *buf; + EditWinData *windata; + ModestUIPrivate *priv; + gint height, width; + + g_return_if_fail (modest_ui); + + edit_win = modest_editor_window_new(modest_ui); + windata = (EditWinData *)modest_editor_window_get_data(MODEST_EDITOR_WINDOW(edit_win)); + g_return_if_fail(windata); + + glade_xml = windata->glade_xml; + btn = glade_xml_get_widget (glade_xml, "toolb_send"); + g_signal_connect (btn, "clicked", G_CALLBACK(on_send_button_clicked), + edit_win); + btn = glade_xml_get_widget (glade_xml, "toolb_attach"); + g_signal_connect (btn, "clicked", G_CALLBACK(on_attach_button_clicked), + edit_win); + + w = glade_xml_get_widget (glade_xml, "to_entry"); + g_signal_connect(w, "changed", G_CALLBACK(on_editor_entry_changed), edit_win); + w = glade_xml_get_widget (glade_xml, "subject_entry"); + g_signal_connect(w, "changed", G_CALLBACK(on_editor_entry_changed), edit_win); + w = glade_xml_get_widget (glade_xml, "body_view"); + buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(w)); + g_signal_connect(buf, "changed", G_CALLBACK(on_editor_buffer_changed), edit_win); + + g_signal_connect (edit_win, "destroy-event", G_CALLBACK(close_edit_window), + edit_win); + g_signal_connect (edit_win, "delete-event", G_CALLBACK(close_edit_window), + edit_win); + + priv = MODEST_UI_GET_PRIVATE(modest_ui); + height = modest_conf_get_int (priv->modest_conf, + MODEST_CONF_EDIT_WINDOW_HEIGHT, NULL); + width = modest_conf_get_int (priv->modest_conf, + MODEST_CONF_EDIT_WINDOW_WIDTH, NULL); + + // g_message("new editor win@%dx%d", width, height); + + gtk_widget_set_usize (GTK_WIDGET(edit_win), width, height); + if (strlen(subject_header) > 0) + gtk_window_set_title (GTK_WINDOW(edit_win), subject_header); + else + gtk_window_set_title (GTK_WINDOW(edit_win), _("Untitled")); + + modest_window_mgr_register(priv->modest_window_mgr, G_OBJECT(edit_win), MODEST_EDIT_WINDOW, 0); + + modest_editor_window_set_to_header(MODEST_EDITOR_WINDOW(edit_win), to_header); + modest_editor_window_set_cc_header(MODEST_EDITOR_WINDOW(edit_win), cc_header); + modest_editor_window_set_bcc_header(MODEST_EDITOR_WINDOW(edit_win), bcc_header); + modest_editor_window_set_subject_header(MODEST_EDITOR_WINDOW(edit_win), subject_header); + modest_editor_window_set_body(MODEST_EDITOR_WINDOW(edit_win), body); + modest_editor_window_set_attachments(MODEST_EDITOR_WINDOW(edit_win), attachments); + + modest_editor_window_set_modified(MODEST_EDITOR_WINDOW(edit_win), FALSE); + + gtk_widget_show(edit_win); +} + + +void +on_new_mail_clicked (GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *) user_data; + + new_editor_with_presets(modest_ui, "", "", "", "", "", NULL); +} + +void +ui_on_mailto_clicked (GtkWidget *widget, const gchar *uri, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *) user_data; + + new_editor_with_presets(modest_ui, uri, "", "", "", "", NULL); +} + + +void +quoted_send_msg (ModestUI *modest_ui, quoted_send_type qstype) +{ + GtkTreeSelection *sel; + GtkTreeModel *model; + GtkTreeIter iter; + + TnyMsgHeaderIface *header; + + ModestTnyHeaderTreeView *header_view; + ModestTnyMsgView *msg_view; + ModestUIPrivate *priv; + + const TnyMsgIface *msg; + const TnyMsgFolderIface *folder; + GString *re_sub; + const gchar *subject, *from; + gchar *unquoted, *quoted; + time_t sent_date; + gint line_limit = 76; + + GList *attachments = NULL; + + g_return_if_fail (modest_ui); + + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + msg_view = MODEST_TNY_MSG_VIEW(priv->message_view); + g_return_if_fail (msg_view); + + header_view = MODEST_TNY_HEADER_TREE_VIEW(priv->header_view); + g_return_if_fail (header_view); + + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(header_view)); + g_return_if_fail (sel); + + if (!gtk_tree_selection_get_selected (sel, &model, &iter)) { + g_warning("nothing to reply to"); + return; + } + + gtk_tree_model_get (model, &iter, + TNY_MSG_HEADER_LIST_MODEL_INSTANCE_COLUMN, + &header, -1); + + if (!header) { + g_warning("no header"); + return; + } + + folder = tny_msg_header_iface_get_folder (TNY_MSG_HEADER_IFACE(header)); + if (!folder) { + g_warning ("cannot find folder"); + return; + } + + msg = tny_msg_folder_iface_get_message (TNY_MSG_FOLDER_IFACE(folder), header); + if (!msg) { + g_warning ("cannot find msg"); + return; + } + + subject = tny_msg_header_iface_get_subject(header); + re_sub = g_string_new(subject); + /* FIXME: honor replyto, cc */ + from = tny_msg_header_iface_get_from(header); + sent_date = tny_msg_header_iface_get_date_sent(header); + + unquoted = modest_tny_msg_view_get_selected_text(msg_view); + quoted = modest_tny_msg_actions_quote(msg, from, sent_date, line_limit, unquoted); + + switch (qstype) { + case QUOTED_SEND_REPLY: + g_string_prepend(re_sub, _("Re: ")); + new_editor_with_presets(modest_ui, from, /* cc */ "", /* bcc */ "", re_sub->str, quoted, attachments); + break; + case QUOTED_SEND_FORWARD: + attachments = modest_tny_attachment_new_list_from_msg(msg, FALSE); + g_string_prepend(re_sub, _("Fwd: ")); + new_editor_with_presets(modest_ui, /* from */ "", /* cc */ "", /* bcc */ "", re_sub->str, quoted, attachments); + break; + case QUOTED_SEND_FORWARD_ATTACHED: + attachments = modest_tny_attachment_new_list_from_msg(msg, TRUE); + g_string_prepend(re_sub, _("Fwd: ")); + new_editor_with_presets(modest_ui, /* from */ "", /* cc */ "", /* bcc */ "", re_sub->str, "", attachments); + break; + default: + break; + } + g_free(quoted); + g_free(unquoted); + g_string_free(re_sub, TRUE); +} + + +static void +on_attach_button_clicked (GtkWidget *widget, ModestEditorWindow *modest_editwin) +{ + /* open file selector */ + GtkWidget *dialog; + ModestTnyAttachment *attachment; + gchar *filename = NULL; + + dialog = gtk_file_chooser_dialog_new ("Open File", + GTK_WINDOW(modest_editwin), + GTK_FILE_CHOOSER_ACTION_OPEN, + GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, + GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT, + NULL); + + if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT) + { + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dialog)); + printf ("file:%s\n", filename); + } + gtk_widget_destroy (dialog); + + /* check file */ + if (!filename) + return; + + attachment = modest_tny_attachment_new(); + modest_tny_attachment_set_filename(attachment, filename); + modest_tny_attachment_guess_mime_type(attachment); + + modest_editor_window_attach_file(modest_editwin, attachment); + + g_free (filename); +} + + +static void +on_send_button_clicked (GtkWidget *widget, ModestEditorWindow *modest_editwin) +{ + ModestTnyTransportActions *actions; + ModestUI *modest_ui; + ModestUIPrivate *priv; + GtkWidget *to_entry, *subject_entry, *body_view; + const gchar *to, *subject, *email_from; + gchar *body; + GtkTextIter start, end; + GtkTextBuffer *buf; + TnyAccountStoreIface *account_store; + const GList *transport_accounts; + TnyTransportAccountIface *transport_account; + ModestIdentityMgr *id_mgr; + EditWinData *win_data; + GList * attachments; + + + win_data = modest_editor_window_get_data(modest_editwin); + modest_ui = win_data->modest_ui; + + g_return_if_fail (modest_ui); + + actions = MODEST_TNY_TRANSPORT_ACTIONS + (modest_tny_transport_actions_new ()); + + priv = MODEST_UI_GET_PRIVATE(modest_ui); + + account_store = priv->account_store; + transport_accounts = + tny_account_store_iface_get_transport_accounts (account_store); + if (!transport_accounts) { + g_message ("cannot send message: no transport account defined"); + return; + } else /* take the first one! */ + transport_account = + TNY_TRANSPORT_ACCOUNT_IFACE(transport_accounts->data); + + to_entry = glade_xml_get_widget (win_data->glade_xml, "to_entry"); + subject_entry = glade_xml_get_widget (win_data->glade_xml, "subject_entry"); + body_view = glade_xml_get_widget (win_data->glade_xml, "body_view"); + + to = gtk_entry_get_text (GTK_ENTRY(to_entry)); + subject = gtk_entry_get_text (GTK_ENTRY(subject_entry)); + + buf = gtk_text_view_get_buffer(GTK_TEXT_VIEW(body_view)); + gtk_text_buffer_get_bounds (buf, &start, &end); + body = gtk_text_buffer_get_text (buf, &start, &end, FALSE); + + id_mgr = priv->modest_id_mgr; + email_from = modest_identity_mgr_get_identity_string(id_mgr, + MODEST_IDENTITY_DEFAULT_IDENTITY, + MODEST_IDENTITY_EMAIL, NULL); + attachments = modest_editor_window_get_attachments(modest_editwin); + if (!email_from) + email_from = ""; + + g_message("sending \"%s\" %s ==> %s", subject, email_from, to); + + modest_tny_transport_actions_send_message (actions, + transport_account, + email_from, + to, "", "", subject, + body, + attachments); + + modest_editor_window_set_attachments(modest_editwin, NULL); /* This unrefs them, too. */ + g_free (body); + g_object_unref (G_OBJECT(actions)); + + gtk_widget_hide (GTK_WIDGET(modest_editwin)); + modest_window_mgr_unregister(priv->modest_window_mgr, G_OBJECT(modest_editwin)); + if (GTK_IS_WIDGET(modest_editwin)) { + gtk_widget_destroy(GTK_WIDGET(modest_editwin)); + } else + g_warning("editor window has vanished!"); +} diff --git a/src/gtk/modest-ui-message-editor.h b/src/gtk/modest-ui-message-editor.h new file mode 100644 index 0000000..c003927 --- /dev/null +++ b/src/gtk/modest-ui-message-editor.h @@ -0,0 +1,32 @@ +#ifndef _MODEST_UI_MESSAGE_EDITOR_H +#define _MODEST_UI_MESSAGE_EDITOR_H + +typedef enum { + QUOTED_SEND_REPLY, + QUOTED_SEND_REPLY_ALL, + QUOTED_SEND_FORWARD, + QUOTED_SEND_FORWARD_ATTACHED +} quoted_send_type; + +/** + * quoted_send_msg: + * @modest_ui: a ModestUI instance + * @qstype: determines whether to REPLY, REPLY_ALL or FORWARD + * + * open a new editor window quoting the currently selected message + * the quote type determines which parts are to be quoted + */ +void quoted_send_msg (ModestUI *modest_ui, quoted_send_type qstype); + +/** + * on_new_mail_clicked: + * @widget: the button widget that received the signal + * @user_data: pointer to user-data, here ModestUI + * + * callback used in main-window + * called when user presses the "New Mail" button + */ +void on_new_mail_clicked (GtkWidget *widget, gpointer user_data); + +void ui_on_mailto_clicked (GtkWidget *widget, const gchar * uri, gpointer user_data); +#endif /* _MODEST_UI_MESSAGE_EDITOR_H */ diff --git a/src/gtk/modest-ui-message-viewer.c b/src/gtk/modest-ui-message-viewer.c new file mode 100644 index 0000000..4a50fbb --- /dev/null +++ b/src/gtk/modest-ui-message-viewer.c @@ -0,0 +1,200 @@ +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif /*HAVE_CONFIG_H*/ + +/* TODO: put in auto* */ +#include +#include + +#include "../modest-ui.h" +#include "../modest-window-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-identity-mgr.h" + +#include "../modest-tny-account-store.h" +#include "../modest-tny-folder-tree-view.h" +#include "../modest-tny-header-tree-view.h" +#include "../modest-tny-msg-view.h" +#include "../modest-tny-transport-actions.h" +#include "../modest-tny-store-actions.h" + +#include "../modest-text-utils.h" +#include "../modest-tny-msg-actions.h" + +#include "../modest-viewer-window.h" + +#include "modest-ui-glade.h" +#include "modest-ui-message-viewer.h" + + + +typedef struct { + ModestUI *modest_ui; + ModestViewerWindow *viewer_win; + GladeXML *glade_xml; +} ViewerWinData; + + +GtkContainer +*modest_ui_new_viewer_window (ModestUI *modest_ui, GtkWidget *msg_view, TnyMsgIface *msg, gpointer *user_data) +{ + GtkWidget *top_container; + GladeXML *glade_xml; + ViewerWinData *win_data; + GtkWidget *paned; + + glade_xml = glade_xml_new(MODEST_GLADE, "viewer_top_container", NULL); + if (!glade_xml) + return NULL; + + win_data = g_malloc(sizeof(ViewerWinData)); + win_data->modest_ui = modest_ui; + win_data->glade_xml = glade_xml; + + *user_data = win_data; + + top_container = glade_xml_get_widget(glade_xml, "viewer_top_container"); + if (!top_container) { + g_object_unref(G_OBJECT(glade_xml)); + return NULL; + } + + if (!GTK_IS_WIDGET(msg_view)) + return NULL; + paned = glade_xml_get_widget(glade_xml, "vpaned3"); + gtk_paned_add2(GTK_PANED(paned), msg_view); + gtk_widget_show_all(msg_view); + + return GTK_CONTAINER(top_container); +} + + +static void +close_viewer_window(GtkWidget *win, GdkEvent *event, gpointer data) +{ + ModestViewerWindow *viewer_win; + ModestUIPrivate *priv; + ViewerWinData *win_data; + + viewer_win = (ModestViewerWindow *)data; + win_data = modest_viewer_window_get_data(viewer_win); + priv = MODEST_UI_GET_PRIVATE(win_data->modest_ui); + + modest_window_mgr_unregister(priv->modest_window_mgr, G_OBJECT(viewer_win)); + gtk_widget_hide (GTK_WIDGET(viewer_win)); + gtk_widget_destroy(GTK_WIDGET(viewer_win)); +} + + +static void +open_message_viewer_window(ModestUI *modest_ui) +{ + GtkWidget *viewer_win; + ModestUIPrivate *priv; + gint width, height; + ViewerWinData *windata; + GtkWidget *paned; + GtkTreeSelection *sel; + GtkTreeModel *model; + GtkTreeIter iter; + GtkScrolledWindow *scroll; + ModestTnyHeaderTreeView *header_view; + TnyMsgHeaderIface *header; + const TnyMsgFolderIface *folder; + TnyMsgIface *msg; + const gchar *subject, *to, *from; + time_t sent_date; + gchar date_str[101]; + GtkWidget *w; + + priv = MODEST_UI_GET_PRIVATE(modest_ui); + /* FIXME: maybe use seperate viewer defaults? */ + height = modest_conf_get_int (priv->modest_conf, MODEST_CONF_EDIT_WINDOW_HEIGHT, NULL); + width = modest_conf_get_int (priv->modest_conf, MODEST_CONF_EDIT_WINDOW_WIDTH, NULL); + + paned = glade_xml_get_widget (priv->glade_xml,"mail_paned"); + g_return_if_fail (paned); + + scroll = GTK_SCROLLED_WINDOW(gtk_paned_get_child1 (GTK_PANED(paned))); + g_return_if_fail (scroll); + + header_view = MODEST_TNY_HEADER_TREE_VIEW(gtk_bin_get_child (GTK_BIN(scroll))); + g_return_if_fail (header_view); + + sel = gtk_tree_view_get_selection (GTK_TREE_VIEW(header_view)); + g_return_if_fail (sel); + + if (!gtk_tree_selection_get_selected (sel, &model, &iter)) { + g_warning("nothing to display"); + return; + } + + gtk_tree_model_get (model, &iter, + TNY_MSG_HEADER_LIST_MODEL_INSTANCE_COLUMN, &header, -1); + + if (!header) { + g_warning("no header"); + return; + } + + folder = tny_msg_header_iface_get_folder (TNY_MSG_HEADER_IFACE(header)); + if (!folder) { + g_warning ("cannot find folder"); + return; + } + + msg = (TnyMsgIface *) tny_msg_folder_iface_get_message (TNY_MSG_FOLDER_IFACE(folder), header); + if (!msg) { + g_warning ("cannot find msg"); + return; + } + + viewer_win = modest_viewer_window_new(modest_ui, msg); + windata = (ViewerWinData *)modest_viewer_window_get_data(MODEST_VIEWER_WINDOW(viewer_win)); + g_return_if_fail(windata); + + subject = tny_msg_header_iface_get_subject(header); + from = tny_msg_header_iface_get_from(header); + to = tny_msg_header_iface_get_to(header); + sent_date = tny_msg_header_iface_get_date_sent(header); + strftime (date_str, 100, "%c", localtime (&sent_date)); + + w = glade_xml_get_widget (windata->glade_xml, "from"); + gtk_label_set_text(GTK_LABEL(w), from); + w = glade_xml_get_widget (windata->glade_xml, "to"); + gtk_label_set_text(GTK_LABEL(w), to); + w = glade_xml_get_widget (windata->glade_xml, "subject"); + gtk_label_set_text(GTK_LABEL(w), subject); + w = glade_xml_get_widget (windata->glade_xml, "date"); + gtk_label_set_text(GTK_LABEL(w), date_str); + + // g_message("new viewer win@%dx%d", width, height); + gtk_widget_set_usize (GTK_WIDGET(viewer_win), width, height); + gtk_widget_show(viewer_win); + modest_window_mgr_register(priv->modest_window_mgr, G_OBJECT(viewer_win), MODEST_VIEW_WINDOW, 0); + g_signal_connect (viewer_win, "destroy-event", G_CALLBACK(close_viewer_window), viewer_win); + g_signal_connect (viewer_win, "delete-event", G_CALLBACK(close_viewer_window), viewer_win); +} + + +void +on_open_message_clicked (GtkWidget *widget, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + + open_message_viewer_window(modest_ui); +} + +void +on_message_activated (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) +{ + ModestUI *modest_ui = (ModestUI *)user_data; + + open_message_viewer_window(modest_ui); +} diff --git a/src/gtk/modest-ui-message-viewer.h b/src/gtk/modest-ui-message-viewer.h new file mode 100644 index 0000000..447aaf3 --- /dev/null +++ b/src/gtk/modest-ui-message-viewer.h @@ -0,0 +1,17 @@ + +#ifndef _MODEST_UI_MESSAGE_VIEWER_H +#define _MODEST_UI_MESSAGE_VIEWER_H + +/* + * callback used in main-window + * called when the menu-item "Open" is activated + */ +void on_open_message_clicked (GtkWidget *widget, gpointer user_data); + +/* + * callback used in main-window + * called when double clicking on a message header + */ +void on_message_activated (GtkTreeView *tree_view, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data); + +#endif /* _MODEST_UI_MESSAGE_VIEWER_H */ diff --git a/src/gtk/modest-ui-wizard.c b/src/gtk/modest-ui-wizard.c new file mode 100644 index 0000000..3edf494 --- /dev/null +++ b/src/gtk/modest-ui-wizard.c @@ -0,0 +1,303 @@ +/* modest-ui-wizard.c */ + +/* insert (c)/licensing information) */ + +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif /*HAVE_CONFIG_H*/ + +#include "../modest-account-mgr.h" +#include "../modest-identity-mgr.h" + +#include "modest-ui-glade.h" +#include "modest-ui-wizard.h" + + +static void wizard_incoming_button_toggled(GtkWidget *button, + gpointer userdata) { + GtkWidget *awidget; + if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON(button))==TRUE) { + awidget=glade_xml_get_widget(GLADE_XML(userdata), "AWOutUserNameEntry"); + gtk_widget_set_sensitive(GTK_WIDGET(awidget), FALSE); + awidget=glade_xml_get_widget(GLADE_XML(userdata), "AWOutPasswordEntry"); + gtk_widget_set_sensitive(GTK_WIDGET(awidget), FALSE); + } + else { + awidget=glade_xml_get_widget(GLADE_XML(userdata), "AWOutUserNameEntry"); + gtk_widget_set_sensitive(GTK_WIDGET(awidget), TRUE); + awidget=glade_xml_get_widget(GLADE_XML(userdata), "AWOutPasswordEntry"); + gtk_widget_set_sensitive(GTK_WIDGET(awidget), TRUE); + } +} + +void wizard_missing_notification(GtkWindow *parent, gchar *info_message) { + GtkWidget *DenyDialog; + + DenyDialog=gtk_message_dialog_new(parent, + GTK_DIALOG_MODAL, + GTK_MESSAGE_INFO, + GTK_BUTTONS_OK, + "%s", + info_message); + + gtk_dialog_run(GTK_DIALOG(DenyDialog)); + + gtk_widget_destroy(DenyDialog); +} + +gchar *get_text_from_combobox (GtkWidget *combobox){ + /* Remember to free the returned variable after usage! */ + + GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(combobox)); + GtkTreeIter iter; + + gchar *value; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(combobox), &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(model), + &iter, + 0, &value, + -1); + } + + return value; +} + + +gboolean advance_sanity_check(GladeXML *glade_xml, gint cp) { + gchar *tmptext; + + /* FIXME: + * all calls to wizard_missing_notification lack the parent window. + */ + + switch (cp) { + case 1: + /* Only needed if the "mailbox name" field is used in the first page of the wizard. + * if (strlen(gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWMailboxnameEntry"))))==0) + * { + * wizard_missing_notification(NULL, "Please enter mailbox name"); + * return FALSE; + * } + */ + if (strlen(gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWEMailAddressEntry"))))==0) { + wizard_missing_notification(NULL, "Please enter the E-Mail address."); + return FALSE; + } + return TRUE; + break; + case 2: + tmptext=gtk_combo_box_get_active_text(GTK_COMBO_BOX(glade_xml_get_widget(glade_xml, "AWMailboxtypeComboBox"))); + if (tmptext==NULL) { + wizard_missing_notification(NULL, "Please select mailbox type."); + return FALSE; + } + g_free(tmptext); + if (strlen(gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWInServerComboEntry"))))==0) { + wizard_missing_notification(NULL, "Please specify incoming server adress."); + return FALSE; + } + if (strlen(gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWUserNameEntry"))))==0) { + wizard_missing_notification(NULL, "Please enter user name."); + return FALSE; + } + return TRUE; + break; + case 3: + if (strlen(gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWOutServerComboEntry"))))==0) { + wizard_missing_notification(NULL, "Please specify outgoing server address."); + return FALSE; + } + /* smtp servers may work without a username + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade_xml, "AWUseIncomingCheckButton")))==FALSE + && strlen(gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWOutUserNameEntry"))))==0) { + wizard_missing_notification(NULL, "Please enter user name."); + return FALSE; + } */ + + return TRUE; + break; + } + + return FALSE; +} + +gchar *search_unused_account_or_identity_name(gpointer mgr, gchar *draft) { + GString *tmpaccount_name; + gint counter; + + tmpaccount_name=g_string_new(""); + g_string_printf(tmpaccount_name, "%s", draft); + if(MODEST_IS_ACCOUNT_MGR(mgr)) { + for(counter=0; modest_account_mgr_server_account_exists(mgr, tmpaccount_name->str, NULL); counter++) + g_string_printf(tmpaccount_name, "%s%d", draft, counter); + } + else + for(counter=0; modest_identity_mgr_identity_exists(mgr, tmpaccount_name->str, NULL); counter++) + g_string_printf(tmpaccount_name, "%s%d", draft, counter); + + return g_string_free(tmpaccount_name, FALSE); +} + +gboolean wizard_account_add(GladeXML *glade_xml, ModestUI *modest_ui) +{ + ModestAccountMgr *acc_mgr; + ModestIdentityMgr *id_mgr; + gchar *store; + gchar *transport; + gchar *identity; + ModestUIPrivate *priv; + ModestConf *conf; + gchar *tmptext; + gchar *tmptext2; + + g_return_val_if_fail (MODEST_IS_UI(modest_ui), FALSE); + priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui)); + conf = priv->modest_conf; + + acc_mgr = priv->modest_acc_mgr; + id_mgr = priv->modest_id_mgr; + + tmptext2=get_text_from_combobox(glade_xml_get_widget(glade_xml, "AWMailboxtypeComboBox")); + tmptext=g_utf8_strdown(tmptext2, -1); + g_free(tmptext2); + + store=search_unused_account_or_identity_name(acc_mgr, "incoming"); + modest_account_mgr_add_server_account (acc_mgr, + store, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWInServerComboEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWUserNameEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWPasswordEntry"))), + tmptext); + g_free(store); + g_free(tmptext); + + transport=search_unused_account_or_identity_name(acc_mgr, "outgoing"); + if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(glade_xml_get_widget(glade_xml, "AWUseIncomingCheckButton")))==TRUE) + modest_account_mgr_add_server_account (acc_mgr, + transport, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWOutServerComboEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWUserNameEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWPasswordEntry"))), + "smtp"); + else + modest_account_mgr_add_server_account (acc_mgr, + transport, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWOutServerComboEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWOutUserNameEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWOutPasswordEntry"))), + "smtp"); + + identity=search_unused_account_or_identity_name(id_mgr, MODEST_IDENTITY_DEFAULT_IDENTITY); + if (!modest_identity_mgr_add_identity (id_mgr, + identity, + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWRealNameEntry"))), + gtk_entry_get_text(GTK_ENTRY(glade_xml_get_widget(glade_xml, "AWEMailAddressEntry"))), + "", "", FALSE, transport, FALSE )) + g_warning ("failed to add default identity"); + + g_free(transport); + g_free(identity); + return TRUE; +} + + +void wizard_account_dialog(ModestUI *modest_ui) +{ + GladeXML *glade_xml; + GtkWidget *dialog; + ModestUIPrivate *priv; + GtkWidget *finish_button; + GtkWidget *back_button; + GtkWidget *next_button; + GtkWidget *cancel_button; + GtkWidget *notebook; + GtkWidget *use_incoming_button; + gint cp; + gint result; + gboolean account_added_successfully=FALSE; + + g_return_if_fail(MODEST_IS_UI(modest_ui)); + priv = MODEST_UI_GET_PRIVATE(MODEST_UI(modest_ui)); + + glade_xml = glade_xml_new(MODEST_GLADE, "account_wizard", NULL); + + dialog = glade_xml_get_widget(glade_xml, "account_wizard"); + + gtk_widget_show_all(dialog); + + finish_button=glade_xml_get_widget(glade_xml, "AWFinishButton"); + back_button=glade_xml_get_widget(glade_xml, "AWBackButton"); + next_button=glade_xml_get_widget(glade_xml, "AWNextButton"); + cancel_button=glade_xml_get_widget(glade_xml, "AWCancelButton"); + notebook=glade_xml_get_widget(glade_xml, "AWNotebook"); + + gtk_widget_set_sensitive(finish_button, FALSE); + + use_incoming_button=glade_xml_get_widget(glade_xml, "AWUseIncomingCheckButton"); + g_signal_connect(use_incoming_button, + "toggled", + G_CALLBACK(wizard_incoming_button_toggled), + glade_xml); + + /* First page not used currently. It's reserved for the account preset. */ + gtk_notebook_set_current_page (GTK_NOTEBOOK(notebook), 1); + + do { + cp=gtk_notebook_get_current_page(GTK_NOTEBOOK(notebook)); + switch (cp) { + case 1: + gtk_widget_set_sensitive(back_button, FALSE); + break; + case 2: + gtk_widget_set_sensitive(back_button, TRUE); + break; + case 3: + gtk_widget_set_sensitive(finish_button, FALSE); + gtk_widget_set_sensitive(next_button, TRUE); + break; + case 4: + gtk_widget_set_sensitive(finish_button, TRUE); + gtk_widget_set_sensitive(next_button, FALSE); + break; + default: + g_error("I'm on page %d of notebook AWNotebook, which shouldn't have happened. Pulling emergency breaks.", cp); + break; + } + + result=gtk_dialog_run(GTK_DIALOG(dialog)); + + switch (result) { + case 1: + if (advance_sanity_check(glade_xml, cp)==TRUE) + gtk_notebook_next_page(GTK_NOTEBOOK(notebook)); + break; + case 2: + gtk_notebook_prev_page(GTK_NOTEBOOK(notebook)); + break; + case GTK_RESPONSE_ACCEPT: + account_added_successfully=wizard_account_add(glade_xml, modest_ui); + break; + default: + account_added_successfully=FALSE; + } + } + while(result!=GTK_RESPONSE_DELETE_EVENT && result!=GTK_RESPONSE_CANCEL && account_added_successfully!=TRUE); + + gtk_widget_destroy(dialog); + g_object_unref(glade_xml); +} + +void new_wizard_account (GtkWidget *widget, + gpointer user_data) +{ + /* This will probably never be used to modify any existing account. */ + wizard_account_dialog(MODEST_UI(user_data)); +} + + diff --git a/src/gtk/modest-ui-wizard.h b/src/gtk/modest-ui-wizard.h new file mode 100644 index 0000000..c9cdd54 --- /dev/null +++ b/src/gtk/modest-ui-wizard.h @@ -0,0 +1,29 @@ +/* modest-ui-wizard.h */ +/* insert (c)/licensing information) */ + +#ifndef __MODEST_UI_WIZARD_H__ +#define __MODEST_UI_WIZARD_H__ + +#include "modest-ui-glade.h" + +/** + * wizard_account_dialog: + * @modest-ui: a ModestUI instance + * + * Handle the dialog window acting as account wizard. The wizard allows + * the creation of identities and server accounts. + */ +void +wizard_account_dialog(ModestUI *modest_ui); + +/** + * new_wizard_account: + * @GtkWidget: The widget by which this CALLBACK is called. + * @gpointer: A ModestUI is needed as second argument. + */ +void +new_wizard_account (GtkWidget *, + gpointer); + +#endif /* __MODEST_UI_WIZARD_H__ */ + diff --git a/src/gtk/modest-ui.c b/src/gtk/modest-ui.c new file mode 100644 index 0000000..36f4f49 --- /dev/null +++ b/src/gtk/modest-ui.c @@ -0,0 +1,316 @@ +/* modest-ui.c */ + +/* insert (c)/licensing information) */ + +#include +#include +#include +#include + +#ifdef HAVE_CONFIG_H +#include +#endif /*HAVE_CONFIG_H*/ + +/* TODO: put in auto* */ +#include +#include + +#include "../modest-ui.h" +#include "../modest-window-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-account-mgr.h" +#include "../modest-identity-mgr.h" + +#include "../modest-tny-account-store.h" +#include "../modest-tny-folder-tree-view.h" +#include "../modest-tny-header-tree-view.h" +#include "../modest-tny-msg-view.h" +#include "../modest-tny-transport-actions.h" +#include "../modest-tny-store-actions.h" + +#include "../modest-text-utils.h" +#include "../modest-tny-msg-actions.h" + +#include "../modest-editor-window.h" + +#include "modest-ui-glade.h" +#include "modest-ui-wizard.h" + +/* 'private'/'protected' functions */ +static void modest_ui_class_init (ModestUIClass *klass); +static void modest_ui_init (ModestUI *obj); +static void modest_ui_finalize (GObject *obj); + +static void modest_ui_window_destroy (GtkWidget *win, GdkEvent *event, gpointer data); +static void modest_ui_last_window_closed (GObject *obj, gpointer data); + +gchar *on_password_requested (TnyAccountIface *, const gchar *, gboolean *); + +/* list my signals */ +enum { + /* MY_SIGNAL_1, */ + /* MY_SIGNAL_2, */ + LAST_SIGNAL +}; + +/* globals */ +static GObjectClass *parent_class = NULL; + + +GType +modest_ui_get_type (void) +{ + static GType my_type = 0; + if (!my_type) { + static const GTypeInfo my_info = { + sizeof(ModestUIClass), + NULL, /* base init */ + NULL, /* base finalize */ + (GClassInitFunc) modest_ui_class_init, + NULL, /* class finalize */ + NULL, /* class data */ + sizeof(ModestUI), + 1, /* n_preallocs */ + (GInstanceInitFunc) modest_ui_init, + }; + my_type = g_type_register_static (G_TYPE_OBJECT, + "ModestUI", + &my_info, 0); + } + return my_type; +} + + +static void +modest_ui_class_init (ModestUIClass *klass) +{ + GObjectClass *gobject_class; + gobject_class = (GObjectClass*) klass; + + parent_class = g_type_class_peek_parent (klass); + gobject_class->finalize = modest_ui_finalize; + + g_type_class_add_private (gobject_class, sizeof(ModestUIPrivate)); + +} + + +static void +modest_ui_init (ModestUI *obj) +{ + ModestUIPrivate *priv = MODEST_UI_GET_PRIVATE(obj); + + priv->modest_acc_mgr = NULL; + priv->modest_id_mgr = NULL; + priv->modest_conf = NULL; + priv->modest_window_mgr = NULL; + priv->glade_xml = NULL; + priv->folder_view = NULL; + priv->header_view = NULL; + priv->message_view = NULL; + priv->current_folder = NULL; +} + + +static void +modest_ui_finalize (GObject *obj) +{ + ModestUIPrivate *priv = MODEST_UI_GET_PRIVATE(obj); + + if (priv->modest_acc_mgr) + g_object_unref (priv->modest_acc_mgr); + priv->modest_acc_mgr = NULL; + + if (priv->modest_id_mgr) + g_object_unref (priv->modest_id_mgr); + priv->modest_id_mgr = NULL; + + if (priv->modest_conf) + g_object_unref (priv->modest_conf); + priv->modest_conf = NULL; + + if (priv->modest_window_mgr) + g_object_unref (priv->modest_window_mgr); + priv->modest_window_mgr = NULL; +} + + +static void +on_accounts_reloaded (ModestTnyAccountStore *account_store, gpointer user_data) +{ + ModestUIPrivate *priv = user_data; + + g_return_if_fail (MODEST_IS_TNY_FOLDER_TREE_VIEW (priv->folder_view)); + g_return_if_fail (MODEST_IS_TNY_HEADER_TREE_VIEW (priv->header_view)); + + modest_tny_header_tree_view_set_folder (priv->header_view, NULL); + + modest_tny_folder_tree_view_update_model(priv->folder_view, account_store); +} + + +GObject* +modest_ui_new (ModestConf *modest_conf) +{ + GObject *obj; + ModestUIPrivate *priv; + ModestAccountMgr *modest_acc_mgr; + ModestIdentityMgr *modest_id_mgr; + TnyAccountStoreIface *account_store_iface; + GSList *account_names_list; + GSList *identities_list; + + g_return_val_if_fail (modest_conf, NULL); + + obj = g_object_new(MODEST_TYPE_UI, NULL); + priv = MODEST_UI_GET_PRIVATE(obj); + + modest_acc_mgr = MODEST_ACCOUNT_MGR(modest_account_mgr_new (modest_conf)); + if (!modest_acc_mgr) { + g_warning ("could not create ModestAccountMgr instance"); + g_object_unref (obj); + return NULL; + } + + modest_id_mgr = MODEST_IDENTITY_MGR(modest_identity_mgr_new (modest_conf)); + if (!modest_id_mgr) { + g_warning ("could not create ModestIdentityMgr instance"); + g_object_unref (obj); + return NULL; + } + + account_store_iface = + TNY_ACCOUNT_STORE_IFACE(modest_tny_account_store_new (modest_acc_mgr)); + if (!account_store_iface) { + g_warning ("could not initialze ModestTnyAccountStore"); + return NULL; + } + + modest_tny_account_store_set_get_pass_func(MODEST_TNY_ACCOUNT_STORE(account_store_iface), + on_password_requested); + + g_signal_connect (account_store_iface, "accounts_reloaded", + G_CALLBACK(on_accounts_reloaded), priv); + + glade_init (); + priv->glade_xml = glade_xml_new (MODEST_GLADE, NULL, NULL); + if (!priv->glade_xml) { + g_warning ("failed to do glade stuff"); + g_object_unref (obj); + return NULL; + } + + /* FIXME: could be used, but doesn't work atm. + * glade_xml_signal_autoconnect(priv->glade_xml); + */ + + priv->modest_acc_mgr = modest_acc_mgr; + priv->modest_id_mgr = modest_id_mgr; + g_object_ref (priv->modest_conf = modest_conf); + + priv->account_store = account_store_iface; + + priv->modest_window_mgr = MODEST_WINDOW_MGR(modest_window_mgr_new()); + g_signal_connect (priv->modest_window_mgr, "last_window_closed", + G_CALLBACK(modest_ui_last_window_closed), + NULL); + + account_names_list = modest_account_mgr_server_account_names(modest_acc_mgr, + NULL, MODEST_PROTO_TYPE_ANY, NULL, FALSE); + identities_list = modest_identity_mgr_identity_names(modest_id_mgr, NULL); + if (!(account_names_list != NULL || identities_list != NULL)) + wizard_account_dialog(MODEST_UI(obj)); + g_slist_free(account_names_list); + g_slist_free(identities_list); + + return obj; +} + + +static void +modest_ui_last_window_closed (GObject *obj, gpointer data) +{ + /* FIXME: Other cleanups todo? Finalize Tinymail? */ + gtk_main_quit (); +} + + +gchar * +on_password_requested (TnyAccountIface *account, + const gchar *prompt, + gboolean *cancel) { + + GtkWidget *passdialog; + GtkWidget *vbox; + GtkWidget *infoscroll; + GtkWidget *infolabel; + GtkWidget *passentry; + GtkTextBuffer *infobuffer; + gchar *retval; + gint result; + + passdialog = gtk_dialog_new_with_buttons(_("Password"), + NULL, + GTK_DIALOG_MODAL|GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_OK, + GTK_RESPONSE_ACCEPT, + GTK_STOCK_CANCEL, + GTK_RESPONSE_REJECT, + NULL); + + vbox = gtk_vbox_new(FALSE, 0); + + infobuffer = gtk_text_buffer_new (NULL); + gtk_text_buffer_set_text(infobuffer, prompt, -1); + infoscroll = gtk_scrolled_window_new(NULL, NULL); + infolabel = gtk_text_view_new_with_buffer(infobuffer); + gtk_container_add(GTK_CONTAINER(infoscroll), infolabel); + passentry = gtk_entry_new(); + gtk_entry_set_visibility(GTK_ENTRY(passentry), FALSE); + + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(passdialog)->vbox), infoscroll, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(GTK_DIALOG(passdialog)->vbox), passentry, FALSE, FALSE, 0); + gtk_widget_show_all(passdialog); + + result = gtk_dialog_run (GTK_DIALOG(passdialog)); + + switch (result) { + case GTK_RESPONSE_ACCEPT: + retval = g_strdup(gtk_entry_get_text(GTK_ENTRY(passentry))); + *cancel=FALSE; + break; + default: + retval = g_strdup("");; + *cancel=TRUE; + break; + } + + gtk_widget_hide(passdialog); + gtk_widget_destroy(passdialog); + while (gtk_events_pending()){ + gtk_main_iteration(); + } + + return retval; +} + + +void +on_account_selector_selection_changed (GtkWidget *widget, gpointer user_data) +{ + GtkTreeModel *model = gtk_combo_box_get_model(GTK_COMBO_BOX(widget)); + GtkTreeIter iter; + + gchar *account_name; + + if (gtk_combo_box_get_active_iter(GTK_COMBO_BOX(widget), &iter)) { + gtk_tree_model_get(GTK_TREE_MODEL(model), &iter, + 0, &account_name, -1); + } else { + account_name="empty"; + } + + free(account_name); +} + + diff --git a/src/gtk/modest.glade b/src/gtk/modest.glade new file mode 100644 index 0000000..bdf33a2 --- /dev/null +++ b/src/gtk/modest.glade @@ -0,0 +1,4563 @@ + + + + + + + Modest + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 800 + 600 + True + False + qgn_toolb_messagin.png + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + 0 + + + + True + GTK_PACK_DIRECTION_LTR + GTK_PACK_DIRECTION_LTR + + + + True + _Message + True + + + + + + + True + New e-mail + True + + + + + + + + True + Open + True + + + + + + + + True + + + + + + True + Reply + True + + + + + + + True + Reply to all + True + + + + + + + True + Forward + True + + + + + + + True + Forward attached + True + + + + + + + True + + + + + + True + Delete + True + + + + + + + True + + + + + + True + Details + True + + + + + + + + + + + True + _Edit + True + + + + + + + True + Undo + True + + + + + + + True + + + + + + True + Cut + True + + + + + + + True + Copy + True + + + + + + + True + Paste + True + + + + + + + True + _Select + True + + + + + + + True + Mark all + True + + + + + + + True + Unmark all + True + + + + + + + + + + + True + + + + + + True + Move to... + True + + + + + + + + + + + True + _Folders + True + + + + + + + True + New folder... + True + + + + + + + True + Manage folders + True + + + + + + + True + + + + + + True + Details + True + + + + + + + True + Folder settings... + True + + + + + + + True + + + + + + True + Inbox + True + True + + + + + + + True + Outbox + True + True + inbox1 + + + + + + + True + Drafts + True + True + inbox1 + + + + + + + True + Sent + True + True + inbox1 + + + + + + + True + Archive + True + True + inbox1 + + + + + + + + + + + True + _View + True + + + + + + + True + Sort... + True + + + + + + + True + + + + + + True + _Show toolbar + True + + + + + + + + True + Normal screen + True + True + + + + + + + True + Full screen + True + True + + + + + + + + + + + True + Folders + True + True + + + + + + + True + Attachments + True + True + + + + + + + True + Full screen + True + False + + + + + + + + + + + True + E-m_ail + True + + + + + + + + True + Send & receive + True + + + + + + + True + Retrieve e-mail contents + True + + + + + + + True + Purge attacments + True + + + + + + + + + + + True + _Tools + True + + + + + + + + True + Open contacts... + True + + + + + + + True + + + + + + True + New Identity + True + + + + + + + True + Identities and accounts + True + + + + + + + True + Options + True + + + + + + + True + + + + + + True + Search e-mails... + True + + + + + + + True + + + + + + True + Help + True + + + + + + + + + + + True + _Close + True + + + + + + + True + Close window + True + + + + + + + True + Close all windows + True + + + + + + + + + + 0 + False + False + + + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + True + True + + + + True + Compose new e-mail message + New e-mail + True + qgn_toolb_messagin_new.png + True + True + False + + + False + True + + + + + + True + Reply + Reply + True + qgn_toolb_messagin_reply.png + True + True + False + + + False + True + + + + + + True + Reply all + Reply all + True + qgn_toolb_messagin_replytoall.png + True + True + False + + + False + True + + + + + + True + Forward + Forward + True + qgn_toolb_messagin_forward.png + True + True + False + + + False + True + + + + + + True + Move message to other location + Move to... + True + qgn_toolb_messagin_moveto.png + True + True + False + + + False + True + + + + + + True + Delete message + Delete + True + qgn_toolb_messagin_delete.png + True + True + False + + + False + True + + + + + + True + Send and receive + Send & receive + True + qgn_toolb_messagin_sendreceive.png + True + True + False + + + False + True + + + + + 0 + False + False + + + + + + True + True + 170 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + + + + True + False + + + + + + True + True + 150 + + + + True + True + GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_SHADOW_NONE + GTK_CORNER_TOP_LEFT + + + + + + + True + False + + + + + + + + + True + True + + + + + 0 + True + True + + + + + + True + 0 + + + + True + GTK_PROGRESS_LEFT_TO_RIGHT + 0 + 0.10000000149 + PANGO_ELLIPSIZE_NONE + + + 0 + False + True + + + + + + True + True + + + 0 + False + True + + + + + 0 + False + False + + + + + + + + Modest - New message + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 800 + 600 + True + False + qgn_toolb_messagin.png + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + 0 + + + + True + GTK_PACK_DIRECTION_LTR + GTK_PACK_DIRECTION_LTR + + + + True + _Message + True + + + + + + + True + Send + True + + + + + + + True + + + + + + True + New e-mail + True + + + + + + + + True + + + + + + True + Delete message + True + + + + + + + True + + + + + + True + Select recipients... + True + + + + + + + True + Check names + True + + + + + + + + + + + True + _Edit + True + + + + + + + True + Undo + True + + + + + + + True + + + + + + True + Cut + True + + + + + + + True + Copy + True + + + + + + + True + Paste + True + + + + + + + True + Select all + True + + + + + + + + + + True + _Attachments + True + + + + + + + True + Attach file... + True + + + + + + + True + Insert inline image + True + + + + + + + True + + + + + + True + Remove attachment + True + + + + + + + + + + + True + _View + True + + + + + + + True + _Zoom + True + + + + + + + + True + 50% + True + True + + + + + + + True + 100% + True + True + 50%1 + + + + + + + True + 150% + True + True + 50%1 + + + + + + + True + 200% + True + True + 50%1 + + + + + + + + + + + True + Show toolbar + True + + + + + + + + True + Normal screen + True + True + + + + + + + True + Full screen + True + True + + + + + + + + + + + True + Full screen + True + False + + + + + + + True + + + + + + True + Show Cc + True + False + + + + + + + True + Show Bcc + True + False + + + + + + + + + + + True + _Format + True + + + + + + + + True + Font... + True + + + + + + + True + Bullets + True + + + + + + + True + Numbers + True + + + + + + + True + Alignment + True + + + + + + + True + Left + True + True + + + + + + + True + Center + True + True + left1 + + + + + + + True + Right + True + True + left1 + + + + + + + + + + + True + Background colour + True + + + + + + + + + + + True + _Tools + True + + + + + + + + True + Sending options... + True + + + + + + + True + + + + + + True + Find on page... + True + + + + + + + True + Search e-mails... + True + + + + + + + True + + + + + + True + Help + True + + + + + + + + + + + True + _Security + True + + + + + + + + True + None + True + True + + + + + + + True + Encrypt + True + False + none1 + + + + + + + True + Digitally sign + True + False + none1 + + + + + + + True + Digitally sign and encrypt + True + False + none1 + + + + + + + + + + + True + _Close + True + + + + + + + True + Close window + True + + + + + + + True + Close all windows + True + + + + + + + + + + 0 + False + False + + + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + True + True + + + + True + Send message + Send + True + qgn_toolb_messagin_send.png + True + True + False + + + False + True + + + + + + True + Add attachment + Attach + True + qgn_list_gene_attacpap.png + True + True + False + + + False + True + + + + + + True + Add reipients + Recipients + True + qgn_list_gene_contacts.png + True + True + False + + + False + True + + + + + 0 + False + False + + + + + + True + True + 65 + + + + 10 + True + 2 + 2 + False + 10 + 10 + + + + True + <b>To:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + <b>Subject:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + False + False + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + True + True + + + + + 0 + True + True + + + + + + + + Modest - Message viewer + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 800 + 600 + True + False + qgn_toolb_messagin.png + True + False + False + GDK_WINDOW_TYPE_HINT_NORMAL + GDK_GRAVITY_NORTH_WEST + True + False + + + + True + False + 0 + + + + True + GTK_PACK_DIRECTION_LTR + GTK_PACK_DIRECTION_LTR + + + + True + _Message + True + + + + + + + True + Reply + True + + + + + + + True + Reply to all + True + + + + + + + True + Forward + True + + + + + + + True + + + + + + True + New e-mail + True + + + + + + + + True + + + + + + True + Delete + True + + + + + + + + + + + True + _Edit + True + + + + + + + True + Cut + True + + + + + + + True + Copy + True + + + + + + + True + Paste + True + + + + + + + True + Select all + True + + + + + + + + + + True + _Attachments + True + + + + + + + True + View + True + + + + + + + True + Save attachments... + True + + + + + + + True + Purge attachments + True + + + + + + + + + + + True + _View + True + + + + + + + True + Zoom + True + + + + + + + + True + 50% + True + True + + + + + + + True + 100% + True + True + + + + + + + True + 150% + True + True + + + + + + + True + 200% + True + True + + + + + + + + + + + True + Show toolbar + True + + + + + + + + True + Normal screen + True + True + + + + + + + True + Full screen + True + True + + + + + + + + + + + True + Full screen + True + False + + + + + + + True + + + + + + True + Next message + True + False + + + + + + + True + Previous message + True + False + + + + + + + + + + + True + _Tools + True + + + + + + + + True + Add contact... + True + + + + + + + True + + + + + + True + Font settings... + True + + + + + + + True + + + + + + True + Find on page... + True + + + + + + + True + Search e-mails... + True + + + + + + + True + + + + + + True + Help + True + + + + + + + + + + + True + _Security + True + + + + + + + + True + Details + True + + + + + + + + + + + True + _Close + True + + + + + + + True + Close window + True + + + + + + + True + Close all windows + True + + + + + + + + + + 0 + False + False + + + + + + True + GTK_ORIENTATION_HORIZONTAL + GTK_TOOLBAR_BOTH + True + True + + + + True + Reply + Reply + True + qgn_toolb_messagin_reply.png + True + True + False + + + False + True + + + + + + True + Reply all + Reply all + True + qgn_toolb_messagin_replytoall.png + True + True + False + + + False + True + + + + + + True + Forward + Forward + True + qgn_toolb_messagin_forward.png + True + True + False + + + False + True + + + + + + True + Save attached files + Save Attacments... + True + qgn_toolb_messagin_saveattachment.png + True + True + False + + + False + True + + + + + + True + Move message to other location + Move to... + True + qgn_toolb_messagin_moveto.png + True + True + False + + + False + True + + + + + + True + View previous message + Previous + True + qgn_toolb_messagin_previous.png + True + True + False + + + False + True + + + + + + True + View next message + Next + True + qgn_toolb_messagin_next.png + True + True + False + + + False + True + + + + + 0 + False + False + + + + + + True + True + 100 + + + + 10 + True + 4 + 2 + False + 10 + 10 + + + + True + <b>From:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + <b>Subject:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + <b>Date:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 2 + 3 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 1 + 2 + 3 + 4 + fill + + + + + + + True + <b>To:</b> + False + True + GTK_JUSTIFY_RIGHT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + False + False + + + + + + + + + 0 + True + True + + + + + + + + 10 + Account Setup + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 500 + 400 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + Finish + True + GTK_RELIEF_NORMAL + True + -3 + + + + + + True + Back + True + GTK_RELIEF_NORMAL + True + 2 + + + + + + True + Next + True + GTK_RELIEF_NORMAL + True + 1 + + + + + + True + Cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + False + False + GTK_POS_TOP + False + False + + + + True + False + 10 + + + + True + False + 0 + + + + True + Mailbox setup wizard allows you to define mailboxes for use on your device. + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 10 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + 0 + False + False + + + + + + True + + + 0 + False + True + + + + + False + True + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + 2 + 2 + False + 10 + 10 + + + + True + E-mail address: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + Your name: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + False + True + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + 5 + 3 + False + 10 + 10 + + + + True + Password: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + User name: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + Incoming server: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + Mailbox type: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + IMAP +POP +LOCAL + False + True + + + 1 + 3 + 0 + 1 + fill + fill + + + + + + True + False + True + Use SSL + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 2 + 3 + 2 + 3 + fill + + + + + + + True + Note: You cannot edit mailbox type once setup is complete! + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 10 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 3 + 1 + 2 + fill + + + + + + + True + True + True + 0 + + True + * + False + + + 1 + 3 + 3 + 4 + + + + + + + True + True + False + 0 + + True + * + False + + + 1 + 3 + 4 + 5 + + + + + + False + True + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + 4 + 3 + False + 10 + 10 + + + + True + Password: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + User name: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Outgoing server: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + False + True + Use SSL + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 2 + 3 + 0 + 1 + fill + + + + + + + True + True + Use incoming settings + True + GTK_RELIEF_NORMAL + True + True + False + True + + + 1 + 3 + 1 + 2 + fill + + + + + + + True + False + True + True + True + 0 + + True + * + False + + + 1 + 3 + 2 + 3 + + + + + + + True + False + True + True + False + 0 + + True + * + False + + + 1 + 3 + 3 + 4 + + + + + + False + False + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + False + 0 + + + + True + Mailbox setup is complete. + +Tap 'Finish' to save or 'Cancel' to discard the settings. +Tap 'Advanced' to edit the advanced e-mail settings. + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + False + True + + + + + + True + + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + 0 + False + False + + + + + + + + 10 + Identity setup + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 500 + 400 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 7 + 2 + False + 10 + 10 + + + + True + E-mail address: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Your name: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 1 + 2 + + + + + + + True + True + + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 1 + 2 + 5 + 6 + fill + + + + + + + True + Use Signature: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 5 + 6 + fill + + + + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + False + True + True + False + True + GTK_JUSTIFY_LEFT + GTK_WRAP_NONE + True + 0 + 0 + 0 + 0 + 0 + 0 + + + + + + 0 + 2 + 6 + 7 + fill + + + + + + True + Identity + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 0 + 1 + + + + + + + True + Outgoing Server: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + Reply-To: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + False + True + + + 1 + 2 + 4 + 5 + fill + fill + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 3 + 4 + + + + + + 0 + True + True + + + + + + + + Identities and Accounts + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 500 + 400 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-close + True + GTK_RELIEF_NORMAL + True + -7 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + True + True + True + GTK_POS_TOP + False + False + + + + True + False + 10 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + True + False + 10 + + + + True + True + Create new + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + False + True + Edit + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + False + True + Delete + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + 0 + False + False + + + + + False + True + + + + + + True + Identities + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + + True + False + 10 + + + + True + True + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_SHADOW_IN + GTK_CORNER_TOP_LEFT + + + + True + True + True + False + False + True + False + False + False + + + + + 0 + True + True + + + + + + True + False + 10 + + + + True + True + Create new + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + False + True + Edit + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + + True + False + True + Delete + True + GTK_RELIEF_NORMAL + True + + + 0 + False + False + + + + + 0 + False + False + + + + + False + True + + + + + + True + Accounts + False + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + tab + + + + + 0 + True + True + + + + + + + + 10 + Account setup + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + 500 + 400 + True + False + True + False + False + GDK_WINDOW_TYPE_HINT_DIALOG + GDK_GRAVITY_NORTH_WEST + True + False + True + + + + True + False + 0 + + + + True + GTK_BUTTONBOX_END + + + + True + True + True + gtk-cancel + True + GTK_RELIEF_NORMAL + True + -6 + + + + + + True + True + True + gtk-ok + True + GTK_RELIEF_NORMAL + True + -5 + + + + + 0 + False + True + GTK_PACK_END + + + + + + True + 5 + 3 + False + 10 + 10 + + + + True + Type: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 1 + 2 + fill + + + + + + + True + Hostname: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + fill + + + + + + + True + False + True + Use SSL + True + GTK_RELIEF_NORMAL + True + False + False + True + + + 2 + 3 + 2 + 3 + fill + + + + + + + True + User name: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 3 + 4 + fill + + + + + + + True + Password: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 4 + 5 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 2 + 2 + 3 + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 3 + 3 + 4 + + + + + + + True + True + True + False + 0 + + True + * + False + + + 1 + 3 + 4 + 5 + + + + + + + True + Name: + False + False + GTK_JUSTIFY_LEFT + False + False + 0 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 0 + 1 + fill + + + + + + + True + True + True + True + 0 + + True + * + False + + + 1 + 3 + 0 + 1 + + + + + + + True + SMTP +IMAP +POP +LOCAL + False + True + + + 1 + 3 + 1 + 2 + fill + fill + + + + + 0 + True + True + + + + + + + diff --git a/src/gtk/modest.gladep b/src/gtk/modest.gladep new file mode 100644 index 0000000..4d1a57d --- /dev/null +++ b/src/gtk/modest.gladep @@ -0,0 +1,8 @@ + + + + + Modest + Modest + FALSE + diff --git a/src/gtk/pixmaps/qgn_addr_icon_user_group.png b/src/gtk/pixmaps/qgn_addr_icon_user_group.png new file mode 100644 index 0000000..c5b9f6c Binary files /dev/null and b/src/gtk/pixmaps/qgn_addr_icon_user_group.png differ diff --git a/src/gtk/pixmaps/qgn_list_gene_attacpap.png b/src/gtk/pixmaps/qgn_list_gene_attacpap.png new file mode 100644 index 0000000..0448a7d Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_gene_attacpap.png differ diff --git a/src/gtk/pixmaps/qgn_list_gene_fldr_clp.png b/src/gtk/pixmaps/qgn_list_gene_fldr_clp.png new file mode 100644 index 0000000..0034909 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_gene_fldr_clp.png differ diff --git a/src/gtk/pixmaps/qgn_list_gene_fldr_cls.png b/src/gtk/pixmaps/qgn_list_gene_fldr_cls.png new file mode 100644 index 0000000..976155c Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_gene_fldr_cls.png differ diff --git a/src/gtk/pixmaps/qgn_list_gene_fldr_exp.png b/src/gtk/pixmaps/qgn_list_gene_fldr_exp.png new file mode 100644 index 0000000..28a583f Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_gene_fldr_exp.png differ diff --git a/src/gtk/pixmaps/qgn_list_gene_fldr_opn.png b/src/gtk/pixmaps/qgn_list_gene_fldr_opn.png new file mode 100644 index 0000000..2bf04f2 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_gene_fldr_opn.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin.png b/src/gtk/pixmaps/qgn_list_messagin.png new file mode 100644 index 0000000..173f657 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_drafts.png b/src/gtk/pixmaps/qgn_list_messagin_drafts.png new file mode 100644 index 0000000..c16cdcd Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_drafts.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_editor.png b/src/gtk/pixmaps/qgn_list_messagin_editor.png new file mode 100644 index 0000000..c68ef5e Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_editor.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr.png b/src/gtk/pixmaps/qgn_list_messagin_hdr.png new file mode 100644 index 0000000..c61cc32 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted.png new file mode 100644 index 0000000..9c27686 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted_high.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted_high.png new file mode 100644 index 0000000..699a464 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted_low.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted_low.png new file mode 100644 index 0000000..10287d5 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_encrypted_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_high.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_high.png new file mode 100644 index 0000000..00328bc Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_high_unread.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_high_unread.png new file mode 100644 index 0000000..0c1f206 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_high_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_low.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_low.png new file mode 100644 index 0000000..7b9493b Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_low_unread.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_low_unread.png new file mode 100644 index 0000000..61d8b56 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_low_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_signed.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_signed.png new file mode 100644 index 0000000..ff95a21 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_signed.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_signed_high.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_signed_high.png new file mode 100644 index 0000000..3071acd Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_signed_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_signed_low.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_signed_low.png new file mode 100644 index 0000000..014d02f Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_signed_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_unread.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread.png new file mode 100644 index 0000000..1c0c5f9 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted.png new file mode 100644 index 0000000..c44ecb5 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted_high.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted_high.png new file mode 100644 index 0000000..7fc702d Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted_low.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted_low.png new file mode 100644 index 0000000..cc0e90e Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_encrypted_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed.png new file mode 100644 index 0000000..ec1cc23 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed_high.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed_high.png new file mode 100644 index 0000000..c9c4bbb Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed_low.png b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed_low.png new file mode 100644 index 0000000..9e60c21 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_hdr_unread_signed_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_inbox.png b/src/gtk/pixmaps/qgn_list_messagin_inbox.png new file mode 100644 index 0000000..eb79b09 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_inbox.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail.png b/src/gtk/pixmaps/qgn_list_messagin_mail.png new file mode 100644 index 0000000..4038776 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_deleted.png b/src/gtk/pixmaps/qgn_list_messagin_mail_deleted.png new file mode 100644 index 0000000..0e8df2d Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_deleted.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read.png b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read.png new file mode 100644 index 0000000..2395b98 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read_high.png b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read_high.png new file mode 100644 index 0000000..2ddb3f5 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read_low.png b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read_low.png new file mode 100644 index 0000000..6bf9e47 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_read_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread.png b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread.png new file mode 100644 index 0000000..e85b88c Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread_high.png b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread_high.png new file mode 100644 index 0000000..4a34249 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread_low.png b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread_low.png new file mode 100644 index 0000000..76dd826 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_encrypted_unread_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_high.png b/src/gtk/pixmaps/qgn_list_messagin_mail_high.png new file mode 100644 index 0000000..92799de Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_high_unread.png b/src/gtk/pixmaps/qgn_list_messagin_mail_high_unread.png new file mode 100644 index 0000000..f19237b Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_high_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_low.png b/src/gtk/pixmaps/qgn_list_messagin_mail_low.png new file mode 100644 index 0000000..6ee833c Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_low_unread.png b/src/gtk/pixmaps/qgn_list_messagin_mail_low_unread.png new file mode 100644 index 0000000..739fc52 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_low_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read.png b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read.png new file mode 100644 index 0000000..5f7dd8f Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read_high.png b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read_high.png new file mode 100644 index 0000000..8d00684 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read_low.png b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read_low.png new file mode 100644 index 0000000..0c6b647 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_read_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread.png b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread.png new file mode 100644 index 0000000..7ff25a5 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread_high.png b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread_high.png new file mode 100644 index 0000000..c25a609 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread_low.png b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread_low.png new file mode 100644 index 0000000..b07cacb Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_signed_unread_low.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_mail_unread.png b/src/gtk/pixmaps/qgn_list_messagin_mail_unread.png new file mode 100644 index 0000000..3d15a38 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_mail_unread.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_outbox.png b/src/gtk/pixmaps/qgn_list_messagin_outbox.png new file mode 100644 index 0000000..2b5a10a Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_outbox.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_sent.png b/src/gtk/pixmaps/qgn_list_messagin_sent.png new file mode 100644 index 0000000..73c8c27 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_sent.png differ diff --git a/src/gtk/pixmaps/qgn_list_messagin_viewer.png b/src/gtk/pixmaps/qgn_list_messagin_viewer.png new file mode 100644 index 0000000..2ee8ca1 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messagin_viewer.png differ diff --git a/src/gtk/pixmaps/qgn_list_messaging_high.png b/src/gtk/pixmaps/qgn_list_messaging_high.png new file mode 100644 index 0000000..ed8cd61 Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messaging_high.png differ diff --git a/src/gtk/pixmaps/qgn_list_messaging_low.png b/src/gtk/pixmaps/qgn_list_messaging_low.png new file mode 100644 index 0000000..fe2ff2c Binary files /dev/null and b/src/gtk/pixmaps/qgn_list_messaging_low.png differ diff --git a/src/gtk/pixmaps/qgn_widg_datedit.png b/src/gtk/pixmaps/qgn_widg_datedit.png new file mode 100644 index 0000000..b942504 Binary files /dev/null and b/src/gtk/pixmaps/qgn_widg_datedit.png differ