aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--shell/ChangeLog27
-rw-r--r--shell/e-shell-view.c94
-rw-r--r--shell/e-storage-set-view.c29
-rw-r--r--shell/e-storage-set-view.h4
4 files changed, 123 insertions, 31 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index f3f4e4ec38..5e7400a337 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,3 +1,30 @@
+2001-09-26 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-shell-view.c (setup_verb_sensitivity_for_folder): New helper
+ function.
+ (folder_selected_cb): Call it.
+ (folder_context_menu_popping_up_cb): New callback for the
+ "folder_context_menu_popping_up" signal on the folder bar's
+ EStorageSetView; set the sensitivities of the verbs according to
+ the right-clicked folder.
+ (folder_context_menu_popped_down_cb): New, callback for the
+ "folder_context_menu_popped_down" signal on the folder bar's
+ EStorageSetView; set the sensitivities of the verbs according to
+ the currently displayed folder.
+ (e_shell_view_get_folder_bar_right_click_path): Add a cast to
+ placate a warning.
+
+ * e-storage-set-view.c (class_init): Set up the
+ "folder_context_menu_popping_up" and
+ "folder_context_menu_popped_down" signals.
+ (right_click): Emit "folder_context_menu_popping_up" before
+ popping up the menu, "folder_context_menu_popped_down" after the
+ menu is gone.
+
+ * e-storage-set-view.h: New signals
+ "folder_context_menu_popping_up" and
+ "folder_context_menu_popped_down".
+
2001-09-25 Ettore Perazzoli <ettore@ximian.com>
* e-shell-folder-commands.c (e_shell_command_rename_folder):
diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c
index 1e632a912b..cc651d1d3b 100644
--- a/shell/e-shell-view.c
+++ b/shell/e-shell-view.c
@@ -275,6 +275,39 @@ cleanup_delayed_selection (EShellView *shell_view)
}
}
+static void
+setup_verb_sensitivity_for_folder (EShellView *shell_view,
+ const char *path)
+{
+ EShellViewPrivate *priv;
+ BonoboUIComponent *ui_component;
+ const char *prop;
+
+ priv = shell_view->priv;
+
+ /* Adjust sensitivity for menu options depending on whether the folder
+ selected is a stock folder. */
+
+ if (path == NULL) {
+ prop = "0";
+ } else {
+ EFolder *folder;
+
+ folder = e_storage_set_get_folder (e_shell_get_storage_set (priv->shell), path);
+ if (folder != NULL && ! e_folder_get_is_stock (folder))
+ prop = "1";
+ else
+ prop = "0";
+ }
+
+ ui_component = e_shell_view_get_bonobo_ui_component (shell_view);
+
+ bonobo_ui_component_set_prop (ui_component, "/commands/MoveFolder", "sensitive", prop, NULL);
+ bonobo_ui_component_set_prop (ui_component, "/commands/CopyFolder", "sensitive", prop, NULL);
+ bonobo_ui_component_set_prop (ui_component, "/commands/DeleteFolder", "sensitive", prop, NULL);
+ bonobo_ui_component_set_prop (ui_component, "/commands/RenameFolder", "sensitive", prop, NULL);
+}
+
/* Folder bar pop-up handling. */
@@ -594,38 +627,10 @@ folder_selected_cb (EStorageSetView *storage_set_view,
void *data)
{
EShellView *shell_view;
- EShellViewPrivate *priv;
- EStorageSet *storage_set;
- EFolder *folder;
shell_view = E_SHELL_VIEW (data);
- priv = shell_view->priv;
-
- /* Adjust sensitivity for menu options depending on whether
- the folder selected is a stock folder */
- storage_set = e_shell_get_storage_set (priv->shell);
- folder = e_storage_set_get_folder (storage_set, path);
- if (folder) {
- BonoboUIComponent *uic;
- char *txt;
-
- if (e_folder_get_is_stock (folder))
- txt = "0";
- else
- txt = "1";
-
- uic = e_shell_view_get_bonobo_ui_component (shell_view);
-
- bonobo_ui_component_set_prop (uic, "/commands/MoveFolder",
- "sensitive", txt, NULL);
- bonobo_ui_component_set_prop (uic, "/commands/CopyFolder",
- "sensitive", txt, NULL);
- bonobo_ui_component_set_prop (uic, "/commands/DeleteFolder",
- "sensitive", txt, NULL);
- bonobo_ui_component_set_prop (uic, "/commands/RenameFolder",
- "sensitive", txt, NULL);
- }
+ setup_verb_sensitivity_for_folder (shell_view, path);
switch_on_folder_tree_click (shell_view, path);
}
@@ -646,6 +651,31 @@ storage_selected_cb (EStorageSetView *storage_set_view,
g_free (path);
}
+/* Callbacks for the folder context menu in the folder bar. */
+
+static void
+folder_context_menu_popping_up_cb (EStorageSetView *storage_set_view,
+ const char *path,
+ void *data)
+{
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (data);
+
+ setup_verb_sensitivity_for_folder (shell_view, path);
+}
+
+static void
+folder_context_menu_popped_down_cb (EStorageSetView *storage_set_view,
+ void *data)
+{
+ EShellView *shell_view;
+
+ shell_view = E_SHELL_VIEW (data);
+
+ setup_verb_sensitivity_for_folder (shell_view, e_shell_view_get_current_path (shell_view));
+}
+
/* Callback called when the button on the tree's title bar is clicked. */
static void
storage_set_view_button_clicked_cb (ETitleBar *title_bar,
@@ -718,6 +748,10 @@ setup_storage_set_subwindow (EShellView *shell_view)
GTK_SIGNAL_FUNC (folder_selected_cb), shell_view);
gtk_signal_connect (GTK_OBJECT (storage_set_view), "storage_selected",
GTK_SIGNAL_FUNC (storage_selected_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_context_menu_popping_up",
+ GTK_SIGNAL_FUNC (folder_context_menu_popping_up_cb), shell_view);
+ gtk_signal_connect (GTK_OBJECT (storage_set_view), "folder_context_menu_popped_down",
+ GTK_SIGNAL_FUNC (folder_context_menu_popped_down_cb), shell_view);
scroll_frame = e_scroll_frame_new (NULL, NULL);
e_scroll_frame_set_policy (E_SCROLL_FRAME (scroll_frame),
@@ -2504,7 +2538,7 @@ e_shell_view_get_folder_bar_right_click_path (EShellView *shell_view)
priv = shell_view->priv;
- return e_storage_set_view_get_right_click_path (priv->storage_set_view);
+ return e_storage_set_view_get_right_click_path (E_STORAGE_SET_VIEW (priv->storage_set_view));
}
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c
index fe941b2715..96b705954a 100644
--- a/shell/e-storage-set-view.c
+++ b/shell/e-storage-set-view.c
@@ -106,6 +106,8 @@ enum {
FOLDER_SELECTED,
STORAGE_SELECTED,
DND_ACTION,
+ FOLDER_CONTEXT_MENU_POPPING_UP,
+ FOLDER_CONTEXT_MENU_POPPED_DOWN,
LAST_SIGNAL
};
@@ -1248,9 +1250,17 @@ right_click (ETree *etree,
g_free (priv->right_click_row_path);
priv->right_click_row_path = g_strdup (e_tree_memory_node_get_data (E_TREE_MEMORY(priv->etree_model), path));
- if (priv->container)
+ if (priv->container) {
+ gtk_signal_emit (GTK_OBJECT (storage_set_view),
+ signals[FOLDER_CONTEXT_MENU_POPPING_UP],
+ priv->right_click_row_path);
+
popup_folder_menu (storage_set_view, (GdkEventButton *) event);
+ gtk_signal_emit (GTK_OBJECT (storage_set_view),
+ signals[FOLDER_CONTEXT_MENU_POPPED_DOWN]);
+ }
+
g_free (priv->right_click_row_path);
priv->right_click_row_path = NULL;
@@ -1671,6 +1681,23 @@ class_init (EStorageSetViewClass *klass)
GTK_TYPE_STRING,
GTK_TYPE_STRING);
+ signals[FOLDER_CONTEXT_MENU_POPPING_UP]
+ = gtk_signal_new ("folder_context_menu_popping_up",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, folder_context_menu_popping_up),
+ gtk_marshal_NONE__STRING,
+ GTK_TYPE_NONE, 1,
+ GTK_TYPE_STRING);
+
+ signals[FOLDER_CONTEXT_MENU_POPPED_DOWN]
+ = gtk_signal_new ("folder_context_menu_popped_down",
+ GTK_RUN_FIRST,
+ object_class->type,
+ GTK_SIGNAL_OFFSET (EStorageSetViewClass, folder_context_menu_popped_down),
+ gtk_marshal_NONE__NONE,
+ GTK_TYPE_NONE, 0);
+
gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL);
}
diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h
index d70d09e89b..34daecaf7e 100644
--- a/shell/e-storage-set-view.h
+++ b/shell/e-storage-set-view.h
@@ -65,6 +65,10 @@ struct _EStorageSetViewClass {
const char *source_data,
const char *source_data_type,
const char *target_path);
+
+ void (* folder_context_menu_popping_up) (EStorageSetView *storage_set_view,
+ const char *path);
+ void (* folder_context_menu_popped_down) (EStorageSetView *storage_set_view);
};