[Goodies-commits] r7851 - in parole/trunk: . parole

Ali Abdallah aliov at xfce.org
Mon Jul 27 22:00:48 CEST 2009


Author: aliov
Date: 2009-07-27 20:00:48 +0000 (Mon, 27 Jul 2009)
New Revision: 7851

Added:
   parole/trunk/parole/parole-open-location.c
   parole/trunk/parole/parole-open-location.h
Modified:
   parole/trunk/ChangeLog
   parole/trunk/README
   parole/trunk/parole/Makefile.am
   parole/trunk/parole/parole-gst.c
   parole/trunk/parole/parole-mediachooser.c
   parole/trunk/parole/parole-mediachooser.h
   parole/trunk/parole/parole-medialist.c
   parole/trunk/parole/parole-player.c
   parole/trunk/parole/parole-plugin.h
   parole/trunk/parole/parole-plugins-manager.c
   parole/trunk/parole/parole-rc-utils.c
   parole/trunk/parole/parole-rc-utils.h
Log:
	* Fix a wrong pixbuf name introduced in the previous commit.
	* Add missing support for packing plugins in the main notebook.
	* Add GStreamer dependency in the README file.
	* parole-gst.c don't draw logo on expose when buffering.
	* added parole-open-location.{c,h} added parole open location
	to handle location open with entry completion.
	

Modified: parole/trunk/ChangeLog
===================================================================
--- parole/trunk/ChangeLog	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/ChangeLog	2009-07-27 20:00:48 UTC (rev 7851)
@@ -1,3 +1,11 @@
+2009-07-27: 22:00 Ali aliov at xfce.org
+	* Fix a wrong pixbuf name introduced in the previous commit.
+	* Add missing support for packing plugins in the main notebook.
+	* Add GStreamer dependency in the README file.
+	* parole-gst.c don't draw logo on expose when buffering.
+	* added parole-open-location.{c,h} added parole open location
+	to handle location open with entry completion.
+	
 2009-07-27: 18:00 Ali aliov at xfce.org
 	* Don't show notebook tabs if we have one page.
 	* Added subtitle font encoding support, encodings code taken from

Modified: parole/trunk/README
===================================================================
--- parole/trunk/README	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/README	2009-07-27 20:00:48 UTC (rev 7851)
@@ -15,6 +15,7 @@
  - Gio 2.16 or above.
  - DBus 0.60 or above.
  - DBus glib 0.70 or above.
+ - GStreamer 0.10.11.
  - libxfcegui4 4.6.0 or above.
  - libxfce4util 4.6.0 or above
 

Modified: parole/trunk/parole/Makefile.am
===================================================================
--- parole/trunk/parole/Makefile.am	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/Makefile.am	2009-07-27 20:00:48 UTC (rev 7851)
@@ -76,7 +76,8 @@
 	parole-pl-parser.h			\
 	parole-about.h				\
 	parole-builder.h			\
-	parole-subtitle-encoding.h
+	parole-subtitle-encoding.h		\
+	parole-open-location.h
 
 libparole_headers =				\
 	$(INST_HFILES)
@@ -114,7 +115,8 @@
 	parole-pl-parser.c			\
 	parole-about.c				\
 	parole-builder.c			\
-	parole-subtitle-encoding.c
+	parole-subtitle-encoding.c		\
+	parole-open-location.c
 
 libparole_la_LDFLAGS =				\
 	$(PAROLE_LDFLAGS)

Modified: parole/trunk/parole/parole-gst.c
===================================================================
--- parole/trunk/parole/parole-gst.c	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-gst.c	2009-07-27 20:00:48 UTC (rev 7851)
@@ -70,6 +70,7 @@
     ParoleConf   *conf;
     gboolean	  update;
     gboolean      with_vis;
+    gboolean      buffering;
 };
 
 enum
