diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-14 05:11:22 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-09-14 05:11:22 +0800 |
commit | c788ba0fafe0143c06efb32a633aef139d21e142 (patch) | |
tree | 2c593a485ad3d35f6f453f1f46b7a1394d828337 | |
parent | 080576bf0dc05633d2e0d4ed7fef8db98a853fc9 (diff) | |
download | gsoc2013-evolution-c788ba0fafe0143c06efb32a633aef139d21e142.tar.gz gsoc2013-evolution-c788ba0fafe0143c06efb32a633aef139d21e142.tar.zst gsoc2013-evolution-c788ba0fafe0143c06efb32a633aef139d21e142.zip |
Disable DnD on the EStorageSetView to avoid strange behaviors.
* e-shell-view.c (pop_up_folder_bar): Disable DnD on the
EStorageSetView to avoid strange behaviors.
(reparent_storage_set_view_box_and_destroy_popup): Re-enable DnD
here.
(popdown_transient_folder_bar): And here as well.
* evolution-storage-set-view-factory.c
(evolution_storage_set_view_factory_new_view): Disable DnD on the
EStorageSetView.
* e-shell-folder-selection-dialog.c
(e_shell_folder_selection_dialog_construct): Disable DnD on the
EStorageSetView.
* e-shell-folder-creation-dialog.c (add_storage_set_view): Disable
DnD on the EStorageSetView.
* e-storage-set-view.c: New member `allow_dnd' in
`EStorageSetViewPrivate'.
(init): Init to `allow_dnd' %TRUE.
(tree_start_drag): If `allow_dnd' is false, don't start the drag
and return %FALSE.
(tree_drag_motion): If `allow_dnd' is false, return %FALSE.
(e_storage_set_view_get_allow_dnd): New.
(e_storage_set_view_set_allow_dnd): New.
svn path=/trunk/; revision=12810
-rw-r--r-- | shell/ChangeLog | 28 | ||||
-rw-r--r-- | shell/e-shell-folder-creation-dialog.c | 2 | ||||
-rw-r--r-- | shell/e-shell-folder-selection-dialog.c | 1 | ||||
-rw-r--r-- | shell/e-shell-view.c | 11 | ||||
-rw-r--r-- | shell/e-shell.c | 30 | ||||
-rw-r--r-- | shell/e-storage-set-view.c | 31 | ||||
-rw-r--r-- | shell/e-storage-set-view.h | 22 | ||||
-rw-r--r-- | shell/evolution-storage-set-view-factory.c | 2 |
8 files changed, 104 insertions, 23 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 4d37f660f1..ba3194db23 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,31 @@ +2001-09-13 Ettore Perazzoli <ettore@ximian.com> + + * e-shell-view.c (pop_up_folder_bar): Disable DnD on the + EStorageSetView to avoid strange behaviors. + (reparent_storage_set_view_box_and_destroy_popup): Re-enable DnD + here. + (popdown_transient_folder_bar): And here as well. + + * evolution-storage-set-view-factory.c + (evolution_storage_set_view_factory_new_view): Disable DnD on the + EStorageSetView. + + * e-shell-folder-selection-dialog.c + (e_shell_folder_selection_dialog_construct): Disable DnD on the + EStorageSetView. + + * e-shell-folder-creation-dialog.c (add_storage_set_view): Disable + DnD on the EStorageSetView. + + * e-storage-set-view.c: New member `allow_dnd' in + `EStorageSetViewPrivate'. + (init): Init to `allow_dnd' %TRUE. + (tree_start_drag): If `allow_dnd' is false, don't start the drag + and return %FALSE. + (tree_drag_motion): If `allow_dnd' is false, return %FALSE. + (e_storage_set_view_get_allow_dnd): New. + (e_storage_set_view_set_allow_dnd): New. + 2001-09-12 Ettore Perazzoli <ettore@ximian.com> * main.c (main): Add SUB_VERSION to the version string passed to diff --git a/shell/e-shell-folder-creation-dialog.c b/shell/e-shell-folder-creation-dialog.c index dfee004a1e..59d6468338 100644 --- a/shell/e-shell-folder-creation-dialog.c +++ b/shell/e-shell-folder-creation-dialog.c @@ -331,6 +331,8 @@ add_storage_set_view (GtkWidget *dialog, storage_set = e_shell_get_storage_set (shell); storage_set_view = e_storage_set_new_view (storage_set, NULL/*XXX*/); + e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (storage_set_view), FALSE); + GTK_WIDGET_SET_FLAGS (storage_set_view, GTK_CAN_FOCUS); if (default_parent_folder != NULL) diff --git a/shell/e-shell-folder-selection-dialog.c b/shell/e-shell-folder-selection-dialog.c index 063bf9a442..e113b540dc 100644 --- a/shell/e-shell-folder-selection-dialog.c +++ b/shell/e-shell-folder-selection-dialog.c @@ -373,6 +373,7 @@ e_shell_folder_selection_dialog_construct (EShellFolderSelectionDialog *folder_s gtk_object_ref (GTK_OBJECT (priv->storage_set)); priv->storage_set_view = e_storage_set_new_view (priv->storage_set, NULL /* No BonoboUIContainer */); + e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), FALSE); /* Load the expanded state for this StorageSetView */ filename = g_strdup_printf ("%s/config/storage-set-view-expanded:view_0", diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 2182c53d8d..974da73007 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -307,6 +307,10 @@ reparent_storage_set_view_box_and_destroy_popup (EShellView *shell_view) gtk_widget_destroy (priv->folder_bar_popup); priv->folder_bar_popup = NULL; + + /* Re-enable DnD on the StorageSetView (it got disabled when displaying + the pop-up). */ + e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), TRUE); } static void @@ -320,6 +324,10 @@ popdown_transient_folder_bar (EShellView *shell_view) gtk_widget_hide (priv->storage_set_view_box); e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar), FALSE); + + /* Re-enable DnD on the StorageSetView (it got disabled when displaying + the pop-up). */ + e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), TRUE); } static int @@ -485,6 +493,9 @@ pop_up_folder_bar (EShellView *shell_view) gtk_widget_show (priv->storage_set_view_box); gtk_widget_popup (priv->folder_bar_popup, x, y); + + /* Disable DnD or "interesting" things will happen. */ + e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (priv->storage_set_view), FALSE); } diff --git a/shell/e-shell.c b/shell/e-shell.c index a328e3384e..aa258f5bea 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -112,6 +112,11 @@ struct _EShellPrivate { /* Configuration Database */ Bonobo_ConfigDatabase db; + + /* Whether the shell is succesfully initialized. This is needed during + the start-up sequence, to avoid CORBA calls to do make wrong things + to happen while the shell is initializing. */ + gboolean is_initialized; }; @@ -842,6 +847,7 @@ init (EShell *shell) priv->crash_type_names = NULL; priv->line_status = E_SHELL_LINE_STATUS_ONLINE; priv->db = CORBA_OBJECT_NIL; + priv->is_initialized = FALSE; shell->priv = priv; } @@ -904,18 +910,7 @@ e_shell_construct (EShell *shell, } CORBA_exception_free (&ev); - - /* Now we can register into OAF. Notice that we shouldn't be - registering into OAF until we are sure we can complete the - process. */ - - /* FIXME: Multi-display stuff. */ - corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); - if (oaf_active_server_register (iid, corba_object) != OAF_REG_SUCCESS) { - CORBA_exception_free (&ev); - return E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER; - } - + if (! show_splash) { splash = NULL; } else { @@ -984,6 +979,17 @@ e_shell_construct (EShell *shell, e_shortcuts_add_default_group (priv->shortcuts); g_free (shortcut_path); + + /* Now we can register into OAF. Notice that we shouldn't be + registering into OAF until we are initialized. */ + + /* FIXME: Multi-display stuff. */ + corba_object = bonobo_object_corba_objref (BONOBO_OBJECT (shell)); + if (oaf_active_server_register (iid, corba_object) != OAF_REG_SUCCESS) { + CORBA_exception_free (&ev); + return E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER; + } + return E_SHELL_CONSTRUCT_RESULT_OK; } diff --git a/shell/e-storage-set-view.c b/shell/e-storage-set-view.c index 2828ab499a..835cef4301 100644 --- a/shell/e-storage-set-view.c +++ b/shell/e-storage-set-view.c @@ -82,7 +82,8 @@ struct _EStorageSetViewPrivate { /* Path of the row selected by the latest "cursor_activated" signal. */ char *selected_row_path; - gboolean show_folders; + unsigned int show_folders : 1; + unsigned int allow_dnd : 1; /* The `Evolution::ShellComponentDnd::SourceFolder' interface for the folder we are dragging from, or CORBA_OBJECT_NIL if no dragging is @@ -777,7 +778,6 @@ destroy (GtkObject *object) } - static gint tree_start_drag (ETree *tree, int row, ETreePath path, int col, GdkEvent *event) { @@ -788,6 +788,9 @@ tree_start_drag (ETree *tree, int row, ETreePath path, int col, GdkEvent *event) storage_set_view = E_STORAGE_SET_VIEW (tree); + if (! storage_set_view->priv->allow_dnd) + return FALSE; + target_list = create_target_list_for_node (storage_set_view, path); if (target_list == NULL) return FALSE; @@ -1051,6 +1054,9 @@ tree_drag_motion (ETree *tree, storage_set_view = E_STORAGE_SET_VIEW (tree); priv = storage_set_view->priv; + if (! priv->allow_dnd) + return FALSE; + path = e_tree_node_at_row (E_TREE (storage_set_view), row); component_client = get_component_at_node (storage_set_view, path); @@ -1694,6 +1700,7 @@ init (EStorageSetView *storage_set_view) priv->type_name_to_pixbuf = g_hash_table_new (g_str_hash, g_str_equal); priv->selected_row_path = NULL; priv->show_folders = TRUE; + priv->allow_dnd = TRUE; priv->drag_corba_source_interface = CORBA_OBJECT_NIL; @@ -2028,4 +2035,24 @@ e_storage_set_view_get_show_folders (EStorageSetView *storage_set_view) } +void +e_storage_set_view_set_allow_dnd (EStorageSetView *storage_set_view, + gboolean allow_dnd) +{ + g_return_if_fail (storage_set_view != NULL); + g_return_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view)); + + storage_set_view->priv->allow_dnd = !! allow_dnd; +} + +gboolean +e_storage_set_view_get_allow_dnd (EStorageSetView *storage_set_view) +{ + g_return_val_if_fail (storage_set_view != NULL, FALSE); + g_return_val_if_fail (E_IS_STORAGE_SET_VIEW (storage_set_view), FALSE); + + return storage_set_view->priv->allow_dnd; +} + + E_MAKE_TYPE (e_storage_set_view, "EStorageSetView", EStorageSetView, class_init, init, PARENT_TYPE) diff --git a/shell/e-storage-set-view.h b/shell/e-storage-set-view.h index b5de34b2f1..9e00c0e678 100644 --- a/shell/e-storage-set-view.h +++ b/shell/e-storage-set-view.h @@ -68,21 +68,25 @@ struct _EStorageSetViewClass { }; -GtkType e_storage_set_view_get_type (void); -GtkWidget *e_storage_set_view_new_partial_view (EStorageSet *storage_set, - GList *visible_types); -GtkWidget *e_storage_set_view_new (EStorageSet *storage_set, - BonoboUIContainer *container); -void e_storage_set_view_construct (EStorageSetView *storage_set_view, - EStorageSet *storage_set, - BonoboUIContainer *container); +GtkType e_storage_set_view_get_type (void); + +GtkWidget *e_storage_set_view_new (EStorageSet *storage_set, + BonoboUIContainer *container); +void e_storage_set_view_construct (EStorageSetView *storage_set_view, + EStorageSet *storage_set, + BonoboUIContainer *container); + void e_storage_set_view_set_current_folder (EStorageSetView *storage_set_view, const char *path); const char *e_storage_set_view_get_current_folder (EStorageSetView *storage_set_view); void e_storage_set_view_set_show_folders (EStorageSetView *storage_set_view, - gboolean show); + gboolean show); gboolean e_storage_set_view_get_show_folders (EStorageSetView *storage_set_view); + +void e_storage_set_view_set_allow_dnd (EStorageSetView *storage_set_view, + gboolean allow_dnd); +gboolean e_storage_set_view_get_allow_dnd (EStorageSetView *storage_set_view); #ifdef __cplusplus } diff --git a/shell/evolution-storage-set-view-factory.c b/shell/evolution-storage-set-view-factory.c index 50b066401b..9f2f30dee1 100644 --- a/shell/evolution-storage-set-view-factory.c +++ b/shell/evolution-storage-set-view-factory.c @@ -47,6 +47,8 @@ evolution_storage_set_view_factory_new_view (EShell *shell) storage_set_view = e_storage_set_view_new (storage_set, NULL /*XXX*/); gtk_widget_show (storage_set_view); + e_storage_set_view_set_allow_dnd (E_STORAGE_SET_VIEW (storage_set_view), FALSE); + storage_set_view_interface = evolution_storage_set_view_new (E_STORAGE_SET_VIEW (storage_set_view)); if (storage_set_view_interface == NULL) { gtk_widget_destroy (storage_set_view); |