diff options
author | Luis de Bethencourt <luis@debethencourt.com> | 2011-05-13 12:44:57 +0200 |
---|---|---|
committer | Luis de Bethencourt <luis@debethencourt.com> | 2011-05-13 12:44:57 +0200 |
commit | 019369de93a9dbb03b822859cb0d3681023b8ef8 (patch) | |
tree | d8b0f7b8b5225dd612eed296f049725f22fed4a4 | |
parent | 390eafcb5207732869dd5477eaab4bb4704ff8cf (diff) |
engine: name function fix
uri_is_unfinished_playback () -> is_uri_unfinished_playback ()
-rw-r--r-- | src/gst_engine.c | 48 |
1 files changed, 24 insertions, 24 deletions
diff --git a/src/gst_engine.c b/src/gst_engine.c index ef08e98..676867f 100644 --- a/src/gst_engine.c +++ b/src/gst_engine.c @@ -150,13 +150,13 @@ discover (GstEngine * engine, gchar * uri) return TRUE; } -gboolean -remove_uri_unfinished_playback (GstEngine * engine, gchar * uri) +gint64 +is_uri_unfinished_playback (GstEngine * engine, gchar * uri) { guint hash_key; + gint64 position = -1; const gchar *config_dir; - gchar *path, *data, *key; - FILE *file; + gchar *path, *key; GKeyFile *keyfile; GKeyFileFlags flags; @@ -169,29 +169,24 @@ remove_uri_unfinished_playback (GstEngine * engine, gchar * uri) config_dir = g_get_user_config_dir (); path = g_strdup_printf ("%s/snappy/history", config_dir); - // remove key if gkeyfile exists if (g_key_file_load_from_file (keyfile, path, flags, NULL)) - g_key_file_remove_key (keyfile, "unfinished", key, NULL); - - // save gkeyfile to a file - data = g_key_file_to_data (keyfile, NULL, NULL); - file = fopen (path, "w"); - fputs (data, file); - fclose (file); + if (g_key_file_has_group (keyfile, "unfinished")) + if (g_key_file_has_key (keyfile, "unfinished", key, NULL)) + position = g_key_file_get_int64 (keyfile, "unfinished", key, NULL); - g_free (data); + g_key_file_free (keyfile); g_free (path); - return TRUE; + return position; } -gint64 -uri_is_unfinished_playback (GstEngine * engine, gchar * uri) +gboolean +remove_uri_unfinished_playback (GstEngine * engine, gchar * uri) { guint hash_key; - gint64 position = -1; const gchar *config_dir; - gchar *path, *key; + gchar *path, *data, *key; + FILE *file; GKeyFile *keyfile; GKeyFileFlags flags; @@ -204,15 +199,20 @@ uri_is_unfinished_playback (GstEngine * engine, gchar * uri) config_dir = g_get_user_config_dir (); path = g_strdup_printf ("%s/snappy/history", config_dir); + // remove key if gkeyfile exists if (g_key_file_load_from_file (keyfile, path, flags, NULL)) - if (g_key_file_has_group (keyfile, "unfinished")) - if (g_key_file_has_key (keyfile, "unfinished", key, NULL)) - position = g_key_file_get_int64 (keyfile, "unfinished", key, NULL); + g_key_file_remove_key (keyfile, "unfinished", key, NULL); - g_key_file_free (keyfile); + // save gkeyfile to a file + data = g_key_file_to_data (keyfile, NULL, NULL); + file = fopen (path, "w"); + fputs (data, file); + fclose (file); + + g_free (data); g_free (path); - return position; + return TRUE; } /* -------------------- non-static functions --------------------- */ @@ -277,7 +277,7 @@ bus_call (GstBus * bus, GstMessage * msg, gpointer data) if (!engine->has_started) { gint64 position; - position = uri_is_unfinished_playback (engine, engine->uri); + position = is_uri_unfinished_playback (engine, engine->uri); if (position != -1) { seek (engine, position); } |