diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-19 03:59:59 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-08-19 03:59:59 +0800 |
commit | 9f79315277d064fc533e1741fb43a0c540057105 (patch) | |
tree | 9d0eed6f9af2d3216c47dfd49f9446c0fee03334 /shell | |
parent | 60d36d71771eb158e04fa1e2eb073f073d13a9b0 (diff) | |
download | gsoc2013-evolution-9f79315277d064fc533e1741fb43a0c540057105.tar gsoc2013-evolution-9f79315277d064fc533e1741fb43a0c540057105.tar.gz gsoc2013-evolution-9f79315277d064fc533e1741fb43a0c540057105.tar.bz2 gsoc2013-evolution-9f79315277d064fc533e1741fb43a0c540057105.tar.lz gsoc2013-evolution-9f79315277d064fc533e1741fb43a0c540057105.tar.xz gsoc2013-evolution-9f79315277d064fc533e1741fb43a0c540057105.tar.zst gsoc2013-evolution-9f79315277d064fc533e1741fb43a0c540057105.zip |
New, replacing `shortcut_bar_mode_changed_cb'.
* e-shell-view-menu.c (shortcut_bar_visibility_changed_cb): New,
replacing `shortcut_bar_mode_changed_cb'.
(folder_bar_visibility_changed_cb): New, replacing
`folder_bar_mode_changed_cb'.
(command_toggle_folder_bar): Use `e_shell_view_show_folder_bar()'
instead of `e_shell_view_set_folder_bar_mode()'.
(command_toggle_shortcut_bar): Use
`e_shell_view_show_shortcut_bar()' instead of
`e_shell_view_set_shortcut_bar_mode()'.
(e_shell_view_menu_setup): Updated for the
"shortcut_bar_visibility_changed" and
"folder_bar_visibility_changed" signals and the above changes.
* e-shell-view.c: New member `folder_bar_popup' in
`EShellViewPrivate'. Replaced `folder_bar_mode' and
`shortcut_bar_mode' with `folder_bar_shown' and
`shortcut_bar_shown', respectively.
(init): Updated to initialize these correctly.
(reparent): New helper function.
(reparent_storage_set_view_box_and_destroy_popup): New helper
function.
(popdown_transient_folder_bar): Updated to use the
`folder_bar_popup'.
(folder_bar_popup_map_callback): Renamed from
`storage_set_view_box_map_cb'.
(e_shell_view_set_shortcut_bar_mode): Removed.
(e_shell_view_set_folder_bar_mode): Removed.
(e_shell_view_show_shortcut_bar): New. All the calls to
`e_shell_view_set_shortcut_bar_mode()' replaced with calls to this
one.
(e_shell_view_show_folder_bar): New. All the calls to
`e_shell_view_set_folder_bar_mode()' replaced with calls to this
one.
(e_shell_view_folder_bar_shown): New. All the calls to
`e_shell_view_get_folder_bar_mode()' replaced with calls to this
one.
(e_shell_view_shortcut_bar_shown): New. All the calls to
`e_shell_view_get_shortcut_bar_mode()' replaced with calls to this
one.
(class_init): Replace signal `folder_bar_mode_changed' with
`folder_bar_visibility_changed' and `shortcut_bar_mode_changed'
with `shortcut_visibility_changed'.
(e_shell_view_save_settings): Use keys "ShortcutBarShown" and
"FolderBarShown" instead of "ShortcutBarMode" and "FolderBarMode",
respectively.
(e_shell_view_load_settings): Likewise.
* e-shell-view.h: Removed enum `EShellViewSubwindowMode'. Renamed
signal `shortcut_bar_mode_changed' to
`shortcut_bar_visibility_changed' and `folder_bar_mode_changed' to
`folder_bar_visibility_changed'.
svn path=/trunk/; revision=12203
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 54 | ||||
-rw-r--r-- | shell/e-shell-view-menu.c | 62 | ||||
-rw-r--r-- | shell/e-shell-view.c | 248 | ||||
-rw-r--r-- | shell/e-shell-view.h | 24 |
4 files changed, 221 insertions, 167 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 4902b8b9fb..d8669e5732 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,57 @@ +2001-08-18 Ettore Perazzoli <ettore@ximian.com> + + * e-shell-view-menu.c (shortcut_bar_visibility_changed_cb): New, + replacing `shortcut_bar_mode_changed_cb'. + (folder_bar_visibility_changed_cb): New, replacing + `folder_bar_mode_changed_cb'. + (command_toggle_folder_bar): Use `e_shell_view_show_folder_bar()' + instead of `e_shell_view_set_folder_bar_mode()'. + (command_toggle_shortcut_bar): Use + `e_shell_view_show_shortcut_bar()' instead of + `e_shell_view_set_shortcut_bar_mode()'. + (e_shell_view_menu_setup): Updated for the + "shortcut_bar_visibility_changed" and + "folder_bar_visibility_changed" signals and the above changes. + + * e-shell-view.c: New member `folder_bar_popup' in + `EShellViewPrivate'. Replaced `folder_bar_mode' and + `shortcut_bar_mode' with `folder_bar_shown' and + `shortcut_bar_shown', respectively. + (init): Updated to initialize these correctly. + (reparent): New helper function. + (reparent_storage_set_view_box_and_destroy_popup): New helper + function. + (popdown_transient_folder_bar): Updated to use the + `folder_bar_popup'. + (folder_bar_popup_map_callback): Renamed from + `storage_set_view_box_map_cb'. + (e_shell_view_set_shortcut_bar_mode): Removed. + (e_shell_view_set_folder_bar_mode): Removed. + (e_shell_view_show_shortcut_bar): New. All the calls to + `e_shell_view_set_shortcut_bar_mode()' replaced with calls to this + one. + (e_shell_view_show_folder_bar): New. All the calls to + `e_shell_view_set_folder_bar_mode()' replaced with calls to this + one. + (e_shell_view_folder_bar_shown): New. All the calls to + `e_shell_view_get_folder_bar_mode()' replaced with calls to this + one. + (e_shell_view_shortcut_bar_shown): New. All the calls to + `e_shell_view_get_shortcut_bar_mode()' replaced with calls to this + one. + (class_init): Replace signal `folder_bar_mode_changed' with + `folder_bar_visibility_changed' and `shortcut_bar_mode_changed' + with `shortcut_visibility_changed'. + (e_shell_view_save_settings): Use keys "ShortcutBarShown" and + "FolderBarShown" instead of "ShortcutBarMode" and "FolderBarMode", + respectively. + (e_shell_view_load_settings): Likewise. + + * e-shell-view.h: Removed enum `EShellViewSubwindowMode'. Renamed + signal `shortcut_bar_mode_changed' to + `shortcut_bar_visibility_changed' and `folder_bar_mode_changed' to + `folder_bar_visibility_changed'. + 2001-08-17 Iain Holmes <iain@ximian.com> * Makefile.am: Add the Evolution-Wizard.idl file diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index f2fd333547..f62d443091 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -96,18 +96,18 @@ const char *authors[] = { /* EShellView callbacks. */ static void -shortcut_bar_mode_changed_cb (EShellView *shell_view, - EShellViewSubwindowMode new_mode, - void *data) +shortcut_bar_visibility_changed_cb (EShellView *shell_view, + gboolean visible, + void *data) { BonoboUIComponent *uic; const char *path; - char *txt; + const char *txt; - if (new_mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN) - txt = "0"; - else + if (visible) txt = "1"; + else + txt = "0"; path = (const char *) data; uic = e_shell_view_get_bonobo_ui_component (shell_view); @@ -116,18 +116,18 @@ shortcut_bar_mode_changed_cb (EShellView *shell_view, } static void -folder_bar_mode_changed_cb (EShellView *shell_view, - EShellViewSubwindowMode new_mode, - void *data) +folder_bar_visibility_changed_cb (EShellView *shell_view, + gboolean visible, + void *data) { BonoboUIComponent *uic; const char *path; - char *txt; + const char *txt; - if (new_mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN) - txt = "0"; - else + if (visible) txt = "1"; + else + txt = "0"; path = (const char *) data; uic = e_shell_view_get_bonobo_ui_component (shell_view); @@ -223,7 +223,7 @@ command_about_box (BonoboUIComponent *uih, "within the GNOME desktop environment."), NULL); gtk_signal_connect(GTK_OBJECT(about_box), "destroy", - GTK_SIGNAL_FUNC(zero_pointer), &about_box); + GTK_SIGNAL_FUNC (zero_pointer), &about_box); gtk_widget_show(about_box); g_free (version); @@ -246,21 +246,15 @@ command_toggle_folder_bar (BonoboUIComponent *component, gpointer user_data) { EShellView *shell_view; - EShellViewSubwindowMode mode; gboolean show; if (type != Bonobo_UIComponent_STATE_CHANGED) return; shell_view = E_SHELL_VIEW (user_data); - show = atoi (state); - if (show) - mode = E_SHELL_VIEW_SUBWINDOW_STICKY; - else - mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; - e_shell_view_set_folder_bar_mode (shell_view, mode); + e_shell_view_show_folder_bar (shell_view, show); } static void @@ -271,7 +265,6 @@ command_toggle_shortcut_bar (BonoboUIComponent *component, gpointer user_data) { EShellView *shell_view; - EShellViewSubwindowMode mode; gboolean show; if (type != Bonobo_UIComponent_STATE_CHANGED) @@ -281,12 +274,7 @@ command_toggle_shortcut_bar (BonoboUIComponent *component, show = atoi (state); - if (show) - mode = E_SHELL_VIEW_SUBWINDOW_STICKY; - else - mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; - - e_shell_view_set_shortcut_bar_mode (shell_view, mode); + e_shell_view_show_shortcut_bar (shell_view, show); } @@ -772,18 +760,18 @@ e_shell_view_menu_setup (EShellView *shell_view) e_pixmaps_update (uic, pixmaps); - gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_mode_changed", - GTK_SIGNAL_FUNC (shortcut_bar_mode_changed_cb), + gtk_signal_connect (GTK_OBJECT (shell_view), "shortcut_bar_visibility_changed", + GTK_SIGNAL_FUNC (shortcut_bar_visibility_changed_cb), SHORTCUT_BAR_TOGGLE_PATH); - gtk_signal_connect (GTK_OBJECT (shell_view), "folder_bar_mode_changed", - GTK_SIGNAL_FUNC (folder_bar_mode_changed_cb), + gtk_signal_connect (GTK_OBJECT (shell_view), "folder_bar_visibility_changed", + GTK_SIGNAL_FUNC (folder_bar_visibility_changed_cb), FOLDER_BAR_TOGGLE_PATH); /* Initialize the toggles. Yeah, this is, well, yuck. */ - folder_bar_mode_changed_cb (shell_view, e_shell_view_get_folder_bar_mode (shell_view), - FOLDER_BAR_TOGGLE_PATH); - shortcut_bar_mode_changed_cb (shell_view, e_shell_view_get_shortcut_bar_mode (shell_view), - SHORTCUT_BAR_TOGGLE_PATH); + folder_bar_visibility_changed_cb (shell_view, e_shell_view_folder_bar_shown (shell_view), + FOLDER_BAR_TOGGLE_PATH); + shortcut_bar_visibility_changed_cb (shell_view, e_shell_view_shortcut_bar_shown (shell_view), + SHORTCUT_BAR_TOGGLE_PATH); /* Set up the work online / work offline menu item. */ gtk_signal_connect_while_alive (GTK_OBJECT (shell), "line_status_changed", diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 0c4f548582..60a1f35220 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -117,7 +117,11 @@ struct _EShellViewPrivate { GtkWidget *menu_hint_label; GtkWidget *task_bar; - /* The view we have already open. */ + /* The pop-up window for the folder-tree (i.e. the one we create when + the user clicks on the folder title. */ + GtkWidget *folder_bar_popup; + + /* The views we have already open. */ GHashTable *uri_to_control; /* Position of the handles in the paneds, to be restored when we show elements @@ -125,17 +129,17 @@ struct _EShellViewPrivate { unsigned int hpaned_position; unsigned int view_hpaned_position; - /* Status of the shortcut and folder bars. */ - EShellViewSubwindowMode shortcut_bar_mode; - EShellViewSubwindowMode folder_bar_mode; + /* Whether the shortcut and folder bars are visible or not. */ + unsigned int shortcut_bar_shown : 1; + unsigned int folder_bar_shown : 1; /* List of sockets we created. */ GList *sockets; }; enum { - SHORTCUT_BAR_MODE_CHANGED, - FOLDER_BAR_MODE_CHANGED, + SHORTCUT_BAR_VISIBILITY_CHANGED, + FOLDER_BAR_VISIBILITY_CHANGED, LAST_SIGNAL }; @@ -242,10 +246,18 @@ cleanup_delayed_selection (EShellView *shell_view) /* Folder bar pop-up handling. */ -static void disconnect_popup_signals (EShellView *shell_view); +static void +reparent (GtkWidget *widget, + GtkContainer *new_container) +{ + gtk_widget_ref (widget); + gtk_container_remove (GTK_CONTAINER (widget->parent), widget); + gtk_container_add (GTK_CONTAINER (new_container), widget); + gtk_widget_unref (widget); +} static void -popdown_transient_folder_bar (EShellView *shell_view) +reparent_storage_set_view_box_and_destroy_popup (EShellView *shell_view) { EShellViewPrivate *priv; @@ -254,9 +266,26 @@ popdown_transient_folder_bar (EShellView *shell_view) gdk_pointer_ungrab (GDK_CURRENT_TIME); gtk_grab_remove (priv->storage_set_view_box); - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN); + g_assert (priv->folder_bar_popup != NULL); + + gtk_widget_ref (priv->storage_set_view_box); + gtk_container_remove (GTK_CONTAINER (priv->folder_bar_popup), priv->storage_set_view_box); + e_paned_pack1 (E_PANED (priv->view_hpaned), priv->storage_set_view_box, FALSE, TRUE); + gtk_widget_unref (priv->storage_set_view_box); + + gtk_widget_destroy (priv->folder_bar_popup); + priv->folder_bar_popup = NULL; +} + +static void +popdown_transient_folder_bar (EShellView *shell_view) +{ + EShellViewPrivate *priv; + + priv = shell_view->priv; - disconnect_popup_signals (shell_view); + reparent_storage_set_view_box_and_destroy_popup (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); } @@ -339,18 +368,17 @@ popup_storage_set_view_button_clicked (ETitleBar *title_bar, shell_view = E_SHELL_VIEW (data); priv = shell_view->priv; - gdk_pointer_ungrab (GDK_CURRENT_TIME); - gtk_grab_remove (priv->storage_set_view_box); + g_assert (priv->folder_bar_popup != NULL); - disconnect_popup_signals (shell_view); + reparent_storage_set_view_box_and_destroy_popup (shell_view); - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_STICKY); + e_shell_view_show_folder_bar (shell_view, TRUE); e_shell_folder_title_bar_set_toggle_state (E_SHELL_FOLDER_TITLE_BAR (priv->folder_title_bar), FALSE); } static void -storage_set_view_box_map_cb (GtkWidget *widget, - void *data) +folder_bar_popup_map_callback (GtkWidget *widget, + void *data) { EShellView *shell_view; EShellViewPrivate *priv; @@ -365,63 +393,64 @@ storage_set_view_box_map_cb (GtkWidget *widget, | GDK_LEAVE_NOTIFY_MASK | GDK_POINTER_MOTION_MASK), NULL, NULL, GDK_CURRENT_TIME) != 0) { - g_warning ("e-shell-view.c:storage_set_view_box_map_cb() -- pointer grab failed."); - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_STICKY); + g_warning ("e-shell-view.c:folder_bar_popup_map_callback() -- pointer grab failed."); return; } gtk_grab_add (widget); - gtk_signal_connect (GTK_OBJECT (widget), "event", - GTK_SIGNAL_FUNC (storage_set_view_box_event_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (widget), "button_release_event", - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view), "button_release_event", - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_title_bar), "button_clicked", - GTK_SIGNAL_FUNC (popup_storage_set_view_button_clicked), shell_view); -} -static void -disconnect_popup_signals (EShellView *shell_view) -{ - EShellViewPrivate *priv; - - priv = shell_view->priv; - - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view_box), - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), - shell_view); - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view), - GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), - shell_view); - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_title_bar), - GTK_SIGNAL_FUNC (popup_storage_set_view_button_clicked), - shell_view); - gtk_signal_disconnect_by_func (GTK_OBJECT (priv->storage_set_view_box), - GTK_SIGNAL_FUNC (storage_set_view_box_map_cb), - shell_view); + gtk_signal_connect_while_alive (GTK_OBJECT (widget), "event", + GTK_SIGNAL_FUNC (storage_set_view_box_event_cb), shell_view, + GTK_OBJECT (priv->folder_bar_popup)); + gtk_signal_connect_while_alive (GTK_OBJECT (widget), "button_release_event", + GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view, + GTK_OBJECT (priv->folder_bar_popup)); + gtk_signal_connect_while_alive (GTK_OBJECT (priv->storage_set_view), "button_release_event", + GTK_SIGNAL_FUNC (storage_set_view_box_button_release_event_cb), shell_view, + GTK_OBJECT (priv->folder_bar_popup)); + gtk_signal_connect_while_alive (GTK_OBJECT (priv->storage_set_title_bar), "button_clicked", + GTK_SIGNAL_FUNC (popup_storage_set_view_button_clicked), shell_view, + GTK_OBJECT (priv->folder_bar_popup)); } static void pop_up_folder_bar (EShellView *shell_view) { EShellViewPrivate *priv; + int x, y; + int orig_x, orig_y; priv = shell_view->priv; - priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_TRANSIENT; + g_assert (! priv->folder_bar_shown); + + priv->folder_bar_popup = gtk_window_new (GTK_WINDOW_POPUP); /* We need to show the storage set view box and do a pointer grab to catch the mouse clicks. But until the box is shown, we cannot grab. So we connect to the "map" signal; `storage_set_view_box_map_cb()' will do the grab. */ + gtk_signal_connect (GTK_OBJECT (priv->folder_bar_popup), "map", + GTK_SIGNAL_FUNC (folder_bar_popup_map_callback), shell_view); + + x = priv->folder_title_bar->allocation.x; + y = priv->folder_title_bar->allocation.y + priv->folder_title_bar->allocation.height; + + gdk_window_get_origin (priv->folder_title_bar->window, &orig_x, &orig_y); + x += orig_x; + y += orig_y + 2; + + gtk_window_set_default_size (GTK_WINDOW (priv->folder_bar_popup), + priv->view_hpaned_position, + priv->view_hpaned->allocation.height); + + reparent (priv->storage_set_view_box, GTK_CONTAINER (priv->folder_bar_popup)); - gtk_signal_connect (GTK_OBJECT (priv->storage_set_view_box), "map", - GTK_SIGNAL_FUNC (storage_set_view_box_map_cb), shell_view); gtk_widget_show (priv->storage_set_view_box); - e_paned_set_position (E_PANED (priv->view_hpaned), priv->view_hpaned_position); + gtk_widget_popup (priv->folder_bar_popup, x, y); } + /* Switching views on a tree view click. */ @@ -464,7 +493,7 @@ switch_on_folder_tree_click (EShellView *shell_view, cleanup_delayed_selection (shell_view); - if (priv->folder_bar_mode == E_SHELL_VIEW_SUBWINDOW_TRANSIENT) { + if (priv->folder_bar_popup != NULL) { e_shell_view_display_uri (shell_view, uri); popdown_transient_folder_bar (shell_view); g_free (uri); @@ -535,8 +564,7 @@ hide_requested_cb (EShortcutsView *shortcut_view, shell_view = E_SHELL_VIEW (data); - e_shell_view_set_shortcut_bar_mode (shell_view, - E_SHELL_VIEW_SUBWINDOW_HIDDEN); + e_shell_view_show_shortcut_bar (shell_view, FALSE); } /* Callback called when a folder on the tree view gets clicked. */ @@ -607,7 +635,8 @@ storage_set_view_button_clicked_cb (ETitleBar *title_bar, shell_view = E_SHELL_VIEW (data); - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN); + if (shell_view->priv->folder_bar_popup == NULL) + e_shell_view_show_folder_bar (shell_view, FALSE); } /* Callback called when the title bar button is clicked. */ @@ -623,7 +652,7 @@ title_bar_toggled_cb (EShellFolderTitleBar *title_bar, if (! state) return; - if (e_shell_view_get_folder_bar_mode (shell_view) != E_SHELL_VIEW_SUBWINDOW_TRANSIENT) + if (shell_view->priv->folder_bar_popup == NULL) pop_up_folder_bar (shell_view); } @@ -915,9 +944,8 @@ setup_widgets (EShellView *shell_view) gtk_widget_show (gray_bar); - /* By default, both the folder bar and shortcut bar are visible. */ - priv->shortcut_bar_mode = E_SHELL_VIEW_SUBWINDOW_STICKY; - priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_STICKY; + priv->shortcut_bar_shown = TRUE; + priv->folder_bar_shown = FALSE; /* FIXME: Session management and stuff? */ gtk_window_set_default_size (GTK_WINDOW (shell_view), DEFAULT_WIDTH, DEFAULT_HEIGHT); @@ -954,6 +982,9 @@ destroy (GtkObject *object) if (priv->corba_interface != NULL) bonobo_object_unref (BONOBO_OBJECT (priv->corba_interface)); + if (priv->folder_bar_popup != NULL) + gtk_widget_destroy (priv->folder_bar_popup); + for (p = priv->sockets; p != NULL; p = p->next) { GtkWidget *socket_widget; int destroy_connection_id; @@ -997,20 +1028,20 @@ class_init (EShellViewClass *klass) parent_class = gtk_type_class (BONOBO_TYPE_WINDOW); - signals[SHORTCUT_BAR_MODE_CHANGED] - = gtk_signal_new ("shortcut_bar_mode_changed", + signals[SHORTCUT_BAR_VISIBILITY_CHANGED] + = gtk_signal_new ("shortcut_bar_visibility_changed", GTK_RUN_FIRST, object_class->type, - GTK_SIGNAL_OFFSET (EShellViewClass, shortcut_bar_mode_changed), + GTK_SIGNAL_OFFSET (EShellViewClass, shortcut_bar_visibility_changed), gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); - signals[FOLDER_BAR_MODE_CHANGED] - = gtk_signal_new ("folder_bar_mode_changed", + signals[FOLDER_BAR_VISIBILITY_CHANGED] + = gtk_signal_new ("folder_bar_visibility_changed", GTK_RUN_FIRST, object_class->type, - GTK_SIGNAL_OFFSET (EShellViewClass, folder_bar_mode_changed), + GTK_SIGNAL_OFFSET (EShellViewClass, folder_bar_visibility_changed), gtk_marshal_NONE__INT, GTK_TYPE_NONE, 1, GTK_TYPE_INT); @@ -1052,8 +1083,10 @@ init (EShellView *shell_view) priv->menu_hint_label = NULL; priv->task_bar = NULL; - priv->shortcut_bar_mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; - priv->folder_bar_mode = E_SHELL_VIEW_SUBWINDOW_HIDDEN; + priv->folder_bar_popup = NULL; + + priv->shortcut_bar_shown = FALSE; + priv->folder_bar_shown = FALSE; priv->hpaned_position = 0; priv->view_hpaned_position = 0; @@ -1239,7 +1272,7 @@ e_shell_view_construct (EShellView *shell_view, "/evolution/UIConf/kvps"); e_shell_view_menu_setup (shell_view); - e_shell_view_set_folder_bar_mode (shell_view, E_SHELL_VIEW_SUBWINDOW_HIDDEN); + e_shell_view_show_folder_bar (shell_view, FALSE); bonobo_ui_component_thaw (priv->ui_component, NULL); @@ -1948,22 +1981,20 @@ e_shell_view_remove_control_for_uri (EShellView *shell_view, void -e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode) +e_shell_view_show_shortcut_bar (EShellView *shell_view, + gboolean show) { EShellViewPrivate *priv; g_return_if_fail (shell_view != NULL); g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - g_return_if_fail (mode == E_SHELL_VIEW_SUBWINDOW_STICKY - || mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN); priv = shell_view->priv; - if (priv->shortcut_bar_mode == mode) + if (!! show == priv->shortcut_bar_shown) return; - if (mode == E_SHELL_VIEW_SUBWINDOW_STICKY) { + if (show) { if (! GTK_WIDGET_VISIBLE (priv->shortcut_frame)) { gtk_widget_show (priv->shortcut_frame); e_paned_set_position (E_PANED (priv->hpaned), priv->hpaned_position); @@ -1977,39 +2008,29 @@ e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, } } - priv->shortcut_bar_mode = mode; + priv->shortcut_bar_shown = !! show; - gtk_signal_emit (GTK_OBJECT (shell_view), signals[SHORTCUT_BAR_MODE_CHANGED], mode); + gtk_signal_emit (GTK_OBJECT (shell_view), signals[SHORTCUT_BAR_VISIBILITY_CHANGED], + priv->shortcut_bar_shown); } -/** - * e_shell_view_set_folder_bar_mode: - * @shell_view: - * @mode: - * - * Set the visualization mode for the folder bar's subwindow. - **/ void -e_shell_view_set_folder_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode) +e_shell_view_show_folder_bar (EShellView *shell_view, + gboolean show) { EShellViewPrivate *priv; g_return_if_fail (shell_view != NULL); g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); - g_return_if_fail (mode == E_SHELL_VIEW_SUBWINDOW_STICKY - || mode == E_SHELL_VIEW_SUBWINDOW_HIDDEN); priv = shell_view->priv; - if (priv->folder_bar_mode == mode) + if (!! show == priv->folder_bar_shown) return; - if (mode == E_SHELL_VIEW_SUBWINDOW_STICKY) { - if (! GTK_WIDGET_VISIBLE (priv->storage_set_view_box)) { - gtk_widget_show (priv->storage_set_view_box); - e_paned_set_position (E_PANED (priv->view_hpaned), priv->view_hpaned_position); - } + if (show) { + gtk_widget_show (priv->storage_set_view_box); + e_paned_set_position (E_PANED (priv->view_hpaned), priv->view_hpaned_position); e_title_bar_set_button_mode (E_TITLE_BAR (priv->storage_set_title_bar), E_TITLE_BAR_BUTTON_MODE_CLOSE); @@ -2031,27 +2052,28 @@ e_shell_view_set_folder_bar_mode (EShellView *shell_view, TRUE); } - priv->folder_bar_mode = mode; + priv->folder_bar_shown = !! show; - gtk_signal_emit (GTK_OBJECT (shell_view), signals[FOLDER_BAR_MODE_CHANGED], mode); + gtk_signal_emit (GTK_OBJECT (shell_view), signals[FOLDER_BAR_VISIBILITY_CHANGED], + priv->folder_bar_shown); } -EShellViewSubwindowMode -e_shell_view_get_shortcut_bar_mode (EShellView *shell_view) +gboolean +e_shell_view_shortcut_bar_shown (EShellView *shell_view) { - g_return_val_if_fail (shell_view != NULL, E_SHELL_VIEW_SUBWINDOW_HIDDEN); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), E_SHELL_VIEW_SUBWINDOW_HIDDEN); + g_return_val_if_fail (shell_view != NULL, FALSE); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - return shell_view->priv->shortcut_bar_mode; + return shell_view->priv->shortcut_bar_shown; } -EShellViewSubwindowMode -e_shell_view_get_folder_bar_mode (EShellView *shell_view) +gboolean +e_shell_view_folder_bar_shown (EShellView *shell_view) { - g_return_val_if_fail (shell_view != NULL, E_SHELL_VIEW_SUBWINDOW_HIDDEN); - g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), E_SHELL_VIEW_SUBWINDOW_HIDDEN); + g_return_val_if_fail (shell_view != NULL, FALSE); + g_return_val_if_fail (E_IS_SHELL_VIEW (shell_view), FALSE); - return shell_view->priv->folder_bar_mode; + return shell_view->priv->folder_bar_shown; } @@ -2220,14 +2242,12 @@ e_shell_view_save_settings (EShellView *shell_view, g_free (key); - key = g_strconcat (prefix, "FolderBarMode", NULL); - bonobo_config_set_long (db, key, - e_shell_view_get_folder_bar_mode (shell_view), NULL); + key = g_strconcat (prefix, "FolderBarShown", NULL); + bonobo_config_set_long (db, key, e_shell_view_folder_bar_shown (shell_view), NULL); g_free (key); - key = g_strconcat (prefix, "ShortcutBarMode", NULL); - bonobo_config_set_long (db, key, - e_shell_view_get_shortcut_bar_mode (shell_view), NULL); + key = g_strconcat (prefix, "ShortcutBarShown", NULL); + bonobo_config_set_long (db, key, e_shell_view_shortcut_bar_shown (shell_view), NULL); g_free (key); key = g_strconcat (prefix, "HPanedPosition", NULL); @@ -2315,14 +2335,14 @@ e_shell_view_load_settings (EShellView *shell_view, e_shell_view_set_current_shortcuts_group_num (shell_view, val); g_free (key); - key = g_strconcat (prefix, "FolderBarMode", NULL); + key = g_strconcat (prefix, "FolderBarShown", NULL); val = bonobo_config_get_long (db, key, NULL); - e_shell_view_set_folder_bar_mode (shell_view, val); + e_shell_view_show_folder_bar (shell_view, val); g_free (key); - key = g_strconcat (prefix, "ShortcutBarMode", NULL); + key = g_strconcat (prefix, "ShortcutBarShown", NULL); val = bonobo_config_get_long (db, key, NULL); - e_shell_view_set_shortcut_bar_mode (shell_view, val); + e_shell_view_show_shortcut_bar (shell_view, val); g_free (key); key = g_strconcat (prefix, "HPanedPosition", NULL); diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index a49d0cf337..9b7b53a47d 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -48,13 +48,6 @@ typedef struct _EShellViewClass EShellViewClass; #define DEFAULT_URI "evolution:/local/Inbox" -enum _EShellViewSubwindowMode { - E_SHELL_VIEW_SUBWINDOW_HIDDEN, - E_SHELL_VIEW_SUBWINDOW_TRANSIENT, - E_SHELL_VIEW_SUBWINDOW_STICKY -}; -typedef enum _EShellViewSubwindowMode EShellViewSubwindowMode; - struct _EShellView { BonoboWindow parent; @@ -65,8 +58,8 @@ struct _EShellViewClass { BonoboWindowClass parent_class; /* Signals. */ - void (* shortcut_bar_mode_changed) (EShellView *shell_view, EShellViewSubwindowMode new_mode); - void (* folder_bar_mode_changed) (EShellView *shell_view, EShellViewSubwindowMode mode); + void (* shortcut_bar_visibility_changed) (EShellView *shell_view, gboolean visible); + void (* folder_bar_visibility_changed) (EShellView *shell_view, gboolean visible); }; @@ -86,13 +79,12 @@ const GNOME_Evolution_ShellView e_shell_view_get_corba_interface (EShellView * gboolean e_shell_view_display_uri (EShellView *shell_view, const char *uri); -void e_shell_view_set_shortcut_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode); -EShellViewSubwindowMode e_shell_view_get_shortcut_bar_mode (EShellView *shell_view); - -void e_shell_view_set_folder_bar_mode (EShellView *shell_view, - EShellViewSubwindowMode mode); -EShellViewSubwindowMode e_shell_view_get_folder_bar_mode (EShellView *shell_view); +void e_shell_view_show_shortcut_bar (EShellView *shell_view, + gboolean show); +gboolean e_shell_view_shortcut_bar_shown (EShellView *shell_view); +void e_shell_view_show_folder_bar (EShellView *shell_view, + gboolean show); +gboolean e_shell_view_folder_bar_shown (EShellView *shell_view); ETaskBar *e_shell_view_get_task_bar (EShellView *shell_view); EShell *e_shell_view_get_shell (EShellView *shell_view); |