Merge lp:~robert-ancell/unity-control-center/even-icon-sizes into lp:unity-control-center

Proposed by Robert Ancell
Status: Merged
Approved by: Sebastien Bacher
Approved revision: 12753
Merged at revision: 12755
Proposed branch: lp:~robert-ancell/unity-control-center/even-icon-sizes
Merge into: lp:unity-control-center
Diff against target: 136 lines (+25/-28)
1 file modified
panels/appearance/cc-appearance-panel.c (+25/-28)
To merge this branch: bzr merge lp:~robert-ancell/unity-control-center/even-icon-sizes
Reviewer Review Type Date Requested Status
Sebastien Bacher Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+211238@code.launchpad.net

Commit message

Only allow icons sizes to be even numbers because odd sizes look blurry.

Description of the change

Limit the icon sizes to even numbers by using a scale for the half-size and then doubling it.

This obsoletes the proposal in lp:~kokoto-java/unity-control-center/fix-lp-1292112.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:12752
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~robert-ancell/unity-control-center/even-icon-sizes/+merge/211238/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/unity-control-center-ci/72/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-control-center-trusty-amd64-ci/72
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-control-center-trusty-armhf-ci/72
    SUCCESS: http://jenkins.qa.ubuntu.com/job/unity-control-center-trusty-i386-ci/73

Click here to trigger a rebuild:
http://s-jenkins.ubuntu-ci:8080/job/unity-control-center-ci/72/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
asmoore82 (asmoore82) wrote :

This works great! But the new effective page increment might be unintentionally large. Since it's 8 with a "scaling factor" of 2x it actually jumps 16 at a time. I would recommend 4 now to get the effect of 8:

+++ panels/appearance/cc-appearance-panel.c 2014-03-17 03:50:51 +0000
@@ -1869,1 +1869,1 @@
- iconsize_adj = gtk_adjustment_new (DEFAULT_ICONSIZE / 2, MIN_ICONSIZE / 2, MAX_ICONSIZE / 2, 1, 8, 0);
+ iconsize_adj = gtk_adjustment_new (DEFAULT_ICONSIZE / 2, MIN_ICONSIZE / 2, MAX_ICONSIZE / 2, 1, 4, 0);

Thanks!

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
12753. By Robert Ancell

Fix icon size adjustment page size being out by a factor of two

Revision history for this message
Robert Ancell (robert-ancell) wrote :

> This works great! But the new effective page increment might be
> unintentionally large. Since it's 8 with a "scaling factor" of 2x it actually
> jumps 16 at a time. I would recommend 4 now to get the effect of 8:

Thanks for spotting that, fixed.

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sebastien Bacher (seb128) wrote :

