~ubuntu-branches/ubuntu/oneiric/evince/oneiric-updates

« back to all changes in this revision

Viewing changes to shell/main.c

  • Committer: Bazaar Package Importer
  • Author(s): Josselin Mouette, Josselin Mouette, Marc 'HE' Brockschmidt
  • Date: 2008-12-31 16:41:58 UTC
  • mfrom: (1.1.36 upstream)
  • mto: (1.5.1 sid)
  • mto: This revision was merged to the branch mainline in revision 109.
  • Revision ID: james.westby@ubuntu.com-20081231164158-xnobl1sokvvc6ho8
Tags: 2.24.2-1
[ Josselin Mouette ]
* README.Debian: document that you need to install poppler-data.
  Closes: #506836.

[ Marc 'HE' Brockschmidt ]
* debian/control: Make the Gnome team maintainer. I'm not doing the job
   anyway.

[ Josselin Mouette ]
* New upstream release.
* Require nautilus 2.22 to build the extension for the correct 
  version.

Show diffs side-by-side

added added

removed removed

Lines of Context:
19
19
 
20
20
#include "config.h"
21
21
 
22
 
#include "ev-application.h"
23
 
#include "ev-metadata-manager.h"
 
22
#include <stdlib.h>
 
23
#include <string.h>
24
24
 
25
25
#include <glib/gi18n.h>
 
26
#include <gtk/gtk.h>
26
27
#include <gdk/gdkx.h>
27
 
#include <gtk/gtkmain.h>
28
 
#include <stdlib.h>
29
 
#include <string.h>
30
 
 
31
 
#if WITH_GNOME
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>
36
 
#endif
37
28
 
38
29
#ifdef ENABLE_DBUS
39
30
#include <dbus/dbus-glib-bindings.h>
40
31
#endif
41
32
 
 
33
#include "ev-application.h"
 
34
#include "ev-backends-manager.h"
 
35
#include "ev-debug.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"
46
40
 
47
41
static gchar   *ev_page_label;
48
42
static gchar   *ev_find_string;
251
245
        connection = dbus_g_bus_get (DBUS_BUS_STARTER, &error);
252
246
 
253
247
        if (connection == NULL) {
254
 
                g_warning (error->message);
 
248
                g_warning ("%s", error->message);
255
249
                g_error_free (error);   
256
250
 
257
251
                return FALSE;
267
261
                                        G_TYPE_UINT, timestamp,
268
262
                                        G_TYPE_INVALID,
269
263
                                        G_TYPE_INVALID)) {
270
 
                        g_warning (error->message);
 
264
                        g_warning ("%s", error->message);
271
265
                        g_clear_error (&error);
272
266
                        g_object_unref (remote_object);
273
267
                        dbus_g_connection_unref (connection);
297
291
                                        G_TYPE_UINT, timestamp,
298
292
                                        G_TYPE_INVALID,
299
293
                                        G_TYPE_INVALID)) {
300
 
                        g_warning (error->message);
 
294
                        g_warning ("%s", error->message);
301
295
                        g_clear_error (&error);
302
296
                        g_free (uri);
303
297
                        continue;
319
313
int
320
314
main (int argc, char *argv[])
321
315
{
322
 
        gboolean enable_metadata = FALSE;
323
316
        GOptionContext *context;
324
317
        GHashTable *args;
325
 
#if WITH_GNOME
326
 
        GnomeProgram *program;
327
 
#else
328
 
        char *accel_filename;
 
318
        gboolean enable_metadata = FALSE;
329
319
        GError *error = NULL;
330
 
#endif
 
320
 
 
321
        /* Init glib threads asap */
 
322
        if (!g_thread_supported ())
 
323
                g_thread_init (NULL);
331
324
 
332
325
        context = g_option_context_new (_("GNOME Document Viewer"));
333
326
 
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);
341
334
#else
342
335
        g_option_context_add_main_entries (context, goption_options, NULL);
343
 
#endif
344
 
 
345
 
#if WITH_GNOME
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,
351
 
                                      NULL);
352
 
#else
 
336
#endif /* ENABLE_NLS */
 
337
        
 
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));
 
340
 
 
341
        gtk_init (&argc, &argv);
 
342
 
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);
 
347
                
357
348
                return 1;
358
349
        }
359
350
        g_option_context_free (context);
360
351
 
361
 
        accel_filename = g_build_filename (ev_dot_dir (), "accels", NULL);
362
 
        gtk_accel_map_load (accel_filename);
363
 
#endif
364
 
 
365
352
        args = arguments_parse ();
366
353
 
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);
371
 
#if WITH_GNOME
372
 
                        g_object_unref (program);
373
 
#endif
 
358
 
374
359
                        return 0;
375
360
                }
376
361
        } else {
377
362
                enable_metadata = TRUE;
378
363
        }
379
 
#endif
380
 
 
381
 
#if WITH_GNOME  
382
 
        gnome_authentication_manager_init ();
383
 
#endif
384
 
 
 
364
#endif /* ENABLE_DBUS */
 
365
 
 
366
        ev_debug_init ();
385
367
        ev_backends_manager_init ();
386
368
        
387
369
        if (enable_metadata) {
388
370
                ev_metadata_manager_init ();
389
371
        }
390
372
 
391
 
        ev_job_queue_init ();
392
 
        g_set_application_name (_("Evince Document Viewer"));
393
 
 
394
373
        ev_file_helpers_init ();
395
374
        ev_stock_icons_init ();
396
375
        gtk_window_set_default_icon_name ("evince");
397
376
 
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);
400
380
 
401
381
        gtk_main ();
402
382
 
403
 
#if WITH_GNOME
404
 
        gnome_accelerators_sync ();
405
 
#else
406
 
        gtk_accel_map_save (accel_filename);
407
 
        g_free (accel_filename);
408
 
#endif
409
 
 
410
383
        ev_file_helpers_shutdown ();
411
384
 
412
385
        if (enable_metadata) {
415
388
 
416
389
        ev_backends_manager_shutdown ();
417
390
 
418
 
#if WITH_GNOME
419
 
        g_object_unref (program);
420
 
#endif
421
 
        
 
391
        ev_debug_shutdown ();
 
392
 
422
393
        return 0;
423
394
}