[Xfce4-commits] [xfce/xfce4-settings] 45/57: color: More UI tweaks

noreply at xfce.org noreply at xfce.org
Thu Mar 21 22:14:33 CET 2019


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 2b40134da47f7729ee329c5eb48dd2f1d90c8d57
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Mon Feb 18 22:38:41 2019 +0100

    color: More UI tweaks
---
 dialogs/color-settings/color-device.c     |  18 +++---
 dialogs/color-settings/color-device.h     |   1 +
 dialogs/color-settings/color-dialog.glade | 101 +++++++++++++++++-------------
 dialogs/color-settings/main.c             |  40 ++++++------
 4 files changed, 86 insertions(+), 74 deletions(-)

diff --git a/dialogs/color-settings/color-device.c b/dialogs/color-settings/color-device.c
index df49058..7d54452 100644
--- a/dialogs/color-settings/color-device.c
+++ b/dialogs/color-settings/color-device.c
@@ -136,21 +136,21 @@ color_device_kind_to_sort (CdDevice *device)
   return "9";
 }
 
-static const gchar *
+const gchar *
 color_device_get_type_icon (CdDevice *device)
 {
   CdDeviceKind kind = cd_device_get_kind (device);
   if (kind == CD_DEVICE_KIND_DISPLAY)
-    return "video-display-symbolic";
+    return "video-display";
   if (kind == CD_DEVICE_KIND_SCANNER)
-    return "scanner-symbolic";
+    return "scanner";
   if (kind == CD_DEVICE_KIND_CAMERA)
-    return "camera-photo-symbolic";
+    return "camera-photo";
   if (kind == CD_DEVICE_KIND_WEBCAM)
-    return "camera-web-symbolic";
+    return "camera-web";
   if (kind == CD_DEVICE_KIND_PRINTER)
-    return "printer-symbolic";
-  return "dialog-question-symbolic";
+    return "printer";
+  return "dialog-question";
 }
 
 gchar *
@@ -170,6 +170,7 @@ color_device_refresh (ColorDevice *color_device)
   g_autoptr(GPtrArray) profiles = NULL;
   AtkObject *accessible;
   g_autofree gchar *name1 = NULL;
+  g_autofree gchar *device_icon = NULL;
 
   /* add switch and expander if there are profiles, otherwise use a label */
   profiles = cd_device_get_profiles (color_device->device);
@@ -180,8 +181,9 @@ color_device_refresh (ColorDevice *color_device)
   gtk_label_set_label (GTK_LABEL (color_device->widget_description), title);
   gtk_widget_set_visible (color_device->widget_description, TRUE);
 
+  device_icon = g_strdup_printf ("%s-symbolic", color_device_get_type_icon (color_device->device));
   gtk_image_set_from_icon_name (GTK_IMAGE (color_device->widget_icon),
-                                color_device_get_type_icon (color_device->device),
+                                device_icon,
                                 GTK_ICON_SIZE_MENU);
   gtk_widget_set_visible (color_device->widget_icon, TRUE);
   gtk_widget_set_visible (color_device->widget_switch, profiles->len > 0);
diff --git a/dialogs/color-settings/color-device.h b/dialogs/color-settings/color-device.h
index 5fc835c..f962c7f 100644
--- a/dialogs/color-settings/color-device.h
+++ b/dialogs/color-settings/color-device.h
@@ -33,6 +33,7 @@ gchar   *color_device_get_sortable_base (CdDevice *device);
 gchar   *color_device_get_title         (CdDevice *device);
 GtkWidget   *color_device_new           (CdDevice       *device);
 CdDevice    *color_device_get_device    (ColorDevice  *color_device);
+const gchar *color_device_get_type_icon (CdDevice *device);
 const gchar *color_device_get_sortable  (ColorDevice  *color_device);
 void         color_device_set_enabled  (ColorDevice  *color_device,
                                           gboolean        enabled);
diff --git a/dialogs/color-settings/color-dialog.glade b/dialogs/color-settings/color-dialog.glade
index 83e3a06..f96e0f7 100644
--- a/dialogs/color-settings/color-dialog.glade
+++ b/dialogs/color-settings/color-dialog.glade
@@ -37,8 +37,8 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <child>
-              <object class="GtkButton" id="button2">
-                <property name="label">gtk-close</property>
+              <object class="GtkButton" id="button1">
+                <property name="label">gtk-help</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -48,11 +48,12 @@
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
             <child>
