aboutsummaryrefslogtreecommitdiffstats
path: root/mail/folder-browser.c
diff options
context:
space:
mode:
authorPeter Williams <peterw@ximian.com>2001-08-14 23:26:00 +0800
committerPeter Williams <peterw@src.gnome.org>2001-08-14 23:26:00 +0800
commit866a960fd9dba9c3c7162c61b1e12feca6d12668 (patch)
treeb9023b5652dfe4c329e300c3abf4d3c251796bed /mail/folder-browser.c
parent4b6f7546b80b48c24cda221f09235cd5ac53bfbd (diff)
downloadgsoc2013-evolution-866a960fd9dba9c3c7162c61b1e12feca6d12668.tar
gsoc2013-evolution-866a960fd9dba9c3c7162c61b1e12feca6d12668.tar.gz
gsoc2013-evolution-866a960fd9dba9c3c7162c61b1e12feca6d12668.tar.bz2
gsoc2013-evolution-866a960fd9dba9c3c7162c61b1e12feca6d12668.tar.lz
gsoc2013-evolution-866a960fd9dba9c3c7162c61b1e12feca6d12668.tar.xz
gsoc2013-evolution-866a960fd9dba9c3c7162c61b1e12feca6d12668.tar.zst
gsoc2013-evolution-866a960fd9dba9c3c7162c61b1e12feca6d12668.zip
Fix bug #215... desensitize menu items based on the number of selected
2001-08-09 Peter Williams <peterw@ximian.com> Fix bug #215... desensitize menu items based on the number of selected messages (and whether there's a message in the pane) * folder-browser-ui.c (folder_browser_ui_add_message): Sensitize the menu items appropriately based on the old state. (fbui_sensitize_items): New function. Set the sensitivity of a list of commands. (folder_browser_ui_set_selection_state): New function. Move the FB to a new state of selected-ness, and sensitize menu items appropriately. (folder_browser_ui_message_loaded): New function. When notified that a message has been loaded, sensitize some menu items. * folder-browser-ui.h: Prototype new functions. * folder-browser.h: New enumeration, FolderBrowserSelectionState, that records the previous state of the selection (_NONE, _SINGLE, _MULTIPLE). * folder-browser.c (got_folder): If the component is set, set our selection state to _NONE, because that's the default state of the ETree. (on_selection_changed): When the number of selected messages is updated, notify the FBUI code of our new state. (folder_browser_gui_init): Hook up to the selection_changed signal and default to the _NONE selection state. (done_message_selected): Notify when a message is loaded. 2001-08-08 Peter Williams <peterw@ximian.com> * mail-folder-cache.c: Display how many messages are selected, too. (make_folder_status): If multiple messages are selected, add that to the string (the 0 and 1 cases are boring) (selection_changed): New function, update the selected count. (mail_folder_cache_note_fb): Connect to the selection_changed signal. svn path=/trunk/; revision=12012
Diffstat (limited to 'mail/folder-browser.c')
-rw-r--r--mail/folder-browser.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/mail/folder-browser.c b/mail/folder-browser.c
index 348d0aa8d0..269f59b9a6 100644
--- a/mail/folder-browser.c
+++ b/mail/folder-browser.c
@@ -47,6 +47,7 @@
#include "mail-autofilter.h"
#include "mail-mt.h"
#include "mail-folder-cache.h"
+#include "folder-browser-ui.h"
#include "mail-local.h"
#include "mail-config.h"
@@ -712,6 +713,11 @@ got_folder(char *uri, CamelFolder *folder, void *data)
mail_folder_cache_note_folder (fb->uri, folder);
mail_folder_cache_note_fb (fb->uri, fb);
+ /* when loading a new folder, nothing is selected initially */
+
+ if (fb->uicomp)
+ folder_browser_ui_set_selection_state (fb, FB_SELSTATE_NONE);
+
done:
gtk_object_unref (GTK_OBJECT (fb));
@@ -1597,6 +1603,33 @@ on_double_click (ETree *tree, gint row, ETreePath path, gint col, GdkEvent *even
}
static void
+on_selection_changed (GtkObject *obj, gpointer user_data)
+{
+ FolderBrowser *fb = FOLDER_BROWSER (user_data);
+ FolderBrowserSelectionState state;
+
+ /* we can get this signal at strange times...
+ * if no uicomp, don't even bother */
+
+ if (fb->uicomp == NULL)
+ return;
+
+ switch (e_selection_model_selected_count (E_SELECTION_MODEL (obj))) {
+ case 0:
+ state = FB_SELSTATE_NONE;
+ break;
+ case 1:
+ state = FB_SELSTATE_SINGLE;
+ break;
+ default:
+ state = FB_SELSTATE_MULTIPLE;
+ break;
+ }
+
+ folder_browser_ui_set_selection_state (fb, state);
+}
+
+static void
fb_resize_cb (GtkWidget *w, GtkAllocation *a, FolderBrowser *fb)
{
if (fb->preview_shown)
@@ -1606,6 +1639,8 @@ fb_resize_cb (GtkWidget *w, GtkAllocation *a, FolderBrowser *fb)
static void
folder_browser_gui_init (FolderBrowser *fb)
{
+ ESelectionModel *esm;
+
/* The panned container */
fb->vpaned = e_vpaned_new ();
gtk_widget_show (fb->vpaned);
@@ -1643,12 +1678,17 @@ folder_browser_gui_init (FolderBrowser *fb)
gtk_signal_connect (GTK_OBJECT (fb->search), "menu_activated",
GTK_SIGNAL_FUNC (folder_browser_search_menu_activated), fb);
+
gtk_table_attach (GTK_TABLE (fb), GTK_WIDGET (fb->search),
0, 1, 0, 1,
GTK_FILL | GTK_EXPAND,
0,
0, 0);
-
+
+ esm = e_tree_get_selection_model (E_TREE (fb->message_list->tree));
+ gtk_signal_connect (GTK_OBJECT (esm), "selection_changed", on_selection_changed, fb);
+ fb->selection_state = FB_SELSTATE_NONE; /* default to none */
+
e_paned_add1 (E_PANED (fb->vpaned), GTK_WIDGET (fb->message_list));
gtk_widget_show (GTK_WIDGET (fb->message_list));
@@ -1687,6 +1727,8 @@ done_message_selected (CamelFolder *folder, char *uid, CamelMimeMessage *msg, vo
return;
mail_display_set_message (fb->mail_display, (CamelMedium *)msg);
+ folder_browser_ui_message_loaded (fb);
+
/* FIXME: should this signal be emitted here?? */
gtk_signal_emit (GTK_OBJECT (fb), folder_browser_signals [MESSAGE_LOADED], uid);