diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-26 05:27:00 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-26 05:27:00 +0800 |
commit | 769e117e901dce718915b863209fc58c218ca3c6 (patch) | |
tree | 442c2ab0c214c4e93f52a5c1da932eafc044cb82 /shell/e-storage-set-view.c | |
parent | 650c4690b2040f83c032b67a271b996f876fdc50 (diff) | |
download | gsoc2013-evolution-769e117e901dce718915b863209fc58c218ca3c6.tar.gz gsoc2013-evolution-769e117e901dce718915b863209fc58c218ca3c6.tar.zst gsoc2013-evolution-769e117e901dce718915b863209fc58c218ca3c6.zip |
New helper function. (command_move_folder): Pass the @folder_path argument
* e-shell-view-menu.c (get_path_for_folder_op): New helper
function.
(command_move_folder): Pass the @folder_path argument to
`e_shell_command_move_folder' by using it.
(command_copy_folder): Pass the @folder_path argument to
`e_shell_command_copy_folder' by using it.
(command_delete_folder): Pass the @folder_path argument to
`e_shell_command_delete_folder()' by using it.
(command_add_folder_to_shortcut_bar): Pass the @folder_path
argument to `e_shell_command_add_to_shortcut_bar()' by using it.
(command_create_folder): Pass the @parent_folder_path argument to
`e_shell_command_create_new_folder()' by using it.
(command_new_folder): Use `get_path_for_folder_op()'.
* e-shell-folder-commands.c (e_shell_command_add_to_shortcut_bar):
New arg @folder_path.
(e_shell_command_copy_folder): New arg @folder_path.
(e_shell_command_move_folder): New arg @folder_path.
(e_shell_command_open_folder_in_other_window): New arg @folder_path.
(e_shell_command_create_new_folder): New arg @parent_folder_path.
(e_shell_command_delete_folder): New arg @folder_path.
* e-shell-view.c (e_shell_view_get_folder_bar_right_click_path): New.
* e-storage-set-view.c: New member `right_click_row_path'.
(init): Init to NULL.
(destroy): Free.
(right_click): Set.
(popup_folder_menu): Use `gnome_popup_menu_do_popup_modal()' so we
are stuck in here until the menu disappears. After that, destroy
the menu and call `e_tree_right_click_up()'.
(e_storage_set_view_get_right_click_path): New.
svn path=/trunk/; revision=13124
Diffstat (limited to 'shell/e-storage-set-view.c')
-rw-r--r-- | shell/e-storage-set-view.c | 71 |
1 files changed, 30 insertions, 41 deletions
diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 73c73f940f..2a86048185 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -82,6 +82,9 @@ struct _EStorageSetViewPrivate { /* Path of the row selected by the latest "cursor_activated" signal. */ char *selected_row_path; + /* Path of the row selected by a right click. */ + char *right_click_row_path; + unsigned int show_folders : 1; unsigned int allow_dnd : 1; @@ -634,46 +637,6 @@ folder_xfer_callback (EStorageSet *storage_set, /* Folder context menu. */ -/* FIXME: This should be moved somewhere else, so that also the shortcut code - can share it. */ - -#if 0 -static void -folder_context_menu_activate_cb (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - gtk_signal_emit (GTK_OBJECT (storage_set_view), signals[FOLDER_SELECTED], - priv->selected_row_path); -} - -static void -remove_cb(EStorageSet *storage_set, EStorageResult result, void *data) -{ - g_print ("remove_cb: %d\n", result); -} - -static void -folder_context_menu_remove_cb (BonoboUIComponent *uih, - void *data, - const char *path) -{ - EStorageSetView *storage_set_view; - EStorageSetViewPrivate *priv; - - storage_set_view = E_STORAGE_SET_VIEW (data); - priv = storage_set_view->priv; - - e_storage_set_async_remove_folder (priv->storage_set, priv->selected_row_path, - remove_cb, storage_set_view); -} -#endif static void popup_folder_menu (EStorageSetView *storage_set_view, @@ -711,7 +674,12 @@ popup_folder_menu (EStorageSetView *storage_set_view, e_folder_get_type_string (folder)); gtk_widget_show (GTK_WIDGET (menu)); - gtk_menu_popup (GTK_MENU (menu), NULL, NULL, NULL, NULL, 3, event->time); + + gnome_popup_menu_do_popup_modal (GTK_WIDGET (menu), NULL, NULL, event, NULL); + + gtk_widget_destroy (GTK_WIDGET (menu)); + + e_tree_right_click_up (E_TREE (storage_set_view)); } @@ -771,6 +739,7 @@ destroy (GtkObject *object) CORBA_free (priv->drag_corba_data); g_free (priv->selected_row_path); + g_free (priv->right_click_row_path); g_free (priv); @@ -1265,9 +1234,17 @@ right_click (ETree *etree, storage_set_view = E_STORAGE_SET_VIEW (etree); priv = storage_set_view->priv; + /* This should never happen, but you never know with ETree. */ + if (priv->right_click_row_path != NULL) + 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) popup_folder_menu (storage_set_view, (GdkEventButton *) event); + g_free (priv->right_click_row_path); + priv->right_click_row_path = NULL; + return TRUE; } @@ -1698,7 +1675,10 @@ init (EStorageSetView *storage_set_view) priv->storage_set = NULL; priv->path_to_etree_node = g_hash_table_new (g_str_hash, g_str_equal); priv->type_name_to_pixbuf = g_hash_table_new (g_str_hash, g_str_equal); + priv->selected_row_path = NULL; + priv->right_click_row_path = NULL; + priv->show_folders = TRUE; priv->allow_dnd = TRUE; @@ -2054,5 +2034,14 @@ e_storage_set_view_get_allow_dnd (EStorageSetView *storage_set_view) return storage_set_view->priv->allow_dnd; } +const char * +e_storage_set_view_get_right_click_path (EStorageSetView *storage_set_view) +{ + g_return_val_if_fail (storage_set_view != NULL, NULL); + g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view), NULL); + + return storage_set_view->priv->right_click_row_path; +} + E_MAKE_TYPE (e_storage_set_view, "EStorageSetView", EStorageSetView, class_init, init, PARENT_TYPE) |