changeset 2979:2d91fa378e45 trunk

Automated merge with ssh://hg.atheme.org//hg/audacious
author William Pitcock <nenolod@atheme-project.org>
date Tue, 03 Jul 2007 21:20:09 -0500
parents f4971c7d6384 (diff) 3298ebb6f5db (current diff)
children d58560be5a4c
files
diffstat 13 files changed, 10 insertions(+), 283 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/Makefile	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/Makefile	Tue Jul 03 21:20:09 2007 -0500
@@ -108,7 +108,6 @@
 	ui_skinned_textbox.c \
 	ui_skinselector.c \
 	ui_urlopener.c \
-	urldecode.c \
 	util.c \
 	vfs.c \
 	vfs_buffer.c \
--- a/src/audacious/main.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/main.c	Tue Jul 03 21:20:09 2007 -0500
@@ -221,7 +221,7 @@
     FALSE,          /* internal: whether or not to terminate */
     TRUE,           /* whether show progress bar in filepopup or not */
     TRUE,           /* close jtf dialog on jump */
-    FALSE,          /* use back and forth scroll */
+    TRUE,          /* use back and forth scroll */
 };
 
 typedef struct bmp_cfg_boolent_t {
--- a/src/audacious/playback.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/playback.c	Tue Jul 03 21:20:09 2007 -0500
@@ -48,7 +48,6 @@
 #include "ui_main.h"
 #include "ui_playlist.h"
 #include "ui_skinselector.h"
-#include "urldecode.h"
 #include "util.h"
 
 #include "playback.h"
--- a/src/audacious/playlist.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/playlist.c	Tue Jul 03 21:20:09 2007 -0500
@@ -56,7 +56,6 @@
 #include "util.h"
 #include "configdb.h"
 #include "vfs.h"
-#include "urldecode.h"
 #include "ui_equalizer.h"
 #include "playback.h"
 #include "playlist.h"
@@ -898,49 +897,6 @@
     return playlist_ins_url(playlist, url, -1);
 }
 
