changeset 3150:5d1fe50ebbce trunk

Automated merge with ssh://hg.atheme.org//hg/audacious
author William Pitcock <nenolod@atheme-project.org>
date Mon, 23 Jul 2007 15:55:40 -0500
parents 84c44d369969 (current diff) 7e773af556c1 (diff)
children 6494bb1f23a4
files
diffstat 5 files changed, 154 insertions(+), 38 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/input.c	Mon Jul 23 15:55:04 2007 -0500
+++ b/src/audacious/input.c	Mon Jul 23 15:55:40 2007 -0500
@@ -371,6 +371,27 @@
     if (tmp != NULL && g_ascii_isdigit(*(tmp + 1)))
         *tmp = '\0';
 
+    /* CD-Audio uses cdda:// dummy paths, no filedescriptor handling for it */
+    if (!g_strncasecmp(filename, "cdda://", 7)) {
+        for (node = get_input_list(); node != NULL; node = g_list_next(node))
+        {
+            ip = INPUT_PLUGIN(node->data);
+            if (!ip || !input_is_enabled(ip->filename))
+                continue;
+            if (ip->is_our_file != NULL)
+                ret = ip->is_our_file(filename_proxy);
+            if (ret > 0)
+            {
+                g_free(filename_proxy);
+                pr = g_new0(ProbeResult, 1);
+                pr->ip = ip;
+                return pr;
+            }
+        }
+        g_free(filename_proxy);
+        return NULL;
+    }
+
     fd = vfs_buffered_file_new_from_uri(tmp_uri);
     g_free(tmp_uri);
 
@@ -393,7 +414,7 @@
         vfs_fclose(fd);
 
         pr = g_new0(ProbeResult, 1);
-        pr->ip = NULL;
+        pr->ip = ip;
 
         return pr;
     }
--- a/src/audacious/ui_main.c	Mon Jul 23 15:55:04 2007 -0500
+++ b/src/audacious/ui_main.c	Mon Jul 23 15:55:40 2007 -0500
@@ -476,7 +476,6 @@
     gtk_widget_hide(equalizerwin);
     gtk_widget_hide(playlistwin);
     gtk_widget_hide(mainwin);
-    gdk_flush();
 
     g_source_remove(mainwin_timeout_id);
 
@@ -1889,6 +1888,37 @@
         gtk_window_move(GTK_WINDOW(mainwin), cfg.player_x, cfg.player_y);
 
     gtk_window_present(GTK_WINDOW(mainwin));
+    gtk_widget_show_all(mainwin);
+
+    if (!bmp_active_skin->properties.mainwin_text_visible)
+        gtk_widget_hide(mainwin_info);
+
+    if (!cfg.player_shaded) {
+        gtk_widget_hide(mainwin_srew);
+        gtk_widget_hide(mainwin_splay);
+        gtk_widget_hide(mainwin_spause);
+        gtk_widget_hide(mainwin_sstop);
+        gtk_widget_hide(mainwin_sfwd);
+        gtk_widget_hide(mainwin_seject);
+        gtk_widget_hide(mainwin_stime_min);
+        gtk_widget_hide(mainwin_stime_sec);
+        gtk_widget_hide(mainwin_svis);
+    }
+
+    gtk_widget_hide(mainwin_minus_num);
+    gtk_widget_hide(mainwin_10min_num);
+    gtk_widget_hide(mainwin_min_num);
+    gtk_widget_hide(mainwin_10sec_num);
+    gtk_widget_hide(mainwin_sec_num);
+    gtk_widget_hide(mainwin_othertext);
+
+    gtk_widget_hide(mainwin_position);
+    gtk_widget_hide(mainwin_sposition);
+
+    if (bmp_active_skin->properties.mainwin_vis_visible)
+        gtk_widget_show(mainwin_vis);
+    else
+        gtk_widget_hide(mainwin_vis);
 }
 
 void
@@ -2869,37 +2899,6 @@
                 bmp_active_skin->properties.mainwin_height * 2, -1);
     mainwin_set_back_pixmap();
     mainwin_create_widgets();
-    gtk_widget_show_all(mainwin);
-
-    if (!bmp_active_skin->properties.mainwin_text_visible)
-        gtk_widget_hide(mainwin_info);
-
-    if (!cfg.player_shaded) {
-        gtk_widget_hide(mainwin_srew);
-        gtk_widget_hide(mainwin_splay);
-        gtk_widget_hide(mainwin_spause);
-        gtk_widget_hide(mainwin_sstop);
-        gtk_widget_hide(mainwin_sfwd);
-        gtk_widget_hide(mainwin_seject);
-        gtk_widget_hide(mainwin_stime_min);
-        gtk_widget_hide(mainwin_stime_sec);
-        gtk_widget_hide(mainwin_svis);
-    }
-
-    gtk_widget_hide(mainwin_minus_num);
-    gtk_widget_hide(mainwin_10min_num);
-    gtk_widget_hide(mainwin_min_num);
-    gtk_widget_hide(mainwin_10sec_num);
-    gtk_widget_hide(mainwin_sec_num);
-    gtk_widget_hide(mainwin_othertext);
-
-    gtk_widget_hide(mainwin_position);
-    gtk_widget_hide(mainwin_sposition);
-
-    if (bmp_active_skin->properties.mainwin_vis_visible)
-        gtk_widget_show(mainwin_vis);
-    else
-        gtk_widget_hide(mainwin_vis);
 }
 
 void
--- a/src/audacious/ui_skinned_playlist_slider.c	Mon Jul 23 15:55:04 2007 -0500
+++ b/src/audacious/ui_skinned_playlist_slider.c	Mon Jul 23 15:55:40 2007 -0500
@@ -45,6 +45,8 @@
 
     gint             resize_height;
     gint             move_x;
