[Xfce4-commits] [xfce/xfce4-settings] 53/57: color: Initial support for gcm-calibrate

noreply at xfce.org noreply at xfce.org
Thu Mar 21 22:14:41 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 5f71ead2bb71b42466bc392eb95bcc9c153c59c1
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Thu Feb 28 00:37:35 2019 +0100

    color: Initial support for gcm-calibrate
---
 dialogs/color-settings/color-dialog.glade | 32 +++++++++++++++++++++------
 dialogs/color-settings/main.c             | 36 ++++++++++++++++++++++++++++++-
 2 files changed, 61 insertions(+), 7 deletions(-)

diff --git a/dialogs/color-settings/color-dialog.glade b/dialogs/color-settings/color-dialog.glade
index 3a66743..b810856 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="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>
@@ -58,11 +58,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>
@@ -72,7 +73,6 @@
                 <property name="expand">False</property>
                 <property name="fill">False</property>
                 <property name="position">0</property>
-                <property name="secondary">True</property>
               </packing>
             </child>
           </object>
@@ -258,6 +258,26 @@
                             <property name="height">3</property>
                           </packing>
                         </child>
+                        <child>
+                          <object class="GtkButton" id="device-calibrate">
+                            <property name="label" translatable="yes">Calibrate</property>
+                            <property name="visible">True</property>
+                            <property name="can_focus">True</property>
+                            <property name="receives_default">True</property>
+                            <property name="halign">start</property>
+                            <property name="margin_top">6</property>
+                          </object>
+                          <packing>
+                            <property name="left_attach">1</property>
+                            <property name="top_attach">3</property>
+                          </packing>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </object>
                       <packing>
                         <property name="expand">False</property>
@@ -448,8 +468,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="image5">
diff --git a/dialogs/color-settings/main.c b/dialogs/color-settings/main.c
index e4c5b50..772a897 100644
--- a/dialogs/color-settings/main.c
+++ b/dialogs/color-settings/main.c
@@ -67,6 +67,7 @@ struct _ColorSettings
     GObject       *model;
     GObject       *vendor;
     GObject       *colorspace;
+    GObject       *device_calibrate;
     GtkListBox    *list_box;
     gchar         *list_box_filter;
     guint          list_box_selected_id;
@@ -577,6 +578,33 @@ color_settings_profile_remove_cb (GtkWidget *widget, ColorSettings *settings)
 
 
 static void
+color_settings_device_calibrate_cb (CdProfile *profile, ColorSettings *settings)
+{
+    gchar *cli;
+    guint xid;
+    GAppInfo *app_info;
+    GError *error = NULL;
+
+    xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (settings->dialog)));
+
+    cli = g_strdup_printf ("gcm-calibrate --device %s --parent-window %i", cd_device_get_id (settings->current_device), xid);
+
+    /* open up gcm-viewer */
+    app_info = g_app_info_create_from_commandline (cli, "Gnome Color Manager Calibration",
+                                                   G_APP_INFO_CREATE_NONE, NULL);
+    if (!g_app_info_launch (app_info, NULL, NULL, &error)) {
+      if (error != NULL) {
+        g_warning ("gcm-calibrate could not be launched. %s", error->message);
+        g_error_free (error);
+      }
+    }
+
+    g_free (cli);
+}
+
+
+
+static void
 color_settings_profile_info_view (CdProfile *profile, ColorSettings *settings)
 {
     gchar *cli;
@@ -597,7 +625,7 @@ color_settings_profile_info_view (CdProfile *profile, ColorSettings *settings)
                                                    G_APP_INFO_CREATE_NONE, NULL);
     if (!g_app_info_launch (app_info, NULL, NULL, &error)) {
       if (error != NULL) {
-        g_warning ("xfce4-notifyd-config could not be launched. %s", error->message);
+        g_warning ("gcm-viewer could not be launched. %s", error->message);
         g_error_free (error);
       }
     }
@@ -1223,6 +1251,12 @@ color_settings_dialog_init (GtkBuilder *builder)
     gtk_container_add (GTK_CONTAINER (settings->scrolled_devices), GTK_WIDGET (settings->list_box));
     gtk_widget_show_all (GTK_WIDGET (settings->list_box));
 
+    /* Conditionally show/hide the calibrate button, based on the availability of gnome-color-manager */
+    settings->device_calibrate = gtk_builder_get_object (builder, "device-calibrate");
+    if (g_find_program_in_path ("gcm-calibrate") == NULL)
+        gtk_widget_hide (GTK_WIDGET (settings->device_calibrate));
+    g_signal_connect (settings->device_calibrate, "clicked", G_CALLBACK (color_settings_device_calibrate_cb), settings);
+
     /* Profiles ListBox */
     settings->profiles_add = gtk_builder_get_object (builder, "profiles-add");
     gtk_widget_set_sensitive (GTK_WIDGET (settings->profiles_add), FALSE);

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


More information about the Xfce4-commits mailing list