@@ -278,6 +279,7 @@
 parole_gst_expose_event (GtkWidget *widget, GdkEventExpose *ev)
 {
     ParoleGst *gst;
+    
     gboolean playing_video;
 
     if ( ev && ev->count > 0 )
@@ -291,7 +293,7 @@
 
     parole_gst_set_x_overlay (gst);
 
-    if ( (gst->priv->state < GST_STATE_PAUSED || !gst->priv->with_vis) && !playing_video)
+    if ( (gst->priv->state < GST_STATE_PAUSED || !gst->priv->with_vis ) && !playing_video && !gst->priv->buffering)
 	parole_gst_draw_logo (gst);
     else 
     {
@@ -718,6 +720,8 @@
 	    TRACE ("Buffering %d %%", per);
 	    g_signal_emit (G_OBJECT (gst), signals [BUFFERING], 0, 
 			   gst->priv->stream, per);
+			   
+	    gst->priv->buffering = per != 100;
 	    break;
 	}
 	case GST_MESSAGE_STATE_CHANGED:
@@ -1069,6 +1073,7 @@
     gst->priv->hidecursor_timer = g_timer_new ();
     gst->priv->update = FALSE;
     gst->priv->vis_sink = NULL;
+    gst->priv->buffering = FALSE;
     
     gst->priv->conf = parole_conf_new ();
     

Modified: parole/trunk/parole/parole-mediachooser.c
===================================================================
--- parole/trunk/parole/parole-mediachooser.c	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-mediachooser.c	2009-07-27 20:00:48 UTC (rev 7851)
@@ -56,7 +56,6 @@
 enum
 {
     MEDIA_FILES_OPENED,
-    LOCATION_OPENED,
     LAST_SIGNAL
 };
 
@@ -125,30 +124,6 @@
 }
 
 static void
-parole_media_chooser_open_location_cb (GtkDialog *dialog, gint response_id, ParoleMediaChooser *chooser)
-{
-    GtkWidget *entry;
-    const gchar *location;
-
-    if ( response_id == GTK_RESPONSE_OK )
-    {
-	entry = GTK_WIDGET (g_object_get_data (G_OBJECT (chooser), "entry"));
-	location = gtk_entry_get_text (GTK_ENTRY (entry));
-	
-	if ( !location || strlen (location) == 0)
-	    goto out;
-
-	TRACE ("Location %s", location);
-
-	gtk_widget_hide (GTK_WIDGET (chooser));
-	g_signal_emit (G_OBJECT (chooser), signals [LOCATION_OPENED], 0, location);
-    }
-
-    out:
-	gtk_widget_destroy (GTK_WIDGET (dialog));
-}
-
-static void
 parole_media_chooser_open_internal (GtkWidget *chooser)
 {
     ParoleMediaChooser *media_chooser;
@@ -201,56 +176,8 @@
 }
 
 static void
-parole_media_chooser_open_location_internal (GtkWidget *chooser)
-{
-    GtkWidget *label;
-    GtkWidget *entry;
-    GtkWidget *vbox;
-    
-    gtk_window_set_title (GTK_WINDOW (chooser), _("Open location..."));
-    
-    label = gtk_label_new (_("Open location of media file or live stream"));
-    
-    entry = gtk_entry_new ();
-    
-    gtk_entry_set_activates_default (GTK_ENTRY (entry), TRUE);
-    
-    g_object_set_data (G_OBJECT (chooser), "entry", entry);
-    
-    vbox = gtk_vbox_new (TRUE, 4);
-    
-    gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
-    gtk_box_pack_start (GTK_BOX (vbox), entry, TRUE, TRUE, 0);
-    
-    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (chooser)->vbox),
-			vbox,
-			TRUE,   
-			TRUE,
-			0);   
-    
-    gtk_dialog_add_buttons (GTK_DIALOG (chooser), 
-			    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
-			    GTK_STOCK_OPEN, GTK_RESPONSE_OK,
-			    NULL);
-    
-    gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_OK);
-    
-    g_signal_connect (chooser, "delete-event",
-		      G_CALLBACK (gtk_widget_destroy), chooser);
-		      
-    g_signal_connect (chooser, "response",
-		      G_CALLBACK (parole_media_chooser_open_location_cb), chooser);
-		      
-    gtk_widget_show_all (GTK_WIDGET (chooser));
-}
-
-static void
 parole_media_chooser_finalize (GObject *object)
 {
-    ParoleMediaChooser *parole_media_chooser;
-
-    parole_media_chooser = PAROLE_MEDIA_CHOOSER (object);
-
     G_OBJECT_CLASS (parole_media_chooser_parent_class)->finalize (object);
 }
 
