summaryrefslogtreecommitdiff
path: root/shell/main.c
diff options
context:
space:
mode:
authorChristian Persch <[email protected]>2012-06-12 18:53:35 +0200
committerraveit65 <[email protected]>2018-03-21 06:56:34 +0100
commit15073fb029c8fc78d7184be7bc0e70d4cbe5ac1b (patch)
tree8f82df7538706918770f0ff860c07147594c2f8f /shell/main.c
parent715e15b587b66122750f1565f24ea7bb818d2061 (diff)
downloadatril-15073fb029c8fc78d7184be7bc0e70d4cbe5ac1b.tar.bz2
atril-15073fb029c8fc78d7184be7bc0e70d4cbe5ac1b.tar.xz
shell: Port to GtkApplication
origin commit: https://git.gnome.org/browse/evince/commit/?h=gnome-3-6&id=b999bdd
Diffstat (limited to 'shell/main.c')
-rw-r--r--shell/main.c18
1 files changed, 15 insertions, 3 deletions
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;
}