diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2001-05-04 10:47:33 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2001-05-04 10:47:33 +0800 |
commit | be2f9a67f63403a95a96e0dfbd72a4c2e68e17c6 (patch) | |
tree | 8e7bf2f5fd9f86d8382ebecb5d469cc94e3ebdcf | |
parent | 7cfacb2f84e3189bed138326e788ea09bdb25eb8 (diff) | |
download | gsoc2013-evolution-be2f9a67f63403a95a96e0dfbd72a4c2e68e17c6.tar.gz gsoc2013-evolution-be2f9a67f63403a95a96e0dfbd72a4c2e68e17c6.tar.zst gsoc2013-evolution-be2f9a67f63403a95a96e0dfbd72a4c2e68e17c6.zip |
Complete the shell side for supporting off-line operations, getting
the dialog to fully work and the menu item to change its label
according to the current status of the line.
svn path=/trunk/; revision=9662
-rw-r--r-- | shell/ChangeLog | 24 | ||||
-rw-r--r-- | shell/e-shell-offline-handler.c | 8 | ||||
-rw-r--r-- | shell/e-shell-view-menu.c | 107 | ||||
-rw-r--r-- | shell/evolution-shell-component-client.c | 2 |
4 files changed, 120 insertions, 21 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 15540ce9f8..658a4b8f21 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,5 +1,29 @@ 2001-05-03 Ettore Perazzoli <ettore@ximian.com> + * e-shell-offline-handler.c + (impl_OfflineProgressListener_updateProgress): Update the GtkCList + before emitting the "offline_procedure_finished" signal. In fact, + we might be destroyed from within the signal handlers and then + things would get messy. + + * evolution-shell-component-client.c + (evolution_shell_component_client_get_offline_interface): + "IDL:GNOME/Evolution/Offline:1.0", not + "IDL:GNOME/Evolution/ShellComponent/Offline:1.0". Sigh. + + * e-shell-view-menu.c: Update to match the rename of the + `WorkOffline' menu item in the `File' menu into `ToggleOffline'. + Now the `WorkOffline' verb actually puts the shell offline, while + `WorkOnline' puts in online, so we don't use one single verb to + toggle the online/offline status. + (command_work_offline): Only go offline. + (command_work_online): New. Make the shell go online. + (update_offline_menu_item): New. + (shell_line_status_changed_cb): New, callback for the + "line_status_changed" signal on the associated EShell. + +2001-05-03 Ettore Perazzoli <ettore@ximian.com> + * e-shell-offline-handler.c: New member `dialog_gui' in `EShellOfflineHandlerPrivate'. (impl_destroy): Unref here if not NULL. diff --git a/shell/e-shell-offline-handler.c b/shell/e-shell-offline-handler.c index 4a6ea1bb64..7a27998b67 100644 --- a/shell/e-shell-offline-handler.c +++ b/shell/e-shell-offline-handler.c @@ -191,10 +191,10 @@ impl_OfflineProgressListener_updateProgress (PortableServer_Servant servant, CORBA_free (component_info->active_connection_list); component_info->active_connection_list = duplicate_connection_list (current_active_connections); + update_dialog_clist (offline_handler); + if (priv->num_total_connections == 0) gtk_signal_emit (GTK_OBJECT (offline_handler), signals[OFFLINE_PROCEDURE_FINISHED], TRUE); - - update_dialog_clist (offline_handler); } static gboolean @@ -618,8 +618,8 @@ pop_up_confirmation_dialog (EShellOfflineHandler *offline_handler) dialog = glade_xml_get_widget (priv->dialog_gui, "active_connection_dialog"); /* FIXME: do we really want this? */ - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (priv->parent_shell_view)); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + /* gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (priv->parent_shell_view)); */ + /* gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); */ gnome_dialog_set_default (GNOME_DIALOG (dialog), 1); diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index 1c4def05c5..3c97d72bc4 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -429,21 +429,23 @@ command_work_offline (BonoboUIComponent *uih, shell_view = E_SHELL_VIEW (data); shell = e_shell_view_get_shell (shell_view); - switch (e_shell_get_line_status (shell)) { - case E_SHELL_LINE_STATUS_ONLINE: - g_warning ("Putting the shell offline"); - e_shell_go_offline (shell, shell_view); - break; - case E_SHELL_LINE_STATUS_OFFLINE: - g_warning ("Putting the shell online"); - e_shell_go_online (shell, shell_view); - break; - case E_SHELL_LINE_STATUS_GOING_OFFLINE: - g_warning ("The shell is going off-line already; not doing anything."); - break; - default: - g_assert_not_reached (); - } + g_warning ("Putting the shell offline"); + e_shell_go_offline (shell, shell_view); +} + +static void +command_work_online (BonoboUIComponent *uih, + void *data, + const char *path) +{ + EShellView *shell_view; + EShell *shell; + + shell_view = E_SHELL_VIEW (data); + shell = e_shell_view_get_shell (shell_view); + + g_warning ("Putting the shell online"); + e_shell_go_online (shell, shell_view); } @@ -498,6 +500,7 @@ BonoboUIVerb file_verbs [] = { BONOBO_UI_VERB ("FileExit", command_quit), BONOBO_UI_VERB ("WorkOffline", command_work_offline), + BONOBO_UI_VERB ("WorkOnline", command_work_online), BONOBO_UI_VERB_END }; @@ -516,7 +519,7 @@ static EPixmap pixmaps [] = { E_PIXMAP ("/menu/File/New/Folder", "folder.xpm"), E_PIXMAP ("/menu/File/Folder/Folder", "folder.xpm"), E_PIXMAP ("/menu/File/FileImporter", "import.xpm"), - E_PIXMAP ("/menu/File/WorkOffline", "work_offline.xpm"), + E_PIXMAP ("/menu/File/ToggleOffline", "work_offline.xpm"), E_PIXMAP_END }; @@ -542,6 +545,71 @@ menu_do_misc (BonoboUIComponent *component, } +/* The Work Online / Work Offline menu item. */ + +static void +update_offline_menu_item (EShellView *shell_view, + EShellLineStatus line_status) +{ + BonoboUIComponent *ui_component; + + ui_component = e_shell_view_get_bonobo_ui_component (shell_view); + + switch (line_status) { + case E_SHELL_LINE_STATUS_OFFLINE: + bonobo_ui_component_set_prop (ui_component, + "/menu/File/ToggleOffline", + "label", _("Work online"), NULL); + bonobo_ui_component_set_prop (ui_component, + "/menu/File/ToggleOffline", + "verb", "WorkOnline", NULL); + bonobo_ui_component_set_prop (ui_component, + "/commands/WorkOnline", + "sensitive", "1", NULL); + break; + + case E_SHELL_LINE_STATUS_ONLINE: + bonobo_ui_component_set_prop (ui_component, + "/menu/File/ToggleOffline", + "label", _("Work offline"), NULL); + bonobo_ui_component_set_prop (ui_component, + "/menu/File/ToggleOffline", + "verb", "WorkOffline", NULL); + bonobo_ui_component_set_prop (ui_component, + "/commands/WorkOffline", + "sensitive", "1", NULL); + break; + + case E_SHELL_LINE_STATUS_GOING_OFFLINE: + bonobo_ui_component_set_prop (ui_component, + "/menu/File/ToggleOffline", + "label", _("Work offline"), NULL); + bonobo_ui_component_set_prop (ui_component, + "/menu/File/ToggleOffline", + "verb", "WorkOffline", NULL); + bonobo_ui_component_set_prop (ui_component, + "/commands/WorkOffline", + "sensitive", "0", NULL); + break; + + default: + g_assert_not_reached (); + } +} + +static void +shell_line_status_changed_cb (EShell *shell, + EShellLineStatus new_status, + void *data) +{ + EShellView *shell_view; + + shell_view = E_SHELL_VIEW (data); + + update_offline_menu_item (shell_view, new_status); +} + + #define SHORTCUT_BAR_TOGGLE_PATH "/commands/ViewShortcutBar" #define FOLDER_BAR_TOGGLE_PATH "/commands/ViewFolderBar" @@ -549,11 +617,13 @@ void e_shell_view_menu_setup (EShellView *shell_view) { BonoboUIComponent *uic; + EShell *shell; g_return_if_fail (shell_view != NULL); g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); uic = e_shell_view_get_bonobo_ui_component (shell_view); + shell = e_shell_view_get_shell (shell_view); bonobo_ui_component_add_verb_list_with_data ( uic, file_verbs, shell_view); @@ -580,4 +650,9 @@ e_shell_view_menu_setup (EShellView *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); + + /* Set up the work online / work offline menu item. */ + gtk_signal_connect (GTK_OBJECT (shell), "line_status_changed", + GTK_SIGNAL_FUNC (shell_line_status_changed_cb), shell_view); + update_offline_menu_item (shell_view, e_shell_get_line_status (shell)); } diff --git a/shell/evolution-shell-component-client.c b/shell/evolution-shell-component-client.c index db92d0efaf..2163813575 100644 --- a/shell/evolution-shell-component-client.c +++ b/shell/evolution-shell-component-client.c @@ -477,7 +477,7 @@ evolution_shell_component_client_get_offline_interface (EvolutionShellComponentC CORBA_exception_init (&ev); interface = Bonobo_Unknown_queryInterface (bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)), - "IDL:GNOME/Evolution/ShellComponent/Offline:1.0", + "IDL:GNOME/Evolution/Offline:1.0", &ev); if (ev._major != CORBA_NO_EXCEPTION) |