[Xfce4-commits] [xfce/xfce4-settings] 55/57: color: Make add-profile dialog device specific

noreply at xfce.org noreply at xfce.org
Thu Mar 21 22:14:43 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 d0c72af126456f79a48d7770985db4bab011669c
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Tue Mar 12 00:27:33 2019 +0100

    color: Make add-profile dialog device specific
---
 dialogs/color-settings/color-device.c     | 54 ++++++++++++++++---------------
 dialogs/color-settings/color-device.h     |  1 +
 dialogs/color-settings/color-dialog.glade | 22 +++++--------
 dialogs/color-settings/main.c             |  7 ++++
 4 files changed, 44 insertions(+), 40 deletions(-)

diff --git a/dialogs/color-settings/color-device.c b/dialogs/color-settings/color-device.c
index 7d54452..d3b0902 100644
--- a/dialogs/color-settings/color-device.c
+++ b/dialogs/color-settings/color-device.c
@@ -57,6 +57,29 @@ enum
 static guint signals [SIGNAL_LAST] = { 0 };
 
 gchar *
+color_device_get_kind (CdDevice *device)
+{
+  if (cd_device_get_kind (device) == CD_DEVICE_KIND_DISPLAY)
+    /* TRANSLATORS: an externally connected display, where %s is either the
+     * model, vendor or ID, e.g. 'LP2480zx Monitor' */
+    return _("Monitor");
+  else if (cd_device_get_kind (device) == CD_DEVICE_KIND_SCANNER)
+    /* TRANSLATORS: a flatbed scanner device, e.g. 'Epson Scanner' */
+    return _("Scanner");
+  else if (cd_device_get_kind (device) == CD_DEVICE_KIND_CAMERA)
+    /* TRANSLATORS: a camera device, e.g. 'Nikon D60 Camera' */
+    return _("Camera");
+  else if (cd_device_get_kind (device) == CD_DEVICE_KIND_PRINTER)
+    /* TRANSLATORS: a printer device, e.g. 'Epson Photosmart Printer' */
+    return _("Printer");
+  else if (cd_device_get_kind (device) == CD_DEVICE_KIND_WEBCAM)
+    /* TRANSLATORS: a webcam device, e.g. 'Philips HiDef Camera' */
+    return _("Webcam");
+  else
+    return NULL;
+}
+
+gchar *
 color_device_get_title (CdDevice *device)
 {
   const gchar *tmp;
@@ -89,32 +112,11 @@ color_device_get_title (CdDevice *device)
   if (tmp == NULL)
     tmp = cd_device_get_id (device);
 
-  switch (cd_device_get_kind (device)) {
-    case CD_DEVICE_KIND_DISPLAY:
-      /* TRANSLATORS: an externally connected display, where %s is either the
-       * model, vendor or ID, e.g. 'LP2480zx Monitor' */
-      g_string_append_printf (string, _("%s Monitor"), tmp);
-      break;
-    case CD_DEVICE_KIND_SCANNER:
-      /* TRANSLATORS: a flatbed scanner device, e.g. 'Epson Scanner' */
-      g_string_append_printf (string, _("%s Scanner"), tmp);
-      break;
-    case CD_DEVICE_KIND_CAMERA:
-      /* TRANSLATORS: a camera device, e.g. 'Nikon D60 Camera' */
-      g_string_append_printf (string, _("%s Camera"), tmp);
-      break;
-    case CD_DEVICE_KIND_PRINTER:
-      /* TRANSLATORS: a printer device, e.g. 'Epson Photosmart Printer' */
-      g_string_append_printf (string, _("%s Printer"), tmp);
-      break;
-    case CD_DEVICE_KIND_WEBCAM:
-      /* TRANSLATORS: a webcam device, e.g. 'Philips HiDef Camera' */
-      g_string_append_printf (string, _("%s Webcam"), tmp);
-      break;
-    default:
-      g_string_append (string, tmp);
-      break;
-  }
+  if (color_device_get_kind (device))
+    g_string_append_printf (string, "%s %s", tmp, color_device_get_kind (device));
+  else
+    g_string_append (string, tmp);
+
 out:
   return g_string_free (string, FALSE);
 }
