[Xfce4-commits] <parole:master> Send the kill signal if the dbus name is not yet registered in the browser plugin.

Ali Abdallah noreply at xfce.org
Sun Dec 6 19:00:02 CET 2009


Updating branch refs/heads/master
         to 5d8bf3613b7205be405e4ccc298e21ec1e3d66aa (commit)
       from 3b3de184bcd90404004ffb1aecbb008c3a86898e (commit)

commit 5d8bf3613b7205be405e4ccc298e21ec1e3d66aa
Author: Ali Abdallah <aliov at xfce.org>
Date:   Sun Dec 6 18:57:32 2009 +0100

    Send the kill signal if the dbus name is not yet registered in the browser plugin.
    
    don't check for vis on ready state when exposing.
    
    Fix previous commit for command line files handling.

 browser-plugin/media-plugin/main.c                 |    2 -
 browser-plugin/media-plugin/parole-plugin-player.c |    5 ++
 browser-plugin/plugin.cpp                          |   74 +++++++++++--------
 browser-plugin/plugin.h                            |    1 +
 data/interfaces/save-playlist.ui                   |    1 +
 docs/plugin-api/tmpl/parole-provider-player.sgml   |    2 +-
 gst/parole-gst.c                                   |   11 ++--
 parole/parole-pl-parser.c                          |    5 +-
 src/parole-medialist.c                             |    8 ++-
 9 files changed, 67 insertions(+), 42 deletions(-)

diff --git a/browser-plugin/media-plugin/main.c b/browser-plugin/media-plugin/main.c
index 3877588..211ab86 100644
--- a/browser-plugin/media-plugin/main.c
+++ b/browser-plugin/media-plugin/main.c
@@ -126,8 +126,6 @@ int main (int argc, char **argv)
         g_error_free (error);
     }
 
-    //parole_plugin_player_play (player);
-    
     gtk_main ();
     g_object_unref (player);
     gtk_widget_destroy (plug);
diff --git a/browser-plugin/media-plugin/parole-plugin-player.c b/browser-plugin/media-plugin/parole-plugin-player.c
index d9bb713..f4f94b6 100644
--- a/browser-plugin/media-plugin/parole-plugin-player.c
+++ b/browser-plugin/media-plugin/parole-plugin-player.c
@@ -31,6 +31,7 @@
 #include <parole/parole.h>
 
 #include <libxfce4util/libxfce4util.h>
+#include <libxfcegui4/libxfcegui4.h>
 
 #include "parole-plugin-player.h"
 
@@ -570,6 +571,7 @@ parole_plugin_player_error_cb (ParoleGst *gst, const gchar *error, ParolePluginP
 {
     player->priv->finished = TRUE;
     parole_screen_saver_uninhibit (player->priv->saver);
+    xfce_err ("%s", error);
     parole_gst_stop (gst);
 }
 
@@ -747,6 +749,9 @@ parole_plugin_player_construct (GObject *object)
     player->priv->vbox = vbox;
     
     g_signal_emit (player, signals [SIG_READY], 0);
+    
+    if ( player->priv->url )
+	parole_plugin_player_play (player);
 }
 
 static void
diff --git a/browser-plugin/plugin.cpp b/browser-plugin/plugin.cpp
index 3b5526d..d02cfa2 100644
--- a/browser-plugin/plugin.cpp
+++ b/browser-plugin/plugin.cpp
@@ -127,6 +127,8 @@ CPlugin::CPlugin (NPP pNPInstance)
     cache          = NULL;
     tmp_file       = NULL;
     
+    child_pid      = 0;
+    
     window_set     = FALSE;
     is_playlist    = FALSE;
     checked        = FALSE;
@@ -257,7 +259,7 @@ NPError CPlugin::RunPlayer ()
 			 NULL,
 			 (GSpawnFlags) 0,
 			 NULL, NULL,
