[totem/wip/hadess/glsink: 82/89] spinner in main app




commit 585ecec4aa1cdaa0ced8dc8c70cceff27af57eba
Author: Bastien Nocera <hadess hadess net>
Date:   Thu May 6 16:44:21 2021 +0200

    spinner in main app

 src/backend/bacon-video-widget.c | 18 ------------------
 src/totem-object.c               | 30 ++++++++++++++++--------------
 src/totem-private.h              |  1 +
 3 files changed, 17 insertions(+), 32 deletions(-)
---
diff --git a/src/backend/bacon-video-widget.c b/src/backend/bacon-video-widget.c
index 9fe8b9cb9..6dde50057 100644
--- a/src/backend/bacon-video-widget.c
+++ b/src/backend/bacon-video-widget.c
@@ -5929,24 +5929,6 @@ bacon_video_widget_initable_init (GInitable     *initable,
                 "rotate-method", GST_GTK_GL_ROTATE_METHOD_AUTO,
                 NULL);
 #if 0
-  bvw->stage = gtk_clutter_embed_get_stage (GTK_CLUTTER_EMBED (bvw));
-  clutter_actor_set_text_direction (bvw->stage,
-                                   CLUTTER_TEXT_DIRECTION_LTR);
-  clutter_actor_set_layout_manager (bvw->stage,
-                                    clutter_bin_layout_new (CLUTTER_BIN_ALIGNMENT_FILL, 
CLUTTER_BIN_ALIGNMENT_FILL));
-  clutter_actor_set_name (bvw->stage, "stage");
-  clutter_actor_set_background_color (bvw->stage, CLUTTER_COLOR_Black);
-
-  listen_navigation_events (bvw->texture, bvw);
-
-  /* The logo */
-  bvw->logo_frame = clutter_actor_new ();
-  clutter_actor_set_name (bvw->logo_frame, "logo-frame");
-  bvw->logo = clutter_image_new ();
-  clutter_actor_set_content (bvw->logo_frame, bvw->logo);
-  clutter_actor_set_content_gravity (bvw->logo_frame, CLUTTER_CONTENT_GRAVITY_RESIZE_ASPECT);
-  clutter_actor_add_child (bvw->stage, bvw->logo_frame);
-  clutter_actor_hide (CLUTTER_ACTOR (bvw->logo_frame));
 
   /* The video's actions */
   action = clutter_tap_action_new ();
diff --git a/src/totem-object.c b/src/totem-object.c
index b2d815630..7c6473786 100644
--- a/src/totem-object.c
+++ b/src/totem-object.c
@@ -212,11 +212,14 @@ totem_object_app_activate (GApplication *app)
                g_assert_not_reached ();
        gtk_grid_attach (GTK_GRID (totem->bvw_grid),
                         GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")),
-                        0, 2, 1, 1);
+                        0, 4, 3, 1);
        gtk_widget_set_hexpand (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")), TRUE);
        gtk_widget_set_vexpand (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")), TRUE);
        gtk_widget_set_valign (GTK_WIDGET (gtk_builder_get_object (totem->controls, "toolbar")), 
GTK_ALIGN_END);
 
+       totem->spinner = gtk_label_new ("");
+       gtk_grid_attach (GTK_GRID (totem->bvw_grid), totem->spinner, 1, 2, 1, 1);
+
        totem->seek = GTK_WIDGET (gtk_builder_get_object (totem->controls, "seek_scale"));
        totem->seekadj = gtk_range_get_adjustment (GTK_RANGE (totem->seek));
        totem->volume = GTK_WIDGET (gtk_builder_get_object (totem->controls, "volume_button"));
@@ -2485,19 +2488,18 @@ on_error_event (BaconVideoWidget *bvw, char *message,
 }
 
 static void
-on_buffering_event (BaconVideoWidget *bvw, gdouble percentage, TotemObject *totem)
+on_buffering_event (BaconVideoWidget *bvw, gdouble percent, TotemObject *totem)
 {
-       g_message ("YEAH! spinner! %g", percentage);
-#if 0
-  if (percent >= 100.0) {
-    clutter_actor_hide (bvw->spinner);
-    /* Reset */
-    g_object_set (G_OBJECT (bvw->spinner), "percent", 0.0, NULL);
-  } else {
-    clutter_actor_show (bvw->spinner);
-    g_object_set (G_OBJECT (bvw->spinner), "percent", (float) percent, NULL);
-  }
-#endif
+       if (percent >= 1.0) {
+               gtk_widget_hide (totem->spinner);
+               gtk_label_set_markup (GTK_LABEL (totem->spinner), "");
+       } else {
+               g_autofree char *text = NULL;
+
+               text = g_strdup_printf ("<span size=\"larger\">%.2f%%</span>", percent * 100);
+               gtk_label_set_markup (GTK_LABEL (totem->spinner), text);
+               gtk_widget_show (totem->spinner);
+       }
 }
 
 static void
@@ -4090,7 +4092,7 @@ add_fullscreen_toolbar (TotemObject *totem,
                          G_CALLBACK (popup_menu_shown_cb), totem);
        totem->fullscreen_gear_button = item;
 
-       gtk_grid_attach (GTK_GRID (container), totem->fullscreen_header, 0, 0, 1, 1);
+       gtk_grid_attach (GTK_GRID (container), totem->fullscreen_header, 0, 0, 3, 1);
        gtk_widget_set_halign (totem->fullscreen_header, GTK_ALIGN_FILL);
        gtk_widget_set_hexpand (totem->fullscreen_header, TRUE);
        gtk_widget_set_opacity (totem->fullscreen_header, 0.86);
diff --git a/src/totem-private.h b/src/totem-private.h
index 62cd5276f..867ba3757 100644
--- a/src/totem-private.h
+++ b/src/totem-private.h
@@ -78,6 +78,7 @@ struct _TotemObject {
        GtkWidget *bvw_grid;
        GtkWidget *prefs;
        GtkWindow *shortcuts_win;
+       GtkWidget *spinner;
 
        GtkWidget *grilo;
 


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