20
20
#include "config.h"
22
#include "ev-application.h"
23
#include "ev-metadata-manager.h"
25
25
#include <glib/gi18n.h>
26
27
#include <gdk/gdkx.h>
27
#include <gtk/gtkmain.h>
32
#include <libgnome/gnome-program.h>
33
#include <libgnomeui/gnome-ui-init.h>
34
#include <libgnomeui/gnome-app-helper.h>
35
#include <libgnomeui/gnome-authentication-manager.h>
39
30
#include <dbus/dbus-glib-bindings.h>
33
#include "ev-application.h"
34
#include "ev-backends-manager.h"
36
#include "ev-file-helpers.h"
37
#include "ev-metadata-manager.h"
42
38
#include "ev-stock-icons.h"
43
#include "ev-job-queue.h"
44
#include "ev-file-helpers.h"
45
#include "ev-backends-manager.h"
39
#include "eggsmclient.h"
47
41
static gchar *ev_page_label;
48
42
static gchar *ev_find_string;
320
314
main (int argc, char *argv[])
322
gboolean enable_metadata = FALSE;
323
316
GOptionContext *context;
324
317
GHashTable *args;
326
GnomeProgram *program;
328
char *accel_filename;
318
gboolean enable_metadata = FALSE;
329
319
GError *error = NULL;
321
/* Init glib threads asap */
322
if (!g_thread_supported ())
323
g_thread_init (NULL);
332
325
context = g_option_context_new (_("GNOME Document Viewer"));
334
327
#ifdef ENABLE_NLS
335
328
/* Initialize the i18n stuff */
336
bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
337
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
338
textdomain(GETTEXT_PACKAGE);
329
bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
330
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
331
textdomain (GETTEXT_PACKAGE);
339
332
g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE);
340
333
g_option_context_set_translation_domain(context, GETTEXT_PACKAGE);
342
335
g_option_context_add_main_entries (context, goption_options, NULL);
346
program = gnome_program_init (PACKAGE, VERSION,
347
LIBGNOMEUI_MODULE, argc, argv,
348
GNOME_PARAM_GOPTION_CONTEXT, context,
349
GNOME_PARAM_HUMAN_READABLE_NAME, _("Evince"),
350
GNOME_PARAM_APP_DATADIR, GNOMEDATADIR,
336
#endif /* ENABLE_NLS */
338
g_option_context_add_group (context, egg_sm_client_get_option_group ());
353
339
g_option_context_add_group (context, gtk_get_option_group (TRUE));
341
gtk_init (&argc, &argv);
354
343
if (!g_option_context_parse (context, &argc, &argv, &error)) {
355
344
g_warning ("Cannot parse arguments: %s", error->message);
356
345
g_error_free (error);
346
g_option_context_free (context);
359
350
g_option_context_free (context);
361
accel_filename = g_build_filename (ev_dot_dir (), "accels", NULL);
362
gtk_accel_map_load (accel_filename);
365
352
args = arguments_parse ();
367
354
#ifdef ENABLE_DBUS
368
355
if (!ev_application_register_service (EV_APP)) {
369
356
if (load_files_remote (file_arguments, args)) {
370
357
g_hash_table_destroy (args);
372
g_object_unref (program);
377
362
enable_metadata = TRUE;
382
gnome_authentication_manager_init ();
364
#endif /* ENABLE_DBUS */
385
367
ev_backends_manager_init ();
387
369
if (enable_metadata) {
388
370
ev_metadata_manager_init ();
391
ev_job_queue_init ();
392
g_set_application_name (_("Evince Document Viewer"));
394
373
ev_file_helpers_init ();
395
374
ev_stock_icons_init ();
396
375
gtk_window_set_default_icon_name ("evince");
398
load_files (file_arguments, args);
377
if (!ev_application_load_session (EV_APP))
378
load_files (file_arguments, args);
399
379
g_hash_table_destroy (args);
404
gnome_accelerators_sync ();
406
gtk_accel_map_save (accel_filename);
407
g_free (accel_filename);
410
383
ev_file_helpers_shutdown ();
412
385
if (enable_metadata) {