@@ -268,15 +195,6 @@
                       g_cclosure_marshal_VOID__POINTER,
                       G_TYPE_NONE, 1, G_TYPE_POINTER);
 
-    signals[LOCATION_OPENED] = 
-        g_signal_new("location-opened",
-                      PAROLE_TYPE_MEDIA_CHOOSER,
-                      G_SIGNAL_RUN_LAST,
-                      G_STRUCT_OFFSET (ParoleMediaChooserClass, location_opened),
-                      NULL, NULL,
-                      g_cclosure_marshal_VOID__STRING,
-                      G_TYPE_NONE, 1, G_TYPE_STRING);
-
     object_class->finalize = parole_media_chooser_finalize;
 }
 
@@ -286,8 +204,7 @@
     gtk_window_set_modal (GTK_WINDOW (chooser), TRUE);
 }
 
-static GtkWidget *
-parole_media_chooser_new (GtkWidget *parent)
+GtkWidget *parole_media_chooser_open_local (GtkWidget *parent)
 {
     ParoleMediaChooser *chooser;
         
@@ -296,28 +213,9 @@
     if ( parent )
 	gtk_window_set_transient_for (GTK_WINDOW (chooser), GTK_WINDOW (parent));
     
-    return GTK_WIDGET (chooser);
-}
-
-GtkWidget *parole_media_chooser_open_local (GtkWidget *parent)
-{
-    GtkWidget *dialog;
+    parole_media_chooser_open_internal (GTK_WIDGET (chooser));
     
-    dialog = parole_media_chooser_new (parent);
-	
-    parole_media_chooser_open_internal (dialog);
-    gtk_window_set_default_size (GTK_WINDOW (dialog), 680, 480);
-    
-    return dialog;
-}
+    gtk_window_set_default_size (GTK_WINDOW (chooser), 680, 480);
 
-GtkWidget *parole_media_chooser_open_location (GtkWidget *parent)
-{
-    GtkWidget *dialog;
-    
-    dialog = parole_media_chooser_new (parent);
-	
-    parole_media_chooser_open_location_internal (dialog);
-    
-    return dialog;
+    return GTK_WIDGET (chooser);
 }

Modified: parole/trunk/parole/parole-mediachooser.h
===================================================================
--- parole/trunk/parole/parole-mediachooser.h	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-mediachooser.h	2009-07-27 20:00:48 UTC (rev 7851)
@@ -45,17 +45,12 @@
     void			 (*media_files_opened)		    (ParoleMediaChooser *chooser,
 								     GPtrArray *array);
 								     
-    void			 (*location_opened)		    (ParoleMediaChooser *chooser,
-								     const gchar *address);
-    
 } ParoleMediaChooserClass;
 
 GType        			 parole_media_chooser_get_type      (void) G_GNUC_CONST;
 
 GtkWidget			*parole_media_chooser_open_local    (GtkWidget *parent);
 								     
-GtkWidget			*parole_media_chooser_open_location (GtkWidget *parent);
-
 G_END_DECLS
 
 #endif /* __PAROLE_MEDIA_CHOOSER_H */

Modified: parole/trunk/parole/parole-medialist.c
===================================================================
--- parole/trunk/parole/parole-medialist.c	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-medialist.c	2009-07-27 20:00:48 UTC (rev 7851)
@@ -41,6 +41,7 @@
 #include "parole-medialist.h"
 #include "parole-file.h"
 #include "parole-mediachooser.h"
