diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2010-10-03 02:07:04 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2010-10-03 03:22:07 +0800 |
commit | ec089b4a4129458f7140254607306eec0ef4aebf (patch) | |
tree | 7418aa00b5e9c66b8176ba5e5b69c1b2a7108841 /mail | |
parent | 45b6f58f0a2d3e9e567694febf58882b9f74a257 (diff) | |
download | gsoc2013-evolution-ec089b4a4129458f7140254607306eec0ef4aebf.tar gsoc2013-evolution-ec089b4a4129458f7140254607306eec0ef4aebf.tar.gz gsoc2013-evolution-ec089b4a4129458f7140254607306eec0ef4aebf.tar.bz2 gsoc2013-evolution-ec089b4a4129458f7140254607306eec0ef4aebf.tar.lz gsoc2013-evolution-ec089b4a4129458f7140254607306eec0ef4aebf.tar.xz gsoc2013-evolution-ec089b4a4129458f7140254607306eec0ef4aebf.tar.zst gsoc2013-evolution-ec089b4a4129458f7140254607306eec0ef4aebf.zip |
Rewrite the folder subscription editor.
Redesign the "Folder Subscriptions" dialog and use Camel's async API
instead of the MailMsg infrastructure to simplify the implementation.
Diffstat (limited to 'mail')
-rw-r--r-- | mail/Makefile.am | 4 | ||||
-rw-r--r-- | mail/e-mail-sidebar.c | 1 | ||||
-rw-r--r-- | mail/em-subscribe-editor.c | 1223 | ||||
-rw-r--r-- | mail/em-subscribe-editor.h | 28 | ||||
-rw-r--r-- | mail/em-subscription-editor.c | 1342 | ||||
-rw-r--r-- | mail/em-subscription-editor.h | 71 | ||||
-rw-r--r-- | mail/evolution-mail.schemas.in | 42 | ||||
-rw-r--r-- | mail/mail-dialogs.ui | 963 |
8 files changed, 1818 insertions, 1856 deletions
diff --git a/mail/Makefile.am b/mail/Makefile.am index d50f9bd23b..79db282629 100644 --- a/mail/Makefile.am +++ b/mail/Makefile.am @@ -80,7 +80,7 @@ mailinclude_HEADERS = \ em-inline-filter.h \ em-junk.h \ em-search-context.h \ - em-subscribe-editor.h \ + em-subscription-editor.h \ em-sync-stream.h \ em-utils.h \ em-vfolder-context.h \ @@ -149,7 +149,7 @@ libevolution_mail_la_SOURCES = \ em-inline-filter.c \ em-junk.c \ em-search-context.c \ - em-subscribe-editor.c \ + em-subscription-editor.c \ em-sync-stream.c \ em-utils.c \ em-vfolder-context.c \ diff --git a/mail/e-mail-sidebar.c b/mail/e-mail-sidebar.c index 5ed65f963b..7f0a569534 100644 --- a/mail/e-mail-sidebar.c +++ b/mail/e-mail-sidebar.c @@ -371,6 +371,7 @@ mail_sidebar_check_state (EMailSidebar *sidebar) if (is_trash) state |= E_MAIL_SIDEBAR_FOLDER_IS_TRASH; + g_object_unref (store); g_free (full_name); g_free (uri); diff --git a/mail/em-subscribe-editor.c b/mail/em-subscribe-editor.c deleted file mode 100644 index b942e35a4b..0000000000 --- a/mail/em-subscribe-editor.c +++ /dev/null @@ -1,1223 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> - -#include "mail-tools.h" -#include "mail-ops.h" -#include "mail-mt.h" -/*#include "mail-folder-cache.h"*/ - -#include "e-util/e-util.h" -#include "e-util/e-account-utils.h" -#include "e-util/e-util-private.h" - -#include "em-folder-utils.h" -#include "em-subscribe-editor.h" - -#include "mail-config.h" - -#include <glib/gi18n.h> - -#define d(x) - -enum { - COL_SUBSCRIBED = 0, /* G_TYPE_BOOLEAN */ - COL_NAME, /* G_TYPE_STRING */ - COL_INFO_NODE, /* G_TYPE_POINTER */ - COL_CAN_SELECT, /* G_TYPE_BOOLEAN */ - COL_ICON_NAME, /* G_TYPE_STRING */ - N_COLUMNS -}; - -typedef struct _EMSubscribeEditor EMSubscribeEditor; -struct _EMSubscribeEditor { - GQueue stores; - - gint busy; - guint busy_id; - - gboolean is_filtering; /* whether filtering is active */ - guint refilter_id; /* source ID of a refilter action, after change in the filter edit */ - - struct _EMSubscribe *current; /* the current one, if any */ - - GtkDialog *dialog; - GtkWidget *vbox; /* where new stores are added */ - GtkWidget *combobox; - GtkWidget *none_selected; /* 'please select a xxx' message */ - GtkWidget *progress; - GtkWidget *filter_entry; /* when not empty, then it's filtering */ - GtkWidget *expand_button; - GtkWidget *collapse_button; - GtkWidget *refresh_button; -}; - -typedef struct _EMSubscribe EMSubscribe; -struct _EMSubscribe { - gint ref_count; - gint cancel; - gint seq; /* upped every time we refresh */ - - struct _EMSubscribeEditor *editor; /* parent object*/ - - gchar *store_uri; - gint store_id; /* looking up a store */ - - CamelStore *store; - GHashTable *folders; - - GtkWidget *widget; /* widget to show for this store */ - GtkTreeView *tree; /* tree, if we have it */ - GtkTreeModel *tree_store; /* a tree store, used when not filtering */ - GtkTreeModel *list_store; /* list store, used when filtering */ - GSList *all_selectable; /* list of selectable info's, stored in the tree_store, in reverse order */ - - GSList *tree_expanded_paths; /* list of expanded paths in the tree model */ - - /* list of all returns from get_folder_info, accessed by other structures */ - GSList *info_list; - - gint pending_id; - - /* queue of pending UN/SUBSCRIBEs, EMsg's */ - gint subscribe_id; - GQueue subscribe; - - /* working variables at runtime */ - gint selected_count; - gint selected_subscribed_count; - guint subscribed_state:1; /* for setting the selection*/ -}; - -typedef struct _EMSubscribeNode EMSubscribeNode; -struct _EMSubscribeNode { - CamelFolderInfo *info; - GtkTreePath *path; -}; - -typedef struct _MailMsgListNode MailMsgListNode; -struct _MailMsgListNode { - MailMsg *msg; -}; - -static void sub_editor_busy (EMSubscribeEditor *se, gint dir); -static gint sub_queue_fill_level (EMSubscribe *sub, EMSubscribeNode *node); -static void sub_selection_changed (GtkTreeSelection *selection, EMSubscribe *sub); - -static gboolean -test_contains (const gchar *where, const gchar *what) -{ - gunichar c; - const gchar *at = what; - - if (!what || !where) - return TRUE; - - while (c = g_utf8_get_char_validated (where, -1), c != 0 && c != (gunichar) -1 && c != (gunichar) -2) { - if (g_utf8_get_char (at) == g_unichar_tolower (c)) { - at = g_utf8_next_char (at); - if (!at || !*at) - return TRUE; - } else { - at = what; - } - where = g_utf8_next_char (where); - } - - return FALSE; -} - -static void -update_filtering_column (EMSubscribeEditor *se, struct _EMSubscribe *sub) -{ - gchar *text; - GtkTreeIter iter; - GtkTreeModel *list_store; - GSList *l; - - g_return_if_fail (se != NULL); - g_return_if_fail (sub != NULL); - g_return_if_fail (g_utf8_validate (gtk_entry_get_text (GTK_ENTRY (se->filter_entry)), -1, NULL)); - - if (!sub->tree) - return; - - if (gtk_tree_view_get_model (sub->tree) == sub->list_store) - gtk_tree_view_set_model (sub->tree, NULL); - - text = g_utf8_strdown (gtk_entry_get_text (GTK_ENTRY (se->filter_entry)), -1); - list_store = sub->list_store; - - gtk_list_store_clear (GTK_LIST_STORE (list_store)); - for (l = sub->all_selectable; l; l = l->next) { - EMSubscribeNode *node = l->data; - gboolean bl; - - if (!node || !node->path || !node->info) - continue; - - bl = (!text || !*text || (node && node->info && node->info->full_name && test_contains (node->info->full_name, text))); - if (!bl) - continue; - - gtk_list_store_prepend ((GtkListStore *)list_store, &iter); - gtk_list_store_set (GTK_LIST_STORE (list_store), &iter, - COL_SUBSCRIBED, (node->info->flags & CAMEL_FOLDER_SUBSCRIBED) != 0, - COL_NAME, node->info->full_name, - COL_INFO_NODE, node, - COL_CAN_SELECT, TRUE, - COL_ICON_NAME, em_folder_utils_get_icon_name (node->info->flags), - -1); - } - - g_free (text); - - if (!gtk_tree_view_get_model (sub->tree)) { - gtk_tree_view_set_model (sub->tree, sub->list_store); - gtk_tree_view_set_search_column (sub->tree, COL_NAME); - } -} - -static void -sub_node_free (EMSubscribeNode *node) -{ - d(printf("sub node free '%s'\n", node->info?node->info->full_name:"<unknown>")); - if (node->path) - gtk_tree_path_free (node->path); - g_free (node); -} - -static void -sub_ref (EMSubscribe *sub) -{ - sub->ref_count++; -} - -static void -sub_unref (EMSubscribe *sub) -{ - GSList *l; - - sub->ref_count--; - if (sub->ref_count == 0) { - d(printf("subscribe object finalised\n")); - /* we dont have to delete the "subscribe" task list, as it must be empty, - otherwise we wouldn't be unreffed (intentional circular reference) */ - if (sub->tree_store) - g_object_unref (sub->tree_store); - if (sub->list_store) - g_object_unref (sub->list_store); - if (sub->folders) - g_hash_table_destroy (sub->folders); - g_slist_free (sub->all_selectable); - g_slist_foreach (sub->tree_expanded_paths, (GFunc) gtk_tree_path_free, NULL); - g_slist_free (sub->tree_expanded_paths); - l = sub->info_list; - while (l) { - GSList *n = l->next; - - camel_store_free_folder_info (sub->store, (CamelFolderInfo *)l->data); - g_slist_free_1 (l); - l = n; - } - if (sub->store) - g_object_unref (sub->store); - g_free (sub->store_uri); - g_free (sub); - } -} - -/* ** Subscribe folder operation **************************************** */ - -struct _zsubscribe_msg { - MailMsg base; - - EMSubscribe *sub; - EMSubscribeNode *node; - gint subscribe; - gchar *path; -}; - -static void -sub_folder_exec (struct _zsubscribe_msg *m) -{ - if (m->subscribe) - camel_store_subscribe_folder_sync ( - m->sub->store, m->node->info->full_name, - m->base.cancellable, &m->base.error); - else - camel_store_unsubscribe_folder_sync ( - m->sub->store, m->node->info->full_name, - m->base.cancellable, &m->base.error); -} - -static void -sub_folder_done (struct _zsubscribe_msg *m) -{ - struct _zsubscribe_msg *next; - GtkTreeIter iter; - GtkTreeModel *model; - EMSubscribeNode *node; - gboolean subscribed, issub; - MailMsgListNode *msgListNode; - - m->sub->subscribe_id = -1; - if (m->sub->cancel) - return; - - if (m->base.error == NULL) { - if (m->subscribe) - m->node->info->flags |= CAMEL_FOLDER_SUBSCRIBED; - else - m->node->info->flags &= ~CAMEL_FOLDER_SUBSCRIBED; - } - - /* make sure the tree view matches the correct state */ - /* all actions are done on tree store, synced to list store */ - model = m->sub->tree_store; - if (gtk_tree_model_get_iter_from_string (model, &iter, m->path)) { - issub = (m->node->info->flags & CAMEL_FOLDER_SUBSCRIBED) != 0; - gtk_tree_model_get (model, &iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); - if (node == m->node) { - gtk_tree_store_set ((GtkTreeStore *)model, &iter, COL_SUBSCRIBED, issub, -1); - } else { - d(printf("node mismatch, or subscribe state changed failed\n")); - } - } - - /* queue any further ones, or if out, update the ui */ - msgListNode = g_queue_pop_head (&m->sub->subscribe); - if (msgListNode) { - next = (struct _zsubscribe_msg *) msgListNode->msg; - /* Free the memory of the MailMsgListNode which won't be used anymore. */ - g_free (msgListNode); - next->sub->subscribe_id = next->base.seq; - mail_msg_unordered_push (next); - } else { - /* should it go off the model instead? */ - sub_selection_changed (gtk_tree_view_get_selection (m->sub->tree), m->sub); - } -} - -static void -sub_folder_free (struct _zsubscribe_msg *m) -{ - g_free (m->path); - sub_unref (m->sub); -} - -static MailMsgInfo sub_subscribe_folder_info = { - sizeof (struct _zsubscribe_msg), - (MailMsgDescFunc) NULL, - (MailMsgExecFunc) sub_folder_exec, - (MailMsgDoneFunc) sub_folder_done, - (MailMsgFreeFunc) sub_folder_free -}; - -/* spath is tree path in string form */ -static gint -sub_subscribe_folder (EMSubscribe *sub, EMSubscribeNode *node, gint state, const gchar *spath) -{ - struct _zsubscribe_msg *m; - MailMsgListNode *msgListNode; - gint id; - - m = mail_msg_new (&sub_subscribe_folder_info); - m->sub = sub; - sub_ref (sub); - m->node = node; - m->subscribe = state; - m->path = g_strdup (spath); - - id = m->base.seq; - if (sub->subscribe_id == -1) { - sub->subscribe_id = id; - d(printf("running subscribe folder '%s'\n", spath)); - mail_msg_unordered_push (m); - } else { - msgListNode = g_malloc0 (sizeof (MailMsgListNode)); - msgListNode->msg = (MailMsg *) m; - d(printf("queueing subscribe folder '%s'\n", spath)); - g_queue_push_tail (&sub->subscribe, msgListNode); - } - - return id; -} - -/* ********************************************************************** */ -static void -sub_fill_levels (EMSubscribe *sub, CamelFolderInfo *info, GtkTreeIter *parent) -{ - CamelFolderInfo *fi; - GtkTreeStore *treestore; - GtkTreeIter iter; - EMSubscribeNode *node; - - treestore = (GtkTreeStore *) sub->tree_store; - g_return_if_fail (treestore != NULL); - - /* first, fill a level up */ - fi = info; - while (fi) { - gboolean known = FALSE; - - if ((node = g_hash_table_lookup (sub->folders, fi->full_name)) == NULL) { - gboolean state; - - gtk_tree_store_append (treestore, &iter, parent); - node = g_malloc0 (sizeof (*node)); - node->info = fi; - state = (fi->flags & CAMEL_FOLDER_SUBSCRIBED) != 0; - gtk_tree_store_set (treestore, &iter, - COL_SUBSCRIBED, state, - COL_NAME, fi->name, - COL_INFO_NODE, node, - COL_CAN_SELECT, (fi->flags & CAMEL_FOLDER_NOSELECT) == 0, - COL_ICON_NAME, em_folder_utils_get_icon_name (fi->flags), - -1); - if ((fi->flags & CAMEL_FOLDER_NOSELECT) == 0) - sub->all_selectable = g_slist_prepend (sub->all_selectable, node); - if (state) { - GtkTreePath *path = gtk_tree_model_get_path ((GtkTreeModel *)treestore, &iter); - gtk_tree_view_expand_to_path (sub->tree, path); - gtk_tree_path_free (path); - } - if ((fi->flags & CAMEL_FOLDER_NOINFERIORS) == 0) - node->path = gtk_tree_model_get_path ((GtkTreeModel *)treestore, &iter); - g_hash_table_insert (sub->folders, fi->full_name, node); - } else if (node->path) { - gtk_tree_model_get_iter (GTK_TREE_MODEL (treestore), &iter, node->path); - known = TRUE; - } - - d(printf("flags & CAMEL_FOLDER_NOCHILDREN=%d, f & CAMEL_FOLDER_NOINFERIORS=%d\t fi->full_name=[%s], node->path=%p\n", - fi->flags & CAMEL_FOLDER_NOCHILDREN, fi->flags & CAMEL_FOLDER_NOINFERIORS, fi->full_name, - node->path)); - - if ((fi->flags & CAMEL_FOLDER_NOINFERIORS) == 0 - && node->path) { - /* save time, if we have any children alread, dont re-scan */ - if (fi->child) { - d(printf("scanning child '%s'\n", fi->child->full_name)); - sub_fill_levels (sub, fi->child, &iter); - } else if (!(fi->flags & CAMEL_FOLDER_NOCHILDREN)) { - d(printf("flags: CAMEL_FOLDER_NOCHILDREN is not set '%s', known:%d\n", fi->full_name, known?1:0)); - } - } else { - d(printf("%s:%s: fi->flags & CAMEL_FOLDER_NOINFERIORS=%d\t node->path=[%p]\n", - G_STRLOC, G_STRFUNC, fi->flags & CAMEL_FOLDER_NOINFERIORS, - node->path)); - } - - fi = fi->next; - } -} - -/* async query of folderinfo */ - -struct _emse_folderinfo_msg { - MailMsg base; - - gint seq; - - EMSubscribe *sub; - EMSubscribeNode *node; - CamelFolderInfo *info; -}; - -static void -sub_folderinfo_exec (struct _emse_folderinfo_msg *m) -{ - if (m->seq == m->sub->seq) { - /* get the full folder tree for search ability */ - m->info = camel_store_get_folder_info_sync ( - m->sub->store, NULL, - CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL | - CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST | - CAMEL_STORE_FOLDER_INFO_RECURSIVE, - m->base.cancellable, &m->base.error); - } -} - -static void -sub_folderinfo_done (struct _emse_folderinfo_msg *m) -{ - m->sub->pending_id = -1; - if (m->sub->cancel || m->seq != m->sub->seq) - return; - - if (m->base.error != NULL) - g_warning ( - "Error getting folder info from store: %s", - m->base.error->message); - - if (m->info) { - if (m->node) { - GtkTreeIter iter; - - gtk_tree_model_get_iter (m->sub->tree_store, &iter, m->node->path); - sub_fill_levels (m->sub, m->info, &iter); - } else { - sub_fill_levels (m->sub, m->info, NULL); - } - - if (m->sub->editor->is_filtering) - update_filtering_column (m->sub->editor, m->sub); - } -} - -static void -sub_folderinfo_free (struct _emse_folderinfo_msg *m) -{ - if (m->info) - m->sub->info_list = g_slist_prepend (m->sub->info_list, m->info); - - if (!m->sub->cancel) - sub_editor_busy (m->sub->editor, -1); - - /* Now we just load the children on demand, so set the - expand state to true if m->node is not NULL - */ - if (m->node) - gtk_tree_view_expand_row (m->sub->tree, m->node->path, FALSE); - - sub_unref (m->sub); -} - -static MailMsgInfo sub_folderinfo_info = { - sizeof (struct _emse_folderinfo_msg), - (MailMsgDescFunc) NULL, - (MailMsgExecFunc) sub_folderinfo_exec, - (MailMsgDoneFunc) sub_folderinfo_done, - (MailMsgFreeFunc) sub_folderinfo_free -}; - -static gint -sub_queue_fill_level (EMSubscribe *sub, EMSubscribeNode *node) -{ - struct _emse_folderinfo_msg *m; - gint id; - - d(printf("%s:%s: Starting get folderinfo of '%s'\n", G_STRLOC, G_STRFUNC, - node?node->info->full_name:"<root>")); - - m = mail_msg_new (&sub_folderinfo_info); - sub_ref (sub); - m->sub = sub; - m->node = node; - m->seq = sub->seq; - - sub->pending_id = m->base.seq; - - sub_editor_busy (sub->editor, 1); - - id = m->base.seq; - - mail_msg_unordered_push (m); - return id; -} - -static void -update_buttons_sesitivity (EMSubscribeEditor *se) -{ - gboolean is_tree_model; - - if (!se) - return; - - is_tree_model = se->current && se->current->tree && !se->is_filtering; - - gtk_widget_set_sensitive (se->expand_button, is_tree_model); - gtk_widget_set_sensitive (se->collapse_button, is_tree_model); - gtk_widget_set_sensitive (se->refresh_button, se->current && se->current->tree); -} - -/* ********************************************************************** */ - -/* (un) subscribes the current selection */ - -static void -sub_subscribe_toggled (GtkCellRendererToggle *render, const gchar *spath, EMSubscribe *sub) -{ - GtkTreeIter iter; - GtkTreeModel *model = gtk_tree_view_get_model (sub->tree); - EMSubscribeNode *node; - gboolean subscribed; - - d(printf("subscribe toggled?\n")); - - if (gtk_tree_model_get_iter_from_string (model, &iter, spath)) { - gchar *free_path; - - gtk_tree_model_get (model, &iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); - g_return_if_fail (node != NULL); - subscribed = !subscribed; - d(printf("new state is %s\n", subscribed?"subscribed":"not subscribed")); - if (GTK_IS_TREE_STORE (model)) { - gtk_tree_store_set ((GtkTreeStore *)model, &iter, COL_SUBSCRIBED, subscribed, -1); - } else { - /* it's a list store, convert spath to tree path and update tree store value */ - gtk_list_store_set (GTK_LIST_STORE (model), &iter, COL_SUBSCRIBED, subscribed, -1); - if (gtk_tree_model_get_iter (sub->tree_store, &iter, node->path)) { - gtk_tree_store_set ((GtkTreeStore *)sub->tree_store, &iter, COL_SUBSCRIBED, subscribed, -1); - } - free_path = gtk_tree_path_to_string (node->path); - if (subscribed) - sub->tree_expanded_paths = g_slist_prepend (sub->tree_expanded_paths, gtk_tree_path_copy (node->path)); - spath = free_path; - } - - sub_subscribe_folder (sub, node, subscribed, spath); - } -} - -static void sub_do_changed (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, gpointer data) -{ - EMSubscribe *sub = data; - EMSubscribeNode *node; - gboolean subscribed; - - gtk_tree_model_get (model, iter, COL_SUBSCRIBED, &subscribed, COL_INFO_NODE, &node, -1); - - if (subscribed) - sub->selected_subscribed_count++; - sub->selected_count++; -} - -static void -sub_selection_changed (GtkTreeSelection *selection, EMSubscribe *sub) -{ - sub->selected_count = 0; - sub->selected_subscribed_count = 0; - gtk_tree_selection_selected_foreach (selection, sub_do_changed, sub); -} - -/* double-clicking causes a node item to be evaluated directly */ -static void sub_row_activated (GtkTreeView *tree, GtkTreePath *path, GtkTreeViewColumn *col, EMSubscribe *sub) -{ - if (!gtk_tree_view_row_expanded (tree, path)) - gtk_tree_view_expand_row (tree, path, FALSE); - else - gtk_tree_view_collapse_row (tree, path); - -} - -static void -sub_destroy (GtkWidget *w, EMSubscribe *sub) -{ - struct _zsubscribe_msg *m; - MailMsgListNode *msgListNode; - - d(printf("subscribe closed\n")); - sub->cancel = TRUE; - - if (sub->pending_id != -1) - mail_msg_cancel (sub->pending_id); - - if (sub->subscribe_id != -1) - mail_msg_cancel (sub->subscribe_id); - - while ((msgListNode = g_queue_pop_head (&sub->subscribe)) != NULL) { - m = (struct _zsubscribe_msg *) msgListNode->msg; - /* Free the memory of MailMsgListNode which won't be used anymore. */ - g_free (msgListNode); - mail_msg_unref (m); - } - - sub_unref (sub); -} - -static EMSubscribe * -subscribe_new (EMSubscribeEditor *se, const gchar *uri) -{ - EMSubscribe *sub; - - sub = g_malloc0 (sizeof (*sub)); - sub->store_uri = g_strdup (uri); - sub->editor = se; - sub->ref_count = 1; - sub->pending_id = -1; - sub->subscribe_id = -1; - g_queue_init (&sub->subscribe); - sub->store_id = -1; - - return sub; -} - -static void -subscribe_set_store (EMSubscribe *sub, CamelStore *store) -{ - if (store == NULL || !camel_store_supports_subscriptions (store)) { - GtkWidget *w = gtk_label_new(_("This store does not support subscriptions, or they are not enabled.")); - - gtk_label_set_line_wrap ((GtkLabel *)w, TRUE); - sub->widget = gtk_viewport_new (NULL, NULL); - gtk_viewport_set_shadow_type ((GtkViewport *)sub->widget, GTK_SHADOW_IN); - gtk_container_add ((GtkContainer *)sub->widget, w); - gtk_widget_show (w); - gtk_widget_show (sub->widget); - } else { - GtkTreeSelection *selection; - GtkTreeViewColumn *column; - GtkCellRenderer *renderer; - - sub->all_selectable = NULL; - sub->tree_expanded_paths = NULL; - sub->store = store; - g_object_ref (store); - sub->folders = g_hash_table_new_full ( - g_str_hash, g_str_equal, - (GDestroyNotify) NULL, - (GDestroyNotify) sub_node_free); - - sub->tree_store = (GtkTreeModel *) gtk_tree_store_new (N_COLUMNS, - G_TYPE_BOOLEAN, /* COL_SUBSCRIBED */ - G_TYPE_STRING, /* COL_NAME */ - G_TYPE_POINTER, /* COL_INFO_NODE */ - G_TYPE_BOOLEAN, /* COL_CAN_SELECT */ - G_TYPE_STRING /* COL_ICON_NAME */ - ); - g_object_ref_sink (sub->tree_store); - - sub->list_store = (GtkTreeModel *) gtk_list_store_new (N_COLUMNS, - G_TYPE_BOOLEAN, /* COL_SUBSCRIBED */ - G_TYPE_STRING, /* COL_NAME */ - G_TYPE_POINTER, /* COL_INFO_NODE */ - G_TYPE_BOOLEAN, /* COL_CAN_SELECT */ - G_TYPE_STRING /* COL_ICON_NAME */ - ); - g_object_ref_sink (sub->list_store); - - sub->tree = (GtkTreeView *) gtk_tree_view_new_with_model (sub->editor->is_filtering ? sub->list_store : sub->tree_store); - gtk_widget_show ((GtkWidget *)sub->tree); - - sub->widget = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sub->widget), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sub->widget), GTK_SHADOW_IN); - gtk_container_add ((GtkContainer *)sub->widget, (GtkWidget *)sub->tree); - gtk_widget_show (sub->widget); - - renderer = gtk_cell_renderer_toggle_new (); - g_object_set(renderer, "activatable", TRUE, NULL); - gtk_tree_view_insert_column_with_attributes (sub->tree, -1, _("Subscribed"), renderer, "active", COL_SUBSCRIBED, "visible", COL_CAN_SELECT, NULL); - g_signal_connect(renderer, "toggled", G_CALLBACK(sub_subscribe_toggled), sub); - - column = gtk_tree_view_column_new (); - gtk_tree_view_column_set_title (column, _("Folder")); - gtk_tree_view_append_column (sub->tree, column); - - renderer = gtk_cell_renderer_pixbuf_new (); - gtk_tree_view_column_pack_start (column, renderer, FALSE); - gtk_tree_view_column_add_attribute ( - column, renderer, "icon-name", COL_ICON_NAME); - - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_column_pack_start (column, renderer, TRUE); - gtk_tree_view_column_add_attribute ( - column, renderer, "text", COL_NAME); - gtk_tree_view_set_expander_column (sub->tree, gtk_tree_view_get_column (sub->tree, 1)); - - selection = gtk_tree_view_get_selection (sub->tree); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_MULTIPLE); - gtk_tree_view_set_headers_visible (sub->tree, FALSE); - - gtk_tree_view_set_search_column (sub->tree, COL_NAME); - gtk_tree_view_set_enable_search (sub->tree, TRUE); - - g_signal_connect(sub->tree, "row-activated", G_CALLBACK(sub_row_activated), sub); - g_signal_connect(sub->tree, "destroy", G_CALLBACK(sub_destroy), sub); - - sub_selection_changed (selection, sub); - g_signal_connect(selection, "changed", G_CALLBACK(sub_selection_changed), sub); - - sub_queue_fill_level (sub, NULL); - - update_buttons_sesitivity (sub->editor); - } - - gtk_box_pack_start ((GtkBox *)sub->editor->vbox, sub->widget, TRUE, TRUE, 0); -} - -static void -sub_editor_destroy (GtkWidget *w, EMSubscribeEditor *se) -{ - /* need to clean out pending store opens */ - d(printf("editor destroyed, freeing editor\n")); - if (se->busy_id) - g_source_remove (se->busy_id); - if (se->refilter_id != 0) - g_source_remove (se->refilter_id); - se->refilter_id = 0; - - g_free (se); -} - -static void -sub_editor_close (GtkWidget *w, EMSubscribeEditor *se) -{ - gtk_widget_destroy ((GtkWidget *)se->dialog); -} - -static void -sub_editor_refresh (GtkWidget *w, EMSubscribeEditor *se) -{ - EMSubscribe *sub = se->current; - GSList *l; - - d(printf("sub editor refresh?\n")); - if (sub == NULL || sub->store == NULL) - return; - - sub->seq++; - - /* drop any currently pending */ - if (sub->pending_id != -1) { - mail_msg_cancel (sub->pending_id); - mail_msg_wait (sub->pending_id); - } - - g_slist_free (sub->all_selectable); - sub->all_selectable = NULL; - - g_slist_foreach (sub->tree_expanded_paths, (GFunc) gtk_tree_path_free, NULL); - g_slist_free (sub->tree_expanded_paths); - sub->tree_expanded_paths = NULL; - - gtk_tree_store_clear ((GtkTreeStore *)sub->tree_store); - gtk_list_store_clear ((GtkListStore *)sub->list_store); - - if (sub->folders) - g_hash_table_destroy (sub->folders); - sub->folders = g_hash_table_new_full ( - g_str_hash, g_str_equal, - (GDestroyNotify) NULL, - (GDestroyNotify) sub_node_free); - - l = sub->info_list; - sub->info_list = NULL; - while (l) { - GSList *n = l->next; - - camel_store_free_folder_info (sub->store, (CamelFolderInfo *)l->data); - g_slist_free_1 (l); - l = n; - } - - sub_queue_fill_level (sub, NULL); -} - -static void -sub_editor_got_store (gchar *uri, CamelStore *store, gpointer data) -{ - struct _EMSubscribe *sub = data; - - if (!sub->cancel) - subscribe_set_store (sub, store); - sub_unref (sub); -} - -static void -sub_editor_combobox_changed (GtkWidget *w, EMSubscribeEditor *se) -{ - gint i, n; - GList *link; - - d(printf("combobox changed\n")); - - i = 0; - n = gtk_combo_box_get_active (GTK_COMBO_BOX (se->combobox)); - if (n != -1) { - GtkTreeIter iter; - GtkTreeModel *model; - - gtk_widget_hide (se->none_selected); - - model = gtk_combo_box_get_model (GTK_COMBO_BOX (se->combobox)); - if (gtk_tree_model_get_iter_first (model, &iter)) { - gboolean is_account = TRUE; - - gtk_tree_model_get (model, &iter, 1, &is_account, -1); - - if (!is_account && n > 0) { - /* the first node it not an account node, it's the notice - about "select account please", thus remove it completely */ - gtk_list_store_remove (GTK_LIST_STORE (model), &iter); - n--; - } else if (!is_account) { - gtk_widget_show (se->none_selected); - i++; - } - } - } - - if (se->refilter_id != 0) { - g_source_remove (se->refilter_id); - se->refilter_id = 0; - } - - se->current = NULL; - link = g_queue_peek_head_link (&se->stores); - while (link != NULL) { - struct _EMSubscribe *sub = link->data; - - if (i == n) { - se->current = sub; - if (sub->widget) { - gtk_widget_show (sub->widget); - } else if (sub->store_id == -1) { - sub_ref (sub); - sub->store_id = mail_get_store (sub->store_uri, NULL, sub_editor_got_store, sub); - } - } else { - if (sub->widget) - gtk_widget_hide (sub->widget); - } - i++; - - link = g_list_next (link); - } - - update_buttons_sesitivity (se); - - if (se->current && se->is_filtering) - update_filtering_column (se, se->current); -} - -static gboolean sub_editor_timeout (EMSubscribeEditor *se) -{ - gtk_progress_bar_pulse ((GtkProgressBar *)se->progress); - - return TRUE; -} - -static void sub_editor_busy (EMSubscribeEditor *se, gint dir) -{ - gint was; - - was = se->busy != 0; - se->busy += dir; - if (was && !se->busy) { - g_source_remove (se->busy_id); - se->busy_id = 0; - gtk_widget_hide (se->progress); - } else if (!was && se->busy) { - se->busy_id = g_timeout_add (1000/5, (GSourceFunc)sub_editor_timeout, se); - gtk_widget_show (se->progress); - } -} - -#define DEFAULT_WIDTH 600 -#define DEFAULT_HEIGHT 400 - -static GtkAllocation window_size = { 0, 0, 0, 0 }; - -static void -window_size_allocate (GtkWidget *widget, GtkAllocation *allocation) -{ - GConfClient *gconf; - - /* save to in-memory variable for current session access */ - window_size = *allocation; - - /* save the setting across sessions */ - gconf = gconf_client_get_default (); - gconf_client_set_int (gconf, "/apps/evolution/mail/subscribe_window/width", window_size.width, NULL); - gconf_client_set_int (gconf, "/apps/evolution/mail/subscribe_window/height", window_size.height, NULL); - g_object_unref (gconf); -} - -static void -store_expanded_rows_cb (GtkTreeView *tree_view, GtkTreePath *path, gpointer data) -{ - GSList **slist = data; - - g_return_if_fail (path != NULL); - g_return_if_fail (data != NULL); - - *slist = g_slist_prepend (*slist, gtk_tree_path_copy (path)); -} - -static void -expand_to_path_cb (GtkTreePath *path, GtkTreeView *tree_view) -{ - g_return_if_fail (path != NULL); - g_return_if_fail (tree_view != NULL); - - gtk_tree_view_expand_to_path (tree_view, path); -} - -static void -change_filtering_models (EMSubscribeEditor *se, gboolean turn_on) -{ - GList *link; - - link = g_queue_peek_head_link (&se->stores); - while (link != NULL) { - struct _EMSubscribe *sub = link->data; - - if (sub->widget && sub->tree) { - if (turn_on) { - g_slist_foreach (sub->tree_expanded_paths, (GFunc) gtk_tree_path_free, NULL); - g_slist_free (sub->tree_expanded_paths); - sub->tree_expanded_paths = NULL; - - gtk_tree_view_map_expanded_rows (sub->tree, store_expanded_rows_cb, &sub->tree_expanded_paths); - - gtk_list_store_clear (GTK_LIST_STORE (sub->list_store)); - gtk_tree_view_set_model (sub->tree, sub->list_store); - } else { - gtk_tree_view_set_model (sub->tree, sub->tree_store); - - g_slist_foreach (sub->tree_expanded_paths, (GFunc) expand_to_path_cb, sub->tree); - g_slist_foreach (sub->tree_expanded_paths, (GFunc) gtk_tree_path_free, NULL); - g_slist_free (sub->tree_expanded_paths); - sub->tree_expanded_paths = NULL; - } - - gtk_tree_view_set_search_column (sub->tree, COL_NAME); - } - - link = g_list_next (link); - } - - update_buttons_sesitivity (se); -} - -static gboolean -update_filter_on_timeout_cb (gpointer data) -{ - EMSubscribeEditor *se = data; - - g_return_val_if_fail (se != NULL, FALSE); - - se->refilter_id = 0; - if (se->current) { - /* update filtering options */ - update_filtering_column (se, se->current); - } - - return FALSE; -} - -static void -clear_filter_cb (GtkEntry *entry, GtkEntryIconPosition icon_pos, GdkEvent *event, EMSubscribeEditor *se) -{ - g_return_if_fail (entry != NULL); - - gtk_entry_set_text (entry, ""); -} - -static void -filter_changed_cb (GtkEntry *entry, EMSubscribeEditor *se) -{ - const gchar *text; - gboolean was_filtering; - - g_return_if_fail (entry != NULL); - g_return_if_fail (se != NULL); - - text = gtk_entry_get_text (entry); - was_filtering = se->is_filtering; - se->is_filtering = text && *text; - gtk_entry_set_icon_sensitive (GTK_ENTRY (se->filter_entry), GTK_ENTRY_ICON_SECONDARY, se->is_filtering); - - if (se->refilter_id != 0) { - g_source_remove (se->refilter_id); - se->refilter_id = 0; - } - - if ((was_filtering && !se->is_filtering) || (!was_filtering && se->is_filtering)) { - /* turn on/off filtering - change models */ - change_filtering_models (se, se->is_filtering); - } - - if (se->is_filtering && se->current) - se->refilter_id = g_timeout_add (333, update_filter_on_timeout_cb, se); -} - -static void -expand_all_cb (GtkButton *button, EMSubscribeEditor *se) -{ - g_return_if_fail (se != NULL); - g_return_if_fail (!se->is_filtering); - g_return_if_fail (se->current != NULL); - g_return_if_fail (se->current->tree != NULL); - - gtk_tree_view_expand_all (se->current->tree); -} - -static void -collapse_all_cb (GtkButton *button, EMSubscribeEditor *se) -{ - g_return_if_fail (se != NULL); - g_return_if_fail (!se->is_filtering); - g_return_if_fail (se->current != NULL); - g_return_if_fail (se->current->tree != NULL); - - gtk_tree_view_collapse_all (se->current->tree); -} - -GtkWidget * -em_subscribe_editor_new (void) -{ - EMSubscribeEditor *se; - EAccountList *accounts; - EIterator *iter; - GtkBuilder *builder; - GtkWidget *w; - GtkWidget *container; - GtkCellRenderer *cell; - GtkListStore *store; - GtkTreeIter gtiter; - - se = g_malloc0 (sizeof (*se)); - g_queue_init (&se->stores); - - /* XXX I think we're leaking the GtkBuilder. */ - builder = gtk_builder_new (); - e_load_ui_builder_definition (builder, "mail-dialogs.ui"); - - se->dialog = (GtkDialog *)e_builder_get_widget (builder, "subscribe_dialog"); - g_signal_connect(se->dialog, "destroy", G_CALLBACK(sub_editor_destroy), se); - - gtk_widget_ensure_style ((GtkWidget *)se->dialog); - - container = gtk_dialog_get_action_area (GTK_DIALOG (se->dialog)); - gtk_container_set_border_width (GTK_CONTAINER (container), 12); - - container = gtk_dialog_get_content_area (GTK_DIALOG (se->dialog)); - gtk_container_set_border_width (GTK_CONTAINER (container), 0); - - se->vbox = e_builder_get_widget(builder, "tree_box"); - - /* FIXME: This is just to get the shadow, is there a better way? */ - w = gtk_label_new(_("Please select a server.")); - se->none_selected = gtk_viewport_new (NULL, NULL); - gtk_viewport_set_shadow_type ((GtkViewport *)se->none_selected, GTK_SHADOW_IN); - gtk_container_add ((GtkContainer *)se->none_selected, w); - gtk_widget_show (w); - - gtk_box_pack_start ((GtkBox *)se->vbox, se->none_selected, TRUE, TRUE, 0); - gtk_widget_show (se->none_selected); - - se->progress = e_builder_get_widget(builder, "progress_bar"); - gtk_widget_hide (se->progress); - - se->filter_entry = e_builder_get_widget (builder, "filter_entry"); - gtk_entry_set_icon_sensitive (GTK_ENTRY (se->filter_entry), GTK_ENTRY_ICON_SECONDARY, FALSE); - g_signal_connect (se->filter_entry, "icon-press", G_CALLBACK (clear_filter_cb), se); - g_signal_connect (se->filter_entry, "changed", G_CALLBACK (filter_changed_cb), se); - - se->expand_button = e_builder_get_widget (builder, "expand_button"); - g_signal_connect (se->expand_button, "clicked", G_CALLBACK (expand_all_cb), se); - - se->collapse_button = e_builder_get_widget (builder, "collapse_button"); - g_signal_connect (se->collapse_button, "clicked", G_CALLBACK (collapse_all_cb), se); - - se->refresh_button = e_builder_get_widget (builder, "refresh_button"); - g_signal_connect (se->refresh_button, "clicked", G_CALLBACK (sub_editor_refresh), se); - - w = e_builder_get_widget (builder, "close_button"); - g_signal_connect (w, "clicked", G_CALLBACK (sub_editor_close), se); - - /* setup stores combobox */ - se->combobox = e_builder_get_widget (builder, "store_combobox"); - store = gtk_list_store_new (2, G_TYPE_STRING, G_TYPE_BOOLEAN); - gtk_combo_box_set_model (GTK_COMBO_BOX (se->combobox), GTK_TREE_MODEL (store)); - g_object_unref (store); - - gtk_cell_layout_clear (GTK_CELL_LAYOUT (se->combobox)); - - cell = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (se->combobox), cell, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (se->combobox), cell, - "text", 0, - NULL); - - gtk_list_store_append (store, >iter); - gtk_list_store_set ( - store, >iter, - 0, _("No server has been selected"), - 1, FALSE, - -1); - - accounts = e_get_account_list (); - for (iter = e_list_get_iterator ((EList *) accounts); - e_iterator_is_valid (iter); - e_iterator_next (iter)) { - EAccount *account = (EAccount *) e_iterator_get (iter); - - /* setup url table, and store table? */ - if (account->enabled && account->source->url) { - d(printf("adding account '%s'\n", account->name)); - gtk_list_store_append (store, >iter); - gtk_list_store_set ( - store, >iter, - 0, account->name, - 1, TRUE, - -1); - g_queue_push_tail ( - &se->stores, subscribe_new ( - se, account->source->url)); - } else { - d(printf("not adding account '%s'\n", account->name)); - } - } - g_object_unref (iter); - - gtk_combo_box_set_active (GTK_COMBO_BOX (se->combobox), 0); - g_signal_connect(se->combobox, "changed", G_CALLBACK(sub_editor_combobox_changed), se); - - if (window_size.width == 0) { - /* initialize @window_size with the previous session's size */ - GConfClient *gconf; - GError *err = NULL; - - gconf = gconf_client_get_default (); - - window_size.width = gconf_client_get_int (gconf, "/apps/evolution/mail/subscribe_window/width", &err); - if (err != NULL) { - window_size.width = DEFAULT_WIDTH; - g_clear_error (&err); - } - - window_size.height = gconf_client_get_int (gconf, "/apps/evolution/mail/subscribe_window/height", &err); - if (err != NULL) { - window_size.height = DEFAULT_HEIGHT; - g_clear_error (&err); - } - - g_object_unref (gconf); - } - - gtk_window_set_default_size ((GtkWindow *) se->dialog, window_size.width, window_size.height); - g_signal_connect (se->dialog, "size-allocate", G_CALLBACK (window_size_allocate), NULL); - - update_buttons_sesitivity (se); - - return GTK_WIDGET (se->dialog); -} diff --git a/mail/em-subscribe-editor.h b/mail/em-subscribe-editor.h deleted file mode 100644 index 553ed7d544..0000000000 --- a/mail/em-subscribe-editor.h +++ /dev/null @@ -1,28 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _EM_SUBSCRIBE_EDITOR_H -#define _EM_SUBSCRIBE_EDITOR_H - -#include <gtk/gtk.h> - -GtkWidget *em_subscribe_editor_new (void); - -#endif /* _EM_SUBSCRIBE_EDITOR_H */ diff --git a/mail/em-subscription-editor.c b/mail/em-subscription-editor.c new file mode 100644 index 0000000000..321d245477 --- /dev/null +++ b/mail/em-subscription-editor.c @@ -0,0 +1,1342 @@ +/* + * em-subscription-editor.c + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#include "em-subscription-editor.h" + +#include <config.h> +#include <string.h> +#include <glib/gi18n-lib.h> + +#include "mail-tools.h" +#include "mail-ops.h" +#include "mail-mt.h" + +#include <e-util/e-util.h> +#include <e-util/e-binding.h> +#include <e-util/e-account-utils.h> +#include <e-util/e-util-private.h> +#include <e-util/gconf-bridge.h> + +#include "em-folder-utils.h" + +#define EM_SUBSCRIPTION_EDITOR_GET_PRIVATE(obj) \ + (G_TYPE_INSTANCE_GET_PRIVATE \ + ((obj), EM_TYPE_SUBSCRIPTION_EDITOR, EMSubscriptionEditorPrivate)) + +#define FOLDER_CAN_SELECT(folder_info) \ + ((folder_info) != NULL && \ + ((folder_info)->flags & CAMEL_FOLDER_NOSELECT) == 0) +#define FOLDER_SUBSCRIBED(folder_info) \ + ((folder_info) != NULL && \ + ((folder_info)->flags & CAMEL_FOLDER_SUBSCRIBED) != 0) + +typedef struct _AsyncContext AsyncContext; +typedef struct _StoreData StoreData; + +struct _EMSubscriptionEditorPrivate { + CamelSession *session; + EAccount *initial_account; + + GtkWidget *combo_box; /* not referenced */ + GtkWidget *entry; /* not referenced */ + GtkWidget *notebook; /* not referenced */ + GtkWidget *subscribe_button; /* not referenced */ + GtkWidget *unsubscribe_button; /* not referenced */ + GtkWidget *collapse_all_button; /* not referenced */ + GtkWidget *expand_all_button; /* not referenced */ + GtkWidget *refresh_button; /* not referenced */ + GtkWidget *stop_button; /* not referenced */ + + /* Indicies coincide with the combo box. */ + GPtrArray *stores; + + /* Points at an item in the stores array. */ + StoreData *active; + + /* Casefolded search string. */ + gchar *search_string; + + guint timeout_id; +}; + +struct _AsyncContext { + EMSubscriptionEditor *editor; + CamelFolderInfo *folder_info; + GtkTreeRowReference *reference; +}; + +struct _StoreData { + EAccount *account; + CamelStore *store; + GtkTreeView *tree_view; + GtkTreeModel *list_store; + GtkTreeModel *tree_store; + GCancellable *cancellable; + CamelFolderInfo *folder_info; + gboolean filtered_view; + gboolean needs_refresh; +}; + +enum { + PROP_0, + PROP_ACCOUNT, + PROP_SESSION +}; + +enum { + COL_CASEFOLDED, /* G_TYPE_STRING */ + COL_FOLDER_NAME, /* G_TYPE_STRING */ + COL_FOLDER_ICON, /* G_TYPE_STRING */ + COL_FOLDER_INFO, /* G_TYPE_POINTER */ + N_COLUMNS +}; + +G_DEFINE_TYPE (EMSubscriptionEditor, em_subscription_editor, GTK_TYPE_DIALOG) + +static void +async_context_free (AsyncContext *context) +{ + g_object_unref (context->editor); + gtk_tree_row_reference_free (context->reference); + + g_slice_free (AsyncContext, context); +} + +static void +store_data_free (StoreData *data) +{ + if (data->account != NULL) + g_object_unref (data->account); + + if (data->store != NULL) + g_object_unref (data->store); + + if (data->tree_view != NULL) + g_object_unref (data->tree_view); + + if (data->list_store != NULL) + g_object_unref (data->list_store); + + if (data->tree_store != NULL) + g_object_unref (data->tree_store); + + if (data->cancellable != NULL) { + g_cancellable_cancel (data->cancellable); + g_object_unref (data->cancellable); + } + + camel_folder_info_free (data->folder_info); + + g_slice_free (StoreData, data); +} + +static void +subscription_editor_populate (EMSubscriptionEditor *editor, + CamelFolderInfo *folder_info, + GtkTreeIter *parent) +{ + GtkTreeView *tree_view; + GtkListStore *list_store; + GtkTreeStore *tree_store; + + tree_view = editor->priv->active->tree_view; + list_store = GTK_LIST_STORE (editor->priv->active->list_store); + tree_store = GTK_TREE_STORE (editor->priv->active->tree_store); + + while (folder_info != NULL) { + GtkTreeIter iter; + const gchar *icon_name; + gchar *casefolded; + + icon_name = + em_folder_utils_get_icon_name (folder_info->flags); + + casefolded = g_utf8_casefold (folder_info->full_name, -1); + + gtk_list_store_append (list_store, &iter); + + gtk_list_store_set ( + list_store, &iter, + COL_CASEFOLDED, casefolded, + COL_FOLDER_ICON, icon_name, + COL_FOLDER_NAME, folder_info->full_name, + COL_FOLDER_INFO, folder_info, -1); + + gtk_tree_store_append (tree_store, &iter, parent); + + gtk_tree_store_set ( + tree_store, &iter, + COL_CASEFOLDED, NULL, /* not needed */ + COL_FOLDER_ICON, icon_name, + COL_FOLDER_NAME, folder_info->name, + COL_FOLDER_INFO, folder_info, -1); + + if (FOLDER_SUBSCRIBED (folder_info)) { + GtkTreePath *path; + + path = gtk_tree_model_get_path ( + GTK_TREE_MODEL (tree_store), &iter); + gtk_tree_view_expand_to_path (tree_view, path); + gtk_tree_path_free (path); + } + + g_free (casefolded); + + if (folder_info->child != NULL) + subscription_editor_populate ( + editor, folder_info->child, &iter); + + folder_info = folder_info->next; + } +} + +static void +subscription_editor_get_folder_info_done (CamelStore *store, + GAsyncResult *result, + EMSubscriptionEditor *editor) +{ + GtkTreePath *path; + GtkTreeView *tree_view; + GtkTreeModel *list_store; + GtkTreeModel *tree_store; + GtkTreeSelection *selection; + CamelFolderInfo *folder_info; + GdkWindow *window; + GError *error = NULL; + + folder_info = camel_store_get_folder_info_finish ( + store, result, &error); + + /* Just return quietly if we were cancelled. */ + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_warn_if_fail (folder_info == NULL); + g_error_free (error); + goto exit; + } + + gtk_widget_set_sensitive (editor->priv->notebook, TRUE); + gtk_widget_set_sensitive (editor->priv->refresh_button, TRUE); + gtk_widget_set_sensitive (editor->priv->stop_button, FALSE); + + window = gtk_widget_get_window (GTK_WIDGET (editor)); + gdk_window_set_cursor (window, NULL); + + /* XXX Do something smarter with errors. */ + if (error != NULL) { + g_warn_if_fail (folder_info == NULL); + g_warning ("%s", error->message); + g_error_free (error); + goto exit; + } + + g_return_if_fail (folder_info != NULL); + + camel_folder_info_free (editor->priv->active->folder_info); + editor->priv->active->folder_info = folder_info; + + tree_view = editor->priv->active->tree_view; + list_store = editor->priv->active->list_store; + tree_store = editor->priv->active->tree_store; + + gtk_list_store_clear (GTK_LIST_STORE (list_store)); + gtk_tree_store_clear (GTK_TREE_STORE (tree_store)); + subscription_editor_populate (editor, folder_info, NULL); + + path = gtk_tree_path_new_first (); + selection = gtk_tree_view_get_selection (tree_view); + gtk_tree_selection_select_path (selection, path); + gtk_tree_path_free (path); + + gtk_widget_grab_focus (GTK_WIDGET (tree_view)); + +exit: + g_object_unref (editor); +} + +static void +subscription_editor_subscribe_folder_done (CamelStore *store, + GAsyncResult *result, + AsyncContext *context) +{ + GtkTreeView *tree_view; + GtkTreeModel *tree_model; + GtkTreeSelection *selection; + GtkTreePath *path; + GtkTreeIter iter; + GdkWindow *window; + GError *error = NULL; + + camel_store_subscribe_folder_finish (store, result, &error); + + /* Just return quietly if we were cancelled. */ + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_error_free (error); + goto exit; + } + + /* XXX Do something smarter with errors. */ + if (error == NULL) + context->folder_info->flags |= CAMEL_FOLDER_SUBSCRIBED; + else { + g_warning ("%s", error->message); + g_error_free (error); + } + + gtk_widget_set_sensitive (context->editor->priv->notebook, TRUE); + gtk_widget_set_sensitive (context->editor->priv->refresh_button, TRUE); + gtk_widget_set_sensitive (context->editor->priv->stop_button, FALSE); + + window = gtk_widget_get_window (GTK_WIDGET (context->editor)); + gdk_window_set_cursor (window, NULL); + + /* Update the Subscription/Unsubscription buttons. */ + tree_view = context->editor->priv->active->tree_view; + selection = gtk_tree_view_get_selection (tree_view); + g_signal_emit_by_name (selection, "changed"); + + /* Update the toggle renderer in the selected row. */ + tree_model = gtk_tree_row_reference_get_model (context->reference); + path = gtk_tree_row_reference_get_path (context->reference); + gtk_tree_model_get_iter (tree_model, &iter, path); + gtk_tree_model_row_changed (tree_model, path, &iter); + gtk_tree_path_free (path); + +exit: + async_context_free (context); +} + +static void +subscription_editor_unsubscribe_folder_done (CamelStore *store, + GAsyncResult *result, + AsyncContext *context) +{ + GtkTreeView *tree_view; + GtkTreeModel *tree_model; + GtkTreeSelection *selection; + GtkTreePath *path; + GtkTreeIter iter; + GdkWindow *window; + GError *error = NULL; + + camel_store_unsubscribe_folder_finish (store, result, &error); + + /* Just return quietly if we were cancelled. */ + if (g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) { + g_error_free (error); + goto exit; + } + + /* XXX Do something smarter with errors. */ + if (error == NULL) + context->folder_info->flags &= ~CAMEL_FOLDER_SUBSCRIBED; + else { + g_warning ("%s", error->message); + g_error_free (error); + } + + gtk_widget_set_sensitive (context->editor->priv->notebook, TRUE); + gtk_widget_set_sensitive (context->editor->priv->refresh_button, TRUE); + gtk_widget_set_sensitive (context->editor->priv->stop_button, FALSE); + + window = gtk_widget_get_window (GTK_WIDGET (context->editor)); + gdk_window_set_cursor (window, NULL); + + /* Update the Subscription/Unsubscription buttons. */ + tree_view = context->editor->priv->active->tree_view; + selection = gtk_tree_view_get_selection (tree_view); + g_signal_emit_by_name (selection, "changed"); + + /* Update the toggle renderer in the selected row. */ + tree_model = gtk_tree_row_reference_get_model (context->reference); + path = gtk_tree_row_reference_get_path (context->reference); + gtk_tree_model_get_iter (tree_model, &iter, path); + gtk_tree_model_row_changed (tree_model, path, &iter); + gtk_tree_path_free (path); + +exit: + async_context_free (context); +} + +static void +subscription_editor_subscribe (EMSubscriptionEditor *editor) +{ + CamelFolderInfo *folder_info; + GtkTreeRowReference *reference; + GtkTreeSelection *selection; + GtkTreeModel *tree_model; + GtkTreeView *tree_view; + GtkTreePath *path; + GtkTreeIter iter; + GdkCursor *cursor; + GdkWindow *window; + AsyncContext *context; + gboolean have_selection; + + tree_view = editor->priv->active->tree_view; + selection = gtk_tree_view_get_selection (tree_view); + + have_selection = gtk_tree_selection_get_selected ( + selection, &tree_model, &iter); + g_return_if_fail (have_selection); + + /* Cancel any operation on this store still in progress. */ + gtk_button_clicked (GTK_BUTTON (editor->priv->stop_button)); + + /* Start a new 'subscription' operation. */ + editor->priv->active->cancellable = g_cancellable_new (); + + gtk_widget_set_sensitive (editor->priv->notebook, FALSE); + gtk_widget_set_sensitive (editor->priv->subscribe_button, FALSE); + gtk_widget_set_sensitive (editor->priv->unsubscribe_button, FALSE); + gtk_widget_set_sensitive (editor->priv->refresh_button, FALSE); + gtk_widget_set_sensitive (editor->priv->stop_button, TRUE); + + cursor = gdk_cursor_new (GDK_WATCH); + window = gtk_widget_get_window (GTK_WIDGET (editor)); + gdk_window_set_cursor (window, cursor); + gdk_cursor_unref (cursor); + + gtk_tree_model_get ( + tree_model, &iter, COL_FOLDER_INFO, &folder_info, -1); + + path = gtk_tree_model_get_path (tree_model, &iter); + reference = gtk_tree_row_reference_new (tree_model, path); + gtk_tree_path_free (path); + + context = g_slice_new0 (AsyncContext); + context->editor = g_object_ref (editor); + context->folder_info = folder_info; + context->reference = reference; + + camel_store_subscribe_folder ( + editor->priv->active->store, + folder_info->full_name, G_PRIORITY_DEFAULT, + editor->priv->active->cancellable, (GAsyncReadyCallback) + subscription_editor_subscribe_folder_done, context); +} + +static void +subscription_editor_unsubscribe (EMSubscriptionEditor *editor) +{ + CamelFolderInfo *folder_info; + GtkTreeRowReference *reference; + GtkTreeSelection *selection; + GtkTreeModel *tree_model; + GtkTreeView *tree_view; + GtkTreePath *path; + GtkTreeIter iter; + GdkCursor *cursor; + GdkWindow *window; + AsyncContext *context; + gboolean have_selection; + + tree_view = editor->priv->active->tree_view; + selection = gtk_tree_view_get_selection (tree_view); + + have_selection = gtk_tree_selection_get_selected ( + selection, &tree_model, &iter); + g_return_if_fail (have_selection); + + /* Cancel any operation on this store still in progress. */ + gtk_button_clicked (GTK_BUTTON (editor->priv->stop_button)); + + /* Start a new 'unsubscription' operation. */ + editor->priv->active->cancellable = g_cancellable_new (); + + gtk_widget_set_sensitive (editor->priv->notebook, FALSE); + gtk_widget_set_sensitive (editor->priv->subscribe_button, FALSE); + gtk_widget_set_sensitive (editor->priv->unsubscribe_button, FALSE); + gtk_widget_set_sensitive (editor->priv->refresh_button, FALSE); + gtk_widget_set_sensitive (editor->priv->stop_button, TRUE); + + cursor = gdk_cursor_new (GDK_WATCH); + window = gtk_widget_get_window (GTK_WIDGET (editor)); + gdk_window_set_cursor (window, cursor); + gdk_cursor_unref (cursor); + + gtk_tree_model_get ( + tree_model, &iter, COL_FOLDER_INFO, &folder_info, -1); + + path = gtk_tree_model_get_path (tree_model, &iter); + reference = gtk_tree_row_reference_new (tree_model, path); + gtk_tree_path_free (path); + + context = g_slice_new0 (AsyncContext); + context->editor = g_object_ref (editor); + context->folder_info = folder_info; + context->reference = reference; + + camel_store_unsubscribe_folder ( + editor->priv->active->store, + folder_info->full_name, G_PRIORITY_DEFAULT, + editor->priv->active->cancellable, (GAsyncReadyCallback) + subscription_editor_unsubscribe_folder_done, context); +} + +static void +subscription_editor_collapse_all (EMSubscriptionEditor *editor) +{ + gtk_tree_view_collapse_all (editor->priv->active->tree_view); +} + +static void +subscription_editor_expand_all (EMSubscriptionEditor *editor) +{ + gtk_tree_view_expand_all (editor->priv->active->tree_view); +} + +static void +subscription_editor_refresh (EMSubscriptionEditor *editor) +{ + GdkCursor *cursor; + GdkWindow *window; + + /* Cancel any operation on this store still in progress. */ + gtk_button_clicked (GTK_BUTTON (editor->priv->stop_button)); + + /* Start a new 'refresh' operation. */ + editor->priv->active->cancellable = g_cancellable_new (); + + gtk_widget_set_sensitive (editor->priv->notebook, FALSE); + gtk_widget_set_sensitive (editor->priv->subscribe_button, FALSE); + gtk_widget_set_sensitive (editor->priv->unsubscribe_button, FALSE); + gtk_widget_set_sensitive (editor->priv->refresh_button, FALSE); + gtk_widget_set_sensitive (editor->priv->stop_button, TRUE); + + cursor = gdk_cursor_new (GDK_WATCH); + window = gtk_widget_get_window (GTK_WIDGET (editor)); + gdk_window_set_cursor (window, cursor); + gdk_cursor_unref (cursor); + + camel_store_get_folder_info ( + editor->priv->active->store, NULL, + CAMEL_STORE_FOLDER_INFO_RECURSIVE | + CAMEL_STORE_FOLDER_INFO_NO_VIRTUAL | + CAMEL_STORE_FOLDER_INFO_SUBSCRIPTION_LIST, + G_PRIORITY_DEFAULT, editor->priv->active->cancellable, + (GAsyncReadyCallback) subscription_editor_get_folder_info_done, + g_object_ref (editor)); +} + +static void +subscription_editor_stop (EMSubscriptionEditor *editor) +{ + GdkWindow *window; + + if (editor->priv->active->cancellable != NULL) { + g_cancellable_cancel (editor->priv->active->cancellable); + g_object_unref (editor->priv->active->cancellable); + editor->priv->active->cancellable = NULL; + } + + gtk_widget_set_sensitive (editor->priv->notebook, TRUE); + gtk_widget_set_sensitive (editor->priv->subscribe_button, TRUE); + gtk_widget_set_sensitive (editor->priv->unsubscribe_button, TRUE); + gtk_widget_set_sensitive (editor->priv->refresh_button, TRUE); + gtk_widget_set_sensitive (editor->priv->stop_button, FALSE); + + window = gtk_widget_get_window (GTK_WIDGET (editor)); + gdk_window_set_cursor (window, NULL); +} + +static gboolean +subscription_editor_filter_cb (GtkTreeModel *tree_model, + GtkTreeIter *iter, + EMSubscriptionEditor *editor) +{ + CamelFolderInfo *folder_info; + gchar *casefolded; + gboolean match; + + /* If there's no search string let everything through. */ + if (editor->priv->search_string == NULL) + return TRUE; + + gtk_tree_model_get ( + tree_model, iter, + COL_CASEFOLDED, &casefolded, + COL_FOLDER_INFO, &folder_info, -1); + + match = FOLDER_CAN_SELECT (folder_info) && + (casefolded != NULL) && (*casefolded != '\0') && + (strstr (casefolded, editor->priv->search_string) != NULL); + + g_free (casefolded); + + return match; +} + +static void +subscription_editor_update_view (EMSubscriptionEditor *editor) +{ + GtkEntry *entry; + GtkTreeView *tree_view; + GtkTreeModel *tree_model; + const gchar *text; + + entry = GTK_ENTRY (editor->priv->entry); + tree_view = editor->priv->active->tree_view; + + editor->priv->timeout_id = 0; + + text = gtk_entry_get_text (entry); + + if (text != NULL && *text != '\0') { + g_free (editor->priv->search_string); + editor->priv->search_string = g_utf8_casefold (text, -1); + + /* Install the list store in the tree view if needed. */ + if (!editor->priv->active->filtered_view) { + GtkTreeSelection *selection; + GtkTreePath *path; + + tree_model = gtk_tree_model_filter_new ( + editor->priv->active->list_store, NULL); + gtk_tree_model_filter_set_visible_func ( + GTK_TREE_MODEL_FILTER (tree_model), + (GtkTreeModelFilterVisibleFunc) + subscription_editor_filter_cb, editor, + (GDestroyNotify) NULL); + gtk_tree_view_set_model (tree_view, tree_model); + g_object_unref (tree_model); + + path = gtk_tree_path_new_first (); + selection = gtk_tree_view_get_selection (tree_view); + gtk_tree_selection_select_path (selection, path); + gtk_tree_path_free (path); + + editor->priv->active->filtered_view = TRUE; + } + + tree_model = gtk_tree_view_get_model (tree_view); + gtk_tree_model_filter_refilter ( + GTK_TREE_MODEL_FILTER (tree_model)); + + gtk_entry_set_icon_sensitive ( + entry, GTK_ENTRY_ICON_SECONDARY, TRUE); + + gtk_widget_set_sensitive ( + editor->priv->collapse_all_button, FALSE); + gtk_widget_set_sensitive ( + editor->priv->expand_all_button, FALSE); + + } else { + /* Install the tree store in the tree view if needed. */ + if (editor->priv->active->filtered_view) { + GtkTreeSelection *selection; + GtkTreePath *path; + + tree_model = editor->priv->active->tree_store; + gtk_tree_view_set_model (tree_view, tree_model); + + path = gtk_tree_path_new_first (); + selection = gtk_tree_view_get_selection (tree_view); + gtk_tree_selection_select_path (selection, path); + gtk_tree_path_free (path); + + editor->priv->active->filtered_view = FALSE; + } + + gtk_entry_set_icon_sensitive ( + entry, GTK_ENTRY_ICON_SECONDARY, FALSE); + + gtk_widget_set_sensitive ( + editor->priv->collapse_all_button, TRUE); + gtk_widget_set_sensitive ( + editor->priv->expand_all_button, TRUE); + } +} + +static gboolean +subscription_editor_timeout_cb (EMSubscriptionEditor *editor) +{ + subscription_editor_update_view (editor); + editor->priv->timeout_id = 0; + + return FALSE; +} + +static void +subscription_editor_combo_box_changed_cb (GtkComboBox *combo_box, + EMSubscriptionEditor *editor) +{ + StoreData *data; + gint index; + + index = gtk_combo_box_get_active (combo_box); + g_return_if_fail (index < editor->priv->stores->len); + + data = g_ptr_array_index (editor->priv->stores, index); + g_return_if_fail (data != NULL); + + editor->priv->active = data; + + subscription_editor_stop (editor); + subscription_editor_update_view (editor); + + g_object_notify (G_OBJECT (editor), "account"); + + if (data->needs_refresh) { + subscription_editor_refresh (editor); + data->needs_refresh = FALSE; + } +} + +static void +subscription_editor_entry_changed_cb (GtkEntry *entry, + EMSubscriptionEditor *editor) +{ + const gchar *text; + + if (editor->priv->timeout_id > 0) { + g_source_remove (editor->priv->timeout_id); + editor->priv->timeout_id = 0; + } + + text = gtk_entry_get_text (entry); + + if (text != NULL && *text != '\0') + editor->priv->timeout_id = g_timeout_add_seconds ( + 1, (GSourceFunc) subscription_editor_timeout_cb, editor); + else + subscription_editor_update_view (editor); +} + +static void +subscription_editor_icon_release_cb (GtkEntry *entry, + GtkEntryIconPosition icon_pos, + GdkEvent *event, + EMSubscriptionEditor *editor) +{ + if (icon_pos == GTK_ENTRY_ICON_SECONDARY) + gtk_entry_set_text (entry, ""); +} + +static void +subscription_editor_renderer_toggled_cb (GtkCellRendererToggle *renderer, + const gchar *path_string, + EMSubscriptionEditor *editor) +{ + GtkTreeSelection *selection; + GtkTreeView *tree_view; + GtkTreePath *path; + + tree_view = editor->priv->active->tree_view; + selection = gtk_tree_view_get_selection (tree_view); + + path = gtk_tree_path_new_from_string (path_string); + gtk_tree_selection_select_path (selection, path); + gtk_tree_path_free (path); + + if (gtk_cell_renderer_toggle_get_active (renderer)) + subscription_editor_unsubscribe (editor); + else + subscription_editor_subscribe (editor); +} + +static void +subscription_editor_render_toggle_cb (GtkCellLayout *cell_layout, + GtkCellRenderer *renderer, + GtkTreeModel *tree_model, + GtkTreeIter *iter) +{ + CamelFolderInfo *folder_info; + + gtk_tree_model_get ( + tree_model, iter, COL_FOLDER_INFO, &folder_info, -1); + + g_object_set ( + renderer, "active", FOLDER_SUBSCRIBED (folder_info), + "visible", FOLDER_CAN_SELECT (folder_info), NULL); +} + +static void +subscription_editor_selection_changed_cb (GtkTreeSelection *selection, + EMSubscriptionEditor *editor) +{ + GtkTreeModel *tree_model; + GtkTreeIter iter; + + if (gtk_tree_selection_get_selected (selection, &tree_model, &iter)) { + CamelFolderInfo *folder_info; + + gtk_tree_model_get ( + tree_model, &iter, + COL_FOLDER_INFO, &folder_info, -1); + gtk_widget_set_sensitive ( + editor->priv->subscribe_button, + FOLDER_CAN_SELECT (folder_info) && + !FOLDER_SUBSCRIBED (folder_info)); + gtk_widget_set_sensitive ( + editor->priv->unsubscribe_button, + FOLDER_CAN_SELECT (folder_info) && + FOLDER_SUBSCRIBED (folder_info)); + } else { + gtk_widget_set_sensitive ( + editor->priv->subscribe_button, FALSE); + gtk_widget_set_sensitive ( + editor->priv->subscribe_button, FALSE); + } +} + +static void +subscription_editor_add_account (EMSubscriptionEditor *editor, + EAccount *account) +{ + StoreData *data; + CamelStore *store; + CamelSession *session; + GtkComboBox *combo_box; + GtkListStore *list_store; + GtkTreeStore *tree_store; + GtkTreeViewColumn *column; + GtkTreeSelection *selection; + GtkCellRenderer *renderer; + GtkWidget *container; + GtkWidget *widget; + const gchar *url; + + combo_box = GTK_COMBO_BOX (editor->priv->combo_box); + gtk_combo_box_append_text (combo_box, account->name); + + session = em_subscription_editor_get_session (editor); + url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL); + + store = (CamelStore *) camel_session_get_service ( + session, url, CAMEL_PROVIDER_STORE, NULL); + + tree_store = gtk_tree_store_new ( + N_COLUMNS, + /* COL_CASEFOLDED */ G_TYPE_STRING, + /* COL_FOLDER_ICON */ G_TYPE_STRING, + /* COL_FOLDER_NAME */ G_TYPE_STRING, + /* COL_FOLDER_INFO */ G_TYPE_POINTER); + + list_store = gtk_list_store_new ( + N_COLUMNS, + /* COL_CASEFOLDED */ G_TYPE_STRING, + /* COL_FOLDER_ICON */ G_TYPE_STRING, + /* COL_FOLDER_NAME */ G_TYPE_STRING, + /* COL_FOLDER_INFO */ G_TYPE_POINTER); + + container = editor->priv->notebook; + + widget = gtk_scrolled_window_new (NULL, NULL); + gtk_scrolled_window_set_policy ( + GTK_SCROLLED_WINDOW (widget), + GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); + gtk_scrolled_window_set_shadow_type ( + GTK_SCROLLED_WINDOW (widget), GTK_SHADOW_IN); + gtk_notebook_append_page (GTK_NOTEBOOK (container), widget, NULL); + gtk_widget_show (widget); + + container = widget; + + widget = gtk_tree_view_new_with_model (GTK_TREE_MODEL (tree_store)); + gtk_tree_view_set_enable_search (GTK_TREE_VIEW (widget), TRUE); + gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (widget), FALSE); + gtk_tree_view_set_search_column ( + GTK_TREE_VIEW (widget), COL_FOLDER_NAME); + gtk_container_add (GTK_CONTAINER (container), widget); + gtk_widget_show (widget); + + column = gtk_tree_view_column_new (); + gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column); + + renderer = gtk_cell_renderer_toggle_new (); + g_object_set (renderer, "activatable", TRUE, NULL); + gtk_tree_view_column_pack_start (column, renderer, FALSE); + + gtk_cell_layout_set_cell_data_func ( + GTK_CELL_LAYOUT (column), renderer, + (GtkCellLayoutDataFunc) subscription_editor_render_toggle_cb, + NULL, (GDestroyNotify) NULL); + + g_signal_connect ( + renderer, "toggled", + G_CALLBACK (subscription_editor_renderer_toggled_cb), editor); + + column = gtk_tree_view_column_new (); + gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column); + gtk_tree_view_set_expander_column (GTK_TREE_VIEW (widget), column); + + renderer = gtk_cell_renderer_pixbuf_new (); + gtk_tree_view_column_pack_start (column, renderer, FALSE); + gtk_tree_view_column_add_attribute ( + column, renderer, "icon-name", COL_FOLDER_ICON); + + renderer = gtk_cell_renderer_text_new (); + gtk_tree_view_column_pack_start (column, renderer, TRUE); + gtk_tree_view_column_add_attribute ( + column, renderer, "text", COL_FOLDER_NAME); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (widget)); + + g_signal_connect ( + selection, "changed", + G_CALLBACK (subscription_editor_selection_changed_cb), editor); + + data = g_slice_new0 (StoreData); + data->account = g_object_ref (account); + data->store = g_object_ref (store); + data->tree_view = g_object_ref (widget); + data->list_store = GTK_TREE_MODEL (list_store); + data->tree_store = GTK_TREE_MODEL (tree_store); + data->needs_refresh = TRUE; + + g_ptr_array_add (editor->priv->stores, data); +} + +static gboolean +subscription_editor_test_account (EMSubscriptionEditor *editor, + EAccount *account) +{ + CamelSession *session; + CamelStore *store; + const gchar *url; + + /* Account must be enabled. */ + if (!account->enabled) + return FALSE; + + session = em_subscription_editor_get_session (editor); + url = e_account_get_string (account, E_ACCOUNT_SOURCE_URL); + + store = (CamelStore *) camel_session_get_service ( + session, url, CAMEL_PROVIDER_STORE, NULL); + + /* Corresponding CamelStore must support subscriptions. */ + return (store != NULL) && camel_store_supports_subscriptions (store); +} + +static void +subscription_editor_set_account (EMSubscriptionEditor *editor, + EAccount *account) +{ + g_return_if_fail (editor->priv->initial_account == NULL); + + if (account == NULL) + account = e_get_default_account (); + + if (E_IS_ACCOUNT (account)) + editor->priv->initial_account = g_object_ref (account); +} + +static void +subscription_editor_set_session (EMSubscriptionEditor *editor, + CamelSession *session) +{ + g_return_if_fail (CAMEL_IS_SESSION (session)); + g_return_if_fail (editor->priv->session == NULL); + + editor->priv->session = g_object_ref (session); +} + +static void +subscription_editor_set_property (GObject *object, + guint property_id, + const GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_ACCOUNT: + subscription_editor_set_account ( + EM_SUBSCRIPTION_EDITOR (object), + g_value_get_object (value)); + return; + + case PROP_SESSION: + subscription_editor_set_session ( + EM_SUBSCRIPTION_EDITOR (object), + g_value_get_object (value)); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +subscription_editor_get_property (GObject *object, + guint property_id, + GValue *value, + GParamSpec *pspec) +{ + switch (property_id) { + case PROP_ACCOUNT: + g_value_set_object ( + value, + em_subscription_editor_get_account ( + EM_SUBSCRIPTION_EDITOR (object))); + return; + + case PROP_SESSION: + g_value_set_object ( + value, + em_subscription_editor_get_session ( + EM_SUBSCRIPTION_EDITOR (object))); + return; + } + + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); +} + +static void +subscription_editor_dispose (GObject *object) +{ + EMSubscriptionEditorPrivate *priv; + + priv = EM_SUBSCRIPTION_EDITOR_GET_PRIVATE (object); + + if (priv->session != NULL) { + g_object_unref (priv->session); + priv->session = NULL; + } + + if (priv->initial_account != NULL) { + g_object_unref (priv->initial_account); + priv->initial_account = NULL; + } + + if (priv->timeout_id > 0) { + g_source_remove (priv->timeout_id); + priv->timeout_id = 0; + } + + g_ptr_array_set_size (priv->stores, 0); + + /* Chain up to parent's dispose() method. */ + G_OBJECT_CLASS (em_subscription_editor_parent_class)->dispose (object); +} + +static void +subscription_editor_finalize (GObject *object) +{ + EMSubscriptionEditorPrivate *priv; + + priv = EM_SUBSCRIPTION_EDITOR_GET_PRIVATE (object); + + g_ptr_array_free (priv->stores, TRUE); + + g_free (priv->search_string); + + /* Chain up to parent's finalize() method. */ + G_OBJECT_CLASS (em_subscription_editor_parent_class)->finalize (object); +} + +static void +subscription_editor_realize (GtkWidget *widget) +{ + EMSubscriptionEditor *editor; + EAccountList *account_list; + EIterator *account_iter; + GtkComboBox *combo_box; + gint initial_index = 0; + + editor = EM_SUBSCRIPTION_EDITOR (widget); + + /* Chain up to parent's realize() method. */ + GTK_WIDGET_CLASS (em_subscription_editor_parent_class)->realize (widget); + + /* Find accounts to display, and watch for the default account. */ + account_list = e_get_account_list (); + account_iter = e_list_get_iterator (E_LIST (account_list)); + while (e_iterator_is_valid (account_iter)) { + EAccount *account; + + /* XXX EIterator misuses const. */ + account = (EAccount *) e_iterator_get (account_iter); + if (subscription_editor_test_account (editor, account)) { + if (account == editor->priv->initial_account) + initial_index = editor->priv->stores->len; + subscription_editor_add_account (editor, account); + } + e_iterator_next (account_iter); + } + g_object_unref (account_iter); + + combo_box = GTK_COMBO_BOX (editor->priv->combo_box); + gtk_combo_box_set_active (combo_box, initial_index); +} + +static void +em_subscription_editor_class_init (EMSubscriptionEditorClass *class) +{ + GObjectClass *object_class; + GtkWidgetClass *widget_class; + + g_type_class_add_private (class, sizeof (EMSubscriptionEditorPrivate)); + + object_class = G_OBJECT_CLASS (class); + object_class->set_property = subscription_editor_set_property; + object_class->get_property = subscription_editor_get_property; + object_class->dispose = subscription_editor_dispose; + object_class->finalize = subscription_editor_finalize; + + widget_class = GTK_WIDGET_CLASS (class); + widget_class->realize = subscription_editor_realize; + + g_object_class_install_property ( + object_class, + PROP_ACCOUNT, + g_param_spec_object ( + "account", + NULL, + NULL, + E_TYPE_ACCOUNT, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); + + g_object_class_install_property ( + object_class, + PROP_SESSION, + g_param_spec_object ( + "session", + NULL, + NULL, + CAMEL_TYPE_SESSION, + G_PARAM_READWRITE | + G_PARAM_CONSTRUCT_ONLY)); +} + +static void +em_subscription_editor_init (EMSubscriptionEditor *editor) +{ + GtkWidget *container; + GtkWidget *widget; + GtkWidget *box; + const gchar *tooltip; + + editor->priv = EM_SUBSCRIPTION_EDITOR_GET_PRIVATE (editor); + editor->priv->stores = g_ptr_array_new_with_free_func ( + (GDestroyNotify) store_data_free); + + gtk_container_set_border_width (GTK_CONTAINER (editor), 5); + gtk_window_set_title (GTK_WINDOW (editor), _("Folder Subscriptions")); + + gconf_bridge_bind_window_size ( + gconf_bridge_get (), + "/apps/evolution/mail/subscription_editor", + GTK_WINDOW (editor)); + + gtk_dialog_add_button ( + GTK_DIALOG (editor), + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + + container = gtk_dialog_get_content_area (GTK_DIALOG (editor)); + + widget = gtk_vbox_new (FALSE, 12); + gtk_container_set_border_width (GTK_CONTAINER (widget), 5); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + gtk_widget_show (widget); + + container = box = widget; + + widget = gtk_table_new (2, 3, FALSE); + gtk_table_set_col_spacings (GTK_TABLE (widget), 6); + gtk_table_set_row_spacings (GTK_TABLE (widget), 6); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + container = widget; + + widget = gtk_combo_box_new_text (); + gtk_table_attach ( + GTK_TABLE (container), widget, + 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + editor->priv->combo_box = widget; + gtk_widget_show (widget); + + g_signal_connect ( + widget, "changed", + G_CALLBACK (subscription_editor_combo_box_changed_cb), editor); + + widget = gtk_label_new_with_mnemonic (_("_Account:")); + gtk_label_set_mnemonic_widget ( + GTK_LABEL (widget), editor->priv->combo_box); + gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); + gtk_table_attach ( + GTK_TABLE (container), widget, + 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show (widget); + + widget = gtk_entry_new (); + gtk_entry_set_icon_from_stock ( + GTK_ENTRY (widget), + GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); + gtk_entry_set_icon_tooltip_text ( + GTK_ENTRY (widget), + GTK_ENTRY_ICON_SECONDARY, _("Clear Search")); + gtk_entry_set_icon_sensitive ( + GTK_ENTRY (widget), + GTK_ENTRY_ICON_SECONDARY, FALSE); + gtk_table_attach ( + GTK_TABLE (container), widget, + 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); + editor->priv->entry = widget; + gtk_widget_show (widget); + + g_signal_connect ( + widget, "changed", + G_CALLBACK (subscription_editor_entry_changed_cb), editor); + + g_signal_connect ( + widget, "icon-release", + G_CALLBACK (subscription_editor_icon_release_cb), editor); + + widget = gtk_label_new_with_mnemonic (_("Sho_w items that contain:")); + gtk_label_set_mnemonic_widget ( + GTK_LABEL (widget), editor->priv->entry); + gtk_misc_set_alignment (GTK_MISC (widget), 1.0, 0.5); + gtk_table_attach ( + GTK_TABLE (container), widget, + 0, 1, 1, 2, GTK_FILL, GTK_FILL, 0, 0); + gtk_widget_show (widget); + + container = box; + + widget = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + gtk_widget_show (widget); + + container = widget; + + widget = gtk_notebook_new (); + gtk_notebook_set_show_tabs (GTK_NOTEBOOK (widget), FALSE); + gtk_notebook_set_show_border (GTK_NOTEBOOK (widget), FALSE); + gtk_container_add (GTK_CONTAINER (container), widget); + editor->priv->notebook = widget; + gtk_widget_show (widget); + + e_mutual_binding_new ( + editor->priv->combo_box, "active", + editor->priv->notebook, "page"); + + widget = gtk_vbutton_box_new (); + gtk_box_set_spacing (GTK_BOX (widget), 6); + gtk_button_box_set_layout ( + GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_START); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0); + gtk_widget_show (widget); + + container = widget; + + tooltip = _("Subscribe to the selected folder"); + widget = gtk_button_new_with_mnemonic (_("Su_bscribe")); + gtk_widget_set_sensitive (widget, FALSE); + gtk_widget_set_tooltip_text (widget, tooltip); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + editor->priv->subscribe_button = widget; + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (subscription_editor_subscribe), editor); + + tooltip = _("Unsubscribe from the selected folder"); + widget = gtk_button_new_with_mnemonic (_("_Unsubscribe")); + gtk_widget_set_sensitive (widget, FALSE); + gtk_widget_set_tooltip_text (widget, tooltip); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + editor->priv->unsubscribe_button = widget; + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (subscription_editor_unsubscribe), editor); + + tooltip = _("Collapse all folders"); + widget = gtk_button_new_with_mnemonic (_("C_ollapse All")); + gtk_widget_set_tooltip_text (widget, tooltip); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + editor->priv->collapse_all_button = widget; + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (subscription_editor_collapse_all), editor); + + tooltip = _("Expand all folders"); + widget = gtk_button_new_with_mnemonic (_("E_xpand All")); + gtk_widget_set_tooltip_text (widget, tooltip); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + editor->priv->expand_all_button = widget; + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (subscription_editor_expand_all), editor); + + tooltip = _("Refresh the folder list"); + widget = gtk_button_new_from_stock (GTK_STOCK_REFRESH); + gtk_widget_set_tooltip_text (widget, tooltip); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_set_sensitive (widget, FALSE); + editor->priv->refresh_button = widget; + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (subscription_editor_refresh), editor); + + tooltip = _("Stop the current operation"); + widget = gtk_button_new_from_stock (GTK_STOCK_STOP); + gtk_widget_set_tooltip_text (widget, tooltip); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_set_sensitive (widget, FALSE); + editor->priv->stop_button = widget; + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (subscription_editor_stop), editor); +} + +GtkWidget * +em_subscription_editor_new (GtkWindow *parent, + CamelSession *session, + EAccount *account) +{ + g_return_val_if_fail (GTK_IS_WINDOW (parent), NULL); + g_return_val_if_fail (CAMEL_IS_SESSION (session), NULL); + + return g_object_new ( + EM_TYPE_SUBSCRIPTION_EDITOR, + "account", account, + "session", session, + "transient-for", parent, + NULL); +} + +EAccount * +em_subscription_editor_get_account (EMSubscriptionEditor *editor) +{ + g_return_val_if_fail (EM_IS_SUBSCRIPTION_EDITOR (editor), NULL); + + if (editor->priv->active == NULL) + return NULL; + + return editor->priv->active->account; +} + +CamelSession * +em_subscription_editor_get_session (EMSubscriptionEditor *editor) +{ + g_return_val_if_fail (EM_IS_SUBSCRIPTION_EDITOR (editor), NULL); + + return editor->priv->session; +} diff --git a/mail/em-subscription-editor.h b/mail/em-subscription-editor.h new file mode 100644 index 0000000000..618a617d7d --- /dev/null +++ b/mail/em-subscription-editor.h @@ -0,0 +1,71 @@ +/* + * em-subscription-editor.h + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + */ + +#ifndef EM_SUBSCRIPTION_EDITOR_H +#define EM_SUBSCRIPTION_EDITOR_H + +#include <gtk/gtk.h> +#include <camel/camel.h> +#include <libedataserver/e-account.h> + +/* Standard GObject macros */ +#define EM_TYPE_SUBSCRIPTION_EDITOR \ + (em_subscription_editor_get_type ()) +#define EM_SUBSCRIPTION_EDITOR(obj) \ + (G_TYPE_CHECK_INSTANCE_CAST \ + ((obj), EM_TYPE_SUBSCRIPTION_EDITOR, EMSubscriptionEditor)) +#define EM_SUBSCRIPTION_EDITOR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_CAST \ + ((cls), EM_TYPE_SUBSCRIPTION_EDITOR, EMSubscriptionEditorClass)) +#define EM_IS_SUBSCRIPTION_EDITOR(obj) \ + (G_TYPE_CHECK_INSTANCE_TYPE \ + ((obj), EM_TYPE_SUBSCRIPTION_EDITOR)) +#define EM_IS_SUBSCRIPTION_EDITOR_CLASS(cls) \ + (G_TYPE_CHECK_CLASS_TYPE \ + ((cls), EM_TYPE_SUBSCRIPTION_EDITOR)) +#define EM_IS_SUBSCRIPTION_EDITOR_GET_CLASS(obj) \ + (G_TYPE_INSTANCE_GET_CLASS \ + ((obj), EM_TYPE_SUBSCRIPTION_EDITOR, EMSubscriptionEditorClass)) + +G_BEGIN_DECLS + +typedef struct _EMSubscriptionEditor EMSubscriptionEditor; +typedef struct _EMSubscriptionEditorClass EMSubscriptionEditorClass; +typedef struct _EMSubscriptionEditorPrivate EMSubscriptionEditorPrivate; + +struct _EMSubscriptionEditor { + GtkDialog parent; + EMSubscriptionEditorPrivate *priv; +}; + +struct _EMSubscriptionEditorClass { + GtkDialogClass parent_class; +}; + +GType em_subscription_editor_get_type (void); +GtkWidget * em_subscription_editor_new (GtkWindow *parent, + CamelSession *session, + EAccount *account); +EAccount * em_subscription_editor_get_account + (EMSubscriptionEditor *editor); +CamelSession * em_subscription_editor_get_session + (EMSubscriptionEditor *editor); + +G_END_DECLS + +#endif /* EM_SUBSCRIPTION_EDITOR_H */ diff --git a/mail/evolution-mail.schemas.in b/mail/evolution-mail.schemas.in index 2cc0fb06e4..737dcfa76a 100644 --- a/mail/evolution-mail.schemas.in +++ b/mail/evolution-mail.schemas.in @@ -871,26 +871,48 @@ <!-- Subscribe dialog --> <schema> - <key>/schemas/apps/evolution/mail/subscribe_window/width</key> - <applyto>/apps/evolution/mail/subscribe_window/width</applyto> + <key>/schemas/apps/evolution/mail/subscription_editor_height</key> + <applyto>/apps/evolution/mail/subscription_editor_height</applyto> <owner>evolution-mail</owner> <type>int</type> - <default>600</default> + <default>400</default> <locale name="C"> - <short>Subscribe dialog default width</short> - <long>Default width of the subscribe dialog.</long> + <short>"Folder Subscriptions" window height</short> + <long> + Initial height of the "Folder Subscriptions" window. + The value updates as the user resizes the window vertically. + </long> </locale> </schema> <schema> - <key>/schemas/apps/evolution/mail/subscribe_window/height</key> - <applyto>/apps/evolution/mail/subscribe_window/height</applyto> + <key>/schemas/apps/evolution/mail/subscription_editor_maximized</key> + <applyto>/apps/evolution/mail/subscription_editor_maximized</applyto> + <type>bool</type> + <locale name="C"> + <short>"Folder Subscriptions" window maximize state</short> + <long> + Initial maximize state of the "Folder Subscriptions" window. + The value updates when the user maximizes or unmaximizes the + window. Note, this particular value is not used by Evolution + since the "Folder Subscriptions" window cannot be maximized. + This key exists only as an implementation detail. + </long> + </locale> + </schema> + + <schema> + <key>/schemas/apps/evolution/mail/subscription_editor_width</key> + <applyto>/apps/evolution/mail/subscription_editor_width</applyto> <owner>evolution-mail</owner> <type>int</type> - <default>400</default> + <default>600</default> <locale name="C"> - <short>Subscribe dialog default height</short> - <long>Default height of the subscribe dialog.</long> + <short>"Folder Subscriptions" window width</short> + <long> + Initial width of the "Folder Subscriptions" window. + The value updates as the user resizes the window horizontally. + </long> </locale> </schema> diff --git a/mail/mail-dialogs.ui b/mail/mail-dialogs.ui index fa7eda0a21..82e9928bef 100644 --- a/mail/mail-dialogs.ui +++ b/mail/mail-dialogs.ui @@ -1,320 +1,52 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <interface> <requires lib="gtk+" version="2.16"/> <!-- interface-naming-policy toplevel-contextual --> - <object class="GtkDialog" id="message_security_dialog"> - <property name="border_width">6</property> - <property name="title" translatable="yes">Security Information</property> - <property name="type_hint">dialog</property> - <property name="has_separator">False</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox2"> + <object class="GtkVBox" id="vfolder_source_frame"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label13"> <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkVBox" id="vbox161"> - <property name="visible">True</property> - <property name="border_width">12</property> - <property name="orientation">vertical</property> - <property name="spacing">18</property> - <child> - <object class="GtkVBox" id="frame5"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label464"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Digital Signature</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox170"> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="label465"> - <property name="visible">True</property> - <property name="xpad">12</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table10"> - <property name="visible">True</property> - <property name="column_spacing">6</property> - <property name="row_spacing">2</property> - <child> - <object class="GtkVBox" id="signature_vbox"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="frame6"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label477"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Encryption</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox171"> - <property name="visible">True</property> - <child> - <object class="GtkLabel" id="label478"> - <property name="visible">True</property> - <property name="xpad">12</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkTable" id="table11"> - <property name="visible">True</property> - <property name="column_spacing">6</property> - <property name="row_spacing">2</property> - <child> - <object class="GtkVBox" id="encryption_vbox"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <child> - <placeholder/> - </child> - </object> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> - </packing> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area2"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="okbutton1"> - <property name="label">gtk-ok</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> + <property name="xalign">0</property> + <property name="label" translatable="yes">Search Folder Sources</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> </child> - <action-widgets> - <action-widget response="-5">okbutton1</action-widget> - </action-widgets> - </object> - <object class="GtkDialog" id="subscribe_dialog"> - <property name="title" translatable="yes">Folder Subscriptions</property> - <property name="default_width">600</property> - <property name="default_height">400</property> - <property name="type_hint">dialog</property> - <property name="has_separator">False</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog-vbox1"> + <child> + <object class="GtkHBox" id="hbox9"> <property name="visible">True</property> - <property name="orientation">vertical</property> <child> - <object class="GtkVBox" id="vbox2"> + <object class="GtkLabel" id="label14"> <property name="visible">True</property> - <property name="border_width">12</property> - <property name="orientation">vertical</property> - <property name="spacing">12</property> - <child> - <object class="GtkTable" id="top_items_table"> - <property name="visible">True</property> - <property name="n_rows">2</property> - <property name="n_columns">3</property> - <property name="column_spacing">12</property> - <property name="row_spacing">6</property> - <child> - <object class="GtkLabel" id="label1"> - <property name="visible">True</property> - <property name="label" translatable="yes">S_erver:</property> - <property name="use_underline">True</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkComboBox" id="store_combobox"> - <property name="visible">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">2</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkProgressBar" id="progress_bar"> - <property name="visible">True</property> - <property name="pulse_step">0.10000000149</property> - </object> - <packing> - <property name="left_attach">2</property> - <property name="right_attach">3</property> - <property name="top_attach">0</property> - <property name="bottom_attach">1</property> - </packing> - </child> - <child> - <object class="GtkLabel" id="filterlabel"> - <property name="visible">True</property> - <property name="label" translatable="yes">S_how only items containing:</property> - <property name="use_underline">True</property> - <property name="xalign">1</property> - </object> - <packing> - <property name="left_attach">0</property> - <property name="right_attach">1</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="x_options">GTK_FILL</property> - <property name="y_options"></property> - </packing> - </child> - <child> - <object class="GtkEntry" id="filter_entry"> - <property name="visible">True</property> - <property name="secondary_icon_stock">gtk-clear</property> - <property name="secondary_icon_activatable">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options"></property> - </packing> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="tree_box"> - <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <placeholder/> - </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> + <property name="label"> </property> </object> <packing> - <property name="position">1</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> </packing> </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area1"> + <child> + <object class="GtkVBox" id="vbox5"> <property name="visible">True</property> - <property name="layout_style">end</property> + <property name="border_width">6</property> + <property name="spacing">6</property> <child> - <object class="GtkButton" id="expand_button"> - <property name="label" translatable="yes">E_xpand all</property> + <object class="GtkRadioButton" id="local_rb"> + <property name="label" translatable="yes">All local folders</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="draw_indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -323,13 +55,14 @@ </packing> </child> <child> - <object class="GtkButton" id="collapse_button"> - <property name="label" translatable="yes">Collapse _all</property> + <object class="GtkRadioButton" id="remote_rb"> + <property name="label" translatable="yes">All active remote folders</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <property name="group">local_rb</property> </object> <packing> <property name="expand">False</property> @@ -338,13 +71,14 @@ </packing> </child> <child> - <object class="GtkButton" id="refresh_button"> - <property name="label">gtk-refresh</property> + <object class="GtkRadioButton" id="local_and_remote_rb"> + <property name="label" translatable="yes">All local and active remote folders</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> <property name="receives_default">False</property> - <property name="use_stock">True</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <property name="group">local_rb</property> </object> <packing> <property name="expand">False</property> @@ -353,13 +87,14 @@ </packing> </child> <child> - <object class="GtkButton" id="close_button"> - <property name="label">gtk-close</property> + <object class="GtkRadioButton" id="specific_rb"> + <property name="label" translatable="yes">Specific folders</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> <property name="receives_default">False</property> - <property name="use_stock">True</property> + <property name="use_underline">True</property> + <property name="draw_indicator">True</property> + <property name="group">local_rb</property> </object> <packing> <property name="expand">False</property> @@ -367,116 +102,57 @@ <property name="position">3</property> </packing> </child> - </object> - <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> - </packing> - </child> - </object> - </child> - <action-widgets> - <action-widget response="0">refresh_button</action-widget> - <action-widget response="-7">close_button</action-widget> - </action-widgets> - </object> - <object class="GtkDialog" id="license_dialog"> - <property name="title" translatable="yes">License Agreement</property> - <property name="type_hint">dialog</property> - <child internal-child="vbox"> - <object class="GtkVBox" id="dialog_vbox"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkVBox" id="vbox1"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <child> - <object class="GtkLabel" id="license_top_label"> - <property name="visible">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> <child> - <object class="GtkScrolledWindow" id="lic_scrolledwindow"> + <object class="GtkHBox" id="source_selector"> <property name="visible">True</property> - <property name="can_focus">True</property> + <property name="spacing">6</property> <child> - <object class="GtkTextView" id="license_textview"> - <property name="width_request">500</property> - <property name="height_request">400</property> + <object class="GtkScrolledWindow" id="source_scrolled_window"> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <property name="shadow_type">in</property> + <child> + <object class="GtkTreeView" id="source_list"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="model">source_model</property> + <property name="headers_visible">False</property> + <child> + <object class="GtkTreeViewColumn" id="source_column"> + <property name="title">column</property> + <child> + <object class="GtkCellRendererText" id="source_renderer"/> + <attributes> + <attribute name="text">0</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> </object> + <packing> + <property name="position">0</property> + </packing> </child> - </object> - <packing> - <property name="position">1</property> - </packing> - </child> - <child> - <object class="GtkCheckButton" id="license_checkbutton"> - <property name="label" translatable="yes">_Tick this to accept the license agreement</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">2</property> - </packing> - </child> - </object> - <packing> - <property name="position">2</property> - </packing> - </child> - <child internal-child="action_area"> - <object class="GtkHButtonBox" id="dialog-action_area4"> - <property name="visible">True</property> - <property name="layout_style">end</property> - <child> - <object class="GtkButton" id="lic_no_button"> - <property name="label">gtk-no</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkButton" id="lic_yes_button"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> <child> - <object class="GtkAlignment" id="alignment1"> + <object class="GtkVBox" id="vbox4"> <property name="visible">True</property> - <property name="xscale">0</property> - <property name="yscale">0</property> + <property name="spacing">1</property> <child> - <object class="GtkHBox" id="hbox3"> + <object class="GtkVButtonBox" id="vbuttonbox3"> <property name="visible">True</property> - <property name="spacing">2</property> + <property name="spacing">6</property> <child> - <object class="GtkImage" id="image1"> + <object class="GtkButton" id="source_add"> + <property name="label">gtk-add</property> <property name="visible">True</property> - <property name="stock">gtk-yes</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> @@ -485,10 +161,13 @@ </packing> </child> <child> - <object class="GtkLabel" id="label2"> + <object class="GtkButton" id="source_remove"> + <property name="label">gtk-remove</property> <property name="visible">True</property> - <property name="label" translatable="yes">_Accept License</property> - <property name="use_underline">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> @@ -497,80 +176,38 @@ </packing> </child> </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> </child> </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">1</property> + <property name="position">4</property> </packing> </child> </object> <packing> - <property name="expand">False</property> - <property name="pack_type">end</property> - <property name="position">0</property> + <property name="position">1</property> </packing> </child> </object> + <packing> + <property name="position">1</property> + </packing> </child> - <action-widgets> - <action-widget response="-6">lic_no_button</action-widget> - <action-widget response="-3">lic_yes_button</action-widget> - </action-widgets> - </object> - <object class="GtkListStore" id="source_model"> - <columns> - <!-- column-name Translated --> - <column type="gchararray"/> - <!-- column-name Raw --> - <column type="gpointer"/> - </columns> - </object> - <object class="GtkListStore" id="combo_model"> - <columns> - <!-- column-name Flag --> - <column type="gchararray"/> - </columns> - <data> - <row> - <col id="0" translatable="yes">Call</col> - </row> - <row> - <col id="0" translatable="yes">Do Not Forward</col> - </row> - <row> - <col id="0" translatable="yes">Follow-Up</col> - </row> - <row> - <col id="0" translatable="yes">For Your Information</col> - </row> - <row> - <col id="0" translatable="yes">Forward</col> - </row> - <row> - <col id="0" translatable="yes">No Response Necessary</col> - </row> - <row> - <col id="0" translatable="yes" comments="Past tense, as in "has been read".">Read</col> - </row> - <row> - <col id="0" translatable="yes">Reply</col> - </row> - <row> - <col id="0" translatable="yes">Reply to All</col> - </row> - <row> - <col id="0" translatable="yes">Review</col> - </row> - </data> </object> <object class="GtkVBox" id="toplevel"> <property name="visible">True</property> <property name="border_width">6</property> - <property name="orientation">vertical</property> <property name="spacing">12</property> <child> <object class="GtkHBox" id="hbox2"> @@ -676,19 +313,6 @@ Please select a follow up action from the "Flag" menu.</property> </packing> </child> <child> - <object class="EDateEdit" id="target_date"> - <property name="allow-no-date-set">True</property> - <property name="visible">True</property> - </object> - <packing> - <property name="left_attach">1</property> - <property name="right_attach">3</property> - <property name="top_attach">1</property> - <property name="bottom_attach">2</property> - <property name="y_options">GTK_FILL</property> - </packing> - </child> - <child> <object class="GtkCheckButton" id="completed"> <property name="label" translatable="yes">Co_mpleted</property> <property name="visible">True</property> @@ -735,53 +359,64 @@ Please select a follow up action from the "Flag" menu.</property> </packing> </child> </object> - <object class="GtkVBox" id="vfolder_source_frame"> - <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> - <child> - <object class="GtkLabel" id="label13"> - <property name="visible">True</property> - <property name="xalign">0</property> - <property name="label" translatable="yes">Search Folder Sources</property> - <attributes> - <attribute name="weight" value="bold"/> - </attributes> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkHBox" id="hbox9"> + <object class="GtkListStore" id="combo_model"> + <columns> + <!-- column-name Flag --> + <column type="gchararray"/> + </columns> + <data> + <row> + <col id="0" translatable="yes">Call</col> + </row> + <row> + <col id="0" translatable="yes">Do Not Forward</col> + </row> + <row> + <col id="0" translatable="yes">Follow-Up</col> + </row> + <row> + <col id="0" translatable="yes">For Your Information</col> + </row> + <row> + <col id="0" translatable="yes">Forward</col> + </row> + <row> + <col id="0" translatable="yes">No Response Necessary</col> + </row> + <row> + <col id="0" translatable="yes" comments="Past tense, as in "has been read".">Read</col> + </row> + <row> + <col id="0" translatable="yes">Reply</col> + </row> + <row> + <col id="0" translatable="yes">Reply to All</col> + </row> + <row> + <col id="0" translatable="yes">Review</col> + </row> + </data> + </object> + <object class="GtkListStore" id="source_model"> + <columns> + <!-- column-name Translated --> + <column type="gchararray"/> + <!-- column-name Raw --> + <column type="gpointer"/> + </columns> + </object> + <object class="GtkDialog" id="license_dialog"> + <property name="title" translatable="yes">License Agreement</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog_vbox"> <property name="visible">True</property> <child> - <object class="GtkLabel" id="label14"> - <property name="visible">True</property> - <property name="label" translatable="no"> </property> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">False</property> - <property name="position">0</property> - </packing> - </child> - <child> - <object class="GtkVBox" id="vbox5"> + <object class="GtkVBox" id="vbox1"> <property name="visible">True</property> - <property name="border_width">6</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> <child> - <object class="GtkRadioButton" id="local_rb"> - <property name="label" translatable="yes">All local folders</property> + <object class="GtkLabel" id="license_top_label"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> </object> <packing> <property name="expand">False</property> @@ -790,30 +425,30 @@ Please select a follow up action from the "Flag" menu.</property> </packing> </child> <child> - <object class="GtkRadioButton" id="remote_rb"> - <property name="label" translatable="yes">All active remote folders</property> + <object class="GtkScrolledWindow" id="lic_scrolledwindow"> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">local_rb</property> + <child> + <object class="GtkTextView" id="license_textview"> + <property name="width_request">500</property> + <property name="height_request">400</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + </object> + </child> </object> <packing> - <property name="expand">False</property> - <property name="fill">False</property> <property name="position">1</property> </packing> </child> <child> - <object class="GtkRadioButton" id="local_and_remote_rb"> - <property name="label" translatable="yes">All local and active remote folders</property> + <object class="GtkCheckButton" id="license_checkbutton"> + <property name="label" translatable="yes">_Tick this to accept the license agreement</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> <property name="use_underline">True</property> <property name="draw_indicator">True</property> - <property name="group">local_rb</property> </object> <packing> <property name="expand">False</property> @@ -821,75 +456,49 @@ Please select a follow up action from the "Flag" menu.</property> <property name="position">2</property> </packing> </child> + </object> + <packing> + <property name="position">2</property> + </packing> + </child> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area4"> + <property name="visible">True</property> + <property name="layout_style">end</property> <child> - <object class="GtkRadioButton" id="specific_rb"> - <property name="label" translatable="yes">Specific folders</property> + <object class="GtkButton" id="lic_no_button"> + <property name="label">gtk-no</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> <property name="receives_default">False</property> - <property name="use_underline">True</property> - <property name="draw_indicator">True</property> - <property name="group">local_rb</property> + <property name="use_stock">True</property> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> - <property name="position">3</property> + <property name="position">0</property> </packing> </child> <child> - <object class="GtkHBox" id="source_selector"> + <object class="GtkButton" id="lic_yes_button"> <property name="visible">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkScrolledWindow" id="source_scrolled_window"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">automatic</property> - <property name="vscrollbar_policy">automatic</property> - <property name="shadow_type">in</property> - <child> - <object class="GtkTreeView" id="source_list"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="model">source_model</property> - <property name="headers_visible">False</property> - <child> - <object class="GtkTreeViewColumn" id="source_column"> - <property name="title">column</property> - <child> - <object class="GtkCellRendererText" id="source_renderer"/> - <attributes> - <attribute name="text">0</attribute> - </attributes> - </child> - </object> - </child> - </object> - </child> - </object> - <packing> - <property name="position">0</property> - </packing> - </child> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">False</property> <child> - <object class="GtkVBox" id="vbox4"> + <object class="GtkAlignment" id="alignment1"> <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">1</property> + <property name="xscale">0</property> + <property name="yscale">0</property> <child> - <object class="GtkVButtonBox" id="vbuttonbox3"> + <object class="GtkHBox" id="hbox3"> <property name="visible">True</property> - <property name="orientation">vertical</property> - <property name="spacing">6</property> + <property name="spacing">2</property> <child> - <object class="GtkButton" id="source_add"> - <property name="label">gtk-add</property> + <object class="GtkImage" id="image1"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> + <property name="stock">gtk-yes</property> </object> <packing> <property name="expand">False</property> @@ -898,13 +507,10 @@ Please select a follow up action from the "Flag" menu.</property> </packing> </child> <child> - <object class="GtkButton" id="source_remove"> - <property name="label">gtk-remove</property> + <object class="GtkLabel" id="label2"> <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="receives_default">False</property> - <property name="use_stock">True</property> + <property name="label" translatable="yes">_Accept License</property> + <property name="use_underline">True</property> </object> <packing> <property name="expand">False</property> @@ -913,22 +519,167 @@ Please select a follow up action from the "Flag" menu.</property> </packing> </child> </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> + </object> + </child> + <action-widgets> + <action-widget response="-6">lic_no_button</action-widget> + <action-widget response="-3">lic_yes_button</action-widget> + </action-widgets> + </object> + <object class="GtkDialog" id="message_security_dialog"> + <property name="border_width">6</property> + <property name="title" translatable="yes">Security Information</property> + <property name="type_hint">dialog</property> + <child internal-child="vbox"> + <object class="GtkVBox" id="dialog-vbox2"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkVBox" id="vbox161"> + <property name="visible">True</property> + <property name="border_width">12</property> + <property name="spacing">18</property> + <child> + <object class="GtkVBox" id="frame5"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label464"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Digital Signature</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox170"> + <property name="visible">True</property> + <child> + <object class="GtkLabel" id="label465"> + <property name="visible">True</property> + <property name="xpad">12</property> + </object> <packing> <property name="expand">False</property> <property name="fill">False</property> <property name="position">0</property> </packing> </child> + <child> + <object class="GtkTable" id="table10"> + <property name="visible">True</property> + <property name="column_spacing">6</property> + <property name="row_spacing">2</property> + <child> + <object class="GtkVBox" id="signature_vbox"> + <property name="visible">True</property> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkVBox" id="frame6"> + <property name="visible">True</property> + <property name="spacing">6</property> + <child> + <object class="GtkLabel" id="label477"> + <property name="visible">True</property> + <property name="xalign">0</property> + <property name="label" translatable="yes">Encryption</property> + <attributes> + <attribute name="weight" value="bold"/> + </attributes> </object> <packing> <property name="expand">False</property> <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox171"> + <property name="visible">True</property> + <child> + <object class="GtkLabel" id="label478"> + <property name="visible">True</property> + <property name="xpad">12</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkTable" id="table11"> + <property name="visible">True</property> + <property name="column_spacing">6</property> + <property name="row_spacing">2</property> + <child> + <object class="GtkVBox" id="encryption_vbox"> + <property name="visible">True</property> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + <packing> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> <property name="position">1</property> </packing> </child> </object> <packing> - <property name="position">4</property> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">1</property> </packing> </child> </object> @@ -936,10 +687,36 @@ Please select a follow up action from the "Flag" menu.</property> <property name="position">1</property> </packing> </child> + <child internal-child="action_area"> + <object class="GtkHButtonBox" id="dialog-action_area2"> + <property name="visible">True</property> + <property name="layout_style">end</property> + <child> + <object class="GtkButton" id="okbutton1"> + <property name="label">gtk-ok</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="receives_default">False</property> + <property name="use_stock">True</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">False</property> + <property name="position">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="pack_type">end</property> + <property name="position">0</property> + </packing> + </child> </object> - <packing> - <property name="position">1</property> - </packing> </child> + <action-widgets> + <action-widget response="-5">okbutton1</action-widget> + </action-widgets> </object> </interface> |