aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2003-11-11 09:01:11 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2003-11-11 09:01:11 +0800
commita99f0c42908ca1d5e923164c624f34cc770bef4f (patch)
tree133ea3ae8f73acf6649ee8c1f2aeda120206144d
parentb1c26ce2bde7fffcd39cc185cc8670e767d190ba (diff)
downloadgsoc2013-evolution-a99f0c42908ca1d5e923164c624f34cc770bef4f.tar.gz
gsoc2013-evolution-a99f0c42908ca1d5e923164c624f34cc770bef4f.tar.zst
gsoc2013-evolution-a99f0c42908ca1d5e923164c624f34cc770bef4f.zip
Added a new "-c" command-line arg. (idle_cb): If the arg is specified,
* main.c: Added a new "-c" command-line arg. (idle_cb): If the arg is specified, open the component with that id/alias. * e-shell.c (impl_Shell_createNewView): New, implementation for the Shell::createNewView() CORBA method. (e_shell_class_init): Install. (e_shell_create_window): Get a component_id arg. * e-shell-window.c (e_shell_window_new): Get a component_id arg and create the window with that component activated if not NULL. * Evolution-Shell.idl (createNewView): Remove. (createNewWindow): New. svn path=/trunk/; revision=23274
-rw-r--r--shell/ChangeLog17
-rw-r--r--shell/Evolution-Shell.idl18
-rw-r--r--shell/e-shell-window.c32
-rw-r--r--shell/e-shell-window.h3
-rw-r--r--shell/e-shell.c56
-rw-r--r--shell/e-shell.h1
-rw-r--r--shell/main.c50
7 files changed, 76 insertions, 101 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 1a5a3110d6..0212982d6f 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,22 @@
2003-11-10 Ettore Perazzoli <ettore@ximian.com>
+ * main.c: Added a new "-c" command-line arg.
+ (idle_cb): If the arg is specified, open the component with that
+ id/alias.
+
+ * e-shell.c (impl_Shell_createNewView): New, implementation for
+ the Shell::createNewView() CORBA method.
+ (e_shell_class_init): Install.
+ (e_shell_create_window): Get a component_id arg.
+
+ * e-shell-window.c (e_shell_window_new): Get a component_id arg
+ and create the window with that component activated if not NULL.
+
+ * Evolution-Shell.idl (createNewView): Remove.
+ (createNewWindow): New.
+
+2003-11-10 Ettore Perazzoli <ettore@ximian.com>
+
* e-shell-window.c (struct _ComponentView): New member
"component_alias".
(component_view_new): Get a new "alias" arg, set the member in the
diff --git a/shell/Evolution-Shell.idl b/shell/Evolution-Shell.idl
index dd3f44838c..5f2690afe4 100644
--- a/shell/Evolution-Shell.idl
+++ b/shell/Evolution-Shell.idl
@@ -13,21 +13,21 @@
module GNOME {
module Evolution {
interface Shell : Bonobo::Unknown {
- exception NotReady {};
+ exception Busy {};
+ exception ComponentNotFound {};
+ exception InternalError {};
+ exception InvalidURI {};
exception NotFound {};
+ exception NotReady {};
exception UnsupportedSchema {};
- exception InvalidURI {};
- exception InternalError {};
- exception Busy {};
/**
- * createNewView:
- * @uri: URI for the view to open
+ * createNewWindow:
+ * @component_id: id or alias of the component to display in the new window.
*
- * Return value: the new view.
*/
- ShellView createNewView (in string uri)
- raises (NotReady, NotFound, UnsupportedSchema, InvalidURI, InternalError);
+ void createNewWindow (in string component_id)
+ raises (NotReady, ComponentNotFound, UnsupportedSchema, InternalError);
/**
* handleURI:
diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c
index 0e8dea989e..158ef3b485 100644
--- a/shell/e-shell-window.c
+++ b/shell/e-shell-window.c
@@ -389,13 +389,12 @@ init (EShellWindow *shell_window)
/* Instantiation. */
GtkWidget *
-e_shell_window_new (EShell *shell)
+e_shell_window_new (EShell *shell,
+ const char *component_id)
{
EShellWindow *window = g_object_new (e_shell_window_get_type (), NULL);
EShellWindowPrivate *priv = window->priv;
BonoboUIContainer *ui_container;
- GConfClient *gconf_client;
- char *default_component_id;
if (bonobo_window_construct (BONOBO_WINDOW (window),
bonobo_ui_container_new (),
@@ -428,17 +427,24 @@ e_shell_window_new (EShell *shell)
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
- gconf_client = gconf_client_get_default ();
- default_component_id = gconf_client_get_string (gconf_client,
- "/apps/evolution/shell/view_defaults/component_id",
- NULL);
- g_object_unref (gconf_client);
-
- if (default_component_id == NULL) {
- e_shell_window_switch_to_component (window, "mail");
+ if (component_id != NULL) {
+ e_shell_window_switch_to_component (window, component_id);
} else {
- e_shell_window_switch_to_component (window, default_component_id);
- g_free (default_component_id);
+ GConfClient *gconf_client;
+ char *default_component_id;
+
+ gconf_client = gconf_client_get_default ();
+ default_component_id = gconf_client_get_string (gconf_client,
+ "/apps/evolution/shell/view_defaults/component_id",
+ NULL);
+ g_object_unref (gconf_client);
+
+ if (default_component_id == NULL) {
+ e_shell_window_switch_to_component (window, "mail");
+ } else {
+ e_shell_window_switch_to_component (window, default_component_id);
+ g_free (default_component_id);
+ }
}
return GTK_WIDGET (window);
diff --git a/shell/e-shell-window.h b/shell/e-shell-window.h
index 1a012fe20a..2d1848b034 100644
--- a/shell/e-shell-window.h
+++ b/shell/e-shell-window.h
@@ -52,7 +52,8 @@ struct _EShellWindowClass {
GType e_shell_window_get_type (void);
-GtkWidget *e_shell_window_new (EShell *shell);
+GtkWidget *e_shell_window_new (EShell *shell,
+ const char *component_id);
void e_shell_window_switch_to_component (EShellWindow *shell,
const char *component_id);
diff --git a/shell/e-shell.c b/shell/e-shell.c
index 6c864124b9..d4b8fdf131 100644
--- a/shell/e-shell.c
+++ b/shell/e-shell.c
@@ -166,52 +166,27 @@ raise_exception_if_not_ready (PortableServer_Servant servant,
return FALSE;
}
-static GNOME_Evolution_ShellView
-impl_Shell_createNewView (PortableServer_Servant servant,
- const CORBA_char *uri,
- CORBA_Environment *ev)
+static void
+impl_Shell_createNewWindow (PortableServer_Servant servant,
+ const CORBA_char *component_id,
+ CORBA_Environment *ev)
{
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_InternalError, NULL);
-
- return CORBA_OBJECT_NIL;
-
-#if 0 /* FIXME */
BonoboObject *bonobo_object;
EShell *shell;
EShellWindow *shell_window;
- GNOME_Evolution_ShellView shell_view_interface;
if (raise_exception_if_not_ready (servant, ev))
- return CORBA_OBJECT_NIL;
+ return;
bonobo_object = bonobo_object_from_servant (servant);
shell = E_SHELL (bonobo_object);
- if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_UnsupportedSchema,
- NULL);
- return CORBA_OBJECT_NIL;
- }
-
- shell_window = e_shell_create_window (shell, uri, NULL);
+ shell_window = e_shell_create_window (shell, component_id, NULL);
if (shell_window == NULL) {
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_NotFound, NULL);
- return CORBA_OBJECT_NIL;
- }
-
- shell_window_interface = e_shell_window_get_corba_interface (shell_window);
- if (shell_window_interface == CORBA_OBJECT_NIL) {
- CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
- ex_GNOME_Evolution_Shell_InternalError, NULL);
- return CORBA_OBJECT_NIL;
+ ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
+ return;
}
-
- Bonobo_Unknown_ref (shell_window_interface, ev);
- return CORBA_Object_duplicate ((CORBA_Object) shell_window_interface, ev);
-#endif
}
static void
@@ -233,7 +208,7 @@ impl_Shell_handleURI (PortableServer_Servant servant,
if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0
|| strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0) {
- e_shell_create_window (shell, NULL);
+ e_shell_create_window (shell, NULL, NULL);
return;
}
@@ -344,6 +319,7 @@ window_weak_notify (void *data,
static EShellWindow *
create_window (EShell *shell,
+ const char *component_id,
EShellWindow *template_window)
{
EShellPrivate *priv;
@@ -351,7 +327,7 @@ create_window (EShell *shell,
priv = shell->priv;
- window = E_SHELL_WINDOW (e_shell_window_new (shell));
+ window = E_SHELL_WINDOW (e_shell_window_new (shell, component_id));
g_signal_connect (window, "delete_event", G_CALLBACK (window_delete_event_cb), shell);
g_object_weak_ref (G_OBJECT (window), window_weak_notify, shell);
@@ -473,9 +449,9 @@ e_shell_class_init (EShellClass *klass)
G_TYPE_POINTER);
epv = & klass->epv;
- epv->createNewView = impl_Shell_createNewView;
- epv->handleURI = impl_Shell_handleURI;
- epv->setLineStatus = impl_Shell_setLineStatus;
+ epv->createNewWindow = impl_Shell_createNewWindow;
+ epv->handleURI = impl_Shell_handleURI;
+ epv->setLineStatus = impl_Shell_setLineStatus;
}
static void
@@ -601,6 +577,7 @@ e_shell_new (EShellStartupLineMode startup_line_mode,
/**
* e_shell_create_window:
* @shell: The shell for which to create a new window.
+ * @component_id: Id or alias of the component to display in the new window.
* @template_window: Window from which to copy the window settings (can be %NULL).
*
* Create a new window for @uri.
@@ -609,6 +586,7 @@ e_shell_new (EShellStartupLineMode startup_line_mode,
**/
EShellWindow *
e_shell_create_window (EShell *shell,
+ const char *component_id,
EShellWindow *template_window)
{
EShellWindow *window;
@@ -621,7 +599,7 @@ e_shell_create_window (EShell *shell,
priv = shell->priv;
- window = create_window (shell, template_window);
+ window = create_window (shell, component_id, template_window);
gtk_widget_show (GTK_WIDGET (window));
diff --git a/shell/e-shell.h b/shell/e-shell.h
index a25ef1a168..add8c3e425 100644
--- a/shell/e-shell.h
+++ b/shell/e-shell.h
@@ -102,6 +102,7 @@ EShell *e_shell_new (EShellStartupLineMode startup_line_m
EShellConstructResult *construct_result_return);
EShellWindow *e_shell_create_window (EShell *shell,
+ const char *component_id,
EShellWindow *template_window);
gboolean e_shell_request_close_window (EShell *shell,
EShellWindow *window);
diff --git a/shell/main.c b/shell/main.c
index 8a6d011cb6..3c7e3678ee 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -85,6 +85,7 @@ static gboolean start_online = FALSE;
static gboolean start_offline = FALSE;
static gboolean setup_only = FALSE;
static gboolean killev = FALSE;
+static char *default_component_id = NULL;
extern char *evolution_debug_log;
@@ -404,35 +405,15 @@ idle_cb (void *data)
}
have_evolution_uri = FALSE;
- displayed_any = FALSE;
- for (p = uri_list; p != NULL; p = p->next) {
- const char *uri;
-
- uri = (const char *) p->data;
- if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0 ||
- strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0)
- have_evolution_uri = TRUE;
- }
+ if (uri_list == NULL && shell != NULL)
+ e_shell_create_window (shell, default_component_id, NULL);
+ else {
+ CORBA_Environment ev;
- if (shell == NULL) {
- /* We're talking to a remote shell. If the user didn't ask us to open any particular
- URI, then open another view of the default URI. */
- if (uri_list == NULL)
- display_default = TRUE;
- else
- display_default = FALSE;
- } else {
- /* We're starting a new shell. If the user didn't specify any evolution: URIs to
- view, AND we can't load the user's previous settings, then show the default
- URI. */
- if (! have_evolution_uri) {
- e_shell_create_window (shell, NULL);
- display_default = TRUE;
- displayed_any = TRUE;
- } else {
- display_default = FALSE;
- }
+ CORBA_exception_init (&ev);
+ GNOME_Evolution_Shell_createNewWindow (corba_shell, default_component_id, &ev);
+ CORBA_exception_free (&ev);
}
for (p = uri_list; p != NULL; p = p->next) {
@@ -440,9 +421,7 @@ idle_cb (void *data)
uri = (const char *) p->data;
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
- if (ev._major == CORBA_NO_EXCEPTION)
- displayed_any = TRUE;
- else {
+ if (ev._major == CORBA_NO_EXCEPTION) {
g_warning ("CORBA exception %s when requesting URI -- %s",
BONOBO_EX_REPOID (&ev), uri);
CORBA_exception_free (&ev);
@@ -451,15 +430,6 @@ idle_cb (void *data)
g_slist_free (uri_list);
- if (display_default && ! displayed_any) {
- const char *uri;
-
- uri = E_SHELL_VIEW_DEFAULT_URI;
- GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
- if (ev._major != CORBA_NO_EXCEPTION)
- g_warning ("CORBA exception %s when requesting URI -- %s", BONOBO_EX_REPOID (&ev), uri);
- }
-
CORBA_Object_release (corba_shell, &ev);
CORBA_exception_free (&ev);
@@ -526,6 +496,8 @@ int
main (int argc, char **argv)
{
struct poptOption options[] = {
+ { "component", 'c', POPT_ARG_STRING, &default_component_id, 0,
+ N_("Start Evolution activating the specified component"), NULL },
{ "offline", '\0', POPT_ARG_NONE, &start_offline, 0,
N_("Start in offline mode"), NULL },
{ "online", '\0', POPT_ARG_NONE, &start_online, 0,