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
=== modified file 'panels/appearance/cc-appearance-panel.c'
--- panels/appearance/cc-appearance-panel.c 2014-02-25 18:45:48 +0000
+++ panels/appearance/cc-appearance-panel.c 2014-03-17 04:23:19 +0000
@@ -121,18 +121,11 @@
121121
122#define MIN_ICONSIZE 16.0122#define MIN_ICONSIZE 16.0
123#define MAX_ICONSIZE 64.0123#define MAX_ICONSIZE 64.0
124#define DEFAULT_ICONSIZE 48.0
124125
125#define MIN_LAUNCHER_SENSIVITY 0.2126#define MIN_LAUNCHER_SENSIVITY 0.2
126#define MAX_LAUNCHER_SENSIVITY 8.0127#define MAX_LAUNCHER_SENSIVITY 8.0
127128
128typedef struct
129{
130 gdouble min;
131 gdouble max;
132} MinMax;
133static MinMax iconsize_values;
134static MinMax launchersensitivity_values;
135
136#define WID(y) (GtkWidget *) gtk_builder_get_object (priv->builder, y)129#define WID(y) (GtkWidget *) gtk_builder_get_object (priv->builder, y)
137130
138static void131static void
@@ -1412,7 +1405,7 @@
1412iconsize_widget_refresh (GtkAdjustment *iconsize_adj, GSettings *unity_settings)1405iconsize_widget_refresh (GtkAdjustment *iconsize_adj, GSettings *unity_settings)
1413{1406{
1414 gint value = g_settings_get_int (unity_settings, UNITY_ICONSIZE_KEY);1407 gint value = g_settings_get_int (unity_settings, UNITY_ICONSIZE_KEY);
1415 gtk_adjustment_set_value (iconsize_adj, (gdouble)value);1408 gtk_adjustment_set_value (iconsize_adj, (gdouble)value / 2);
1416}1409}
14171410
1418static void1411static void
@@ -1423,10 +1416,16 @@
1423 iconsize_widget_refresh (GTK_ADJUSTMENT (user_data), settings);1416 iconsize_widget_refresh (GTK_ADJUSTMENT (user_data), settings);
1424}1417}
14251418
1419static gchar *
1420on_iconsize_format_value (GtkScale *scale, gdouble value)
1421{
1422 return g_strdup_printf ("%d", (int) value * 2);
1423}
1424
1426static void1425static void
1427on_iconsize_changed (GtkAdjustment *adj, GSettings *unity_settings)1426on_iconsize_changed (GtkAdjustment *adj, GSettings *unity_settings)
1428{1427{
1429 g_settings_set_int (unity_settings, UNITY_ICONSIZE_KEY, (gint)gtk_adjustment_get_value (adj));1428 g_settings_set_int (unity_settings, UNITY_ICONSIZE_KEY, (gint)gtk_adjustment_get_value (adj) * 2);
1430}1429}
14311430
1432static void1431static void
@@ -1791,21 +1790,21 @@
1791/* Get scrolling in the right direction */1790/* Get scrolling in the right direction */
1792static gboolean1791static gboolean
1793on_scale_scroll_event (GtkWidget *widget,1792on_scale_scroll_event (GtkWidget *widget,
1794 GdkEventScroll *event,1793 GdkEventScroll *event)
1795 gpointer *data)
1796{1794{
1797 gdouble value;1795 gdouble value;
1798 GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (widget));1796 GtkAdjustment *adj = gtk_range_get_adjustment (GTK_RANGE (widget));
1799 MinMax *iconsize_values = (MinMax *) data;1797 double min = gtk_adjustment_get_lower (adj);
1800 gdouble delta = iconsize_values->max - iconsize_values->min;1798 double max = gtk_adjustment_get_upper (adj);
1799 gdouble delta = max - min;
18011800
1802 value = gtk_adjustment_get_value (adj);1801 value = gtk_adjustment_get_value (adj);
18031802
1804 if ((event->direction == GDK_SCROLL_UP) ||1803 if ((event->direction == GDK_SCROLL_UP) ||
1805 (event->direction == GDK_SCROLL_SMOOTH && event->delta_y < 0))1804 (event->direction == GDK_SCROLL_SMOOTH && event->delta_y < 0))
1806 {1805 {
1807 if (value + delta/8 > iconsize_values->max)1806 if (value + delta/8 > max)
1808 value = iconsize_values->max;1807 value = max;
1809 else1808 else
1810 value = value + delta/8;1809 value = value + delta/8;
1811 gtk_adjustment_set_value (adj, value);1810 gtk_adjustment_set_value (adj, value);
@@ -1813,8 +1812,8 @@
1813 else if ((event->direction == GDK_SCROLL_DOWN) ||1812 else if ((event->direction == GDK_SCROLL_DOWN) ||
1814 (event->direction == GDK_SCROLL_SMOOTH && event->delta_y > 0))1813 (event->direction == GDK_SCROLL_SMOOTH && event->delta_y > 0))
1815 {1814 {
1816 if (value - delta/8 < iconsize_values->min)1815 if (value - delta/8 < min)
1817 value = iconsize_values->min;1816 value = min;
1818 else1817 else
1819 value = value - delta/8;1818 value = value - delta/8;
1820 gtk_adjustment_set_value (adj, value);1819 gtk_adjustment_set_value (adj, value);
@@ -1866,20 +1865,20 @@
1866 if (!priv->unity_settings || !priv->compizcore_settings || !priv->unity_own_settings || !priv->unity_launcher_settings)1865 if (!priv->unity_settings || !priv->compizcore_settings || !priv->unity_own_settings || !priv->unity_launcher_settings)
1867 return;1866 return;
18681867
1869 /* Icon size change */1868 /* Icon size change - we halve the sizes so we can only get even values*/
1870 iconsize_values.min = MIN_ICONSIZE;1869 iconsize_adj = gtk_adjustment_new (DEFAULT_ICONSIZE / 2, MIN_ICONSIZE / 2, MAX_ICONSIZE / 2, 1, 4, 0);
1871 iconsize_values.max = MAX_ICONSIZE;
1872 iconsize_adj = gtk_adjustment_new (48, iconsize_values.min, iconsize_values.max, 1, 5, 0);
1873 iconsize_scale = GTK_SCALE (WID ("unity-iconsize-scale"));1870 iconsize_scale = GTK_SCALE (WID ("unity-iconsize-scale"));
1874 gtk_range_set_adjustment (GTK_RANGE (iconsize_scale), iconsize_adj);1871 gtk_range_set_adjustment (GTK_RANGE (iconsize_scale), iconsize_adj);
1875 gtk_scale_add_mark (iconsize_scale, 48, GTK_POS_BOTTOM, NULL);1872 gtk_scale_add_mark (iconsize_scale, DEFAULT_ICONSIZE / 2, GTK_POS_BOTTOM, NULL);
1876 g_signal_connect (priv->unity_settings, "changed::" UNITY_ICONSIZE_KEY,1873 g_signal_connect (priv->unity_settings, "changed::" UNITY_ICONSIZE_KEY,
1877 G_CALLBACK (ext_iconsize_changed_callback), iconsize_adj);1874 G_CALLBACK (ext_iconsize_changed_callback), iconsize_adj);
18781875
1876 g_signal_connect (G_OBJECT (iconsize_scale), "format-value",
1877 G_CALLBACK (on_iconsize_format_value), NULL);
1879 g_signal_connect (iconsize_adj, "value_changed",1878 g_signal_connect (iconsize_adj, "value_changed",
1880 G_CALLBACK (on_iconsize_changed), priv->unity_settings);1879 G_CALLBACK (on_iconsize_changed), priv->unity_settings);
1881 g_signal_connect (G_OBJECT (iconsize_scale), "scroll-event",1880 g_signal_connect (G_OBJECT (iconsize_scale), "scroll-event",
1882 G_CALLBACK (on_scale_scroll_event), &iconsize_values);1881 G_CALLBACK (on_scale_scroll_event), NULL);
1883 iconsize_widget_refresh (iconsize_adj, priv->unity_settings);1882 iconsize_widget_refresh (iconsize_adj, priv->unity_settings);
18841883
1885 /* Reveal spot setting */1884 /* Reveal spot setting */
@@ -1892,9 +1891,7 @@
1892 reveallauncher_widget_refresh (self);1891 reveallauncher_widget_refresh (self);
18931892
1894 /* Launcher reveal */1893 /* Launcher reveal */
1895 launchersensitivity_values.min = MIN_LAUNCHER_SENSIVITY;1894 launcher_sensitivity_adj = gtk_adjustment_new (2, MIN_LAUNCHER_SENSIVITY, MAX_LAUNCHER_SENSIVITY, 0.1, 1, 0);
1896 launchersensitivity_values.max = MAX_LAUNCHER_SENSIVITY;
1897 launcher_sensitivity_adj = gtk_adjustment_new (2, launchersensitivity_values.min, launchersensitivity_values.max, 0.1, 1, 0);
1898 launcher_sensitivity_scale = GTK_SCALE (WID ("unity-launcher-sensitivity"));1895 launcher_sensitivity_scale = GTK_SCALE (WID ("unity-launcher-sensitivity"));
1899 gtk_range_set_adjustment (GTK_RANGE (launcher_sensitivity_scale), launcher_sensitivity_adj);1896 gtk_range_set_adjustment (GTK_RANGE (launcher_sensitivity_scale), launcher_sensitivity_adj);
1900 gtk_scale_add_mark (launcher_sensitivity_scale, 2, GTK_POS_BOTTOM, NULL);1897 gtk_scale_add_mark (launcher_sensitivity_scale, 2, GTK_POS_BOTTOM, NULL);
@@ -1903,7 +1900,7 @@
1903 g_signal_connect (launcher_sensitivity_adj, "value_changed",1900 g_signal_connect (launcher_sensitivity_adj, "value_changed",
1904 G_CALLBACK (on_launchersensitivity_changed), self);1901 G_CALLBACK (on_launchersensitivity_changed), self);
1905 g_signal_connect (G_OBJECT (launcher_sensitivity_scale), "scroll-event",1902 g_signal_connect (G_OBJECT (launcher_sensitivity_scale), "scroll-event",
1906 G_CALLBACK (on_scale_scroll_event), &launchersensitivity_values);1903 G_CALLBACK (on_scale_scroll_event), NULL);
1907 launcher_sensitivity_widget_refresh (launcher_sensitivity_adj, priv->unity_settings);1904 launcher_sensitivity_widget_refresh (launcher_sensitivity_adj, priv->unity_settings);
19081905
1909 /* Autohide launcher setting */1906 /* Autohide launcher setting */

Subscribers

People subscribed via source and target branches