[gnome-video-arcade] main: Restore progress bar to the way it was intended.



commit 8760266ba179bd2c21a258bfa8619a4dc44007fb
Author: Matthew Barnes <mbarnes redhat com>
Date:   Mon Jul 27 22:44:28 2015 -0400

    main: Restore progress bar to the way it was intended.
    
    Height should match that of the status bar, not a mere 6 pixels.

 data/gnome-video-arcade.builder |    1 +
 src/main.c                      |   37 +++++++++++++++++++++++++++++++++++++
 2 files changed, 38 insertions(+), 0 deletions(-)
---
diff --git a/data/gnome-video-arcade.builder b/data/gnome-video-arcade.builder
index c4c6c63..6f7625b 100644
--- a/data/gnome-video-arcade.builder
+++ b/data/gnome-video-arcade.builder
@@ -430,6 +430,7 @@
               <object class="GtkProgressBar" id="main-progress-bar">
                 <property name="can_focus">False</property>
                 <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | 
GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+                <property name="valign">center</property>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/src/main.c b/src/main.c
index 29afdfb..225c6d3 100644
--- a/src/main.c
+++ b/src/main.c
@@ -305,6 +305,41 @@ idle_start (gpointer unused)
         return FALSE;
 }
 
+static gboolean
+tweak_css (gpointer unused)
+{
+        GtkAllocation allocation;
+        GtkCssProvider *provider;
+        GtkStyleContext *context;
+        gchar *css_data;
+
+        /* XXX Restore progress bar to the way it was intended to look. */
+
+        gtk_widget_get_allocation (GVA_WIDGET_MAIN_STATUSBAR, &allocation);
+
+        css_data = g_strdup_printf (
+                "GtkProgressBar { "
+                "-GtkProgressBar-min-horizontal-bar-height: %u;"
+                " }",
+                allocation.height);
+
+        provider = gtk_css_provider_new ();
+        gtk_css_provider_load_from_data (provider, css_data, -1, NULL);
+
+        g_free (css_data);
+
+        context = gtk_widget_get_style_context (GVA_WIDGET_MAIN_PROGRESS_BAR);
+
+        gtk_style_context_add_provider (
+                context, GTK_STYLE_PROVIDER (provider),
+                GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
+
+        g_object_unref (provider);
+
+        /* Do not reschedule this callback. */
+        return FALSE;
+}
+
 gint
 main (gint argc, gchar **argv)
 {
@@ -426,6 +461,8 @@ main (gint argc, gchar **argv)
 
         g_idle_add (idle_start, NULL);
 
+        g_idle_add (tweak_css, NULL);
+
         gtk_main ();
 
         g_object_unref (application);


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