Looks good to me, thanks

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'panels/appearance/cc-appearance-panel.c'
2--- panels/appearance/cc-appearance-panel.c 2014-02-25 18:45:48 +0000
3+++ panels/appearance/cc-appearance-panel.c 2014-03-17 04:23:19 +0000
4@@ -121,18 +121,11 @@
5
6 #define MIN_ICONSIZE 16.0
7 #define MAX_ICONSIZE 64.0
8+#define DEFAULT_ICONSIZE 48.0
9
10 #define MIN_LAUNCHER_SENSIVITY 0.2
11 #define MAX_LAUNCHER_SENSIVITY 8.0
12
13-typedef struct
14-{
15- gdouble min;
16- gdouble max;
17-} MinMax;
18-static MinMax iconsize_values;
19-static MinMax launchersensitivity_values;
20-
21 #define WID(y) (GtkWidget *) gtk_builder_get_object (priv->builder, y)
22
23 static void
24@@ -1412,7 +1405,7 @@
25 iconsize_widget_refresh (GtkAdjustment *iconsize_adj, GSettings *unity_settings)
26 {
27 gint value = g_settings_get_int (unity_settings, UNITY_ICONSIZE_KEY);
28- gtk_adjustment_set_value (iconsize_adj, (gdouble)value);
29+ gtk_adjustment_set_value (iconsize_adj, (gdouble)value / 2);
30 }
31
32 static void
33@@ -1423,10 +1416,16 @@
34 iconsize_widget_refresh (GTK_ADJUSTMENT (user_data), settings);
35 }
36
37+static gchar *
38+on_iconsize_format_value (GtkScale *scale, gdouble value)
39+{
40+ return g_strdup_printf ("%d", (int) value * 2);
41+}
42+
43 static void
44 on_iconsize_changed (GtkAdjustment *adj, GSettings *unity_settings)
45 {
46- g_settings_set_int (unity_settings, UNITY_ICONSIZE_KEY, (gint)gtk_adjustment_get_value (adj));
47+ g_settings_set_int (unity_settings, UNITY_ICONSIZE_KEY, (gint)gtk_adjustment_get_value (adj) * 2);
48 }
49
50 static void
51@@ -1791,21 +1790,21 @@
52 /* Get scrolling in the right direction */
53 static gboolean
54 on_scale_scroll_event (GtkWidget *widget,
55- GdkEventScroll *event,
56- gpointer *data)
57+ GdkEventScroll *event)
58 {
59 gdouble value;
60 GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (widget));
61- MinMax *iconsize_values = (MinMax *) data;
62- gdouble delta = iconsize_values->max - iconsize_values->min;
63+ double min = gtk_adjustment_get_lower (adj);
64+ double max = gtk_adjustment_get_upper (adj);
65+ gdouble delta = max - min;
66
67 value = gtk_adjustment_get_value (adj);
68
69 if ((event->direction == GDK_SCROLL_UP) ||
70 (event->direction == GDK_SCROLL_SMOOTH && event->delta_y < 0))
71 {
72- if (value + delta/8 > iconsize_values->max)
73- value = iconsize_values->max;
74+ if (value + delta/8 > max)
75+ value = max;
76 else
77 value = value + delta/8;
78 gtk_adjustment_set_value (adj, value);
79@@ -1813,8 +1812,8 @@
80 else if ((event->direction == GDK_SCROLL_DOWN) ||
81 (event->direction == GDK_SCROLL_SMOOTH && event->delta_y > 0))
82 {
83- if (value - delta/8 < iconsize_values->min)
84- value = iconsize_values->min;
85+ if (value - delta/8 < min)
86+ value = min;
87 else
88 value = value - delta/8;
89 gtk_adjustment_set_value (adj, value);
90@@ -1866,20 +1865,20 @@
91 if (!priv->unity_settings || !priv->compizcore_settings || !priv->unity_own_settings || !priv->unity_launcher_settings)
92 return;
93
94- /* Icon size change */
95- iconsize_values.min = MIN_ICONSIZE;
96- iconsize_values.max = MAX_ICONSIZE;
97- iconsize_adj = gtk_adjustment_new (48, iconsize_values.min, iconsize_values.max, 1, 5, 0);
98+ /* Icon size change - we halve the sizes so we can only get even values*/
99+ iconsize_adj = gtk_adjustment_new (DEFAULT_ICONSIZE / 2, MIN_ICONSIZE / 2, MAX_ICONSIZE / 2, 1, 4, 0);
100 iconsize_scale = GTK_SCALE (WID ("unity-iconsize-scale"));
101 gtk_range_set_adjustment (GTK_RANGE (iconsize_scale), iconsize_adj);
102- gtk_scale_add_mark (iconsize_scale, 48, GTK_POS_BOTTOM, NULL);
103+ gtk_scale_add_mark (iconsize_scale, DEFAULT_ICONSIZE / 2, GTK_POS_BOTTOM, NULL);
104 g_signal_connect (priv->unity_settings, "changed::" UNITY_ICONSIZE_KEY,
105 G_CALLBACK (ext_iconsize_changed_callback), iconsize_adj);
106
107+ g_signal_connect (G_OBJECT (iconsize_scale), "format-value",
108+ G_CALLBACK (on_iconsize_format_value), NULL);
109 g_signal_connect (iconsize_adj, "value_changed",
110 G_CALLBACK (on_iconsize_changed), priv->unity_settings);
111 g_signal_connect (G_OBJECT (iconsize_scale), "scroll-event",
112- G_CALLBACK (on_scale_scroll_event), &iconsize_values);
113+ G_CALLBACK (on_scale_scroll_event), NULL);
114 iconsize_widget_refresh (iconsize_adj, priv->unity_settings);
115
116 /* Reveal spot setting */
117@@ -1892,9 +1891,7 @@
118 reveallauncher_widget_refresh (self);
119
120 /* Launcher reveal */
121- launchersensitivity_values.min = MIN_LAUNCHER_SENSIVITY;
122- launchersensitivity_values.max = MAX_LAUNCHER_SENSIVITY;
123- launcher_sensitivity_adj = gtk_adjustment_new (2, launchersensitivity_values.min, launchersensitivity_values.max, 0.1, 1, 0);
124+ launcher_sensitivity_adj = gtk_adjustment_new (2, MIN_LAUNCHER_SENSIVITY, MAX_LAUNCHER_SENSIVITY, 0.1, 1, 0);
125 launcher_sensitivity_scale = GTK_SCALE (WID ("unity-launcher-sensitivity"));
126 gtk_range_set_adjustment (GTK_RANGE (launcher_sensitivity_scale), launcher_sensitivity_adj);
127 gtk_scale_add_mark (launcher_sensitivity_scale, 2, GTK_POS_BOTTOM, NULL);
128@@ -1903,7 +1900,7 @@
129 g_signal_connect (launcher_sensitivity_adj, "value_changed",
130 G_CALLBACK (on_launchersensitivity_changed), self);
131 g_signal_connect (G_OBJECT (launcher_sensitivity_scale), "scroll-event",
132- G_CALLBACK (on_scale_scroll_event), &launchersensitivity_values);
133+ G_CALLBACK (on_scale_scroll_event), NULL);
134 launcher_sensitivity_widget_refresh (launcher_sensitivity_adj, priv->unity_settings);
135
136 /* Autohide launcher setting */

Subscribers

People subscribed via source and target branches