diff --git a/dialogs/color-settings/color-device.h b/dialogs/color-settings/color-device.h
index f962c7f..87dd073 100644
--- a/dialogs/color-settings/color-device.h
+++ b/dialogs/color-settings/color-device.h
@@ -29,6 +29,7 @@ G_BEGIN_DECLS
 #define TYPE_COLOR_DEVICE (color_device_get_type ())
 G_DECLARE_FINAL_TYPE (ColorDevice, color_device, CC, COLOR_DEVICE, GtkListBoxRow)
 
+gchar   *color_device_get_kind          (CdDevice *device);
 gchar   *color_device_get_sortable_base (CdDevice *device);
 gchar   *color_device_get_title         (CdDevice *device);
 GtkWidget   *color_device_new           (CdDevice       *device);
diff --git a/dialogs/color-settings/color-dialog.glade b/dialogs/color-settings/color-dialog.glade
index b810856..7c184a5 100644
--- a/dialogs/color-settings/color-dialog.glade
+++ b/dialogs/color-settings/color-dialog.glade
@@ -47,8 +47,8 @@
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
             <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>
@@ -58,12 +58,11 @@
                 <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="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>
@@ -73,6 +72,7 @@
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
+                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -468,8 +468,8 @@
       </object>
     </child>
     <action-widgets>
-      <action-widget response="-11">button1</action-widget>
       <action-widget response="0">button2</action-widget>
+      <action-widget response="-11">button1</action-widget>
     </action-widgets>
   </object>
   <object class="GtkImage" id="image5">
@@ -489,7 +489,7 @@
       <column type="gchararray"/>
     </columns>
   </object>
-  <object class="GtkDialog" id="dialog-assign">
+  <object class="XfceTitledDialog" id="dialog-assign">
     <property name="can_focus">False</property>
     <property name="title" translatable="yes">Add Profile to Device</property>
     <property name="modal">True</property>
@@ -498,9 +498,7 @@
     <property name="icon_name">preferences-color</property>
     <property name="type_hint">dialog</property>
     <property name="transient_for">dialog</property>
-    <child>
-      <placeholder/>
-    </child>
+    <property name="subtitle" translatable="yes">Add a Color Profile to your Device</property>
     <child internal-child="vbox">
       <object class="GtkBox">
         <property name="can_focus">False</property>
@@ -557,8 +555,6 @@
               <object class="GtkScrolledWindow">
                 <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="shadow_type">in</property>
                 <child>
                   <object class="GtkTreeView" id="treeview-assign">
@@ -581,8 +577,6 @@
               <object class="GtkBox">
                 <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_bottom">12</property>
                 <child>
                   <object class="GtkButton" id="assign-import">
diff --git a/dialogs/color-settings/main.c b/dialogs/color-settings/main.c
index 5e79ec2..4d355a3 100644
--- a/dialogs/color-settings/main.c
+++ b/dialogs/color-settings/main.c
@@ -497,6 +497,7 @@ static void
 color_settings_profile_add_cb (GtkButton *button, ColorSettings *settings)
 {
     g_autoptr(GPtrArray) profiles = NULL;
+    gchar *window_title;
 
     /* add profiles of the right kind */
     profiles = cd_device_get_profiles (settings->current_device);
@@ -506,6 +507,12 @@ color_settings_profile_add_cb (GtkButton *button, ColorSettings *settings)
     gtk_widget_set_sensitive (GTK_WIDGET (settings->button_assign_ok), FALSE);
 
     /* show the dialog */
+    gtk_window_set_icon_name (GTK_WINDOW (settings->dialog_assign), color_device_get_type_icon (settings->current_device));
+    window_title = g_strdup_printf ("Add Color Profile to %s",
+                                    color_device_get_kind (settings->current_device) ? color_device_get_kind (settings->current_device) : "Device");
+    gtk_window_set_title (GTK_WINDOW (settings->dialog_assign), window_title);
+    xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (settings->dialog_assign), color_device_get_title (settings->current_device));
+    g_free (window_title);
     gtk_widget_show (GTK_WIDGET (settings->dialog_assign));
 }
 

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


More information about the Xfce4-commits mailing list