diff options
author | Peter Williams <peterw@ximian.com> | 2001-08-14 23:26:00 +0800 |
---|---|---|
committer | Peter Williams <peterw@src.gnome.org> | 2001-08-14 23:26:00 +0800 |
commit | 866a960fd9dba9c3c7162c61b1e12feca6d12668 (patch) | |
tree | b9023b5652dfe4c329e300c3abf4d3c251796bed /mail/mail-folder-cache.c | |
parent | 4b6f7546b80b48c24cda221f09235cd5ac53bfbd (diff) | |
download | gsoc2013-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/mail-folder-cache.c')
-rw-r--r-- | mail/mail-folder-cache.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c index 9e7d0f2e0f..46f595c6ed 100644 --- a/mail/mail-folder-cache.c +++ b/mail/mail-folder-cache.c @@ -50,7 +50,8 @@ typedef enum mail_folder_info_flags { MAIL_FIF_PATH_VALID = (1 << 5), MAIL_FIF_NAME_VALID = (1 << 6), MAIL_FIF_UPDATE_QUEUED = (1 << 7), - MAIL_FIF_FB_VALID = (1 << 8) + MAIL_FIF_FB_VALID = (1 << 8), + MAIL_FIF_SELECTED_VALID = (1 << 9) } mfif; typedef enum mail_folder_info_update_mode { @@ -73,7 +74,7 @@ typedef struct _mail_folder_info { gchar *name; guint flags; - guint unread, total, hidden; + guint unread, total, hidden, selected; FolderBrowser *fb; @@ -154,6 +155,13 @@ make_folder_status (mail_folder_info *mfi) set_one = TRUE; } + if (mfi->flags & MAIL_FIF_SELECTED_VALID && mfi->selected > 1) { + if (set_one) + work = g_string_append (work, _(", ")); + g_string_sprintfa (work, _("%d selected"), mfi->selected); + set_one = TRUE; + } + if (mfi->flags & MAIL_FIF_TOTAL_VALID) { if (set_one) work = g_string_append (work, _(", ")); @@ -424,6 +432,23 @@ message_list_built (MessageList *ml, gpointer user_data) } static void +selection_changed (ESelectionModel *esm, gpointer user_data) +{ + mail_folder_info *mfi = user_data; + + d(g_message ("Selection model %p changed, checking selected", esm)); + + LOCK_FOLDERS (); + + mfi->selected = e_selection_model_selected_count (esm); + mfi->flags |= MAIL_FIF_SELECTED_VALID; + + UNLOCK_FOLDERS (); + + maybe_update (mfi); +} + +static void check_for_fb_match (gpointer key, gpointer value, gpointer user_data) { mail_folder_info *mfi = (mail_folder_info *) value; @@ -652,6 +677,8 @@ mail_folder_cache_note_fb (const gchar *uri, FolderBrowser *fb) gtk_signal_connect (GTK_OBJECT (fb->message_list), "message_list_built", message_list_built, mfi); + gtk_signal_connect (GTK_OBJECT (e_tree_get_selection_model (fb->message_list->tree)), + "selection_changed", selection_changed, mfi); UNLOCK_FOLDERS (); |