changeset 3204:be19736de36b trunk

Serbian translation updated
author Strahinja Kustudic <kustodian@gmail.com>
date Wed, 01 Aug 2007 14:29:58 +0200
parents 808c6b79e838 (current diff) e1470a536417 (diff)
children 97d992b5db2b
files
diffstat 6 files changed, 117 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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))
--- 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) {
--- 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) {
--- 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);
 }
--- 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;
+}
--- 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