-              <object class="GtkButton" id="button1">
-                <property name="label">gtk-help</property>
+              <object class="GtkButton" id="button2">
+                <property name="label">gtk-close</property>
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="receives_default">True</property>
@@ -62,7 +63,6 @@
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -83,20 +83,19 @@
               <object class="GtkPaned" id="paned">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
+                <property name="margin_left">12</property>
+                <property name="margin_right">12</property>
+                <property name="margin_top">12</property>
                 <child>
                   <object class="GtkBox" id="device">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_left">6</property>
-                    <property name="margin_top">6</property>
-                    <property name="margin_bottom">6</property>
                     <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkScrolledWindow" id="scrolled-devices">
                         <property name="visible">True</property>
                         <property name="can_focus">True</property>
                         <property name="hexpand">True</property>
-                        <property name="shadow_type">in</property>
                         <property name="min_content_width">250</property>
                         <child>
                           <placeholder/>
@@ -153,10 +152,10 @@
                   <object class="GtkBox" id="profile">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="margin_left">12</property>
-                    <property name="margin_right">12</property>
-                    <property name="margin_top">12</property>
-                    <property name="margin_bottom">12</property>
+                    <property name="margin_left">24</property>
+                    <property name="margin_right">24</property>
+                    <property name="margin_top">24</property>
+                    <property name="margin_bottom">24</property>
                     <property name="orientation">vertical</property>
                     <child>
                       <object class="GtkGrid">
@@ -166,29 +165,38 @@
                         <property name="margin_bottom">6</property>
                         <property name="row_spacing">3</property>
                         <property name="column_spacing">12</property>
-                        <property name="column_homogeneous">True</property>
                         <child>
-                          <object class="GtkLabel">
+                          <object class="GtkLabel" id="model">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">Model:</property>
-                            <property name="xalign">1</property>
+                            <property name="xalign">0</property>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
+                            <property name="left_attach">2</property>
                             <property name="top_attach">0</property>
                           </packing>
                         </child>
                         <child>
+                          <object class="GtkLabel" id="colorspace">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="xalign">0</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">2</property>
+                          </packing>
+                        </child>
+                        <child>
                           <object class="GtkLabel">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="label" translatable="yes">Vendor:</property>
+                            <property name="label" translatable="yes">Model:</property>
                             <property name="xalign">1</property>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
-                            <property name="top_attach">1</property>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">0</property>
                           </packing>
                         </child>
                         <child>
@@ -199,26 +207,27 @@
                             <property name="xalign">1</property>
                           </object>
                           <packing>
-                            <property name="left_attach">0</property>
+                            <property name="left_attach">1</property>
                             <property name="top_attach">2</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="model">
+                          <object class="GtkLabel" id="vendor">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
                             <property name="xalign">0</property>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">0</property>
+                            <property name="left_attach">2</property>
+                            <property name="top_attach">1</property>
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="vendor">
+                          <object class="GtkLabel">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
+                            <property name="label" translatable="yes">Vendor:</property>
+                            <property name="xalign">1</property>
                           </object>
                           <packing>
                             <property name="left_attach">1</property>
@@ -226,14 +235,17 @@
                           </packing>
                         </child>
                         <child>
-                          <object class="GtkLabel" id="colorspace">
+                          <object class="GtkImage" id="device-icon">
                             <property name="visible">True</property>
                             <property name="can_focus">False</property>
-                            <property name="xalign">0</property>
+                            <property name="margin_right">12</property>
+                            <property name="pixel_size">64</property>
+                            <property name="icon_size">3</property>
                           </object>
                           <packing>
-                            <property name="left_attach">1</property>
-                            <property name="top_attach">2</property>
+                            <property name="left_attach">0</property>
+                            <property name="top_attach">0</property>
+                            <property name="height">3</property>
                           </packing>
                         </child>
                       </object>
@@ -259,20 +271,17 @@
                       </packing>
                     </child>
                     <child>
-                      <object class="GtkFrame" id="box-profiles">
+                      <object class="GtkScrolledWindow" id="scrolled-profiles">
                         <property name="visible">True</property>
-                        <property name="can_focus">False</property>
-                        <property name="label_xalign">0</property>
+                        <property name="can_focus">True</property>
+                        <property name="vexpand">True</property>
                         <property name="shadow_type">in</property>
                         <child>
                           <placeholder/>
                         </child>
