diff options
author | Christian Persch <chpe@gnome.org> | 2009-06-04 21:49:00 (GMT) |
---|---|---|
committer | Christian Persch <chpe@gnome.org> | 2009-06-11 21:39:09 (GMT) |
commit | aaf935747f65a1084ba4ffa3cf32a1e1ea93c987 (patch) | |
tree | 94e927cec4374dc23c53f1ac071c022fccc08be8 /shell | |
parent | 0d4abbc120aa7f038739737de99de3ec3df0c60e (diff) |
Make smclient optional
Add --with-smclient configure option, and conditionalise the code. Use
--without-smclient to disable smclient. Smclient is disabled by default
on hildon platform.
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ev-application.c | 16 | ||||
-rw-r--r-- | shell/main.c | 20 |
2 files changed, 28 insertions, 8 deletions
diff --git a/shell/ev-application.c b/shell/ev-application.c index 3d4afb1..dc6d5b8 100644 --- a/shell/ev-application.c +++ b/shell/ev-application.c @@ -33,7 +33,10 @@ #endif #include "totem-scrsaver.h" + +#ifdef WITH_SMCLIENT #include "eggsmclient.h" +#endif #include "ev-application.h" #include "ev-document-factory.h" @@ -67,7 +70,9 @@ struct _EvApplication { TotemScrsaver *scr_saver; +#ifdef WITH_SMCLIENT EggSMClient *smclient; +#endif gchar *filechooser_open_uri; gchar *filechooser_save_uri; @@ -287,11 +292,14 @@ ev_application_load_session (EvApplication *application) GKeyFile *state_file; gchar **uri_list; +#ifdef WITH_SMCLIENT if (egg_sm_client_is_resumed (application->smclient)) { state_file = egg_sm_client_get_state_file (application->smclient); if (!state_file) return FALSE; - } else if (g_file_test (application->crashed_file, G_FILE_TEST_IS_REGULAR)) { + } else +#endif /* WITH_SMCLIENT */ + if (g_file_test (application->crashed_file, G_FILE_TEST_IS_REGULAR)) { if (ev_application_run_crash_recovery_dialog (application)) { state_file = g_key_file_new (); g_key_file_load_from_file (state_file, @@ -325,6 +333,8 @@ ev_application_load_session (EvApplication *application) return TRUE; } +#ifdef WITH_SMCLIENT + static void smclient_save_state_cb (EggSMClient *client, GKeyFile *state_file, @@ -346,12 +356,15 @@ smclient_quit_cb (EggSMClient *client, ev_application_shutdown (application); } +#endif /* WITH_SMCLIENT */ + static void ev_application_init_session (EvApplication *application) { application->crashed_file = g_build_filename (application->dot_dir, "evince-crashed", NULL); +#ifdef WITH_SMCLIENT application->smclient = egg_sm_client_get (); g_signal_connect (application->smclient, "save_state", G_CALLBACK (smclient_save_state_cb), @@ -359,6 +372,7 @@ ev_application_init_session (EvApplication *application) g_signal_connect (application->smclient, "quit", G_CALLBACK (smclient_quit_cb), application); +#endif } /** diff --git a/shell/main.c b/shell/main.c index 43fca48..41fd85f 100644 --- a/shell/main.c +++ b/shell/main.c @@ -37,10 +37,13 @@ #include "ev-init.h" #include "ev-file-helpers.h" #include "ev-stock-icons.h" + +#ifdef WITH_SMCLIENT #include "eggsmclient.h" #ifndef G_OS_WIN32 #include "eggdesktopfile.h" #endif +#endif /* WITH_SMCLIENT */ static gchar *ev_page_label; static gchar *ev_find_string; @@ -398,8 +401,11 @@ main (int argc, char *argv[]) context = g_option_context_new (N_("GNOME Document Viewer")); g_option_context_set_translation_domain(context, GETTEXT_PACKAGE); g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE); - + +#ifdef WITH_SMCLIENT g_option_context_add_group (context, egg_sm_client_get_option_group ()); +#endif + g_option_context_add_group (context, gtk_get_option_group (TRUE)); if (!g_option_context_parse (context, &argc, &argv, &error)) { @@ -436,13 +442,13 @@ main (int argc, char *argv[]) ev_stock_icons_init (); -#ifdef G_OS_WIN32 - /* Manually set name and icon in win32 */ - g_set_application_name (_("Evince")); - gtk_window_set_default_icon_name ("evince"); -#else +#if defined(WITH_SMCLIENT) && !defined(G_OS_WIN32) egg_set_desktop_file (GNOMEDATADIR "/applications/evince.desktop"); -#endif /* G_OS_WIN32 */ +#else + /* Manually set name and icon */ + g_set_application_name (_("Document Viewer")); + gtk_window_set_default_icon_name ("evince"); +#endif /* WITH_SMCLIENT && !G_OS_WIN32 */ ev_application_load_session (EV_APP); load_files (file_arguments, args); |