+#include "parole-open-location.h"
 
 #include "parole-filters.h"
 #include "parole-pl-parser.h"
@@ -224,7 +225,7 @@
 }
 
 static void
-parole_media_list_location_opened_cb (ParoleMediaChooser *chooser, const gchar *location, ParoleMediaList *list)
+parole_media_list_location_opened_cb (ParoleOpenLocation *obj, const gchar *location, ParoleMediaList *list)
 {
     ParoleFile *file;
     
@@ -255,14 +256,14 @@
 static void
 parole_media_list_open_location_internal (ParoleMediaList *list)
 {
-    GtkWidget *chooser;
+    GtkWidget *location;
     
-    chooser = parole_media_chooser_open_location (gtk_widget_get_toplevel (GTK_WIDGET (list)));
+    location = parole_open_location (gtk_widget_get_toplevel (GTK_WIDGET (list)));
 					       
-    g_signal_connect (G_OBJECT (chooser), "location-opened",
+    g_signal_connect (G_OBJECT (location), "location-opened",
 		          G_CALLBACK (parole_media_list_location_opened_cb), list);
     
-    gtk_widget_show_all (GTK_WIDGET (chooser));
+    gtk_widget_show_all (GTK_WIDGET (location));
 }
 
 static gboolean

Added: parole/trunk/parole/parole-open-location.c
===================================================================
--- parole/trunk/parole/parole-open-location.c	                        (rev 0)
+++ parole/trunk/parole/parole-open-location.c	2009-07-27 20:00:48 UTC (rev 7851)
@@ -0,0 +1,216 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <libxfce4util/libxfce4util.h>
+
+#include "parole-open-location.h"
+#include "parole-rc-utils.h"
+
+static void parole_open_location_finalize   (GObject *object);
+
+#define PAROLE_OPEN_LOCATION_GET_PRIVATE(o) \
+(G_TYPE_INSTANCE_GET_PRIVATE ((o), PAROLE_TYPE_OPEN_LOCATION, ParoleOpenLocationPrivate))
+
+struct ParoleOpenLocationPrivate
+{
+    GtkWidget *entry;
+};
+
+enum
+{
+    LOCATION_OPENED,
+    LAST_SIGNAL
+};
+
+enum
+{
+    COL_ADDRESS,
+    N_COLS
+};
+
+static guint signals [LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (ParoleOpenLocation, parole_open_location, GTK_TYPE_DIALOG)
+
+static void
+parole_open_location_response_cb (GtkDialog *dialog, gint response_id, ParoleOpenLocation *self)
+{
+    const gchar *location;
+
+    if ( response_id == GTK_RESPONSE_OK )
+    {
+	location = gtk_entry_get_text (GTK_ENTRY (self->priv->entry));
+	
+	if ( !location || strlen (location) == 0)
+	    goto out;
+
+	TRACE ("Location %s", location);
+
+	gtk_widget_hide (GTK_WIDGET (self));
+	g_signal_emit (G_OBJECT (self), signals [LOCATION_OPENED], 0, location);
+    }
+
+    out:
+	gtk_widget_destroy (GTK_WIDGET (self));
+}
+
+static GtkTreeModel *
+parole_open_location_get_completion_model (void)
+{
+    GtkListStore *store;
+    GtkTreeIter iter;
+    gchar **lines = NULL;
+    guint i;
+    
+    store = gtk_list_store_new (N_COLS, GTK_TYPE_STRING);
+    
+    lines = parole_get_history ();
+    
+    if ( lines )
+    {
+	for ( i = 0; lines[i]; i++)
+	{
+	    gtk_list_store_append (store, &iter);
+	    gtk_list_store_set (store, &iter,
+				COL_ADDRESS, lines [i],
+				-1);
+	}
+	
+	g_strfreev (lines);
+    }
+    return GTK_TREE_MODEL (store);
+}
+
+static gboolean
+parole_open_location_match (GtkEntryCompletion *cmpl, const gchar *key, 
+			    GtkTreeIter *iter, gpointer data)
+{
+    gchar *uri, *match;
+
+    gtk_tree_model_get (data, iter, 0, &uri, -1);
+    match = strstr (uri, key);
+    g_free (uri);
+
+    return (match != NULL);
+}
+
+static void
+parole_open_location_class_init (ParoleOpenLocationClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+    object_class->finalize = parole_open_location_finalize;
+    
+    signals[LOCATION_OPENED] = 
+        g_signal_new("location-opened",
+                      PAROLE_TYPE_OPEN_LOCATION,
+                      G_SIGNAL_RUN_LAST,
+                      G_STRUCT_OFFSET (ParoleOpenLocationClass, location_opened),
+                      NULL, NULL,
+                      g_cclosure_marshal_VOID__STRING,
+                      G_TYPE_NONE, 1, G_TYPE_STRING);
+
+    g_type_class_add_private (klass, sizeof (ParoleOpenLocationPrivate));
+}
+
+static void
+parole_open_location_init (ParoleOpenLocation *self)
+{
+    self->priv = PAROLE_OPEN_LOCATION_GET_PRIVATE (self);
+}
+
+static void
+parole_open_location_finalize (GObject *object)
+{
+    ParoleOpenLocation *self;
+
+    self = PAROLE_OPEN_LOCATION (object);
+
+    G_OBJECT_CLASS (parole_open_location_parent_class)->finalize (object);
+}
+
+GtkWidget *parole_open_location (GtkWidget *parent)
+{
+    GtkEntryCompletion *cmpl;
+    GtkTreeModel *model;
+    GtkWidget *label;
+    GtkWidget *vbox;
+    
+    ParoleOpenLocation *self = NULL;
+    
+    self = g_object_new (PAROLE_TYPE_OPEN_LOCATION, NULL);
+    
+    if ( parent )
+	gtk_window_set_transient_for (GTK_WINDOW (self), GTK_WINDOW (parent));
+    
+    gtk_window_set_title (GTK_WINDOW (self), _("Open location..."));
+    
+    label = gtk_label_new (_("Open location of media file or live stream"));
+    
+    self->priv->entry = gtk_entry_new ();
+    model = parole_open_location_get_completion_model ();
+    
+    gtk_entry_set_activates_default (GTK_ENTRY (self->priv->entry), TRUE);
+    cmpl = gtk_entry_completion_new();
+    
+    gtk_entry_set_completion (GTK_ENTRY (self->priv->entry), cmpl);
+    gtk_entry_completion_set_model (cmpl, model);
+    gtk_entry_completion_set_text_column (cmpl, 0);
+    gtk_entry_completion_set_match_func (cmpl, 
+					 (GtkEntryCompletionMatchFunc) parole_open_location_match, 
+					 model, 
+					 NULL);
+	
+    vbox = gtk_vbox_new (TRUE, 4);
+    
+    gtk_box_pack_start (GTK_BOX (vbox), label, TRUE, TRUE, 0);
+    gtk_box_pack_start (GTK_BOX (vbox), self->priv->entry, TRUE, TRUE, 0);
+    
+    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (self)->vbox),
+			vbox,
+			TRUE,   
+			TRUE,
+			0);   
+    
+    gtk_dialog_add_buttons (GTK_DIALOG (self), 
+			    GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+			    GTK_STOCK_OPEN, GTK_RESPONSE_OK,
+			    NULL);
+    
+    gtk_dialog_set_default_response (GTK_DIALOG (self), GTK_RESPONSE_OK);
+    
+    g_signal_connect (self, "delete-event",
+		      G_CALLBACK (gtk_widget_destroy), self);
+		      
+    g_signal_connect (self, "response",
+		      G_CALLBACK (parole_open_location_response_cb), self);
+		      
+    gtk_widget_show_all (GTK_WIDGET (self));
+    
+    return GTK_WIDGET (self);
+}

Added: parole/trunk/parole/parole-open-location.h
===================================================================
--- parole/trunk/parole/parole-open-location.h	                        (rev 0)
+++ parole/trunk/parole/parole-open-location.h	2009-07-27 20:00:48 UTC (rev 7851)
@@ -0,0 +1,57 @@
+/*
+ * * Copyright (C) 2009 Ali <aliov at xfce.org>
+ *
+ * Licensed under the GNU General Public License Version 2
+ *
+ * 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
+ */
+
+#ifndef __PAROLE_OPEN_LOCATION_H
+#define __PAROLE_OPEN_LOCATION_H
+
+#include <glib-object.h>
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+#define PAROLE_TYPE_OPEN_LOCATION        (parole_open_location_get_type () )
+#define PAROLE_OPEN_LOCATION(o)          (G_TYPE_CHECK_INSTANCE_CAST ((o), PAROLE_TYPE_OPEN_LOCATION, ParoleOpenLocation))
+#define PAROLE_IS_OPEN_LOCATION(o)       (G_TYPE_CHECK_INSTANCE_TYPE ((o), PAROLE_TYPE_OPEN_LOCATION))
+
+typedef struct ParoleOpenLocationPrivate ParoleOpenLocationPrivate;
+
+typedef struct
+{
+    GtkDialog         		   parent;
+    ParoleOpenLocationPrivate     *priv;
+    
+} ParoleOpenLocation;
+
+typedef struct
+{
+    GtkDialogClass 		   parent_class;
+    
+    void			  (*location_opened)		       (ParoleOpenLocation *self,
+								        const gchar *address);
+    
+} ParoleOpenLocationClass;
+
+GType        			   parole_open_location_get_type       (void) G_GNUC_CONST;
+
+GtkWidget			  *parole_open_location 	       (GtkWidget *parent);
+
+G_END_DECLS
+
+#endif /* __PAROLE_OPEN_LOCATION_H */

Modified: parole/trunk/parole/parole-player.c
===================================================================
--- parole/trunk/parole/parole-player.c	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-player.c	2009-07-27 20:00:48 UTC (rev 7851)
@@ -305,6 +305,48 @@
 }
 
 static void
