From bd6359c660895ea0765c216563957c3a2f44e112 Mon Sep 17 00:00:00 2001 From: JP Rosevear Date: Thu, 18 Apr 2002 18:57:45 +0000 Subject: emit show_settings signal (corba_class_init): assign epv method 2002-04-18 JP Rosevear * evolution-shell-view.c (impl_ShellView_show_settings): emit show_settings signal (corba_class_init): assign epv method (class_init): add signal * evolution-shell-view.h: new signal * e-shell.c (init): init settings_dialog private member (settings_dialog_destroy_cb): reset dialog pointer (e_shell_show_settings): show the settings dialog, bring it to the front if one already exists for this shell * e-shell.h: new proto * e-shell-view.c (corba_interface_show_settings): implement showSettings method (setup_corba_interface): listen for show_settings signal (e_shell_view_show_settings): show the settings dialog * e-shell-view.h: new proto * e-shell-view-menu.c (command_settings): call e_shell_view_show_settings instead * Evolution-ShellView.idl: add showSettings method svn path=/trunk/; revision=16510 --- shell/ChangeLog | 28 +++++++++++++++++++++++++++ shell/Evolution-ShellView.idl | 1 + shell/e-shell-view-menu.c | 12 +----------- shell/e-shell-view.c | 34 ++++++++++++++++++++++++++++++++ shell/e-shell-view.h | 2 ++ shell/e-shell.c | 45 +++++++++++++++++++++++++++++++++++++++++++ shell/e-shell.h | 5 ++++- shell/evolution-shell-view.c | 20 +++++++++++++++++++ shell/evolution-shell-view.h | 1 + 9 files changed, 136 insertions(+), 12 deletions(-) (limited to 'shell') diff --git a/shell/ChangeLog b/shell/ChangeLog index c066965a10..05cc90f0c8 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,31 @@ +2002-04-18 JP Rosevear + + * evolution-shell-view.c (impl_ShellView_show_settings): emit + show_settings signal + (corba_class_init): assign epv method + (class_init): add signal + + * evolution-shell-view.h: new signal + + * e-shell.c (init): init settings_dialog private member + (settings_dialog_destroy_cb): reset dialog pointer + (e_shell_show_settings): show the settings dialog, bring it to the + front if one already exists for this shell + + * e-shell.h: new proto + + * e-shell-view.c (corba_interface_show_settings): implement + showSettings method + (setup_corba_interface): listen for show_settings signal + (e_shell_view_show_settings): show the settings dialog + + * e-shell-view.h: new proto + + * e-shell-view-menu.c (command_settings): call + e_shell_view_show_settings instead + + * Evolution-ShellView.idl: add showSettings method + 2002-04-17 Ettore Perazzoli * e-shortcuts-view.c (impl_shortcut_drag_motion): New, override diff --git a/shell/Evolution-ShellView.idl b/shell/Evolution-ShellView.idl index 685604e601..026888913c 100644 --- a/shell/Evolution-ShellView.idl +++ b/shell/Evolution-ShellView.idl @@ -19,6 +19,7 @@ module Evolution { void changeCurrentView (in string uri); void setTitle (in string title); void setFolderBarLabel (in string text); + void showSettings (); }; }; }; diff --git a/shell/e-shell-view-menu.c b/shell/e-shell-view-menu.c index 236044ae0c..5869048abf 100644 --- a/shell/e-shell-view-menu.c +++ b/shell/e-shell-view-menu.c @@ -33,8 +33,6 @@ #include "e-shell-folder-creation-dialog.h" #include "e-shell-folder-selection-dialog.h" -#include "e-shell-settings-dialog.h" - #include "e-shell-constants.h" #include "e-shell-importer.h" @@ -588,18 +586,10 @@ command_settings (BonoboUIComponent *uih, const char *path) { EShellView *shell_view; - GtkWidget *dialog; - const char *type; shell_view = E_SHELL_VIEW (data); - type = e_shell_view_get_current_folder_type (shell_view); - dialog = e_shell_settings_dialog_new (); - e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (dialog), type); - - gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (shell_view)); - - gtk_widget_show (dialog); + e_shell_view_show_settings (shell_view); } static void diff --git a/shell/e-shell-view.c b/shell/e-shell-view.c index 0125004d8a..07ef3d2aa4 100644 --- a/shell/e-shell-view.c +++ b/shell/e-shell-view.c @@ -1517,6 +1517,22 @@ corba_interface_set_folder_bar_label (EvolutionShellView *evolution_shell_view, text); } +static void +corba_interface_show_settings (EvolutionShellView *evolution_shell_view, + void *data) +{ + EShellView *shell_view; + EShellViewPrivate *priv; + + g_return_if_fail (data != NULL); + g_return_if_fail (E_IS_SHELL_VIEW (data)); + + shell_view = E_SHELL_VIEW (data); + priv = shell_view->priv; + + e_shell_view_show_settings (shell_view); +} + static void unmerge_on_error (BonoboObject *object, CORBA_Object cobject, @@ -1945,6 +1961,9 @@ setup_corba_interface (EShellView *shell_view, gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "set_folder_bar_label", GTK_SIGNAL_FUNC (corba_interface_set_folder_bar_label), shell_view, GTK_OBJECT (shell_view)); + gtk_signal_connect_while_alive (GTK_OBJECT (corba_interface), "show_settings", + GTK_SIGNAL_FUNC (corba_interface_show_settings), + shell_view, GTK_OBJECT (shell_view)); bonobo_object_add_interface (BONOBO_OBJECT (control_frame), BONOBO_OBJECT (corba_interface)); @@ -2349,6 +2368,21 @@ e_shell_view_show_folder_bar (EShellView *shell_view, priv->folder_bar_shown); } +void +e_shell_view_show_settings (EShellView *shell_view) +{ + EShellViewPrivate *priv; + const char *type; + + g_return_if_fail (shell_view != NULL); + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + + priv = shell_view->priv; + + type = e_shell_view_get_current_folder_type (shell_view); + e_shell_show_settings (priv->shell, type, shell_view); +} + gboolean e_shell_view_shortcut_bar_shown (EShellView *shell_view) { diff --git a/shell/e-shell-view.h b/shell/e-shell-view.h index 85a5c9ac95..fc32fc0ab5 100644 --- a/shell/e-shell-view.h +++ b/shell/e-shell-view.h @@ -94,6 +94,8 @@ void e_shell_view_show_folder_bar (EShellView *shell_view, gboolean show); gboolean e_shell_view_folder_bar_shown (EShellView *shell_view); +void e_shell_view_show_settings (EShellView *shell_view); + ETaskBar *e_shell_view_get_task_bar (EShellView *shell_view); EShell *e_shell_view_get_shell (EShellView *shell_view); BonoboUIComponent *e_shell_view_get_bonobo_ui_component (EShellView *shell_view); diff --git a/shell/e-shell.c b/shell/e-shell.c index a129d7a8d9..4b561078c6 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -62,6 +62,7 @@ #include "e-shell-corba-icon-utils.h" #include "e-shell-folder-selection-dialog.h" #include "e-shell-offline-handler.h" +#include "e-shell-settings-dialog.h" #include "e-shell-startup-wizard.h" #include "e-shell-view.h" #include "e-shortcuts.h" @@ -119,6 +120,9 @@ struct _EShellPrivate { /* Line status. */ EShellLineStatus line_status; + /* Settings Dialog */ + GtkWidget *settings_dialog; + /* Configuration Database */ Bonobo_ConfigDatabase db; @@ -1165,6 +1169,7 @@ init (EShell *shell) priv->offline_handler = NULL; priv->crash_type_names = NULL; priv->line_status = E_SHELL_LINE_STATUS_OFFLINE; + priv->settings_dialog = NULL; priv->db = CORBA_OBJECT_NIL; priv->is_initialized = FALSE; priv->is_interactive = FALSE; @@ -2014,6 +2019,46 @@ e_shell_send_receive (EShell *shell) e_free_string_list (id_list); } +static void +settings_dialog_destroy_cb (GtkWidget *widget, void *data) +{ + EShell *shell; + EShellPrivate *priv; + + shell = E_SHELL (data); + priv = shell->priv; + + priv->settings_dialog = NULL; +} + +void +e_shell_show_settings (EShell *shell, const char *type, EShellView *shell_view) +{ + EShellPrivate *priv; + + g_return_if_fail (shell != NULL); + g_return_if_fail (E_IS_SHELL (shell)); + g_return_if_fail (type != NULL); + + priv = shell->priv; + + if (priv->settings_dialog != NULL) { + gdk_window_show (priv->settings_dialog->window); + gtk_widget_grab_focus (priv->settings_dialog); + return; + } + + priv->settings_dialog = e_shell_settings_dialog_new (); + e_shell_settings_dialog_show_type (E_SHELL_SETTINGS_DIALOG (priv->settings_dialog), type); + + gtk_signal_connect (GTK_OBJECT (priv->settings_dialog), "destroy", + GTK_SIGNAL_FUNC (settings_dialog_destroy_cb), shell); + + gtk_window_set_transient_for (GTK_WINDOW (priv->settings_dialog), GTK_WINDOW (shell_view)); + gtk_widget_show (priv->settings_dialog); + +} + Bonobo_ConfigDatabase e_shell_get_config_db (EShell *shell) diff --git a/shell/e-shell.h b/shell/e-shell.h index ef4bd8d709..bf211f886b 100644 --- a/shell/e-shell.h +++ b/shell/e-shell.h @@ -141,7 +141,10 @@ void e_shell_go_offline (EShell *shell, void e_shell_go_online (EShell *shell, EShellView *action_view); -void e_shell_send_receive (EShell *shell); +void e_shell_send_receive (EShell *shell); +void e_shell_show_settings (EShell *shell, + const char *type, + EShellView *shell_view); Bonobo_ConfigDatabase e_shell_get_config_db (EShell *shell); EComponentRegistry *e_shell_get_component_registry (EShell *shell); diff --git a/shell/evolution-shell-view.c b/shell/evolution-shell-view.c index f0d3eb32f5..8925438b5a 100644 --- a/shell/evolution-shell-view.c +++ b/shell/evolution-shell-view.c @@ -44,6 +44,7 @@ enum { CHANGE_VIEW, SET_TITLE, SET_FOLDER_BAR_LABEL, + SHOW_SETTINGS, LAST_SIGNAL }; static int signals[LAST_SIGNAL] = { 0 }; @@ -133,6 +134,16 @@ impl_ShellView_set_folder_bar_label (PortableServer_Servant servant, text); } +static void +impl_ShellView_show_settings (PortableServer_Servant servant, + CORBA_Environment *ev) +{ + BonoboObject *bonobo_object; + + bonobo_object = bonobo_object_from_servant (servant); + gtk_signal_emit (GTK_OBJECT (bonobo_object), signals[SHOW_SETTINGS]); +} + /* GtkObject methods. */ static void @@ -168,6 +179,7 @@ corba_class_init (void) epv->changeCurrentView = impl_ShellView_change_current_view; epv->setTitle = impl_ShellView_set_title; epv->setFolderBarLabel = impl_ShellView_set_folder_bar_label; + epv->showSettings = impl_ShellView_show_settings; vepv = &ShellView_vepv; vepv->_base_epv = base_epv; @@ -228,6 +240,14 @@ class_init (EvolutionShellViewClass *klass) GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + signals[SHOW_SETTINGS] + = gtk_signal_new ("show_settings", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EvolutionShellViewClass, show_settings), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); parent_class = gtk_type_class (bonobo_object_get_type ()); diff --git a/shell/evolution-shell-view.h b/shell/evolution-shell-view.h index 3d20ee3d4d..bcf38fd417 100644 --- a/shell/evolution-shell-view.h +++ b/shell/evolution-shell-view.h @@ -59,6 +59,7 @@ struct _EvolutionShellViewClass { void (* change_current_view) (EvolutionShellView *shell_view, const char *uri); void (* set_title) (EvolutionShellView *shell_view, const char *message); void (* set_folder_bar_label) (EvolutionShellView *shell_view, const char *text); + void (* show_settings) (EvolutionShellView *shell_view); }; -- cgit v1.2.3