totem r5079 - in trunk: . browser-plugin



Author: hadess
Date: Thu Feb  7 17:23:02 2008
New Revision: 5079
URL: http://svn.gnome.org/viewvc/totem?rev=5079&view=rev

Log:
2008-02-07  Bastien Nocera  <hadess hadess net>

	* browser-plugin/totem-plugin-viewer.c: (totem_embedded_set_error),
	(totem_embedded_open_internal), (on_video_button_press_event),
	(on_error_event), (totem_embedded_push_parser):
	Remember the errors, and once we've set the error, allow errors
	to popup when the main window is clicked (Closes: #457337)
	* browser-plugin/totemPlugin.cpp: Fix the plugin not appearing
	when the width or height isn't set



Modified:
   trunk/ChangeLog
   trunk/browser-plugin/totem-plugin-viewer.c
   trunk/browser-plugin/totemPlugin.cpp

Modified: trunk/browser-plugin/totem-plugin-viewer.c
==============================================================================
--- trunk/browser-plugin/totem-plugin-viewer.c	(original)
+++ trunk/browser-plugin/totem-plugin-viewer.c	Thu Feb  7 17:23:02 2008
@@ -137,6 +137,7 @@
 	GtkWidget * fs_window;
 
 	/* Error */
+	GError *error;
 
 	guint type : 3; /* TotemPluginType */
 
@@ -172,6 +173,7 @@
 static gboolean totem_embedded_do_command (TotemEmbedded *emb, const char *command, GError **err);
 static gboolean totem_embedded_push_parser (gpointer data);
 static gboolean totem_embedded_play (TotemEmbedded *embedded, GError **error);
+static void totem_embedded_set_logo_by_name (TotemEmbedded *embedded, const char *name);
 
 static void totem_embedded_clear_playlist (TotemEmbedded *embedded);
 
@@ -287,13 +289,25 @@
 
 static void
 totem_embedded_set_error (TotemEmbedded *emb,
-			  char *primary,
+			  int code,
 			  char *secondary)
 {
-	/* FIXME */
-	g_message ("totem_embedded_set_error: '%s', '%s'", primary, secondary);
+	emb->error = g_error_new (TOTEM_EMBEDDED_ERROR_QUARK,
+				  code,
+				  secondary);
+	g_message ("totem_embedded_set_error: '%s'", secondary);
 }
 
+static gboolean
+totem_embedded_set_error_logo (TotemEmbedded *embedded,
+			       GError *error)
+{
+	g_message ("totem_embedded_set_error_logo called by browser plugin");
+	totem_embedded_set_logo_by_name (embedded, "image-missing");
+	return TRUE;
+}
+
+
 static void
 totem_embedded_set_state (TotemEmbedded *emb, TotemStates state)
 {
@@ -454,23 +468,19 @@
 	if (retval == FALSE)
 	{
 		GError *errint;
-		char *primary;
 
 		/* FIXME we haven't even started sending yet! */
 		//g_signal_emit (emb, signals[STOP_STREAM], 0);
 
 		totem_embedded_set_state (emb, TOTEM_STATE_STOPPED);
-		totem_embedded_set_logo_by_name (emb, "image-missing");
+		totem_embedded_set_error_logo (emb, NULL);
 
 		errint = g_error_new (TOTEM_EMBEDDED_ERROR_QUARK,
 				      TOTEM_EMBEDDED_OPEN_FAILED,
 				      _("Totem could not play '%s'"),
 				     emb->current_uri);
 
-		//FIXME disp = gnome_vfs_unescape_string_for_display (totem->mrl); ?
-		primary = g_strdup_printf(_("Totem could not play '%s'"), emb->current_uri);
-		totem_embedded_set_error (emb, primary, err->message);;
-		g_free (primary);
+		totem_embedded_set_error (emb, err->code, err->message);;
 
 		g_propagate_error (error, err);
 
@@ -590,15 +600,6 @@
 }
 
 static gboolean
-totem_embedded_set_error_logo (TotemEmbedded *embedded,
-			       GError *error)
-{
-	g_message ("totem_embedded_set_error_logo called by browser plugin");
-	totem_embedded_set_logo_by_name (embedded, "image-missing");
-	return TRUE;
-}
-
-static gboolean
 totem_embedded_set_volume (TotemEmbedded *embedded,
 			   gdouble volume,
 			   GError *error)
@@ -1457,7 +1458,11 @@
 	menu = GTK_MENU (gtk_builder_get_object (emb->menuxml, "menu"));
 
 	if (event->type == GDK_BUTTON_PRESS && event->button == 1 && state == 0 && emb->state == TOTEM_STATE_STOPPED) {
-		if (!GTK_WIDGET_VISIBLE (menu)) {
+		if (emb->error != NULL) {
+			totem_interface_error (_("An error occurred"), emb->error->message, (GtkWindow *) (emb->window));
+			g_error_free (emb->error);
+			emb->error = NULL;
+		} else if (!GTK_WIDGET_VISIBLE (menu)) {
 			g_message ("emitting signal");
 			g_signal_emit (emb, signals[BUTTON_PRESS], 0,
 				       event->time,
@@ -1566,7 +1571,8 @@
 		exit (1);
 	}
 
-	totem_embedded_set_error (emb, _("An error occurred"), message);
+	totem_embedded_set_error (emb, BVW_ERROR_GENERIC, message);
+	totem_embedded_set_error_logo (emb, NULL);
 }
 
 static void
@@ -2145,9 +2151,9 @@
 	/* Check if we have anything in the playlist now */
 	if (emb->playlist == NULL && res != TOTEM_PL_PARSER_RESULT_SUCCESS) {
 		g_message ("Couldn't parse playlist '%s'", emb->current_uri);
-		totem_embedded_set_error (emb, _("No playlist or playlist empty") /* FIXME */,
-					  NULL);
-		totem_embedded_set_logo_by_name (emb, "image-missing");
+		totem_embedded_set_error (emb, BVW_ERROR_EMPTY_FILE,
+					  _("No playlist or playlist empty"));
+		totem_embedded_set_error_logo (emb, NULL);
 		return FALSE;
 	} else if (emb->playlist == NULL) {
 		g_message ("Playlist empty");

Modified: trunk/browser-plugin/totemPlugin.cpp
==============================================================================
--- trunk/browser-plugin/totemPlugin.cpp	(original)
+++ trunk/browser-plugin/totemPlugin.cpp	Thu Feb  7 17:23:02 2008
@@ -1728,8 +1728,11 @@
 
 	/* Used as a replacement for HIDDEN=TRUE attribute.
 	 * See http://mxr.mozilla.org/mozilla/source/modules/plugin/base/src/ns4xPluginInstance.cpp#1135
+	 * We don't use:
+	 * width <= 0 || height <= 0
+	 * as -1 is our value for unset/unknown sizes
 	 */
-	if (width <= 0 || height <= 0)
+	if (width == 0 || height == 0)
 		mHidden = PR_TRUE;
 
 	/* Whether to automatically stream and play the content */



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]