+parole_player_save_uri (ParolePlayer *player, const ParoleStream *stream)
+{
+    ParoleMediaType media_type;
+    gchar *uri;
+    gboolean save = TRUE;
+    gchar **lines = NULL;
+    guint i;
+    
+    g_object_get (G_OBJECT (stream),
+		  "media-type", &media_type,
+		  NULL);
+		  
+    if ( media_type == PAROLE_MEDIA_TYPE_LOCAL_FILE )
+	return;
+	
+    lines = parole_get_history ();
+    
+    g_object_get (G_OBJECT (stream),
+		  "uri", &uri,
+		  NULL);
+    if (lines )
+    {
+	for ( i = 0; lines[i]; i++)
+	{
+	    if ( !g_strcmp0 (lines[i], uri) )
+	    {
+		save = FALSE;
+		break;
+	    }   
+	}
+    }
+    
+    if ( save )
+    {
+	parole_insert_line_history (uri);
+    }
+    
+    g_strfreev (lines);
+    g_free (uri);
+}
+
+static void
 parole_player_playing (ParolePlayer *player, const ParoleStream *stream)
 {
     GdkPixbuf *pix = NULL;
@@ -312,8 +354,11 @@
     gboolean seekable;
     
     player->priv->state = PAROLE_MEDIA_STATE_PLAYING;
-    pix = xfce_themed_icon_load (GTK_STOCK_MEDIA_PLAY, 16);
+    pix = xfce_themed_icon_load ("player_play", 16);
     
+    if ( !pix )
+	pix = xfce_themed_icon_load ("gtk-media-play-ltr", 16);
+    
     parole_media_list_set_row_pixbuf (player->priv->list, player->priv->row, pix);
     
     g_object_get (G_OBJECT (stream),
@@ -342,6 +387,8 @@
 
     if ( pix )
 	g_object_unref (pix);
+	
+    parole_player_save_uri (player, stream);
 }
 
 static void

Modified: parole/trunk/parole/parole-plugin.h
===================================================================
--- parole/trunk/parole/parole-plugin.h	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-plugin.h	2009-07-27 20:00:48 UTC (rev 7851)
@@ -38,7 +38,7 @@
 typedef enum
 {
     PAROLE_PLUGIN_CONTAINER_PLAYLIST,
-    PAROLE_PLUGIN_CONTAINER_VIEW
+    PAROLE_PLUGIN_CONTAINER_MAIN_VIEW
 } ParolePluginContainer;
 
 

Modified: parole/trunk/parole/parole-plugins-manager.c
===================================================================
--- parole/trunk/parole/parole-plugins-manager.c	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-plugins-manager.c	2009-07-27 20:00:48 UTC (rev 7851)
@@ -485,9 +485,10 @@
 	gtk_notebook_append_page (GTK_NOTEBOOK (manager->priv->list_nt), widget, gtk_label_new (title));
 	gtk_widget_show_all (widget);
     }
