GNOME Bugzilla – Bug 690102
Couple of style tweaks for the zoom controls
Last modified: 2013-01-02 18:43:16 UTC
Here are two fixes for the zoom controls. * More accurately get the width to use for the entry * Don't include icons for modes since there are only a couple that have icons at all and they add too much space and visual noise and use metaphors that aren't obvious
Created attachment 231374 [details] [review] Don't show icons in zoom entry
Created attachment 231375 [details] [review] Correct test for the max zoom text width
Created attachment 232537 [details] [review] Don't show icons in zoom entry
Created attachment 232538 [details] [review] Correct test for the max zoom text width
Comment on attachment 232538 [details] [review] Correct test for the max zoom text width >From 366aa3c25713a29b58d5eb2ecc3af46fc10d9ebf Mon Sep 17 00:00:00 2001 >From: William Jon McCann <jmccann@redhat.com> >Date: Wed, 12 Dec 2012 13:22:44 +0100 >Subject: [PATCH] Correct test for the max zoom text width > >https://bugzilla.gnome.org/show_bug.cgi?id=690102 >--- > shell/ev-zoom-action-widget.c | 16 +++++++++++++--- > 1 file changed, 13 insertions(+), 3 deletions(-) > >diff --git a/shell/ev-zoom-action-widget.c b/shell/ev-zoom-action-widget.c >index ef82888..cef4661 100644 >--- a/shell/ev-zoom-action-widget.c >+++ b/shell/ev-zoom-action-widget.c >@@ -243,6 +243,8 @@ ev_zoom_action_widget_init (EvZoomActionWidget *control) > GtkWidget *vbox; > GtkCellRenderer *renderer; > GtkListStore *store; >+ int i; >+ int width; > > control->priv = G_TYPE_INSTANCE_GET_PRIVATE (control, EV_TYPE_ZOOM_ACTION_WIDGET, EvZoomActionWidgetPrivate); > priv = control->priv; >@@ -255,9 +257,17 @@ ev_zoom_action_widget_init (EvZoomActionWidget *control) > g_object_unref (store); > > entry = gtk_bin_get_child (GTK_BIN (priv->combo)); >- /* Longest name + two digits + % + icon(3) */ >- gtk_entry_set_width_chars (GTK_ENTRY (entry), >- strlen (zoom_levels[G_N_ELEMENTS (zoom_levels) - 1].name) + 3 + 3); >+ >+ /* Find the longest name */ >+ width = 0; >+ for (i = 0; i < 3; i++) { >+ if (zoom_levels[i].name != NULL) { I don't think we need to check this, zoom_level from 0 to 3 always have a name, right? >+ int length = strlen (zoom_levels[i].name); Leave an empty line between variable declaration block and the body >+ if (length > width) >+ width = length; >+ } >+ } Maybe we could move this to a helper function get_zoom_lvel_max_width() or something similar >+ gtk_entry_set_width_chars (GTK_ENTRY (entry), width); > > renderer = gtk_cell_renderer_text_new (); > gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (priv->combo), renderer, FALSE); >-- >1.7.11.7
Attachment 232537 [details] pushed as 562205d - Don't show icons in zoom entry Attachment 232538 [details] pushed as a482448 - Correct test for the max zoom text width