After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 690102 - Couple of style tweaks for the zoom controls
Couple of style tweaks for the zoom controls
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
unspecified
Other Linux
: Normal normal
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2012-12-12 14:37 UTC by William Jon McCann
Modified: 2013-01-02 18:43 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Don't show icons in zoom entry (3.75 KB, patch)
2012-12-12 14:38 UTC, William Jon McCann
none Details | Review
Correct test for the max zoom text width (1.79 KB, patch)
2012-12-12 14:38 UTC, William Jon McCann
none Details | Review
Don't show icons in zoom entry (3.60 KB, patch)
2013-01-02 16:29 UTC, William Jon McCann
committed Details | Review
Correct test for the max zoom text width (1.88 KB, patch)
2013-01-02 16:29 UTC, William Jon McCann
committed Details | Review

Description William Jon McCann 2012-12-12 14:37:56 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
Comment 1 William Jon McCann 2012-12-12 14:38:22 UTC
Created attachment 231374 [details] [review]
Don't show icons in zoom entry
Comment 2 William Jon McCann 2012-12-12 14:38:27 UTC
Created attachment 231375 [details] [review]
Correct test for the max zoom text width
Comment 3 William Jon McCann 2013-01-02 16:29:07 UTC
Created attachment 232537 [details] [review]
Don't show icons in zoom entry
Comment 4 William Jon McCann 2013-01-02 16:29:09 UTC
Created attachment 232538 [details] [review]
Correct test for the max zoom text width
Comment 5 Carlos Garcia Campos 2013-01-02 18:09:19 UTC
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
Comment 6 William Jon McCann 2013-01-02 18:43:11 UTC
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