[snappy] snappy: file_list from type array to GList
- From: Luis de Bethencourt <luisbg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [snappy] snappy: file_list from type array to GList
- Date: Thu, 3 May 2012 14:16:45 +0000 (UTC)
commit 3b5efb6d98a8207eb233d1409a4845e705de03c5
Author: Luis de Bethencourt <luis debethencourt com>
Date: Thu May 3 14:35:09 2012 +0100
snappy: file_list from type array to GList
src/snappy.c | 15 ++++++++-------
1 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/snappy.c b/src/snappy.c
index 363862f..043bdde 100644
--- a/src/snappy.c
+++ b/src/snappy.c
@@ -65,7 +65,7 @@ close_down (UserInterface * ui, GstEngine * engine)
/* Process command arguments */
gboolean
process_args (int argc, char *argv[],
- gchar * file_list[], gboolean * blind, gboolean * fullscreen,
+ GList ** file_list, gboolean * blind, gboolean * fullscreen,
gboolean * hide, gboolean * loop, gboolean * secret, gchar ** suburi,
gboolean * tags, GOptionContext * context)
{
@@ -135,10 +135,10 @@ process_args (int argc, char *argv[],
goto quit;
}
- /* Save uris in the file_list array */
+ /* Save uris in the file glist */
for (index = 1; index < argc; index++) {
- file_list[pos] = argv[index];
- g_debug ("Adding file: %s\n", file_list[pos]);
+ *file_list = g_list_append (*file_list, argv[index]);
+ g_debug ("Adding file: %s\n", argv[index]);
pos++;
}
@@ -163,8 +163,8 @@ main (int argc, char *argv[])
gint ret = 0;
guint c, index, pos = 0;
gchar *uri;
- gchar *file_list[argc];
gchar *suburi = NULL;
+ GList *file_list = NULL;
GOptionContext *context;
#ifdef ENABLE_DBUS
@@ -177,7 +177,7 @@ main (int argc, char *argv[])
context = g_option_context_new ("<media file> - Play movie files");
/* Process command arguments */
- ok = process_args (argc, argv, file_list, &blind, &fullscreen, &hide, &loop,
+ ok = process_args (argc, argv, &file_list, &blind, &fullscreen, &hide, &loop,
&secret, &suburi, &tags, context);
if (!ok)
goto quit;
@@ -213,7 +213,7 @@ main (int argc, char *argv[])
gst_object_unref (engine->bus);
/* Get uri to load */
- uri = clean_uri (file_list[0]);
+ uri = clean_uri (g_list_first (file_list)->data);
/* Load engine and start interface */
engine_load_uri (engine, uri);
@@ -247,6 +247,7 @@ main (int argc, char *argv[])
#endif
quit:
+ g_list_free (file_list);
g_option_context_free (context);
return ret;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]