updated on Mon Jan 16 16:00:41 UTC 2012
[aur-mirror.git] / screem / goption.patch
blobf0e8f8c5e19d224f42263778cd6d42a5543836a9
1 --- src/screem-main.c 2006-04-17 00:25:57.000000000 +0100
2 +++ src/screem-main.c 2006-04-17 01:12:35.000000000 +0100
3 @@ -54,12 +54,23 @@
4 static gchar *session_filename = SESSION_LAST;
6 /* passed parameters stuff */
7 +#ifndef GNOME_PARAM_GOPTION_CONTEXT
8 static const struct poptOption options[] = {
9 { "load-session", 'l', POPT_ARG_STRING, &session_filename, 0,
10 N_("Load the given session file"),
11 N_("FILE") },
12 { NULL, '\0', 0, NULL, 0, NULL, NULL }
14 +#else /* USE GOption interface */
15 +static const gchar **remaining_args = NULL;
16 +static GOptionEntry option_entries[] = {
17 + { "load-session", 'l', 0, G_OPTION_ARG_STRING, &(session_filename),
18 + N_("Load the given session file"), N_("FILE") },
19 + { G_OPTION_REMAINING, 0, 0, G_OPTION_ARG_FILENAME_ARRAY, &remaining_args,
20 + "Special option that collects any remaining arguments for us" },
21 + { NULL }
22 +};
23 +#endif
25 typedef enum {
26 MISSING_GLADE,
27 @@ -75,8 +86,10 @@
28 int main( int argc, char *argv[] )
30 GnomeProgram *program;
31 + const gchar** start_files;
32 +#ifndef GNOME_PARAM_GOPTION_CONTEXT
33 poptContext ctx;
34 - const gchar** start_files;
35 +#endif
36 const gchar *icon;
38 gchar *dotdir;
39 @@ -88,11 +101,21 @@
40 bind_textdomain_codeset( GETTEXT_PACKAGE, "UTF-8" );
41 textdomain( GETTEXT_PACKAGE );
42 #endif
44 +#ifdef GNOME_PARAM_GOPTION_CONTEXT
45 + GOptionContext *option_context = g_option_context_new("screem");
46 + g_option_context_add_main_entries(option_context, option_entries, NULL);
47 +#endif
49 program = gnome_program_init( PACKAGE, VERSION,
50 LIBGNOMEUI_MODULE,
51 argc, argv,
52 GNOME_PROGRAM_STANDARD_PROPERTIES,
53 +#ifndef GNOME_PARAM_GOPTION_CONTEXT
54 GNOME_PARAM_POPT_TABLE, options,
55 +#else
56 + GNOME_PARAM_GOPTION_CONTEXT, option_context,
57 +#endif
58 GNOME_PARAM_APP_DATADIR, DATADIR,
59 LIBGNOMEUI_PARAM_DEFAULT_ICON,
60 DATADIR"/pixmaps/screem.png",
61 @@ -105,10 +128,14 @@
62 icon = DATADIR"/pixmaps/screem.png";
63 gtk_window_set_default_icon_from_file( icon, NULL );
65 +#ifndef GNOME_PARAM_GOPTION_CONTEXT
66 /* parse arguments */
67 g_object_get( G_OBJECT( program ),
68 GNOME_PARAM_POPT_CONTEXT, &ctx, NULL );
69 start_files = parse_args( ctx, argc, argv );
70 +#else
71 + start_files = remaining_args;
72 +#endif
74 gnome_vfs_init();
75 gnome_authentication_manager_init();
76 @@ -160,6 +187,7 @@
77 return FALSE;
80 +#ifndef GNOME_PARAM_GOPTION_CONTEXT
81 static const gchar **parse_args( poptContext ctx, int argc, char *argv[] )
83 const gchar** start_files;
84 @@ -169,6 +197,7 @@
86 return start_files;
88 +#endif
90 static void screem_main_missing( MissingType type )