[Xfce4-commits] [xfce/xfce4-settings] 19/37: color: Make it possible to import .icc profile files
noreply at xfce.org
noreply at xfce.org
Fri Feb 15 00:27:48 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 o c h o s i / c o l o r d
in repository xfce/xfce4-settings.
commit 6ec0617b462b45c1dbbdf9d41204cc7280645fdf
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Mon Feb 11 00:08:50 2019 +0100
color: Make it possible to import .icc profile files
---
dialogs/color-settings/color-dialog.glade | 34 +++++++++++++++++-----
dialogs/color-settings/main.c | 48 +++++++++++++++++++++++++++++++
2 files changed, 75 insertions(+), 7 deletions(-)
diff --git a/dialogs/color-settings/color-dialog.glade b/dialogs/color-settings/color-dialog.glade
index d7bfbf6..fc7736c 100644
--- a/dialogs/color-settings/color-dialog.glade
+++ b/dialogs/color-settings/color-dialog.glade
@@ -23,6 +23,11 @@
<property name="icon_name">list-remove-symbolic</property>
<property name="use_fallback">True</property>
</object>
+ <object class="GtkImage" id="image3">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="icon_name">folder-open-symbolic</property>
+ </object>
<object class="XfceTitledDialog" id="dialog">
<property name="can_focus">False</property>
<property name="title" translatable="yes">Color Profiles</property>
@@ -44,8 +49,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>
@@ -55,12 +60,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>
@@ -70,6 +74,7 @@
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
+ <property name="secondary">True</property>
</packing>
</child>
</object>
@@ -290,16 +295,31 @@
</packing>
</child>
<child>
+ <object class="GtkButton" id="profiles-import">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Import color profile files (*.icc)</property>
+ <property name="image">image3</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
<object class="GtkButton" id="profiles-remove">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Delete the currently selected profile</property>
<property name="image">image2</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
- <property name="position">1</property>
+ <property name="position">2</property>
</packing>
</child>
<style>
@@ -335,8 +355,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="GtkAdjustment" id="mouse-emulation-curve">
diff --git a/dialogs/color-settings/main.c b/dialogs/color-settings/main.c
index 407e328..d127e11 100644
--- a/dialogs/color-settings/main.c
+++ b/dialogs/color-settings/main.c
@@ -76,6 +76,7 @@ struct _ColorSettings
GtkWidget *dialog_assign;
GObject *label_no_profiles;
GObject *box_profiles;
+ GObject *profiles_import;
GObject *profiles_remove;
GObject *frame_profiles;
GtkListBox *profiles_list_box;
@@ -153,6 +154,51 @@ color_settings_profile_add_cb (GtkButton *button, gpointer user_data)
static void
+color_settings_profile_import_cb (GtkWidget *widget,
+ ColorSettings *settings)
+{
+ g_autoptr(GFile) file = NULL;
+ g_autoptr(GError) error = NULL;
+ g_autoptr(CdProfile) profile = NULL;
+ gboolean ret = FALSE;
+
+ file = color_settings_file_chooser_get_icc_profile (settings);
+ if (file == NULL)
+ {
+ g_warning ("failed to get ICC file");
+ widget = GTK_WIDGET (settings->dialog_assign);
+ gtk_widget_hide (widget);
+ return;
+ }
+
+#if CD_CHECK_VERSION(0,1,12)
+ profile = cd_client_import_profile_sync (settings->client,
+ file,
+ settings->cancellable,
+ &error);
+ if (profile == NULL)
+ {
+ g_warning ("failed to get imported profile: %s", error->message);
+ return;
+ }
+#endif
+
+ /* just add it, the list store will get ::changed */
+ ret = cd_device_add_profile_sync (settings->current_device,
+ CD_DEVICE_RELATION_HARD,
+ profile,
+ settings->cancellable,
+ &error);
+ if (!ret)
+ {
+ g_warning ("failed to add: %s", error->message);
+ return;
+ }
+}
+
+
+
+static void
color_settings_profile_remove_cb (GtkWidget *widget, ColorSettings *settings)
{
CdProfile *profile;
@@ -628,6 +674,8 @@ color_settings_dialog_init (GtkBuilder *builder)
/* Profiles ListBox */
profile_add = gtk_builder_get_object (builder, "profiles-add");
g_signal_connect (profile_add, "clicked", G_CALLBACK (color_settings_profile_add_cb), NULL);
+ settings->profiles_import = gtk_builder_get_object (builder, "profiles-import");
+ g_signal_connect (settings->profiles_import, "clicked", G_CALLBACK (color_settings_profile_import_cb), settings);
settings->profiles_remove = gtk_builder_get_object (builder, "profiles-remove");
g_signal_connect (settings->profiles_remove, "clicked", G_CALLBACK (color_settings_profile_remove_cb), settings);
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list