]> www.fi.muni.cz Git - evince.git/commitdiff
Port to GOption command line parsing. Fix for the bug #327518
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 13 May 2006 04:57:13 +0000 (04:57 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Sat, 13 May 2006 04:57:13 +0000 (04:57 +0000)
* configure.ac:
* shell/Makefile.am:
* shell/main.c: (main):

Port to GOption command line parsing. Fix for the
bug #327518

ChangeLog
configure.ac
shell/Makefile.am
shell/main.c

index 974c83d28df90fa3c4306c2dd304983b1fe43f06..0e426d7a7f7f2f2ff3112d16309fe36a6ecb0c8d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2006-05-13  Michael Plump  <plumpy@skylab.org>
+
+       * configure.ac:
+       * shell/Makefile.am:
+       * shell/main.c: (main):
+       
+       Port to GOption command line parsing. Fix for the 
+       bug #327518
+
 2006-05-13  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-window.c: (ev_window_cmd_help_about):
index 256a871fac7dd06cede4b2cb4fcf684a20230357..88ed566226dcd1edf746dbf8910a26a43f1edce5 100644 (file)
@@ -46,8 +46,8 @@ DBUS_GLIB_REQUIRED=0.33
 GTK_REQUIRED=2.8.15
 KEYRING_REQUIRED=0.4.0
 
-LIBGNOMEUI_REQUIRED=2.6.0
-LIBGNOMEPRINTUI_REQUIRED=2.5.1
+LIBGNOMEUI_REQUIRED=2.14.0
+LIBGNOMEPRINTUI_REQUIRED=2.6.0
 
 PKG_CHECK_MODULES(LIB, gtk+-2.0 >= $GTK_REQUIRED libgnomeui-2.0 >= $LIBGNOMEUI_REQUIRED)
 PKG_CHECK_MODULES(BACKEND, gtk+-2.0 >= $GTK_REQUIRED gnome-vfs-2.0)
index 4712686ea9d904d04b7afdc937e876f800b7576b..4ce5bce8147b418d20603dbfa55e23765808cdaa 100644 (file)
@@ -11,6 +11,7 @@ INCLUDES=                                             \
        -DGNOMEICONDIR=\""$(datadir)/pixmaps"\"         \
        $(SHELL_CFLAGS)                                 \
        $(WARN_CFLAGS)                                  \
+       $(DISABLE_DEPRECATED)                           \
        $(GNOME_PRINT_CFLAGS)
 
 bin_PROGRAMS=evince
index 480d00e967c67fcec430420d35a0daf881d3fa0e..d1aabceb3021c7d38d55e393cec41bc3e4a863a7 100644 (file)
 #include "ev-file-helpers.h"
 
 static char *ev_page_label;
+static char **file_arguments = NULL;
 
-static struct poptOption popt_options[] =
+static const GOptionEntry goption_options[] =
 {
-       { "page-label", 'p', POPT_ARG_STRING, &ev_page_label, 0, N_("The page of the document to display."), N_("PAGE")},
-       { NULL, 0, 0, NULL, 0, NULL, NULL }
+       { "page-label", 'p', 0, G_OPTION_ARG_STRING, &ev_page_label, N_("The page of the document to display."), N_("PAGE")},
+       { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &file_arguments, NULL, N_("[FILE...]") },
+       { NULL }
 };
 
 static void
@@ -207,32 +209,31 @@ int
 main (int argc, char *argv[])
 {
        gboolean enable_metadata = FALSE;
-       poptContext context;
-        GValue context_as_value = { 0 };
+       GOptionContext *context;
        GnomeProgram *program;
 
+       context = g_option_context_new (_("GNOME Document Viewer"));
+
 #ifdef ENABLE_NLS
        /* Initialize the i18n stuff */
        bindtextdomain(GETTEXT_PACKAGE, GNOMELOCALEDIR);
        bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
        textdomain(GETTEXT_PACKAGE);
+       g_option_context_add_main_entries (context, goption_options, GETTEXT_PACKAGE);
+#else
+       g_option_context_add_main_entries (context, goption_options, NULL);
 #endif
 
        program = gnome_program_init (PACKAGE, VERSION,
                                       LIBGNOMEUI_MODULE, argc, argv,
-                                      GNOME_PARAM_POPT_TABLE, popt_options,
+                                      GNOME_PARAM_GOPTION_CONTEXT, context,
                                       GNOME_PARAM_HUMAN_READABLE_NAME, _("Evince"),
                                      GNOME_PARAM_APP_DATADIR, GNOMEDATADIR,
                                       NULL);
-       g_object_get_property (G_OBJECT (program),
-                               GNOME_PARAM_POPT_CONTEXT,
-                               g_value_init (&context_as_value, G_TYPE_POINTER));
-        context = g_value_get_pointer (&context_as_value);
-
 
 #ifdef ENABLE_DBUS
        if (!ev_application_register_service (EV_APP)) {
-               if (load_files_remote (poptGetArgs (context))) {
+               if (load_files_remote (file_arguments)) {
                        return 0;
                }
        } else {
@@ -255,17 +256,17 @@ main (int argc, char *argv[])
        ev_stock_icons_init ();
        gtk_window_set_default_icon_name ("evince");
 
-       load_files (poptGetArgs (context));
+       load_files (file_arguments);
 
        gtk_main ();
 
        gnome_accelerators_sync ();
-       poptFreeContext (context);
        ev_file_helpers_shutdown ();
 
        if (enable_metadata) {
                ev_metadata_manager_shutdown ();
        }
+       g_object_unref(program);
 
        return 0;
 }