[Xfce4-commits] [xfce/xfce4-settings] 02/05: display: Improve look of ratio

noreply at xfce.org noreply at xfce.org
Thu Jan 2 22:54:25 CET 2020


This is an automated email from the git hooks/post-receive script.

o   c   h   o   s   i       p   u   s   h   e   d       a       c   o   m   m   i   t       t   o       b   r   a   n   c   h       m   a   s   t   e   r   
   in repository xfce/xfce4-settings.

commit 27f36f68eaa3180308457ba2bf0ed4eb06388e91
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed Dec 25 14:54:30 2019 +0100

    display: Improve look of ratio
---
 dialogs/display-settings/main.c | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 2235f03..e070601 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -652,9 +652,11 @@ display_setting_resolutions_changed (GtkComboBox *combobox,
 
 /* Greatest common divisor */
 static guint
-gcd (guint a, guint b) {
+gcd (guint a,
+     guint b)
+{
     if (b == 0)
-        return a;
+      return a;
 
     return gcd (b, a % b);
 }
@@ -664,6 +666,7 @@ display_setting_resolutions_populate (GtkBuilder *builder)
 {
     GtkTreeModel     *model;
     GObject          *combobox, *label;
+    GtkCellRenderer  *renderer;
     gint              nmode, n;
     gchar            *name;
     GtkTreeIter       iter;
@@ -673,6 +676,14 @@ display_setting_resolutions_populate (GtkBuilder *builder)
     combobox = gtk_builder_get_object (builder, "randr-resolution");
     model = gtk_combo_box_get_model (GTK_COMBO_BOX (combobox));
     gtk_list_store_clear (GTK_LIST_STORE (model));
+
+    /* Replace the standard text renderer of the combobox with markup */
+    renderer = gtk_cell_renderer_text_new ();
+    gtk_cell_layout_clear (GTK_CELL_LAYOUT (combobox));
+    gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combobox), renderer, FALSE);
+    gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (combobox), renderer,
+                                   "markup", 0);
+
     label = gtk_builder_get_object (builder, "label-resolution");
 
     /* Disable it if no mode is selected */
@@ -741,12 +752,12 @@ display_setting_resolutions_populate (GtkBuilder *builder)
                 guint gcd_tmp = gcd (modes[n].width, modes[n].height);
                 guint format_x = modes[n].width / gcd_tmp;
                 guint format_y = modes[n].height / gcd_tmp;
-                name = g_strdup_printf ("%dx%d (%d:%d - %.3f)", modes[n].width,
+                name = g_strdup_printf ("%dx%d <span fgalpha='50%'>%d:%d - %.3f</span>", modes[n].width,
                                         modes[n].height, format_x, format_y, ratio);
             }
             else
             {
-                name = g_strdup_printf ("%dx%d (%s - %.3f)", modes[n].width,
+                name = g_strdup_printf ("%dx%d <span fgalpha='50%'>%s - %.3f</span>", modes[n].width,
                                         modes[n].height, ratio_text, ratio);
             }
             g_free(ratio_text);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list