-    else if ( container == PAROLE_PLUGIN_CONTAINER_VIEW )
+    else if ( container == PAROLE_PLUGIN_CONTAINER_MAIN_VIEW )
     {
-	
+	gtk_notebook_append_page (GTK_NOTEBOOK (manager->priv->main_nt), widget, gtk_label_new (title));
+	gtk_widget_show_all (widget);
     }
     
     if ( title )

Modified: parole/trunk/parole/parole-rc-utils.c
===================================================================
--- parole/trunk/parole/parole-rc-utils.c	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-rc-utils.c	2009-07-27 20:00:48 UTC (rev 7851)
@@ -33,6 +33,7 @@
 #include "parole-rc-utils.h"
 
 #define MEDIA_PLAYER_RESOURCE_FILE 	"xfce4/parole/parole-media-player.rc"
+#define HISTORY_FILE 			"xfce4/parole/history"
 
 static XfceRc *
 open_resource_file (const gchar *group, gboolean readonly)
@@ -137,3 +138,42 @@
     
     return ret_val;
 }
+
+gchar **parole_get_history (void)
+{
+    gchar **lines = NULL;
+    gchar *history = NULL;
+    gchar *contents = NULL;
+    gsize length = 0;
+    
+    history = xfce_resource_lookup (XFCE_RESOURCE_CACHE, HISTORY_FILE);
+    
+    if (history && g_file_get_contents (history, &contents, &length, NULL)) 
+    {
+        lines = g_strsplit (contents, "\n", -1);
+        g_free (contents);
+    }
+    
+    g_free (history);
+    
+    return lines;
+}
+
+void parole_insert_line_history (const gchar *line)
+{
+    gchar *history = NULL;
+    
+    history = xfce_resource_save_location (XFCE_RESOURCE_CACHE, HISTORY_FILE, TRUE);
+    
+    if ( history ) 
+    {
+	FILE *f;
+	f = fopen (history, "a");
+	fprintf (f, "%s\n", line);
+	fclose (f);
+    }
+    else
+	g_warning ("Unable to open cache file");
+ 
+     g_free (history);
+}

Modified: parole/trunk/parole/parole-rc-utils.h
===================================================================
--- parole/trunk/parole/parole-rc-utils.h	2009-07-27 16:06:36 UTC (rev 7850)
+++ parole/trunk/parole/parole-rc-utils.h	2009-07-27 20:00:48 UTC (rev 7851)
@@ -54,5 +54,9 @@
 
 gchar	       	      **parole_rc_read_entry_list	(const gchar *property,
 							 const gchar *group);
+
+gchar                 **parole_get_history	        (void);
+
+void			parole_insert_line_history	(const gchar *line);		
 							 
 #endif /* __RC_UTILS_ */




More information about the Goodies-commits mailing list