-			 NULL, 
+			 &child_pid, 
 			 &error) )
     {
 	g_critical ("Failed to spawn command : %s", error->message);
@@ -345,43 +347,53 @@ void CPlugin::StopPlayer ()
 {
     g_return_if_fail (proxy != NULL);
     
-    if ( player_ready || player_spawned )
+    if ( player_spawned )
     {
-	gint num_tries = 0;
-	
-	do
+    
+	if ( player_ready )
 	{
-	    GError *error = NULL;
-	    g_debug ("Sending Quit message");
-	    dbus_g_proxy_call (proxy, "Quit", &error,
-			       G_TYPE_INVALID,
-			       G_TYPE_INVALID);
-		
-	    /*
-	     * This might happen if the browser unload the plugin quickly
-	     * while the process didn't get the dbus name.
-	     */
-	    if ( error )
+	    gint num_tries = 0;
+	    
+	    do
 	    {
-#ifdef DEBUG
-		g_debug ("Failed to stop the backend via D-Bus %s", error->message);
-#endif
-		if ( g_error_matches (error, DBUS_GERROR, DBUS_GERROR_NO_REPLY ) ||
-		     g_error_matches (error, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN) )
+		GError *error = NULL;
+		g_debug ("Sending Quit message");
+		dbus_g_proxy_call (proxy, "Quit", &error,
+				   G_TYPE_INVALID,
+				   G_TYPE_INVALID);
+		    
+		/*
+		 * This might happen if the browser unload the plugin quickly
+		 * while the process didn't get the dbus name.
+		 */
+		if ( error )
 		{
-		    g_error_free (error);
-		    g_main_context_iteration(NULL, FALSE);
-		    g_usleep (100000);
-		    num_tries++;
-		    g_debug ("No reply, probably not ready, re-trying");
+    #ifdef DEBUG
+		    g_debug ("Failed to stop the backend via D-Bus %s", error->message);
+    #endif
+		    if ( g_error_matches (error, DBUS_GERROR, DBUS_GERROR_NO_REPLY ) ||
+			 g_error_matches (error, DBUS_GERROR, DBUS_GERROR_SERVICE_UNKNOWN) )
+		    {
+			g_error_free (error);
+			g_main_context_iteration(NULL, FALSE);
+			g_usleep (100000);
+			num_tries++;
+			g_debug ("No reply, probably not ready, re-trying");
+		    }
+		    else
+			break;
 		}
 		else
 		    break;
-	    }
-	    else
-		break;
-	    
-	} while (num_tries  < 4  && player_exited != TRUE);
+		
+	    } while (num_tries  < 4  && player_exited != TRUE);
+	}
+	else
+	{
+	    char cmd[128];
+	    g_snprintf (cmd, 128, "kill -9 %d", child_pid);
+	    g_spawn_command_line_async (cmd, NULL);
+	}
     }
 }
 
diff --git a/browser-plugin/plugin.h b/browser-plugin/plugin.h
index 311ec1a..ae412a9 100644
--- a/browser-plugin/plugin.h
+++ b/browser-plugin/plugin.h
@@ -89,6 +89,7 @@ class CPlugin {
     NPP mInstance;
     uint16_t mode;
     gchar *mimetype;
+    GPid             child_pid;
     
     DBusGConnection *bus;
     DBusGProxy      *proxy;
diff --git a/data/interfaces/save-playlist.ui b/data/interfaces/save-playlist.ui
index 4371236..bc754f3 100644
--- a/data/interfaces/save-playlist.ui
+++ b/data/interfaces/save-playlist.ui
@@ -25,6 +25,7 @@
     <property name="type_hint">normal</property>
     <property name="has_separator">False</property>
     <property name="action">save</property>
+    <property name="do_overwrite_confirmation">True</property>
     <child internal-child="vbox">
       <object class="GtkVBox" id="dialog-vbox1">
         <property name="visible">True</property>
diff --git a/docs/plugin-api/tmpl/parole-provider-player.sgml b/docs/plugin-api/tmpl/parole-provider-player.sgml
index b612838..7cccc04 100644
--- a/docs/plugin-api/tmpl/parole-provider-player.sgml
+++ b/docs/plugin-api/tmpl/parole-provider-player.sgml
@@ -7,7 +7,7 @@ The interface of the player.
 <!-- ##### SECTION Long_Description ##### -->
 <para>
 The player interface that the plugins should use in order to, issue playback 
-command to the Parole GStreamer backend or to get information about the current
+commands to the Parole GStreamer backend or to get information about the current
 playback status.
 </para>
 
diff --git a/gst/parole-gst.c b/gst/parole-gst.c
index d946717..1508161 100644
--- a/gst/parole-gst.c
+++ b/gst/parole-gst.c
@@ -187,7 +187,6 @@ parole_gst_parent_expose_event (GtkWidget *w, GdkEventExpose *ev, ParoleGst *gst
     return FALSE;
 }
 
-
 static void
 parole_gst_realize (GtkWidget *widget)
 {
@@ -346,7 +345,8 @@ parole_gst_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
 	w = allocation->width;
 	h = allocation->height;
 	
-	parole_gst_get_video_output_size (PAROLE_GST (widget), &w, &h);
+	if ( PAROLE_GST (widget)->priv->embedded == FALSE )
+	    parole_gst_get_video_output_size (PAROLE_GST (widget), &w, &h);
 
 	width = w;
 	height = h;
@@ -535,8 +535,10 @@ parole_gst_expose_event (GtkWidget *widget, GdkEventExpose *ev)
 		parole_gst_helper_draw_logo (PAROLE_GST_HELPER (gst));
 	    break;
 	case GST_STATE_READY:
-	    if (gst->priv->with_vis == FALSE && gst->priv->target != GST_STATE_PLAYING)
+	    if (gst->priv->target != GST_STATE_PLAYING)
 		parole_gst_helper_draw_logo (PAROLE_GST_HELPER (gst));
+	    else
+		gst_x_overlay_expose (GST_X_OVERLAY (gst->priv->video_sink));
 	    break;
 	case GST_STATE_NULL:
 	case GST_STATE_VOID_PENDING:
@@ -782,8 +784,7 @@ parole_gst_get_pad_capabilities (GObject *object, GParamSpec *pspec, ParoleGst *
 			  "disp-par-d", den,
 			  NULL);
 	}
-		      
-	parole_gst_get_video_output_size (gst, &width, &height);
+
 	parole_gst_size_allocate (GTK_WIDGET (gst), &GTK_WIDGET (gst)->allocation);
     }
 }
