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
This commit is contained in:
Ettore Perazzoli
2001-05-04 02:47:33 +00:00
parent 7cfacb2f84
commit be2f9a67f6
4 changed files with 120 additions and 21 deletions

View File

@ -1,3 +1,27 @@
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

View File

@ -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);

View File

@ -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
};
@ -541,6 +544,71 @@ menu_do_misc (BonoboUIComponent *component,
(BonoboUIVerbFn) command_xml_dump, shell_view);
}
/* 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));
}

View File

@ -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)