Mercurial > audlegacy
changeset 1936:60934ccc817d trunk
[svn] - per bug #605, remove GNOME VFS.
author | nenolod |
---|---|
date | Sun, 05 Nov 2006 02:29:47 -0800 |
parents | 2fb61f0bd143 |
children | f6856d226afb |
files | ChangeLog audacious/main.c audacious/util.c configure.ac libaudacious/Makefile libaudacious/vfs_gnome.c |
diffstat | 6 files changed, 9 insertions(+), 469 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Sun Nov 05 00:55:21 2006 -0800 +++ b/ChangeLog Sun Nov 05 02:29:47 2006 -0800 @@ -1,3 +1,11 @@ +2006-11-05 08:55:21 +0000 William Pitcock <nenolod@nenolod.net> + revision [2827] + - update ja.po via Dai. + + trunk/po/ja.po | 119 +++++++++++++++++++++++++-------------------------------- + 1 file changed, 53 insertions(+), 66 deletions(-) + + 2006-11-05 07:34:22 +0000 William Pitcock <nenolod@nenolod.net> revision [2825] - assign Control+Shift+R keybinding. to Randomize Playlist. Closes #529
--- a/audacious/main.c Sun Nov 05 00:55:21 2006 -0800 +++ b/audacious/main.c Sun Nov 05 02:29:47 2006 -0800 @@ -141,11 +141,7 @@ FALSE, /* sticky */ FALSE, /* no playlist advance */ FALSE, /* stop after current song */ -#ifdef HAVE_GNOME_VFS - FALSE, /* refresh file list - should be unneeded with VFS */ -#else TRUE, /* refresh file list */ -#endif TRUE, /* UNUSED (smooth title scrolling) */ TRUE, /* use playlist metadata */ TRUE, /* warn about unplayables */ @@ -391,10 +387,6 @@ { GSList *features = NULL; -#ifdef HAVE_GNOME_VFS - features = g_slist_append(features, "GNOME VFS"); -#endif - #ifdef HAVE_GCONF features = g_slist_append(features, "GConf"); #endif
--- a/audacious/util.c Sun Nov 05 00:55:21 2006 -0800 +++ b/audacious/util.c Sun Nov 05 02:29:47 2006 -0800 @@ -801,11 +801,7 @@ if (GTK_IS_WIDGET(mainwin_jtf)) gtk_widget_set_sensitive(mainwin_jtf, TRUE); -#ifdef HAVE_GNOME_VFS - ptr = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER(browser)); -#else ptr = gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(browser)); -#endif g_free(cfg.filesel_path); cfg.filesel_path = ptr; @@ -816,11 +812,7 @@ { GSList *files; -#ifdef HAVE_GNOME_VFS - files = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(browser)); -#else files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(browser)); -#endif if (!files) { return; @@ -836,11 +828,7 @@ { GSList *files; -#ifdef HAVE_GNOME_VFS - files = gtk_file_chooser_get_uris(GTK_FILE_CHOOSER(browser)); -#else files = gtk_file_chooser_get_filenames(GTK_FILE_CHOOSER(browser)); -#endif if (!files) return; @@ -973,18 +961,9 @@ chooser = gtk_file_chooser_widget_new(GTK_FILE_CHOOSER_ACTION_OPEN); gtk_file_chooser_set_select_multiple(GTK_FILE_CHOOSER(chooser), TRUE); -#ifdef HAVE_GNOME_VFS - gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(chooser), FALSE); -#endif - if (cfg.filesel_path) -#ifdef HAVE_GNOME_VFS - gtk_file_chooser_set_current_folder_uri(GTK_FILE_CHOOSER(chooser), - cfg.filesel_path); -#else gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(chooser), cfg.filesel_path); -#endif alignment = glade_xml_get_widget(xml, "alignment2"); gtk_container_add(GTK_CONTAINER(alignment), chooser); @@ -1656,10 +1635,6 @@ g_signal_connect(dialog, "destroy", G_CALLBACK(gtk_widget_destroyed), &dialog); -#ifdef HAVE_GNOME_VFS - gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), FALSE); -#endif - button_close = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); gtk_button_set_use_stock(GTK_BUTTON(button_close), TRUE);
--- a/configure.ac Sun Nov 05 00:55:21 2006 -0800 +++ b/configure.ac Sun Nov 05 02:29:47 2006 -0800 @@ -215,32 +215,6 @@ AC_SUBST(CONFIGDB_BACKEND) -dnl GnomeVFS support - -AC_ARG_ENABLE( gnome-vfs, - [ --enable-gnome-vfs enable GnomeVFS support (default=disabled)], - [enable_gnomevfs=$enableval], - [enable_gnomevfs="no"] -) - -if test "$enable_gnomevfs" = "yes"; then - PKG_CHECK_MODULES(GNOMEVFS, [gnome-vfs-2.0 >= 2.6.0], - [ - AC_DEFINE(HAVE_GNOME_VFS, , [Define if building with GnomeVFS support]) - ADD_PC_REQUIRES([gnome-vfs-2.0 >= 2.6.0]) - ], - [AC_MSG_ERROR([Cannot find GnomeVFS])] - ) -fi - -if test "$enable_gnomevfs" = "yes"; then - VFS_BACKEND="gnome" -else - VFS_BACKEND="stdio" -fi - -AC_SUBST(VFS_BACKEND) - AC_CHECK_HEADERS(linux/cdrom.h) AC_CHECK_HEADERS(sys/cdio.h) AC_CHECK_HEADERS(sys/cdrio.h) @@ -419,7 +393,6 @@ echo " GNOME support" echo " -------------" echo " GConf support $enable_gconf" -echo " VFS support $enable_gnomevfs" echo if test "$beep_cv_lib_xlibs_threadsafe" = "no"; then
--- a/libaudacious/Makefile Sun Nov 05 00:55:21 2006 -0800 +++ b/libaudacious/Makefile Sun Nov 05 02:29:47 2006 -0800 @@ -21,7 +21,7 @@ -I../intl CONF_SRC = configdb_$(CONFIGDB_BACKEND).c -VFS_SRC = vfs_$(VFS_BACKEND).c vfs_common.c +VFS_SRC = vfs_stdio.c vfs_common.c SOURCES = \ $(CONF_SRC) \
--- a/libaudacious/vfs_gnome.c Sun Nov 05 00:55:21 2006 -0800 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,408 +0,0 @@ -/* 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; either version 2 of the License, or - * (at your option) any later version. - * - * 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 "vfs.h" -#include <string.h> -#include <libgnomevfs/gnome-vfs.h> - - -struct _VFSFile -{ - GnomeVFSHandle *handle; - gboolean eof; - GSList *streamstack; -}; - - -static void mode_to_gnome_vfs(const gchar * mode, - GnomeVFSOpenMode * g_mode, - gboolean * truncate, - gboolean * append); - -gboolean -vfs_init(void) -{ - if (!gnome_vfs_init()) - return FALSE; - - g_atexit(gnome_vfs_shutdown); - return TRUE; -} - -VFSFile * -vfs_fopen(const gchar * path, - const gchar * mode) -{ - VFSFile *file; - GnomeVFSResult g_result; - GnomeVFSOpenMode g_mode; - gboolean truncate, append; - - if (!path || !mode) - return NULL; - - file = g_new(VFSFile, 1); - file->eof = FALSE; - file->streamstack = NULL; - - mode_to_gnome_vfs(mode, &g_mode, &truncate, &append); - gchar *escaped_file = gnome_vfs_escape_path_string(path); - - if (!truncate) { - g_result = gnome_vfs_open(&(file->handle), escaped_file, g_mode); - if (append && g_result == GNOME_VFS_ERROR_NOT_FOUND) { - g_result = gnome_vfs_create(&(file->handle), - path, g_mode, TRUE, - S_IRUSR | S_IWUSR | - S_IRGRP | S_IWGRP | - S_IROTH | S_IWOTH); - } - - if (append && g_result == GNOME_VFS_OK) { - g_result = gnome_vfs_seek(file->handle, GNOME_VFS_SEEK_END, 0); - if (g_result != GNOME_VFS_OK) - gnome_vfs_close(file->handle); - } - } - else { - g_result = gnome_vfs_create(&(file->handle), - escaped_file, g_mode, FALSE, - S_IRUSR | S_IWUSR | - S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH); - } - - if (g_result != GNOME_VFS_OK) - file->handle = NULL; - - if (file->handle == NULL) { - g_free(file); - file = NULL; - } - - g_free(escaped_file); - - return file; -} - -gint -vfs_fclose(VFSFile * file) -{ - gint ret = 0; - - if (file == NULL) - return 0; - - if (file->handle) { - if (gnome_vfs_close(file->handle) != GNOME_VFS_OK) - ret = -1; - } - - /* free the streamstack */ - if ( file->streamstack != NULL ) - g_slist_free( file->streamstack ); - - g_free(file); - - return ret; -} - -size_t -vfs_fread(gpointer ptr, - size_t size, - size_t nmemb, - VFSFile * file) -{ - GnomeVFSResult result; - GnomeVFSFileSize bytes_read; - - if (file == NULL) - return 0; - - result = gnome_vfs_read(file->handle, ptr, size * nmemb, &bytes_read); - if (result == GNOME_VFS_OK) - return bytes_read; - - if (result == GNOME_VFS_ERROR_EOF) { - file->eof = TRUE; - return 0; - } - - return -1; -} - -size_t -vfs_fwrite(gconstpointer ptr, - size_t size, - size_t nmemb, - VFSFile * file) -{ - GnomeVFSResult result; - GnomeVFSFileSize bytes_written; - - if (file == NULL) - return 0; - - result = gnome_vfs_write(file->handle, ptr, size * nmemb, &bytes_written); - if (result == GNOME_VFS_OK) - return bytes_written; - else - return -1; -} - -gint -vfs_getc(VFSFile *stream) -{ - guchar uc; - if ( stream->streamstack != NULL ) /* check if some char was ungetc'ed before */ - { - uc = GPOINTER_TO_INT(stream->streamstack->data); - stream->streamstack = g_slist_delete_link( stream->streamstack , stream->streamstack ); - return uc; - } - else /* for gnomevfs, vfs_getc is emulated by vfs_fread */ - { - if (vfs_fread(&uc, 1, 1, stream)) - return uc; - else - return EOF; - } -} - -gint -vfs_ungetc(gint c, VFSFile *stream) -{ - stream->streamstack = g_slist_prepend( stream->streamstack , GINT_TO_POINTER(c) ); - if ( stream->streamstack != NULL ) - return c; - else - return EOF; /* an error occurred */ -} - -gint -vfs_fseek(VFSFile * file, - glong offset, - gint whence) -{ - GnomeVFSResult result; - GnomeVFSSeekPosition g_whence; - - if (file == NULL) - return 0; - - switch (whence) { - case SEEK_SET: - g_whence = GNOME_VFS_SEEK_START; - break; - case SEEK_CUR: - g_whence = GNOME_VFS_SEEK_CURRENT; - break; - case SEEK_END: - g_whence = GNOME_VFS_SEEK_END; - break; - default: - g_warning("vfs_fseek: invalid whence value"); - return -1; - } - - result = gnome_vfs_seek(file->handle, g_whence, offset); - - if (result == GNOME_VFS_OK) - return 0; - else - return -1; -} - -void -vfs_rewind(VFSFile * file) -{ - if (file == NULL) - return; - - vfs_fseek(file, 0L, SEEK_SET); -} - -glong -vfs_ftell(VFSFile * file) -{ - GnomeVFSResult result; - GnomeVFSFileSize position; - - if (file == NULL) - return 0; - - result = gnome_vfs_tell(file->handle, &position); - - if (result == GNOME_VFS_OK) - return position; - else - return -1; -} - -gboolean -vfs_feof(VFSFile * file) -{ - if (file == NULL) - return FALSE; - - return file->eof; -} - -gboolean -vfs_file_test(const gchar * path, - GFileTest test) -{ - GnomeVFSResult result; - GnomeVFSFileInfo info; - GFileTest file_test; - - result = gnome_vfs_get_file_info(path, &info, - GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS); - - if (test == G_FILE_TEST_EXISTS) - return (result == GNOME_VFS_OK) ? TRUE : FALSE; - else if (test == G_FILE_TEST_IS_EXECUTABLE) - return (info.permissions & GNOME_VFS_PERM_ACCESS_EXECUTABLE) - ? TRUE : FALSE; - - switch (info.type) { - case GNOME_VFS_FILE_TYPE_REGULAR: - file_test = G_FILE_TEST_IS_REGULAR; - break; - case GNOME_VFS_FILE_TYPE_SYMBOLIC_LINK: - file_test = G_FILE_TEST_IS_SYMLINK; - break; - case GNOME_VFS_FILE_TYPE_DIRECTORY: - file_test = G_FILE_TEST_IS_DIR; - default: - return FALSE; - } - - if (test == file_test) - return TRUE; - else - return FALSE; -} - -gboolean -vfs_is_writeable(const gchar * path) -{ - GnomeVFSFileInfo info; - - if (gnome_vfs_get_file_info(path, &info, GNOME_VFS_FILE_INFO_GET_ACCESS_RIGHTS) - != GNOME_VFS_OK) { - return FALSE; - } - - return (info.permissions & GNOME_VFS_PERM_ACCESS_WRITABLE ? TRUE : FALSE); -} - -gint -vfs_truncate(VFSFile * file, - glong length) -{ - GnomeVFSResult result; - - if (file == NULL) - return -1; - - result = gnome_vfs_truncate_handle(file->handle, (GnomeVFSFileSize) length); - - if (result == GNOME_VFS_OK) - return 0; - else - return -1; -} - -static gchar *strdup_exclude_chars(const gchar * s, - const gchar * c); - -static void -mode_to_gnome_vfs(const gchar * mode, - GnomeVFSOpenMode * g_mode, - gboolean * truncate, - gboolean * append) -{ - gchar *s; - - *g_mode = GNOME_VFS_OPEN_RANDOM; - *truncate = *append = FALSE; - - s = strdup_exclude_chars(mode, "bt"); - switch (s[0]) { - case 'r': - *g_mode |= GNOME_VFS_OPEN_READ; - - if (s[1] == '+') - *g_mode |= GNOME_VFS_OPEN_WRITE; - - break; - case 'w': - case 'a': - *g_mode |= GNOME_VFS_OPEN_WRITE; - - if (s[0] == 'w') - *truncate = TRUE; - else - *append = TRUE; - - if (s[1] == '+') - *g_mode |= GNOME_VFS_OPEN_READ; - - break; - default: - g_warning("mode_to_gnome_vfs: unhandled mode character"); - } - g_free(s); -} - -static gchar * -strdup_exclude_chars(const gchar * s, - const gchar * c) -{ - gint i, j, k; - gint newlen = 0; - gchar *newstr; - gboolean found; - - /* Calculate number of chars in new string */ - for (i = 0; s[i] != '\0'; i++) { - found = FALSE; - - for (j = 0; j < strlen(c) && !found; j++) - if (s[i] == c[j]) - found = TRUE; - - if (!found) - newlen++; - } - - newstr = g_malloc(newlen + 1); - - /* Copy valid chars to new string */ - for (i = k = 0; s[i] != '\0'; i++) { - found = FALSE; - - for (j = 0; j < strlen(c) && !found; j++) - if (s[i] == c[j]) - found = TRUE; - - if (!found) - newstr[k++] = s[i]; - } - - newstr[k] = '\0'; - - return newstr; -}