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
This commit is contained in:
@ -1,3 +1,20 @@
|
|||||||
|
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>
|
2003-11-10 Ettore Perazzoli <ettore@ximian.com>
|
||||||
|
|
||||||
* e-shell-window.c (struct _ComponentView): New member
|
* e-shell-window.c (struct _ComponentView): New member
|
||||||
|
@ -13,21 +13,21 @@
|
|||||||
module GNOME {
|
module GNOME {
|
||||||
module Evolution {
|
module Evolution {
|
||||||
interface Shell : Bonobo::Unknown {
|
interface Shell : Bonobo::Unknown {
|
||||||
exception NotReady {};
|
|
||||||
exception NotFound {};
|
|
||||||
exception UnsupportedSchema {};
|
|
||||||
exception InvalidURI {};
|
|
||||||
exception InternalError {};
|
|
||||||
exception Busy {};
|
exception Busy {};
|
||||||
|
exception ComponentNotFound {};
|
||||||
|
exception InternalError {};
|
||||||
|
exception InvalidURI {};
|
||||||
|
exception NotFound {};
|
||||||
|
exception NotReady {};
|
||||||
|
exception UnsupportedSchema {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* createNewView:
|
* createNewWindow:
|
||||||
* @uri: URI for the view to open
|
* @component_id: id or alias of the component to display in the new window.
|
||||||
*
|
*
|
||||||
* Return value: the new view.
|
|
||||||
*/
|
*/
|
||||||
ShellView createNewView (in string uri)
|
void createNewWindow (in string component_id)
|
||||||
raises (NotReady, NotFound, UnsupportedSchema, InvalidURI, InternalError);
|
raises (NotReady, ComponentNotFound, UnsupportedSchema, InternalError);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* handleURI:
|
* handleURI:
|
||||||
|
@ -389,13 +389,12 @@ init (EShellWindow *shell_window)
|
|||||||
/* Instantiation. */
|
/* Instantiation. */
|
||||||
|
|
||||||
GtkWidget *
|
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);
|
EShellWindow *window = g_object_new (e_shell_window_get_type (), NULL);
|
||||||
EShellWindowPrivate *priv = window->priv;
|
EShellWindowPrivate *priv = window->priv;
|
||||||
BonoboUIContainer *ui_container;
|
BonoboUIContainer *ui_container;
|
||||||
GConfClient *gconf_client;
|
|
||||||
char *default_component_id;
|
|
||||||
|
|
||||||
if (bonobo_window_construct (BONOBO_WINDOW (window),
|
if (bonobo_window_construct (BONOBO_WINDOW (window),
|
||||||
bonobo_ui_container_new (),
|
bonobo_ui_container_new (),
|
||||||
@ -428,17 +427,24 @@ e_shell_window_new (EShell *shell)
|
|||||||
|
|
||||||
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
|
gtk_window_set_default_size (GTK_WINDOW (window), 640, 480);
|
||||||
|
|
||||||
gconf_client = gconf_client_get_default ();
|
if (component_id != NULL) {
|
||||||
default_component_id = gconf_client_get_string (gconf_client,
|
e_shell_window_switch_to_component (window, component_id);
|
||||||
"/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 {
|
} else {
|
||||||
e_shell_window_switch_to_component (window, default_component_id);
|
GConfClient *gconf_client;
|
||||||
g_free (default_component_id);
|
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);
|
return GTK_WIDGET (window);
|
||||||
|
@ -52,7 +52,8 @@ struct _EShellWindowClass {
|
|||||||
|
|
||||||
GType e_shell_window_get_type (void);
|
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,
|
void e_shell_window_switch_to_component (EShellWindow *shell,
|
||||||
const char *component_id);
|
const char *component_id);
|
||||||
|
@ -166,52 +166,27 @@ raise_exception_if_not_ready (PortableServer_Servant servant,
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static GNOME_Evolution_ShellView
|
static void
|
||||||
impl_Shell_createNewView (PortableServer_Servant servant,
|
impl_Shell_createNewWindow (PortableServer_Servant servant,
|
||||||
const CORBA_char *uri,
|
const CORBA_char *component_id,
|
||||||
CORBA_Environment *ev)
|
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;
|
BonoboObject *bonobo_object;
|
||||||
EShell *shell;
|
EShell *shell;
|
||||||
EShellWindow *shell_window;
|
EShellWindow *shell_window;
|
||||||
GNOME_Evolution_ShellView shell_view_interface;
|
|
||||||
|
|
||||||
if (raise_exception_if_not_ready (servant, ev))
|
if (raise_exception_if_not_ready (servant, ev))
|
||||||
return CORBA_OBJECT_NIL;
|
return;
|
||||||
|
|
||||||
bonobo_object = bonobo_object_from_servant (servant);
|
bonobo_object = bonobo_object_from_servant (servant);
|
||||||
shell = E_SHELL (bonobo_object);
|
shell = E_SHELL (bonobo_object);
|
||||||
|
|
||||||
if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) != 0) {
|
shell_window = e_shell_create_window (shell, component_id, NULL);
|
||||||
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);
|
|
||||||
if (shell_window == NULL) {
|
if (shell_window == NULL) {
|
||||||
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
CORBA_exception_set (ev, CORBA_USER_EXCEPTION,
|
||||||
ex_GNOME_Evolution_Shell_NotFound, NULL);
|
ex_GNOME_Evolution_Shell_ComponentNotFound, NULL);
|
||||||
return CORBA_OBJECT_NIL;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
Bonobo_Unknown_ref (shell_window_interface, ev);
|
|
||||||
return CORBA_Object_duplicate ((CORBA_Object) shell_window_interface, ev);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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
|
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) {
|
|| 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -344,6 +319,7 @@ window_weak_notify (void *data,
|
|||||||
|
|
||||||
static EShellWindow *
|
static EShellWindow *
|
||||||
create_window (EShell *shell,
|
create_window (EShell *shell,
|
||||||
|
const char *component_id,
|
||||||
EShellWindow *template_window)
|
EShellWindow *template_window)
|
||||||
{
|
{
|
||||||
EShellPrivate *priv;
|
EShellPrivate *priv;
|
||||||
@ -351,7 +327,7 @@ create_window (EShell *shell,
|
|||||||
|
|
||||||
priv = shell->priv;
|
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_signal_connect (window, "delete_event", G_CALLBACK (window_delete_event_cb), shell);
|
||||||
g_object_weak_ref (G_OBJECT (window), window_weak_notify, 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);
|
G_TYPE_POINTER);
|
||||||
|
|
||||||
epv = & klass->epv;
|
epv = & klass->epv;
|
||||||
epv->createNewView = impl_Shell_createNewView;
|
epv->createNewWindow = impl_Shell_createNewWindow;
|
||||||
epv->handleURI = impl_Shell_handleURI;
|
epv->handleURI = impl_Shell_handleURI;
|
||||||
epv->setLineStatus = impl_Shell_setLineStatus;
|
epv->setLineStatus = impl_Shell_setLineStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
@ -601,6 +577,7 @@ e_shell_new (EShellStartupLineMode startup_line_mode,
|
|||||||
/**
|
/**
|
||||||
* e_shell_create_window:
|
* e_shell_create_window:
|
||||||
* @shell: The shell for which to create a new 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).
|
* @template_window: Window from which to copy the window settings (can be %NULL).
|
||||||
*
|
*
|
||||||
* Create a new window for @uri.
|
* Create a new window for @uri.
|
||||||
@ -609,6 +586,7 @@ e_shell_new (EShellStartupLineMode startup_line_mode,
|
|||||||
**/
|
**/
|
||||||
EShellWindow *
|
EShellWindow *
|
||||||
e_shell_create_window (EShell *shell,
|
e_shell_create_window (EShell *shell,
|
||||||
|
const char *component_id,
|
||||||
EShellWindow *template_window)
|
EShellWindow *template_window)
|
||||||
{
|
{
|
||||||
EShellWindow *window;
|
EShellWindow *window;
|
||||||
@ -621,7 +599,7 @@ e_shell_create_window (EShell *shell,
|
|||||||
|
|
||||||
priv = shell->priv;
|
priv = shell->priv;
|
||||||
|
|
||||||
window = create_window (shell, template_window);
|
window = create_window (shell, component_id, template_window);
|
||||||
|
|
||||||
gtk_widget_show (GTK_WIDGET (window));
|
gtk_widget_show (GTK_WIDGET (window));
|
||||||
|
|
||||||
|
@ -102,6 +102,7 @@ EShell *e_shell_new (EShellStartupLineMode startup_line_m
|
|||||||
EShellConstructResult *construct_result_return);
|
EShellConstructResult *construct_result_return);
|
||||||
|
|
||||||
EShellWindow *e_shell_create_window (EShell *shell,
|
EShellWindow *e_shell_create_window (EShell *shell,
|
||||||
|
const char *component_id,
|
||||||
EShellWindow *template_window);
|
EShellWindow *template_window);
|
||||||
gboolean e_shell_request_close_window (EShell *shell,
|
gboolean e_shell_request_close_window (EShell *shell,
|
||||||
EShellWindow *window);
|
EShellWindow *window);
|
||||||
|
50
shell/main.c
50
shell/main.c
@ -85,6 +85,7 @@ static gboolean start_online = FALSE;
|
|||||||
static gboolean start_offline = FALSE;
|
static gboolean start_offline = FALSE;
|
||||||
static gboolean setup_only = FALSE;
|
static gboolean setup_only = FALSE;
|
||||||
static gboolean killev = FALSE;
|
static gboolean killev = FALSE;
|
||||||
|
static char *default_component_id = NULL;
|
||||||
|
|
||||||
extern char *evolution_debug_log;
|
extern char *evolution_debug_log;
|
||||||
|
|
||||||
@ -404,35 +405,15 @@ idle_cb (void *data)
|
|||||||
}
|
}
|
||||||
|
|
||||||
have_evolution_uri = FALSE;
|
have_evolution_uri = FALSE;
|
||||||
displayed_any = FALSE;
|
|
||||||
|
|
||||||
for (p = uri_list; p != NULL; p = p->next) {
|
if (uri_list == NULL && shell != NULL)
|
||||||
const char *uri;
|
e_shell_create_window (shell, default_component_id, NULL);
|
||||||
|
else {
|
||||||
|
CORBA_Environment ev;
|
||||||
|
|
||||||
uri = (const char *) p->data;
|
CORBA_exception_init (&ev);
|
||||||
if (strncmp (uri, E_SHELL_URI_PREFIX, E_SHELL_URI_PREFIX_LEN) == 0 ||
|
GNOME_Evolution_Shell_createNewWindow (corba_shell, default_component_id, &ev);
|
||||||
strncmp (uri, E_SHELL_DEFAULTURI_PREFIX, E_SHELL_DEFAULTURI_PREFIX_LEN) == 0)
|
CORBA_exception_free (&ev);
|
||||||
have_evolution_uri = TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = uri_list; p != NULL; p = p->next) {
|
for (p = uri_list; p != NULL; p = p->next) {
|
||||||
@ -440,9 +421,7 @@ idle_cb (void *data)
|
|||||||
|
|
||||||
uri = (const char *) p->data;
|
uri = (const char *) p->data;
|
||||||
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
|
GNOME_Evolution_Shell_handleURI (corba_shell, uri, &ev);
|
||||||
if (ev._major == CORBA_NO_EXCEPTION)
|
if (ev._major == CORBA_NO_EXCEPTION) {
|
||||||
displayed_any = TRUE;
|
|
||||||
else {
|
|
||||||
g_warning ("CORBA exception %s when requesting URI -- %s",
|
g_warning ("CORBA exception %s when requesting URI -- %s",
|
||||||
BONOBO_EX_REPOID (&ev), uri);
|
BONOBO_EX_REPOID (&ev), uri);
|
||||||
CORBA_exception_free (&ev);
|
CORBA_exception_free (&ev);
|
||||||
@ -451,15 +430,6 @@ idle_cb (void *data)
|
|||||||
|
|
||||||
g_slist_free (uri_list);
|
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_Object_release (corba_shell, &ev);
|
||||||
|
|
||||||
CORBA_exception_free (&ev);
|
CORBA_exception_free (&ev);
|
||||||
@ -526,6 +496,8 @@ int
|
|||||||
main (int argc, char **argv)
|
main (int argc, char **argv)
|
||||||
{
|
{
|
||||||
struct poptOption options[] = {
|
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,
|
{ "offline", '\0', POPT_ARG_NONE, &start_offline, 0,
|
||||||
N_("Start in offline mode"), NULL },
|
N_("Start in offline mode"), NULL },
|
||||||
{ "online", '\0', POPT_ARG_NONE, &start_online, 0,
|
{ "online", '\0', POPT_ARG_NONE, &start_online, 0,
|
||||||
|
Reference in New Issue
Block a user