Example #1
0
static gint
get_files (gpointer data)
{
	char *s, **strv;
	int i;

	s = bonobo_file_selector_open (NULL, FALSE, NULL, NULL, "/etc");
	g_print ("open test:\n\t%s\n", s);
	g_free (s);

	s = bonobo_file_selector_save (NULL, FALSE, NULL, NULL, "/tmp", "test.txt");
	g_print ("save test:\n\t%s\n", s);
	g_free (s);

	strv = bonobo_file_selector_open_multi (NULL, TRUE, NULL, NULL, NULL);
	g_print ("open multi test:\n");
	if (strv) {
		for (i = 0; strv[i]; i++)
			g_print ("\t%s\n", strv[i]);

		g_strfreev (strv);
	}

	bonobo_main_quit ();

	return FALSE;
}
Example #2
0
static void
run_tests (void)
{
	BonoboEventSource *es;
	CORBA_Environment ev;
	CORBA_any *value;
	char *mask;

	CORBA_exception_init (&ev);

	g_source_remove (idle_id);

	value = bonobo_arg_new (BONOBO_ARG_LONG);

	es = bonobo_event_source_new ();
	g_assert (es != NULL);
	
	mask = "a/test";
	bonobo_event_source_client_add_listener (BONOBO_OBJREF (es), event_cb, mask, &ev, mask);

	mask = "=a/test";
	bonobo_event_source_client_add_listener (BONOBO_OBJREF (es), event_cb, mask, &ev, mask);
	
	bonobo_event_source_notify_listeners (es, "a/test", value, &ev); 
	CHECK_RESULT (&ev, 2, 1);

	bonobo_event_source_notify_listeners (es, "a/test/xyz", value, &ev); 
	CHECK_RESULT (&ev, 3, 1);

	bonobo_event_source_notify_listeners (es, "a/tes", value, &ev); 
	CHECK_RESULT (&ev, 3, 1);

	bonobo_event_source_notify_listeners (es, "test", value, &ev); 
	CHECK_RESULT (&ev, 3, 1);

	bonobo_event_source_notify_listeners (es, "a/test", value, &ev); 
	CHECK_RESULT (&ev, 5, 2);
	
	bonobo_event_source_notify_listeners (es, "a/test:", value, &ev); 
	CHECK_RESULT (&ev, 6, 2);

	bonobo_event_source_notify_listeners (es, "a/test:xyz", value, &ev); 
	CHECK_RESULT (&ev, 7, 2);

	bonobo_event_source_notify_listeners (es, "a/", value, &ev); 
	CHECK_RESULT (&ev, 7, 2);

	bonobo_event_source_notify_listeners (es, "a/test1:xyz", value, &ev); 
	CHECK_RESULT (&ev, 8, 2);

	bonobo_object_unref (BONOBO_OBJECT (es));

	bonobo_main_quit ();
}
Example #3
0
void
sample_app_exit (SampleApp *app)
{
	GList *l;

	for (l = app->doc_views; l; l = l->next)
		g_object_unref (G_OBJECT (l->data));

	g_object_unref (G_OBJECT (app->doc));
	gtk_widget_destroy (app->win);

	g_free (app);

	bonobo_main_quit ();
}
static void
quit_main (GObject *object)
{
	bonobo_main_quit ();
}
Example #5
0
static gboolean
idle_cb (gchar **uris)
{
	GNOME_Evolution_Shell corba_shell;
	CORBA_Environment ev;
	EShellConstructResult result;
	EShellStartupLineMode startup_line_mode;

	g_return_val_if_fail (uris == NULL || g_strv_length (uris) > 0, FALSE);

#ifdef KILL_PROCESS_CMD
	kill_old_dataserver ();
#endif

	CORBA_exception_init (&ev);

	if (! start_online && ! start_offline)
		startup_line_mode = E_SHELL_STARTUP_LINE_MODE_CONFIG;
	else if (start_online)
		startup_line_mode = E_SHELL_STARTUP_LINE_MODE_ONLINE;
	else
		startup_line_mode = E_SHELL_STARTUP_LINE_MODE_OFFLINE;

	shell = e_shell_new (startup_line_mode, &result);

	switch (result) {
	case E_SHELL_CONSTRUCT_RESULT_OK:
		g_signal_connect (shell, "no_windows_left", G_CALLBACK (no_windows_left_cb), NULL);
		g_object_weak_ref (G_OBJECT (shell), shell_weak_notify, NULL);
		corba_shell = bonobo_object_corba_objref (BONOBO_OBJECT (shell));
		corba_shell = CORBA_Object_duplicate (corba_shell, &ev);
		break;

	case E_SHELL_CONSTRUCT_RESULT_CANNOTREGISTER:
		corba_shell = bonobo_activation_activate_from_id (E_SHELL_OAFIID, 0, NULL, &ev);
		if (ev._major != CORBA_NO_EXCEPTION || corba_shell == CORBA_OBJECT_NIL) {
			e_error_run(NULL, "shell:noshell", NULL);
			CORBA_exception_free (&ev);
			bonobo_main_quit ();
			return FALSE;
		}
		break;

	default:
		e_error_run(NULL, "shell:noshell-reason",
			    e_shell_construct_result_to_string(result), NULL);
		CORBA_exception_free (&ev);
		bonobo_main_quit ();
		return FALSE;

	}

	if (shell != NULL) {
		if (uris != NULL)
			open_uris (corba_shell, uris);
		else {
			GConfClient *client = gconf_client_get_default ();
			
			if (gconf_client_get_bool (client, RECOVERY_KEY, NULL) && e_file_lock_exists ()) {
				/* It should have crashed last time or a force-shutdown */
				gboolean skip = gconf_client_get_bool (client, SKIP_RECOVERY_DIALOG_KEY, NULL);
				gboolean recover = TRUE;
				if (!skip){
					int flags = show_recovery_warning ();

					gconf_client_set_bool (client, SKIP_RECOVERY_DIALOG_KEY, (flags & (1<<2)) ? TRUE : FALSE, NULL);
					recover = (flags & (1<<1)) ? TRUE: FALSE;
				}

				if (recover) {
					/* Disable the previews */
					gconf_client_set_bool (client, "/apps/evolution/mail/display/show_preview", FALSE, NULL);
					gconf_client_set_bool (client, "/apps/evolution/mail/display/safe_list", TRUE, NULL);
					gconf_client_set_bool (client, "/apps/evolution/addressbook/display/show_preview", FALSE, NULL);
					gconf_client_set_bool (client, "/apps/evolution/calendar/display/show_task_preview", FALSE, NULL);
				}
				/* Let us not delete and recreate a lock, instead reuse it. We don't use timestamps anyways */
			} else {
				/* What great can we do, if lock creation fails ?*/
				e_file_lock_create ();
			}
			g_object_unref (client);

			e_shell_create_window (shell, default_component_id, NULL);
		}
	} else {
		CORBA_Environment ev;

		CORBA_exception_init (&ev);
		if (uris != NULL)
			open_uris (corba_shell, uris);
		else
			if (default_component_id == NULL)
				GNOME_Evolution_Shell_createNewWindow (corba_shell, "", &ev);
			else
				GNOME_Evolution_Shell_createNewWindow (corba_shell, default_component_id, &ev);

		CORBA_exception_free (&ev);
	}

	CORBA_Object_release (corba_shell, &ev);

	CORBA_exception_free (&ev);

	if (shell == NULL) {
		/*there is another instance but because we don't open any windows
		we must notify the startup was complete manually*/
		gdk_notify_startup_complete ();
		bonobo_main_quit ();
	}

	return FALSE;
}
Example #6
0
static void
shell_weak_notify (void *data,
		   GObject *where_the_object_was)
{
	bonobo_main_quit ();
}
Example #7
0
static void
no_windows_left_cb (EShell *shell, gpointer data)
{
	bonobo_object_unref (BONOBO_OBJECT (shell));
	bonobo_main_quit ();
}
Example #8
0
static void
cb_do_quit (GtkWindow *window, gpointer dummy)
{
	bonobo_main_quit ();
}