-static gchar *
-_playlist_urldecode_basic_path(const gchar * encoded_path)
-{
-    const gchar *cur, *ext;
-    gchar *path, *tmp;
-    gint realchar;
-
-    if (!encoded_path)
-        return NULL;
-
-    if (!str_has_prefix_nocase(encoded_path, "file:"))
-        return NULL;
-
-    cur = encoded_path + 5;
-
-    if (str_has_prefix_nocase(cur, "//localhost"))
-        cur += 11;
-
-    if (*cur == '/')
-        while (cur[1] == '/')
-            cur++;
-
-    tmp = g_malloc0(strlen(cur) + 1);
-
-    while ((ext = strchr(cur, '%')) != NULL) {
-        strncat(tmp, cur, ext - cur);
-        ext++;
-        cur = ext + 2;
-        if (!sscanf(ext, "%2x", &realchar)) {
-            /* Assume it is a literal '%'.  Several file
-             * managers send unencoded file: urls on drag
-             * and drop. */
-            realchar = '%';
-            cur -= 2;
-        }
-        tmp[strlen(tmp)] = realchar;
-    }
-
-    path = g_strconcat(tmp, cur, NULL);
-    g_free(tmp);
-    return path;
-}
-
 guint
 playlist_ins_dir(Playlist * playlist, const gchar * path,
                     gint pos,
@@ -949,7 +905,7 @@
     guint entries = 0;
     GList *list, *node;
     GHashTable *htab;
-    gchar *path2 = _playlist_urldecode_basic_path(path);
+    gchar *path2 = g_filename_from_uri(path, NULL, NULL);
 
     if (path2 == NULL)
         path2 = g_strdup(path);
--- a/src/audacious/ui_fileinfo.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/ui_fileinfo.c	Tue Jul 03 21:20:09 2007 -0500
@@ -48,7 +48,6 @@
 #include "visualization.h"
 
 #include "main.h"
-#include "urldecode.h"
 #include "util.h"
 #include "dnd.h"
 #include "titlestring.h"
--- a/src/audacious/ui_jumptotrack.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/ui_jumptotrack.c	Tue Jul 03 21:20:09 2007 -0500
@@ -64,7 +64,6 @@
 #include "genevent.h"
 #include "hints.h"
 #include "input.h"
-#include "urldecode.h"
 #include "playback.h"
 #include "playlist.h"
 #include "pluginenum.h"
--- a/src/audacious/ui_main.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/ui_main.c	Tue Jul 03 21:20:09 2007 -0500
@@ -64,7 +64,6 @@
 #include "genevent.h"
 #include "hints.h"
 #include "input.h"
-#include "urldecode.h"
 #include "playback.h"
 #include "playlist.h"
 #include "pluginenum.h"
@@ -1426,7 +1425,7 @@
  * Remove all of this flaky iter/sourcelist/strsplit stuff.
  * All we care about is the filepath.
  *
- * We can figure this out and easily pass it to xmms_urldecode_plain().
+ * We can figure this out and easily pass it to g_filename_from_uri().
  *   - nenolod
  */
 void
@@ -1446,8 +1445,11 @@
 
     if (str_has_prefix_nocase((gchar *) selection_data->data, "fonts:///"))
     {
-        gchar *path = (gchar *) selection_data->data + 9;       /* skip fonts:/// */
-    gchar *decoded = xmms_urldecode_plain(path);
+        gchar *path = (gchar *) selection_data->data;
+        gchar *decoded = g_filename_from_uri(path, NULL, NULL);
+
+        if (decoded == NULL)
+            return;
 
         cfg.playlist_font = g_strconcat(decoded, strrchr(cfg.playlist_font, ' '), NULL);
         playlist_list_set_font(cfg.playlist_font);
--- a/src/audacious/ui_preferences.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/ui_preferences.c	Tue Jul 03 21:20:09 2007 -0500
@@ -49,7 +49,6 @@
 #include "main.h"
 #include "widgets/widgetcore.h"
 #include "ui_skinned_textbox.h"
-#include "urldecode.h"
 #include "strings.h"
 #include "util.h"
 #include "dnd.h"
@@ -1922,46 +1921,6 @@
 }
 
 static void
-mainwin_drag_data_received1(GtkWidget * widget,
-                            GdkDragContext * context,
-                            gint x, gint y,
-                            GtkSelectionData * selection_data,
-                            guint info, guint time,
-                            gpointer user_data) 
-{
-    gchar *path, *decoded;
-
-    if (!selection_data->data) {
-        g_warning("DND data string is NULL");
-        return;
-    }
-
-    path = (gchar *) selection_data->data;
-
-    /* FIXME: use a real URL validator/parser */
-
-    if (!str_has_prefix_nocase(path, "fonts:///"))
-        return;
-
-    path[strlen(path) - 2] = 0; /* Why the hell a CR&LF? */
-    path += 8;
-
-    /* plain, since we already stripped the first URI part */
-    decoded = xmms_urldecode_plain(path);
-
-    /* Get the old font's size, and add it to the dropped
-     * font's name */
-    cfg.playlist_font = g_strconcat(decoded+1,
-                                    strrchr(cfg.playlist_font, ' '),
-                                    NULL);
-    playlist_list_set_font(cfg.playlist_font);
-    playlistwin_update_list(playlist_get_active());
-    gtk_font_button_set_font_name(user_data, cfg.playlist_font);	
-    
-    g_free(decoded);
-}
-
-static void
 on_skin_view_drag_data_received(GtkWidget * widget,
                                 GdkDragContext * context,
                                 gint x, gint y,
@@ -2619,7 +2578,7 @@
 
     widget = glade_xml_get_widget(xml, "playlist_font_button");
     g_signal_connect(mainwin, "drag-data-received",
-                     G_CALLBACK(mainwin_drag_data_received1),
+                     G_CALLBACK(mainwin_drag_data_received),
                      widget);
 
     widget = glade_xml_get_widget(xml, "titlestring_cbox");
--- a/src/audacious/urldecode.c	Tue Jul 03 12:14:34 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*  Audacious - Cross-platform multimedia player
- *  Copyright (C) 2005-2007  Audacious development team
- *
- *  Based on BMP:
- *  Copyright (C) 2003-2004  BMP development team.
- *
- *  Based on XMMS:
- *  Copyright (C) 1998-2003  XMMS development team.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; under version 2 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "urldecode.h"
-
-#include <glib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "util.h"
-
-gchar *
-xmms_urldecode_plain(const gchar * encoded_path)
-{
-    const gchar *cur, *ext;
-    gchar *path, *tmp;
-    gint realchar;
-
-    if (!encoded_path)
-        return NULL;
-
-    cur = encoded_path;
-    if (*cur == '/')
-        while (cur[1] == '/')
-            cur++;
-
-    tmp = g_malloc0(strlen(cur) + 1);
-
-    while ((ext = strchr(cur, '%')) != NULL) {
-        strncat(tmp, cur, ext - cur);
-        ext++;
-        cur = ext + 2;
-        if (!sscanf(ext, "%2x", &realchar)) {
-            /*
-             * Assume it is a literal '%'.  Several file
-             * managers send unencoded file: urls on on
-             * drag and drop.
-             */
-            realchar = '%';
-            cur -= 2;
-        }
-        tmp[strlen(tmp)] = realchar;
-    }
-
-    path = g_strconcat(tmp, cur, NULL);
-    g_free(tmp);
-    return path;
-}
--- a/src/audacious/urldecode.h	Tue Jul 03 12:14:34 2007 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-/*  Audacious - Cross-platform multimedia player
- *  Copyright (C) 2005-2007  Audacious development team
- *
- *  Based on BMP:
- *  Copyright (C) 2003-2004  BMP development team.
- *
- *  Based on XMMS:
- *  Copyright (C) 1998-2003  XMMS development team.
- *
- *  This program is free software; you can redistribute it and/or modify
- *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; under version 2 of the License.
- *
- *  This program is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- *  GNU General Public License for more details.
- *
- *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <glib.h>
-
-gchar *xmms_urldecode_path(const gchar *);
-gchar *xmms_urldecode_plain(const gchar *);
--- a/src/audacious/util.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/util.c	Tue Jul 03 21:20:09 2007 -0500
@@ -941,50 +941,6 @@
     return dblimg;
 }
 
-/* URL-decode a file: URL path, return NULL if it's not what we expect */
-gchar *
-xmms_urldecode_path(const gchar * encoded_path)
-{
-    const gchar *cur, *ext;
-    gchar *path, *tmp;
-    gint realchar;
-
-    if (!encoded_path)
-        return NULL;
-
-    if (!str_has_prefix_nocase(encoded_path, "file:"))
-        return NULL;
-
-    cur = encoded_path + 5;
-
-    if (str_has_prefix_nocase(cur, "//localhost"))
-        cur += 11;
-
-    if (*cur == '/')
-        while (cur[1] == '/')
-            cur++;
-
-    tmp = g_malloc0(strlen(cur) + 1);
-
-    while ((ext = strchr(cur, '%')) != NULL) {
-        strncat(tmp, cur, ext - cur);
-        ext++;
-        cur = ext + 2;
-        if (!sscanf(ext, "%2x", &realchar)) {
-            /* Assume it is a literal '%'.  Several file
-             * managers send unencoded file: urls on drag
-             * and drop. */
-            realchar = '%';
-            cur -= 2;
-        }
-        tmp[strlen(tmp)] = realchar;
-    }
-
-    path = g_strconcat(tmp, cur, NULL);
-    g_free(tmp);
-    return path;
-}
-
 /**
  * xmms_show_message:
  * @title: The title of the message to show.
--- a/src/audacious/util.h	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/util.h	Tue Jul 03 21:20:09 2007 -0500
@@ -108,8 +108,6 @@
 
 GdkImage *create_dblsize_image(GdkImage * img);
 
-gchar *xmms_urldecode_path(const gchar * encoded_path);
-
 GdkPixbuf *audacious_create_colorized_pixbuf(GdkPixbuf *src, gint red, gint green, gint blue);
 
 gchar *audacious_get_localdir(void);
--- a/src/audacious/vfs.c	Tue Jul 03 12:14:34 2007 +0200
+++ b/src/audacious/vfs.c	Tue Jul 03 21:20:09 2007 -0500
@@ -25,8 +25,6 @@
 
 #include <string.h>
 
-#include "urldecode.h"
-
 GList *vfs_transports = NULL; /* temporary. -nenolod */
 
 #ifdef VFS_DEBUG
@@ -341,49 +339,6 @@
     return NULL;
 }
 
-static gchar *
-_vfs_urldecode_basic_path(const gchar * encoded_path)
-{
-    const gchar *cur, *ext;
-    gchar *path, *tmp;
-    gint realchar;
-
-    if (!encoded_path)
-        return NULL;
-
-    if (!str_has_prefix_nocase(encoded_path, "file:"))
-        return NULL;
-
-    cur = encoded_path + 5;
-
-    if (str_has_prefix_nocase(cur, "//localhost"))
-        cur += 11;
-
-    if (*cur == '/')
-        while (cur[1] == '/')
-            cur++;
-
-    tmp = g_malloc0(strlen(cur) + 1);
-
-    while ((ext = strchr(cur, '%')) != NULL) {
-        strncat(tmp, cur, ext - cur);
-        ext++;
-        cur = ext + 2;
-        if (!sscanf(ext, "%2x", &realchar)) {
-            /* Assume it is a literal '%'.  Several file
-             * managers send unencoded file: urls on drag
-             * and drop. */
-            realchar = '%';
-            cur -= 2;
-        }
-        tmp[strlen(tmp)] = realchar;
-    }
-
-    path = g_strconcat(tmp, cur, NULL);
-    g_free(tmp);
-    return path;
-}
-
 /**
  * vfs_file_test:
  * @path: A path to test.
@@ -399,7 +354,7 @@
     gchar *path2;
     gboolean ret;
 
-    path2 = _vfs_urldecode_basic_path(path);
+    path2 = g_filename_from_uri(path, NULL, NULL);
 
     if (path2 == NULL)
         path2 = g_strdup(path);