[totem/gnome-3-8] backend: Remove error reporting from bvw_open()



commit 4afde91dc82aa15c9bf7fab498b9a4e979b7fccb
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Mar 27 23:11:32 2013 +0100

    backend: Remove error reporting from bvw_open()
    
    All the errors were reported async, through the error signal,
    so the error reporting in bvw_open() was completely unused.
    
    Conflicts:
        src/totem-object.c

 browser-plugin/totem-plugin-viewer.c |    5 +--
 src/backend/bacon-video-widget.c     |   29 +++++-------------
 src/backend/bacon-video-widget.h     |    5 +--
 src/backend/bvw-test.c               |    2 +-
 src/totem-object.c                   |   55 +++++++++------------------------
 5 files changed, 28 insertions(+), 68 deletions(-)
---
diff --git a/browser-plugin/totem-plugin-viewer.c b/browser-plugin/totem-plugin-viewer.c
index 9ea7361..f00384e 100644
--- a/browser-plugin/totem-plugin-viewer.c
+++ b/browser-plugin/totem-plugin-viewer.c
@@ -421,7 +421,6 @@ totem_embedded_open_internal (TotemEmbedded *emb,
                              gboolean start_play,
                              GError **error)
 {
-       gboolean retval;
        char *uri;
 
        /* FIXME: stop previous content, or is that automatic ? */
@@ -450,7 +449,7 @@ totem_embedded_open_internal (TotemEmbedded *emb,
 
        bacon_video_widget_set_logo_mode (emb->bvw, FALSE);
 
-       retval = bacon_video_widget_open (emb->bvw, uri, NULL);
+       bacon_video_widget_open (emb->bvw, uri);
        bacon_video_widget_set_text_subtitle (emb->bvw, emb->current_subtitle_uri);
        g_free (uri);
 
@@ -466,7 +465,7 @@ totem_embedded_open_internal (TotemEmbedded *emb,
        else
                totem_fullscreen_set_title (emb->fs, emb->current_uri);
 
-       return retval;
+       return TRUE;
 }
 
 static gboolean
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 587f561..145dd36 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -1301,12 +1301,7 @@ mount_cb (GObject *obj, GAsyncResult *res, gpointer user_data)
     GST_DEBUG ("Mounting location '%s' successful", GST_STR_NULL (uri));
     /* Save the expected pipeline state */
     target_state = bvw->priv->target_state;
-    if (bacon_video_widget_open (bvw, uri, &error)) {
-        if (target_state == GST_STATE_PLAYING)
-          bacon_video_widget_play (bvw, NULL);
-        g_free (uri);
-        return;
-    }
+    bacon_video_widget_open (bvw, uri);
   }
 
   if (!ret)
@@ -3437,27 +3432,21 @@ get_target_uri (GFile *file)
  * bacon_video_widget_open:
  * @bvw: a #BaconVideoWidget
  * @mrl: an MRL
- * @error: a #GError, or %NULL
  *
  * Opens the given @mrl in @bvw for playing.
  *
- * If there was a filesystem error, a %BVW_ERROR_GENERIC error will be returned. Otherwise,
- * more specific #BvwError errors will be returned.
- *
- * On success, the MRL is loaded and waiting to be played with bacon_video_widget_play().
- *
- * Return value: %TRUE on success, %FALSE otherwise
+ * The MRL is loaded and waiting to be played with bacon_video_widget_play().
  **/
-gboolean
-bacon_video_widget_open (BaconVideoWidget * bvw,
-                         const gchar * mrl, GError ** error)
+void
+bacon_video_widget_open (BaconVideoWidget *bvw,
+                         const char       *mrl)
 {
   GFile *file;
   char *path;
 
-  g_return_val_if_fail (mrl != NULL, FALSE);
-  g_return_val_if_fail (BACON_IS_VIDEO_WIDGET (bvw), FALSE);
-  g_return_val_if_fail (bvw->priv->play != NULL, FALSE);
+  g_return_if_fail (mrl != NULL);
+  g_return_if_fail (BACON_IS_VIDEO_WIDGET (bvw));
+  g_return_if_fail (bvw->priv->play != NULL);
   
   /* So we aren't closed yet... */
   if (bvw->priv->mrl) {
@@ -3517,8 +3506,6 @@ bacon_video_widget_open (BaconVideoWidget * bvw,
   gst_element_set_state (bvw->priv->play, GST_STATE_PAUSED);
 
   g_signal_emit (bvw, bvw_signals[SIGNAL_CHANNELS_CHANGE], 0);
-
-  return TRUE;
 }
 
 /**
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index a9d2f5c..97f960e 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -129,9 +129,8 @@ GOptionGroup* bacon_video_widget_get_option_group (void);
 GtkWidget *bacon_video_widget_new               (GError **error);
 
 /* Actions */
-gboolean bacon_video_widget_open                (BaconVideoWidget *bvw,
-                                                 const char *mrl,
-                                                 GError **error);
+void bacon_video_widget_open                    (BaconVideoWidget *bvw,
+                                                 const char *mrl);
 gboolean bacon_video_widget_play                 (BaconVideoWidget *bvw,
                                                  GError **error);
 void bacon_video_widget_pause                   (BaconVideoWidget *bvw);
diff --git a/src/backend/bvw-test.c b/src/backend/bvw-test.c
index deee2a6..477a962 100644
--- a/src/backend/bvw-test.c
+++ b/src/backend/bvw-test.c
@@ -16,7 +16,7 @@ static void
 test_bvw_set_mrl (GtkWidget *bvw, const char *path)
 {
        mrl = g_strdup (path);
-       bacon_video_widget_open (BACON_VIDEO_WIDGET (bvw), mrl, NULL);
+       bacon_video_widget_open (BACON_VIDEO_WIDGET (bvw), mrl);
 }
 
 static void
diff --git a/src/totem-object.c b/src/totem-object.c
index 6b5b435..e50c1aa 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -1738,7 +1738,10 @@ totem_action_set_mrl_with_warning (TotemObject *totem,
                gdouble volume;
                char *user_agent;
                char *autoload_sub;
-               GError *err = NULL;
+               /* cast is to shut gcc up */
+               const GtkTargetEntry source_table[] = {
+                       { (gchar*) "text/uri-list", 0, 0 }
+               };
 
                bacon_video_widget_set_logo_mode (totem->bvw, FALSE);
 
@@ -1753,7 +1756,7 @@ totem_action_set_mrl_with_warning (TotemObject *totem,
 
                totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (totem->win));
                totem_try_restore_position (totem, mrl);
-               retval = bacon_video_widget_open (totem->bvw, mrl, &err);
+               bacon_video_widget_open (totem->bvw, mrl);
                bacon_video_widget_set_text_subtitle (totem->bvw, subtitle ? subtitle : autoload_sub);
                g_free (autoload_sub);
                gdk_window_set_cursor (gtk_widget_get_window (totem->win), NULL);
@@ -1772,49 +1775,21 @@ totem_action_set_mrl_with_warning (TotemObject *totem,
                totem->volume_sensitive = caps;
 
                /* Clear the playlist */
-               totem_action_set_sensitivity ("clear-playlist", retval);
+               totem_action_set_sensitivity ("clear-playlist", TRUE);
 
                /* Subtitle selection */
-               totem_action_set_sensitivity ("select-subtitle", !totem_is_special_mrl (mrl) && retval);
+               totem_action_set_sensitivity ("select-subtitle", !totem_is_special_mrl (mrl));
 
                /* Set the playlist */
-               play_pause_set_label (totem, retval ? STATE_PAUSED : STATE_STOPPED);
-
-               if (retval == FALSE && warn != FALSE) {
-                       char *msg, *disp;
+               play_pause_set_label (totem, STATE_PAUSED);
 
-                       disp = totem_uri_escape_for_display (totem->mrl);
-                       msg = g_strdup_printf(_("Totem could not play '%s'."), disp);
-                       g_free (disp);
-                       if (err && err->message) {
-                               totem_action_error (totem, msg, err->message);
-                       }
-                       else {
-                               totem_action_error (totem, msg, _("No error message"));
-                       }
-                       g_free (msg);
-               }
+               totem_file_opened (totem, totem->mrl);
 
-               if (retval == FALSE) {
-                       if (err)
-                               g_error_free (err);
-                       g_free (totem->mrl);
-                       totem->mrl = NULL;
-                       bacon_video_widget_set_logo_mode (totem->bvw, TRUE);
-               } else {
-                       /* cast is to shut gcc up */
-                       const GtkTargetEntry source_table[] = {
-                               { (gchar*) "text/uri-list", 0, 0 }
-                       };
-
-                       totem_file_opened (totem, totem->mrl);
-
-                       /* Set the drag source */
-                       gtk_drag_source_set (GTK_WIDGET (totem->bvw),
-                                            GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
-                                            source_table, G_N_ELEMENTS (source_table),
-                                            GDK_ACTION_COPY);
-               }
+               /* Set the drag source */
+               gtk_drag_source_set (GTK_WIDGET (totem->bvw),
+                                    GDK_BUTTON1_MASK | GDK_BUTTON3_MASK,
+                                    source_table, G_N_ELEMENTS (source_table),
+                                    GDK_ACTION_COPY);
        }
        update_buttons (totem);
        update_media_menu_items (totem);
@@ -2403,7 +2378,7 @@ on_got_redirect (BaconVideoWidget *bvw, const char *mrl, TotemObject *totem)
        totem_file_closed (totem);
        totem->has_played_emitted = FALSE;
        totem_gdk_window_set_waiting_cursor (gtk_widget_get_window (totem->win));
-       bacon_video_widget_open (totem->bvw, new_mrl ? new_mrl : mrl, NULL);
+       bacon_video_widget_open (totem->bvw, new_mrl ? new_mrl : mrl);
        totem_file_opened (totem, new_mrl ? new_mrl : mrl);
        gdk_window_set_cursor (gtk_widget_get_window (totem->win), NULL);
        if (bacon_video_widget_play (bvw, NULL) != FALSE) {


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