~ubuntu-branches/ubuntu/trusty/rygel/trusty

« back to all changes in this revision

Viewing changes to src/rygel/rygel-cmdline-config.vala

  • Committer: Package Import Robot
  • Author(s): Andreas Henriksson
  • Date: 2011-12-16 15:21:25 UTC
  • mfrom: (14.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20111216152125-qgn31dkfmhouhrf0
Upload to unstable

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
 
52
52
    private static bool version;
53
53
 
 
54
    private static string config_file;
 
55
 
54
56
    [CCode (array_length = false, array_null_terminated = true)]
55
57
    [NoArrayLength]
56
58
    private static string[] disabled_plugins;
105
107
          "Set plugin options", "PluginName:OPTION:VALUE1[,VALUE2,..]" },
106
108
        { "disable-upnp", 'P', 0, OptionArg.NONE, ref no_upnp,
107
109
          "Disable UPnP (streaming-only)", null },
 
110
        { "config", 'c', 0, OptionArg.FILENAME, ref config_file,
 
111
          "Use configuration file instead of user configuration", null },
108
112
        { null }
109
113
        };
110
114
 
122
126
        var parameter_string = "- " + BuildConfig.PACKAGE_NAME;
123
127
        var opt_context = new OptionContext (parameter_string);
124
128
        opt_context.set_help_enabled (true);
 
129
        opt_context.set_ignore_unknown_options (true);
125
130
        opt_context.add_main_entries (options, null);
126
131
        opt_context.add_group (Gst.init_get_option_group ());
127
 
        opt_context.parse (ref args);
128
 
 
129
 
                if (version) {
130
 
                        stdout.printf ("%s\n", BuildConfig.PACKAGE_STRING);
131
 
                        throw new CmdlineConfigError.VERSION_ONLY ("");
132
 
                }
 
132
 
 
133
        try {
 
134
            opt_context.parse (ref args);
 
135
        } catch (OptionError.BAD_VALUE err) {
 
136
            stdout.printf (opt_context.get_help (true, null));
 
137
 
 
138
            throw new CmdlineConfigError.VERSION_ONLY ("");
 
139
        }
 
140
 
 
141
        if (version) {
 
142
            stdout.printf ("%s\n", BuildConfig.PACKAGE_STRING);
 
143
 
 
144
            throw new CmdlineConfigError.VERSION_ONLY ("");
 
145
        }
133
146
    }
134
147
 
135
148
    public bool get_upnp_enabled () throws GLib.Error {
263
276
        }
264
277
    }
265
278
 
 
279
    public string get_config_file () throws GLib.Error {
 
280
        if (config_file == null) {
 
281
            throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
 
282
        }
 
283
 
 
284
        return config_file;
 
285
    }
 
286
 
 
287
    public string get_video_upload_folder () throws GLib.Error {
 
288
        throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
 
289
    }
 
290
 
 
291
    public string get_music_upload_folder () throws GLib.Error {
 
292
        throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
 
293
    }
 
294
 
 
295
    public string get_picture_upload_folder () throws GLib.Error {
 
296
        throw new ConfigurationError.NO_VALUE_SET (_("No value available"));
 
297
    }
 
298
 
266
299
    // Dynamic options
267
300
    // FIXME: How to handle them?
268
301
    public string get_string (string section,