# HG changeset patch # User Strahinja Kustudic # Date 1185971398 -7200 # Node ID be19736de36b611e7c17ca0b01b7191e258c0c80 # Parent 808c6b79e8385aa36e0e39e8b4c705491db60cc8# Parent e1470a53641738d6a3c2edcea85e227087a81919 Serbian translation updated diff -r 808c6b79e838 -r be19736de36b src/audacious/input.c --- a/src/audacious/input.c Tue Jul 31 16:09:18 2007 +0200 +++ b/src/audacious/input.c Wed Aug 01 14:29:58 2007 +0200 @@ -410,15 +410,56 @@ !g_strncasecmp(filename, "file://", 7))) ? TRUE : FALSE; mimetype = vfs_get_metadata(fd, "content-type"); - if ((ip = mime_get_plugin(mimetype)) != NULL) + if ((ip = mime_get_plugin(mimetype)) != NULL && + input_is_enabled(ip->filename) == TRUE) { - g_free(filename_proxy); - vfs_fclose(fd); + if (ip->probe_for_tuple != NULL) + { + TitleInput *tuple = ip->probe_for_tuple(filename_proxy, fd); + + if (tuple != NULL) + { + g_free(filename_proxy); + vfs_fclose(fd); + + pr = g_new0(ProbeResult, 1); + pr->ip = ip; + pr->tuple = tuple; + pr->tuple->mtime = input_get_mtime(filename_proxy); + + return pr; + } + } + else if (fd && ip->is_our_file_from_vfs != NULL) + { + ret = ip->is_our_file_from_vfs(filename_proxy, fd); - pr = g_new0(ProbeResult, 1); - pr->ip = ip; + if (ret > 0) + { + g_free(filename_proxy); + vfs_fclose(fd); + + pr = g_new0(ProbeResult, 1); + pr->ip = ip; - return pr; + return pr; + } + } + else if (ip->is_our_file != NULL) + { + ret = ip->is_our_file(filename_proxy); + + if (ret > 0) + { + g_free(filename_proxy); + vfs_fclose(fd); + + pr = g_new0(ProbeResult, 1); + pr->ip = ip; + + return pr; + } + } } for (node = get_input_list(); node != NULL; node = g_list_next(node)) diff -r 808c6b79e838 -r be19736de36b src/audacious/playlist.c --- a/src/audacious/playlist.c Tue Jul 31 16:09:18 2007 +0200 +++ b/src/audacious/playlist.c Wed Aug 01 14:29:58 2007 +0200 @@ -1037,6 +1037,10 @@ PlaylistEventInfoChange *msg; gchar *text; + if(length == -1) { + event_queue("hide seekbar", (gpointer)0xdeadbeef); // event_queue hates NULL --yaz + } + g_return_if_fail(playlist != NULL); if (playlist->position) { diff -r 808c6b79e838 -r be19736de36b src/audacious/ui_main.c --- a/src/audacious/ui_main.c Tue Jul 31 16:09:18 2007 +0200 +++ b/src/audacious/ui_main.c Wed Aug 01 14:29:58 2007 +0200 @@ -2952,16 +2952,6 @@ g_free(time_str); } - if (length == -1) { - gtk_widget_hide(mainwin_position); - gtk_widget_hide(mainwin_sposition); - return TRUE; - } else { - gtk_widget_show(mainwin_position); - if (cfg.player_shaded) - gtk_widget_show(mainwin_sposition); - } - time /= 1000; length /= 1000; if (length > 0) { diff -r 808c6b79e838 -r be19736de36b src/audacious/ui_main_evlisteners.c --- a/src/audacious/ui_main_evlisteners.c Tue Jul 31 16:09:18 2007 +0200 +++ b/src/audacious/ui_main_evlisteners.c Wed Aug 01 14:29:58 2007 +0200 @@ -38,8 +38,15 @@ g_free(text); } +static void +ui_main_evlistener_hide_seekbar(gpointer hook_data, gpointer user_data) +{ + mainwin_disable_seekbar(); +} + void ui_main_evlistener_init(void) { hook_associate("title change", ui_main_evlistener_title_change, NULL); + hook_associate("hide seekbar", ui_main_evlistener_hide_seekbar, NULL); } diff -r 808c6b79e838 -r be19736de36b src/libguess/guess.c --- a/src/libguess/guess.c Tue Jul 31 16:09:18 2007 +0200 +++ b/src/libguess/guess.c Wed Aug 01 14:29:58 2007 +0200 @@ -426,3 +426,52 @@ return "JOHAB"; return NULL; } + +typedef struct _guess_impl { + struct _guess_impl *next; + const char *name; + const char *(*impl)(const char *buf, int len); +} guess_impl; + +static guess_impl *guess_impl_list = NULL; + +void guess_impl_register(const char *lang, + const char *(*impl)(const char *buf, int len)) +{ + guess_impl *iptr = calloc(sizeof(guess_impl), 1); + + iptr->name = lang; + iptr->impl = impl; + iptr->next = guess_impl_list; + + guess_impl_list = iptr; +} + +void guess_init(void) +{ + /* check if already initialized */ + if (guess_impl_list != NULL) + return; + + guess_impl_register(GUESS_REGION_JP, guess_jp); + guess_impl_register(GUESS_REGION_TW, guess_tw); + guess_impl_register(GUESS_REGION_CN, guess_cn); + guess_impl_register(GUESS_REGION_KR, guess_kr); +} + +const char *guess_encoding(const char *inbuf, int buflen, const char *lang) +{ + guess_impl *iter; + + guess_init(); + + for (iter = guess_impl_list; iter != NULL; iter = iter->next) + { + if (!strcasecmp(lang, iter->name)) + return iter->impl(inbuf, buflen); + } + + /* TODO: try other languages as fallback? */ + + return NULL; +} diff -r 808c6b79e838 -r be19736de36b src/libguess/libguess.h --- a/src/libguess/libguess.h Tue Jul 31 16:09:18 2007 +0200 +++ b/src/libguess/libguess.h Wed Aug 01 14:29:58 2007 +0200 @@ -45,4 +45,14 @@ const char *guess_kr(const char *buf, int buflen); int dfa_validate_utf8(const char *buf, int buflen); +#define GUESS_REGION_JP "japanese" +#define GUESS_REGION_TW "taiwanese" +#define GUESS_REGION_CN "chinese" +#define GUESS_REGION_KR "korean" + +const char *guess_encoding(const char *buf, int buflen, const char *lang); +void guess_init(void); +void guess_impl_register(const char *name, + const char *(impl)(const char *buf, int buflen)); + #endif