Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>2006-05-13 04:57:13 (GMT)
committer Nickolay V. Shmyrev <nshmyrev@src.gnome.org>2006-05-13 04:57:13 (GMT)
commit4a45e9810135419fe71ef27361e2a7b3b69a1f35 (patch)
tree65a9ec1348a243106e1b4b1e527a0e4f339a72b2
parent1f97fb3671fbcfd7f39cfb259d20f43c0704a56a (diff)
Port to GOption command line parsing. Fix for the bug #327518
* configure.ac: * shell/Makefile.am: * shell/main.c: (main): Port to GOption command line parsing. Fix for the bug #327518
-rw-r--r--ChangeLog9
-rw-r--r--configure.ac4
-rw-r--r--shell/Makefile.am1
-rw-r--r--shell/main.c29
4 files changed, 27 insertions, 16 deletions
diff --git a/ChangeLog b/ChangeLog
index 974c83d..0e426d7 100644
--- 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):
diff --git a/configure.ac b/configure.ac
index 256a871..88ed566 100644
--- a/configure.ac
+++ b/configure.ac
@@ -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)
diff --git a/shell/Makefile.am b/shell/Makefile.am
index 4712686..4ce5bce 100644
--- a/shell/Makefile.am
+++ b/shell/Makefile.am
@@ -11,6 +11,7 @@ INCLUDES= \
-DGNOMEICONDIR=\""$(datadir)/pixmaps"\" \
$(SHELL_CFLAGS) \
$(WARN_CFLAGS) \
+ $(DISABLE_DEPRECATED) \
$(GNOME_PRINT_CFLAGS)
bin_PROGRAMS=evince
diff --git a/shell/main.c b/shell/main.c
index 480d00e..d1aabce 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -44,11 +44,13 @@
#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;
}