~ubuntu-desktop/rhythmbox/ubuntu

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
From c6a8e7e2565c94cf3793477d63ac913b5f6d5f47 Mon Sep 17 00:00:00 2001
From: Lars Uebernickel <lars.uebernickel@canonical.com>
Date: Wed, 12 Mar 2014 11:40:33 +0100
Subject: [PATCH] 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),
-- 
1.9.0