[rhythmbox] Move .linked class from buttons to their container



commit ec3f68b308820694150b3ae4ecc00272dd9566ec
Author: Lars Uebernickel <lars uebernickel canonical com>
Date:   Wed Mar 12 11:40:33 2014 +0100

    Move .linked class from buttons to their container
    
    According to gtk's documentation, GTK_STYLE_CLASS_LINKED has to be set
    on the surrounding container instead of on the widgets that should be
    linked.
    
    Also move setting the style classes for toolbar buttons into the .ui
    file.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=726167

 data/ui/main-toolbar.ui |   21 +++++++++++++++++++++
 shell/rb-shell.c        |   22 ----------------------
 2 files changed, 21 insertions(+), 22 deletions(-)
---
diff --git a/data/ui/main-toolbar.ui b/data/ui/main-toolbar.ui
index aa1dd76..e6a9177 100644
--- a/data/ui/main-toolbar.ui
+++ b/data/ui/main-toolbar.ui
@@ -53,6 +53,9 @@
             <property name="can_focus">False</property>
             <property name="margin_top">6</property>
             <property name="margin_bottom">6</property>
+            <style>
+              <class name="linked" />
+            </style>
             <child>
               <object class="GtkButton" id="previous-button">
                 <property name="visible">True</property>
@@ -61,6 +64,9 @@
                 <property name="action_name">app.play-previous</property>
                 <property name="image">image5</property>
                 <property name="always_show_image">True</property>
+                <style>
+                  <class name="raised" />
+                </style>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -75,6 +81,9 @@
                 <property name="receives_default">True</property>
                 <property name="action_name">app.play</property>
                 <property name="image">image4</property>
+                <style>
+                  <class name="raised" />
+                </style>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -89,6 +98,9 @@
                 <property name="receives_default">True</property>
                 <property name="action_name">app.play-next</property>
                 <property name="image">image3</property>
+                <style>
+                  <class name="raised" />
+                </style>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -115,6 +127,9 @@
           <object class="GtkBox" id="box4">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
+            <style>
+              <class name="linked" />
+            </style>
             <child>
               <object class="GtkToggleButton" id="repeat-button">
                 <property name="visible">True</property>
@@ -122,6 +137,9 @@
                 <property name="receives_default">True</property>
                 <property name="action_name">app.play-repeat</property>
                 <property name="image">image2</property>
+                <style>
+                  <class name="raised" />
+                </style>
               </object>
               <packing>
                 <property name="expand">False</property>
@@ -136,6 +154,9 @@
                 <property name="receives_default">True</property>
                 <property name="action_name">app.play-shuffle</property>
                 <property name="image">image1</property>
+                <style>
+                  <class name="raised" />
+                </style>
               </object>
               <packing>
                 <property name="expand">False</property>
diff --git a/shell/rb-shell.c b/shell/rb-shell.c
index add6c65..e350c00 100644
--- a/shell/rb-shell.c
+++ b/shell/rb-shell.c
@@ -697,16 +697,6 @@ construct_sources (RBShell *shell)
 }
 
 static void
-set_button_classes (GtkBuilder *builder, const char *name)
-{
-       GtkWidget *widget;
-
-       widget = GTK_WIDGET (gtk_builder_get_object (builder, name));
-       gtk_style_context_add_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_RAISED);
-       gtk_style_context_add_class (gtk_widget_get_style_context (widget), GTK_STYLE_CLASS_LINKED);
-}
-
-static void
 construct_load_ui (RBShell *shell)
 {
        GApplication *app = g_application_get_default ();
@@ -718,14 +708,6 @@ construct_load_ui (RBShell *shell)
        GtkWidget *image;
        GMenuModel *model;
        gboolean rtl;
-       const char *raise_buttons[] = {
-               "previous-button",
-               "play-button",
-               "next-button",
-               "shuffle-button",
-               "repeat-button"
-       };
-       int i;
 
        rb_debug ("shell: loading ui");
        rb_profile_start ("loading ui");
@@ -735,10 +717,6 @@ construct_load_ui (RBShell *shell)
 
        shell->priv->play_button = GTK_WIDGET (gtk_builder_get_object (builder, "play-button"));
 
-       for (i = 0; i < G_N_ELEMENTS (raise_buttons); i++) {
-               set_button_classes (builder, raise_buttons[i]);
-       }
-
        rtl = (gtk_widget_get_direction (shell->priv->play_button) == GTK_TEXT_DIR_RTL);
        image = gtk_button_get_image (GTK_BUTTON (gtk_builder_get_object (builder, "next-button")));
        gtk_image_set_from_icon_name (GTK_IMAGE (image),


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