+    gint             prev_y;
+    gint             drag_y;
 };
 
 static void ui_skinned_playlist_slider_class_init         (UiSkinnedPlaylistSliderClass *klass);
@@ -118,6 +120,8 @@
     playlist_slider->pressed = FALSE;
     priv->resize_height = 0;
     priv->move_x = 0;
+    priv->drag_y = 0;
+    priv->prev_y = 0;
 }
 
 GtkWidget* ui_skinned_playlist_slider_new(GtkWidget *fixed, gint x, gint y, gint h) {
@@ -236,6 +240,8 @@
     if (y < 0) y=0;
     if (y > priv->height - 19) y = priv->height - 19;
 
+    priv->prev_y = y;
+
     /* FIXME: uses bmp_active_skin->pixmaps directly and may need calibration */
     /* drawing background */
     gint c;
@@ -269,13 +275,26 @@
 
 static gboolean ui_skinned_playlist_slider_button_press(GtkWidget *widget, GdkEventButton *event) {
     UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER (widget);
+    UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
 
+    if (event->button != 1 && event->button != 2)
+        return TRUE;
+
+    gint y = event->y;
     if (event->type == GDK_BUTTON_PRESS) {
-        if (event->button == 1) {
-            ps->pressed = TRUE;
-            gint y = event->y;
+        ps->pressed = TRUE;
+        if ((y >= priv->prev_y && y < priv->prev_y + 18)) {
+            priv->drag_y = y - priv->prev_y;
+        } else if (event->button == 2) {
             ui_skinned_playlist_slider_set_position(widget, y);
+            priv->drag_y = 0;
+        } else {
+            gint n = playlistwin_list_get_visible_count() / 2;
+            if (y < priv->prev_y)
+                n *= -1;
+            playlistwin_scroll(n);
         }
+        gtk_widget_queue_draw(widget);
     }
 
     return TRUE;
@@ -284,7 +303,7 @@
 static gboolean ui_skinned_playlist_slider_button_release(GtkWidget *widget, GdkEventButton *event) {
     UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
 
-    if (event->button == 1) {
+    if (event->button == 1 || event->button == 2) {
         ps->pressed = FALSE;
         gtk_widget_queue_draw(widget);
     }
@@ -293,9 +312,10 @@
 
 static gboolean ui_skinned_playlist_slider_motion_notify(GtkWidget *widget, GdkEventMotion *event) {
     UiSkinnedPlaylistSlider *ps = UI_SKINNED_PLAYLIST_SLIDER(widget);
+    UiSkinnedPlaylistSliderPrivate *priv = UI_SKINNED_PLAYLIST_SLIDER_GET_PRIVATE(widget);
 
     if (ps->pressed) {
-        gint y = event->y;
+        gint y = event->y - priv->drag_y;
         ui_skinned_playlist_slider_set_position(widget, y);
     }
     return TRUE;
--- a/src/audacious/vfs.c	Mon Jul 23 15:55:04 2007 -0500
+++ b/src/audacious/vfs.c	Mon Jul 23 15:55:40 2007 -0500
@@ -409,3 +409,75 @@
 
     return in;
 }
+
+/**
+ * vfs_is_remote:
+ * @path: A path to test.
+ *
+ * Tests if a path is remote uri.
+ *
+ * Return value: TRUE if the file is remote, otherwise FALSE.
+ **/
+gboolean
+vfs_is_remote(const gchar * path)
+{
+    VFSConstructor *vtable = NULL;
+    GList *node;
+    gchar *decpath;
+
+    if (!path)
+	return FALSE;
+
+    decpath = g_strdup(path);
+
+    for (node = vfs_transports; node != NULL; node = g_list_next(node))
+    {
+        VFSConstructor *vtptr = (VFSConstructor *) node->data;
+
+        if (!strncasecmp(decpath, vtptr->uri_id, strlen(vtptr->uri_id)))
+        {
+            vtable = vtptr;
+            break;
+        }
+    }
+
+    /* no transport vtable has been registered, bail. */
+    if (vtable == NULL)
+    {
+        g_warning("could not open '%s', no transport plugin available", decpath);
+        return FALSE;
+    }
+
+    /* check if vtable->uri_id is file:// or not, for now. */
+    if(!strncasecmp("file://", vtable->uri_id, strlen(vtable->uri_id)))
+        return FALSE;
+    else
+        return TRUE;
+}
+
+/**
+ * vfs_is_streaming:
+ * @file: A #VFSFile object to test.
+ *
+ * Tests if a file is associated to streaming.
+ *
+ * Return value: TRUE if the file is streaming, otherwise FALSE.
+ **/
+gboolean
+vfs_is_streaming(VFSFile *file)
+{
+    off_t size = 0;
+    glong curpos;
+
+    if(!file)
+        return FALSE;
+
+    curpos = file->base->vfs_ftell_impl(file);
+    size = file->base->vfs_fsize_impl(file);
+    file->base->vfs_fseek_impl(file, curpos, SEEK_SET);
+
+    if(size == -1)
+        return TRUE;
+    else
+        return FALSE;
+}
--- a/src/audacious/vfs.h	Mon Jul 23 15:55:04 2007 -0500
+++ b/src/audacious/vfs.h	Mon Jul 23 15:55:40 2007 -0500
@@ -132,6 +132,10 @@
 
 extern void vfs_file_get_contents(const gchar *filename, gchar **buf, gsize *size);
 
+extern gboolean vfs_is_remote(const gchar * path);
+
+extern gboolean vfs_is_streaming(VFSFile *file);
+
 G_END_DECLS
 
 #endif /* VFS_H */