-                        <child type="label_item">
-                          <placeholder/>
-                        </child>
                       </object>
                       <packing>
-                        <property name="expand">False</property>
+                        <property name="expand">True</property>
                         <property name="fill">True</property>
                         <property name="position">2</property>
                       </packing>
@@ -288,16 +297,17 @@
                             <property name="visible">True</property>
                             <property name="sensitive">False</property>
                             <property name="can_focus">False</property>
-                            <property name="margin_left">12</property>
-                            <property name="margin_right">12</property>
-                            <property name="margin_top">12</property>
-                            <property name="margin_bottom">12</property>
+                            <property name="margin_left">11</property>
+                            <property name="margin_right">11</property>
+                            <property name="margin_top">11</property>
+                            <property name="margin_bottom">11</property>
+                            <property name="vexpand">True</property>
                             <property name="label" translatable="yes"><b>No profiles for the selected device.</b></property>
                             <property name="use_markup">True</property>
                             <property name="justify">center</property>
                           </object>
                           <packing>
-                            <property name="expand">False</property>
+                            <property name="expand">True</property>
                             <property name="fill">True</property>
                             <property name="position">0</property>
                           </packing>
@@ -410,6 +420,9 @@
                     <property name="shrink">False</property>
                   </packing>
                 </child>
+                <style>
+                  <class name="frame"/>
+                </style>
               </object>
               <packing>
                 <property name="expand">True</property>
@@ -427,8 +440,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="0">button2</action-widget>
       <action-widget response="-11">button1</action-widget>
+      <action-widget response="0">button2</action-widget>
     </action-widgets>
   </object>
   <object class="GtkImage" id="image3">
diff --git a/dialogs/color-settings/main.c b/dialogs/color-settings/main.c
index 60315c4..1870684 100644
--- a/dialogs/color-settings/main.c
+++ b/dialogs/color-settings/main.c
@@ -62,6 +62,7 @@ struct _ColorSettings
     GDBusProxy    *proxy;
     GObject       *label_no_devices;
     GObject       *scrolled_devices;
+    GObject       *device_icon;
     GObject       *model;
     GObject       *vendor;
     GObject       *colorspace;
@@ -72,7 +73,7 @@ struct _ColorSettings
     GtkSizeGroup  *list_box_size;
     GObject       *dialog_assign;
     GObject       *label_no_profiles;
-    GObject       *box_profiles;
+    GObject       *scrolled_profiles;
     GObject       *profiles_enable;
     GObject       *profiles_add;
     GObject       *profiles_remove;
@@ -683,17 +684,23 @@ color_settings_update_profile_list_extra_entry (ColorSettings *settings)
     guint number_of_profiles;
 
     if (CD_IS_DEVICE (settings->current_device)) {
-        gtk_label_set_text (GTK_LABEL (settings->model), cd_device_get_model (settings->current_device));
-        gtk_label_set_text (GTK_LABEL (settings->vendor), cd_device_get_vendor (settings->current_device));
-        gtk_label_set_text (GTK_LABEL (settings->colorspace),
-                            cd_colorspace_to_string (cd_device_get_colorspace (settings->current_device)));
+        const gchar *model = cd_device_get_model (settings->current_device);
+        const gchar *vendor = cd_device_get_vendor (settings->current_device);
+        const gchar *colorspace = cd_colorspace_to_string (cd_device_get_colorspace (settings->current_device));
+
+        gtk_image_set_from_icon_name (GTK_IMAGE (settings->device_icon),
+                                      color_device_get_type_icon (settings->current_device),
+                                      GTK_ICON_SIZE_DIALOG);
+        gtk_label_set_text (GTK_LABEL (settings->model), model ? model : _("Unknown"));
+        gtk_label_set_text (GTK_LABEL (settings->vendor), vendor ? vendor : _("Unknown"));
+        gtk_label_set_text (GTK_LABEL (settings->colorspace), colorspace ? colorspace : _("Unknown"));
     }
 
     /* any profiles to show? */
     profile_widgets = gtk_container_get_children (GTK_CONTAINER (settings->profiles_list_box));
     number_of_profiles = g_list_length (profile_widgets);
     gtk_widget_set_visible (GTK_WIDGET (settings->label_no_profiles), number_of_profiles == 0);