diff --git a/parole/parole-pl-parser.c b/parole/parole-pl-parser.c
index 1e1d2da..6d88fd7 100644
--- a/parole/parole-pl-parser.c
+++ b/parole/parole-pl-parser.c
@@ -486,7 +486,7 @@ parole_pl_parser_save_m3u (FILE *f, GSList *files)
     guint len;
     guint i;
     
-    fputs ("#EXTM3U\n", f);
+    fputs ("#EXTM3U\n\n", f);
     
     len = g_slist_length (files);
     
@@ -494,7 +494,8 @@ parole_pl_parser_save_m3u (FILE *f, GSList *files)
     {
 	ParoleFile *file;
 	file = g_slist_nth_data (files, i);
-	fprintf (f, "%s\n", parole_file_get_file_name (file));
+	fprintf (f, "#EXTINF:-1,%s\n", parole_file_get_display_name (file));
+	fprintf (f, "%s\n\n", parole_file_get_file_name (file));
     }
     
     return TRUE;
diff --git a/src/parole-medialist.c b/src/parole-medialist.c
index 2c13d88..6c0707f 100644
--- a/src/parole-medialist.c
+++ b/src/parole-medialist.c
@@ -1112,6 +1112,8 @@ parole_media_list_add_by_path (ParoleMediaList *list, const gchar *path, gboolea
     filter = parole_get_supported_media_filter ();
     g_object_ref_sink (filter);
     
+    TRACE ("Path=%s", path);
+    
     parole_get_media_files (filter, path, TRUE, &files_list);
     
     parole_media_list_files_open (list, files_list, FALSE, emit);
@@ -1300,13 +1302,17 @@ gboolean parole_media_list_add_files (ParoleMediaList *list, gchar **filenames)
     
     for ( i = 0; filenames && filenames[i] != NULL; i++)
     {
-	if ( g_str_has_prefix (filenames[i], "file:/") )
+	if ( g_file_test (filenames[i], G_FILE_TEST_IS_REGULAR ) )
+	{
 	    added += parole_media_list_add_by_path (list, filenames[i], i == 0 ? TRUE : FALSE);
+	}
 	else
 	{
 	    ParoleFile *file;
+	    TRACE ("File=%s", filenames[i]);
 	    file = parole_file_new (filenames[i]);
 	    parole_media_list_add (list, file, i == 0 ? TRUE : FALSE, i == 0 ? TRUE : FALSE);
+	    added++;
 	}
     }
     



More information about the Xfce4-commits mailing list