aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-shell-searchbar.c
diff options
context:
space:
mode:
authorMatthew Barnes <mbarnes@redhat.com>2010-03-27 06:33:00 +0800
committerMatthew Barnes <mbarnes@redhat.com>2010-03-27 08:29:30 +0800
commitf7547cc6ac347ea5e9dd92034264a23e6fd48ac4 (patch)
tree2c2c9475689c880ad3e8307cc33bc6b40e5e15cd /shell/e-shell-searchbar.c
parent0a0f417006abe5afd56c078142d480a26b611950 (diff)
downloadgsoc2013-evolution-f7547cc6ac347ea5e9dd92034264a23e6fd48ac4.tar
gsoc2013-evolution-f7547cc6ac347ea5e9dd92034264a23e6fd48ac4.tar.gz
gsoc2013-evolution-f7547cc6ac347ea5e9dd92034264a23e6fd48ac4.tar.bz2
gsoc2013-evolution-f7547cc6ac347ea5e9dd92034264a23e6fd48ac4.tar.lz
gsoc2013-evolution-f7547cc6ac347ea5e9dd92034264a23e6fd48ac4.tar.xz
gsoc2013-evolution-f7547cc6ac347ea5e9dd92034264a23e6fd48ac4.tar.zst
gsoc2013-evolution-f7547cc6ac347ea5e9dd92034264a23e6fd48ac4.zip
Simplify the search UI for express mode.
For express mode: - Move the search bar up to the toolbar. - Hide the "filter" combo box and lock down the first item. - Hide the "scope" combo box and lock down the first item. (This is the combo box with "Current Folder" only in the mailer.) - EShellView owns the search bar widget now instead of EShellContent. - Insert several nasty hacks that will likely come back to bite me.
Diffstat (limited to 'shell/e-shell-searchbar.c')
-rw-r--r--shell/e-shell-searchbar.c106
1 files changed, 88 insertions, 18 deletions
diff --git a/shell/e-shell-searchbar.c b/shell/e-shell-searchbar.c
index 0cfe16ca64..940bd9fd6b 100644
--- a/shell/e-shell-searchbar.c
+++ b/shell/e-shell-searchbar.c
@@ -67,8 +67,9 @@ struct _EShellSearchbarPrivate {
/* State Key File */
gchar *state_group;
+ guint express_mode : 1;
guint filter_visible : 1;
- guint label_visible : 1;
+ guint labels_visible : 1;
guint search_visible : 1;
guint scope_visible : 1;
guint state_dirty : 1;
@@ -76,9 +77,10 @@ struct _EShellSearchbarPrivate {
enum {
PROP_0,
+ PROP_EXPRESS_MODE,
PROP_FILTER_COMBO_BOX,
PROP_FILTER_VISIBLE,
- PROP_LABEL_VISIBLE,
+ PROP_LABELS_VISIBLE,
PROP_SEARCH_HINT,
PROP_SEARCH_OPTION,
PROP_SEARCH_TEXT,
@@ -472,14 +474,20 @@ shell_searchbar_set_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_EXPRESS_MODE:
+ e_shell_searchbar_set_express_mode (
+ E_SHELL_SEARCHBAR (object),
+ g_value_get_boolean (value));
+ return;
+
case PROP_FILTER_VISIBLE:
e_shell_searchbar_set_filter_visible (
E_SHELL_SEARCHBAR (object),
g_value_get_boolean (value));
return;
- case PROP_LABEL_VISIBLE:
- e_shell_searchbar_set_label_visible (
+ case PROP_LABELS_VISIBLE:
+ e_shell_searchbar_set_labels_visible (
E_SHELL_SEARCHBAR (object),
g_value_get_boolean (value));
return;
@@ -537,15 +545,21 @@ shell_searchbar_get_property (GObject *object,
GParamSpec *pspec)
{
switch (property_id) {
+ case PROP_EXPRESS_MODE:
+ g_value_set_boolean (
+ value, e_shell_searchbar_get_express_mode (
+ E_SHELL_SEARCHBAR (object)));
+ return;
+
case PROP_FILTER_COMBO_BOX:
g_value_set_object (
value, e_shell_searchbar_get_filter_combo_box (
E_SHELL_SEARCHBAR (object)));
return;
- case PROP_LABEL_VISIBLE:
+ case PROP_LABELS_VISIBLE:
g_value_set_boolean (
- value, e_shell_searchbar_get_label_visible (
+ value, e_shell_searchbar_get_labels_visible (
E_SHELL_SEARCHBAR (object)));
return;
@@ -737,6 +751,17 @@ e_shell_searchbar_class_init (EShellSearchbarClass *class)
g_object_class_install_property (
object_class,
+ PROP_EXPRESS_MODE,
+ g_param_spec_boolean (
+ "express-mode",
+ NULL,
+ NULL,
+ FALSE,
+ G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT));
+
+ g_object_class_install_property (
+ object_class,
PROP_FILTER_COMBO_BOX,
g_param_spec_object (
"filter-combo-box",
@@ -747,9 +772,9 @@ e_shell_searchbar_class_init (EShellSearchbarClass *class)
g_object_class_install_property (
object_class,
- PROP_LABEL_VISIBLE,
+ PROP_LABELS_VISIBLE,
g_param_spec_boolean (
- "label-visible",
+ "labels-visible",
NULL,
NULL,
TRUE,
@@ -894,6 +919,10 @@ e_shell_searchbar_init (EShellSearchbar *searchbar)
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
+ e_binding_new (
+ searchbar, "labels-visible",
+ widget, "visible");
+
label = GTK_LABEL (widget);
widget = e_action_combo_box_new ();
@@ -921,11 +950,12 @@ e_shell_searchbar_init (EShellSearchbar *searchbar)
gtk_box_pack_start (box, widget, FALSE, FALSE, 0);
gtk_widget_show (widget);
- label = GTK_LABEL (widget);
e_binding_new (
- searchbar, "label-visible",
+ searchbar, "labels-visible",
widget, "visible");
+ label = GTK_LABEL (widget);
+
widget = e_hinted_entry_new ();
gtk_label_set_mnemonic_widget (label, widget);
gtk_box_pack_start (box, widget, TRUE, TRUE, 0);
@@ -1032,6 +1062,31 @@ e_shell_searchbar_get_shell_view (EShellSearchbar *searchbar)
return E_SHELL_VIEW (searchbar->priv->shell_view);
}
+gboolean
+e_shell_searchbar_get_express_mode (EShellSearchbar *searchbar)
+{
+ g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
+
+ return searchbar->priv->express_mode;
+}
+
+void
+e_shell_searchbar_set_express_mode (EShellSearchbar *searchbar,
+ gboolean express_mode)
+{
+ g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
+
+ searchbar->priv->express_mode = express_mode;
+
+ /* Emit "notify" on all the properties we override. */
+ g_object_freeze_notify (G_OBJECT (searchbar));
+ g_object_notify (G_OBJECT (searchbar), "express-mode");
+ g_object_notify (G_OBJECT (searchbar), "labels-visible");
+ g_object_notify (G_OBJECT (searchbar), "filter-visible");
+ g_object_notify (G_OBJECT (searchbar), "scope-visible");
+ g_object_thaw_notify (G_OBJECT (searchbar));
+}
+
EActionComboBox *
e_shell_searchbar_get_filter_combo_box (EShellSearchbar *searchbar)
{
@@ -1041,22 +1096,26 @@ e_shell_searchbar_get_filter_combo_box (EShellSearchbar *searchbar)
}
gboolean
-e_shell_searchbar_get_label_visible (EShellSearchbar *searchbar)
+e_shell_searchbar_get_labels_visible (EShellSearchbar *searchbar)
{
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
- return searchbar->priv->label_visible;
+ /* Express mode overrides this. */
+ if (e_shell_searchbar_get_express_mode (searchbar))
+ return FALSE;
+
+ return searchbar->priv->labels_visible;
}
void
-e_shell_searchbar_set_label_visible (EShellSearchbar *searchbar,
- gboolean label_visible)
+e_shell_searchbar_set_labels_visible (EShellSearchbar *searchbar,
+ gboolean labels_visible)
{
g_return_if_fail (E_IS_SHELL_SEARCHBAR (searchbar));
- searchbar->priv->label_visible = label_visible;
+ searchbar->priv->labels_visible = labels_visible;
- g_object_notify (G_OBJECT (searchbar), "label-visible");
+ g_object_notify (G_OBJECT (searchbar), "labels-visible");
}
gboolean
@@ -1064,6 +1123,10 @@ e_shell_searchbar_get_filter_visible (EShellSearchbar *searchbar)
{
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
+ /* Express mode overrides this. */
+ if (e_shell_searchbar_get_express_mode (searchbar))
+ return FALSE;
+
return searchbar->priv->filter_visible;
}
@@ -1204,6 +1267,10 @@ e_shell_searchbar_get_scope_visible (EShellSearchbar *searchbar)
{
g_return_val_if_fail (E_IS_SHELL_SEARCHBAR (searchbar), FALSE);
+ /* Express mode overrides this. */
+ if (e_shell_searchbar_get_express_mode (searchbar))
+ return FALSE;
+
return searchbar->priv->scope_visible;
}
@@ -1257,6 +1324,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
GKeyFile *key_file;
GtkAction *action;
GtkWidget *widget;
+ gboolean express_mode;
const gchar *search_text;
const gchar *state_group;
const gchar *key;
@@ -1272,6 +1340,8 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
key_file = e_shell_view_get_state_key_file (shell_view);
shell_window = e_shell_view_get_shell_window (shell_view);
+ express_mode = e_shell_searchbar_get_express_mode (searchbar);
+
/* Changing the combo boxes triggers searches, so block
* the search action until the state is fully restored. */
action = E_SHELL_WINDOW_ACTION_SEARCH_QUICK (shell_window);
@@ -1283,7 +1353,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
key = STATE_KEY_SEARCH_FILTER;
string = g_key_file_get_string (key_file, state_group, key, NULL);
- if (string != NULL && *string != '\0')
+ if (string != NULL && *string != '\0' && !express_mode)
action = e_shell_window_get_action (shell_window, string);
else
action = NULL;
@@ -1328,7 +1398,7 @@ e_shell_searchbar_load_state (EShellSearchbar *searchbar)
key = STATE_KEY_SEARCH_SCOPE;
string = g_key_file_get_string (key_file, state_group, key, NULL);
- if (string != NULL && *string != '\0')
+ if (string != NULL && *string != '\0' && !express_mode)
action = e_shell_window_get_action (shell_window, string);
else
action = NULL;