-    gtk_widget_set_visible (GTK_WIDGET (settings->box_profiles), number_of_profiles > 0);
+    gtk_widget_set_visible (GTK_WIDGET (settings->scrolled_profiles), number_of_profiles > 0);
 }
 
 
@@ -717,7 +724,7 @@ color_settings_list_box_row_activated_cb (GtkListBox *list_box,
         gtk_widget_set_sensitive (GTK_WIDGET (settings->profiles_add), FALSE);
         gtk_widget_set_sensitive (GTK_WIDGET (settings->profiles_remove), FALSE);
         gtk_widget_set_sensitive (GTK_WIDGET (settings->profiles_enable), FALSE);
-        gtk_widget_hide (GTK_WIDGET (settings->box_profiles));
+        gtk_widget_hide (GTK_WIDGET (settings->scrolled_profiles));
     }
 }
 
@@ -731,7 +738,7 @@ color_settings_device_enabled_changed_cb (ColorDevice *widget,
 {
     gtk_list_box_select_row (settings->list_box, GTK_LIST_BOX_ROW (widget));
     gtk_widget_set_visible (GTK_WIDGET (settings->label_no_profiles), !is_enabled);
-    gtk_widget_set_visible (GTK_WIDGET (settings->box_profiles), is_enabled);
+    gtk_widget_set_visible (GTK_WIDGET (settings->scrolled_profiles), is_enabled);
     gtk_widget_set_sensitive (GTK_WIDGET (settings->profiles_add), is_enabled);
     gtk_widget_set_sensitive (GTK_WIDGET (settings->profiles_remove), is_enabled);
     gtk_widget_set_sensitive (GTK_WIDGET (settings->profiles_enable), is_enabled);
@@ -1065,8 +1072,6 @@ color_settings_dialog_init (GtkBuilder *builder)
 {
     ColorSettings *settings;
     GtkTreeSelection *selection;
-    GObject *paned;
-    GtkCssProvider *provider;
 
     settings = g_new0 (ColorSettings, 1);
     settings->cancellable = g_cancellable_new ();
@@ -1079,19 +1084,10 @@ color_settings_dialog_init (GtkBuilder *builder)
     g_signal_connect_data (settings->client, "device-removed",
                            G_CALLBACK (color_settings_device_removed_cb), settings, 0, 0);
 
-    /* hide separator from GtkPaned */
-    paned = gtk_builder_get_object (builder, "paned");
-    provider = gtk_css_provider_new ();
-    gtk_css_provider_load_from_data (provider,
-                                     "paned separator { background:transparent; }",
-                                     -1, NULL);
-    gtk_style_context_add_provider (gtk_widget_get_style_context (GTK_WIDGET (paned)),
-                                    GTK_STYLE_PROVIDER (provider),
-                                    GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
     settings->label_no_devices = gtk_builder_get_object (builder, "label-no-devices");
 
     /* Devices ListBox */
+    settings->device_icon = gtk_builder_get_object (builder, "device-icon");
     settings->model = gtk_builder_get_object (builder, "model");
     settings->vendor = gtk_builder_get_object (builder, "vendor");
     settings->colorspace = gtk_builder_get_object (builder, "colorspace");
@@ -1130,7 +1126,6 @@ color_settings_dialog_init (GtkBuilder *builder)
     g_signal_connect (settings->profiles_enable, "clicked", G_CALLBACK (color_settings_device_profile_enable_cb), settings);
 
     settings->label_no_profiles = gtk_builder_get_object (builder, "label-no-profiles");
-    settings->box_profiles = gtk_builder_get_object (builder, "box-profiles");
     settings->profiles_list_box = GTK_LIST_BOX (gtk_list_box_new ());
     gtk_list_box_set_header_func (settings->profiles_list_box,
                                   list_box_update_header_func,
@@ -1148,7 +1143,8 @@ color_settings_dialog_init (GtkBuilder *builder)
                       settings);
     settings->profiles_list_box_size = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
 
-    gtk_container_add (GTK_CONTAINER (settings->box_profiles), GTK_WIDGET (settings->profiles_list_box));
+    settings->scrolled_profiles = gtk_builder_get_object (builder, "scrolled-profiles");
+    gtk_container_add (GTK_CONTAINER (settings->scrolled_profiles), GTK_WIDGET (settings->profiles_list_box));
     gtk_widget_show (GTK_WIDGET (settings->profiles_list_box));
 
     /* Treeview of all colord profiles */

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


More information about the Xfce4-commits mailing list