diff options
-rw-r--r-- | shell/ChangeLog | 18 | ||||
-rw-r--r-- | shell/Evolution-ShellComponent.idl | 2 | ||||
-rw-r--r-- | shell/e-shell.c | 65 | ||||
-rw-r--r-- | shell/evolution-shell-component.c | 27 | ||||
-rw-r--r-- | shell/evolution-shell-component.h | 3 |
5 files changed, 108 insertions, 7 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index 722455a97c..9ce52dd4d5 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,21 @@ +2001-10-22 Ettore Perazzoli <ettore@ximian.com> + + * e-shell.c: New member `is_interactive' in `EShellPrivate'. + (init): Init to %FALSE. + (set_interactive): New. + (e_shell_create_view): Make interactive. + (view_destroy_cb): If no views are left, make non-interactive. + + * evolution-shell-component.c (class_init): Set up the + "interactive" signal. + (impl_interactive): New implementation for the ::interactive + method. + (class_init): Install. + + * evolution-shell-component.h: New signal `interactive'. + + * Evolution-ShellComponent.idl: New method ::interactive. + 2001-10-19 Ettore Perazzoli <ettore@ximian.com> * e-storage-set-view.c (tree_drag_data_received): Pass the diff --git a/shell/Evolution-ShellComponent.idl b/shell/Evolution-ShellComponent.idl index d920e80956..04e45157c9 100644 --- a/shell/Evolution-ShellComponent.idl +++ b/shell/Evolution-ShellComponent.idl @@ -57,6 +57,8 @@ module Evolution { void unsetOwner () raises (NotOwned); + void interactive (in boolean now_interactive); + void debug (in string log_path); /* FIXME: We might want more exceptions here. */ diff --git a/shell/e-shell.c b/shell/e-shell.c index 510fbe14a3..2962824126 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -124,6 +124,11 @@ struct _EShellPrivate { the start-up sequence, to avoid CORBA calls to do make wrong things to happen while the shell is initializing. */ unsigned int is_initialized : 1; + + /* Wether the shell is working in "interactive" mode or not. + (Currently, it's interactive IIF there is at least one active + view.) */ + unsigned int is_interactive : 1; }; @@ -144,6 +149,49 @@ enum { static guint signals[LAST_SIGNAL] = { 0 }; +/* Interactivity handling. */ + +static void +set_interactive (EShell *shell, + gboolean interactive) +{ + EShellPrivate *priv; + GList *id_list, *p; + + priv = shell->priv; + + if (!! priv->is_interactive == !! interactive) + return; + + priv->is_interactive = interactive; + + id_list = e_component_registry_get_id_list (priv->component_registry); + for (p = id_list; p != NULL; p = p->next) { + EvolutionShellComponentClient *shell_component_client; + GNOME_Evolution_ShellComponent shell_component_objref; + const char *id; + CORBA_Environment ev; + + id = (const char *) p->data; + shell_component_client = e_component_registry_get_component_by_id (priv->component_registry, id); + shell_component_objref = bonobo_object_corba_objref (BONOBO_OBJECT (shell_component_client)); + + CORBA_exception_init (&ev); + + g_print ("Notifying interactive change (%s) -- %s\n", interactive ? "TRUE" : "FALSE", id); + + GNOME_Evolution_ShellComponent_interactive (shell_component_objref, interactive, &ev); + if (ev._major != CORBA_NO_EXCEPTION) + g_warning ("Error changing interactive status of component %s to %s -- %s\n", + id, interactive ? "TRUE" : "FALSE", ev._repo_id); + + CORBA_exception_free (&ev); + } + + e_free_string_list (id_list); +} + + /* Callback for the folder selection dialog. */ static void @@ -430,7 +478,6 @@ impl_Shell_selectUserFolder (PortableServer_Servant servant, } else { XClassHint class_hints; XWMHints *parent_wm_hints; - int format; /* Set the WM class and the WindowGroup hint to be the same as the foreign parent window's. This way smartass window @@ -800,6 +847,8 @@ view_destroy_cb (GtkObject *object, shell->priv->views = g_list_remove (shell->priv->views, object); if (shell->priv->views == NULL) { + set_interactive (shell, FALSE); + bonobo_object_ref (BONOBO_OBJECT (shell)); gtk_signal_emit (GTK_OBJECT (shell), signals [NO_VIEWS_LEFT]); bonobo_object_unref (BONOBO_OBJECT (shell)); @@ -954,6 +1003,7 @@ init (EShell *shell) priv->line_status = E_SHELL_LINE_STATUS_ONLINE; priv->db = CORBA_OBJECT_NIL; priv->is_initialized = FALSE; + priv->is_interactive = FALSE; shell->priv = priv; } @@ -1169,12 +1219,13 @@ e_shell_create_view (EShell *shell, gtk_signal_connect (GTK_OBJECT (view), "destroy", GTK_SIGNAL_FUNC (view_destroy_cb), shell); - if (uri != NULL) - if (!e_shell_view_display_uri (E_SHELL_VIEW (view), uri)) - /* FIXME: Consider popping a dialog box up - about how the provided URI does not - exist/could not be displayed */ + if (uri != NULL) { + if (!e_shell_view_display_uri (E_SHELL_VIEW (view), uri)) { + /* FIXME: Consider popping a dialog box up about how the provided URI does not + exist/could not be displayed. */ e_shell_view_display_uri (E_SHELL_VIEW (view), E_SHELL_VIEW_DEFAULT_URI); + } + } shell->priv->views = g_list_prepend (shell->priv->views, view); @@ -1186,6 +1237,8 @@ e_shell_create_view (EShell *shell, e_shell_view_show_shortcut_bar (view, e_shell_view_shortcut_bar_shown (template_view)); } + set_interactive (shell, TRUE); + return view; } diff --git a/shell/evolution-shell-component.c b/shell/evolution-shell-component.c index 793e579732..2526ba61b6 100644 --- a/shell/evolution-shell-component.c +++ b/shell/evolution-shell-component.c @@ -79,6 +79,7 @@ enum { OWNER_UNSET, OWNER_DIED, DEBUG, + INTERACTIVE, HANDLE_EXTERNAL_URI, USER_CREATE_NEW_ITEM, LAST_SIGNAL @@ -436,6 +437,20 @@ impl_debug (PortableServer_Servant servant, gtk_signal_emit (GTK_OBJECT (shell_component), signals[DEBUG]); } +static void +impl_interactive (PortableServer_Servant servant, + CORBA_boolean interactive, + CORBA_Environment *ev) +{ + BonoboObject *bonobo_object; + EvolutionShellComponent *shell_component; + + bonobo_object = bonobo_object_from_servant (servant); + shell_component = EVOLUTION_SHELL_COMPONENT (bonobo_object); + + gtk_signal_emit (GTK_OBJECT (shell_component), signals[INTERACTIVE], interactive); +} + static Bonobo_Control impl_createView (PortableServer_Servant servant, const CORBA_char *physical_uri, @@ -738,6 +753,15 @@ class_init (EvolutionShellComponentClass *klass) gtk_marshal_NONE__NONE, GTK_TYPE_NONE, 0); + signals[INTERACTIVE] + = gtk_signal_new ("interactive", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EvolutionShellComponentClass, interactive), + gtk_marshal_NONE__BOOL, + GTK_TYPE_NONE, 1, + GTK_TYPE_BOOL); + signals[HANDLE_EXTERNAL_URI] = gtk_signal_new ("handle_external_uri", GTK_RUN_FIRST, @@ -767,7 +791,8 @@ class_init (EvolutionShellComponentClass *klass) epv->_get_userCreatableItemTypes = impl__get_userCreatableItemTypes; epv->setOwner = impl_setOwner; epv->unsetOwner = impl_unsetOwner; - epv->debug = impl_debug; + epv->debug = impl_debug; + epv->interactive = impl_interactive; epv->createView = impl_createView; epv->handleExternalURI = impl_handleExternalURI; epv->createFolderAsync = impl_createFolderAsync; diff --git a/shell/evolution-shell-component.h b/shell/evolution-shell-component.h index bf8eaf4776..aebc161b82 100644 --- a/shell/evolution-shell-component.h +++ b/shell/evolution-shell-component.h @@ -143,6 +143,9 @@ struct _EvolutionShellComponentClass { void (* debug) (EvolutionShellComponent *shell_component); + void (* interactive) (EvolutionShellComponent *shell_component, + gboolean is_interactive); + void (* handle_external_uri) (EvolutionShellComponent *shell_component, const char *uri); |