From 15073fb029c8fc78d7184be7bc0e70d4cbe5ac1b Mon Sep 17 00:00:00 2001 From: Christian Persch Date: Tue, 12 Jun 2012 18:53:35 +0200 Subject: shell: Port to GtkApplication origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-6&id=b999bdd --- shell/main.c | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'shell/main.c') diff --git a/shell/main.c b/shell/main.c index d9dd361e..6e21f9f2 100644 --- a/shell/main.c +++ b/shell/main.c @@ -224,8 +224,10 @@ load_files (const char **files) int main (int argc, char *argv[]) { + EvApplication *application; GOptionContext *context; GError *error = NULL; + int status; #ifdef ENABLE_NLS /* Initialize the i18n stuff */ @@ -266,7 +268,15 @@ main (int argc, char *argv[]) egg_set_desktop_file (MATEDATADIR "/applications/atril.desktop"); - ev_application_load_session (EV_APP); + application = ev_application_new (); + if (!g_application_register (G_APPLICATION (application), NULL, &error)) { + g_printerr ("Failed to register: %s\n", error->message); + g_error_free (error); + status = 1; + goto done; + } + + ev_application_load_session (application); load_files (file_arguments); /* Change directory so we don't prevent unmounting in case the initial cwd @@ -274,10 +284,12 @@ main (int argc, char *argv[]) */ g_chdir (g_get_home_dir ()); - gtk_main (); + status = g_application_run (G_APPLICATION (application), 0, NULL); + done: ev_shutdown (); ev_stock_icons_shutdown (); - return 0; + g_object_unref (application); + return status; } -- cgit v1.2.1