[WIP] color: Port to GTK4
This is very rough still. The calibration code is entirely untested.
This commit is contained in:
parent
d9d670328b
commit
d00cc3929e
11 changed files with 614 additions and 1031 deletions
|
@ -115,6 +115,7 @@ gio_dep = dependency('gio-2.0')
|
|||
glib_dep = dependency('glib-2.0', version: '>= 2.68.0')
|
||||
gnome_desktop_dep = dependency('gnome-desktop-4')
|
||||
gnome_bg_dep = dependency('gnome-bg-4')
|
||||
gnome_rr_dep = dependency('gnome-rr-4')
|
||||
gnome_settings_dep = dependency('gnome-settings-daemon', version: '>= 3.27.90')
|
||||
goa_dep = dependency('goa-1.0', version: goa_req_version)
|
||||
gsettings_desktop_dep = dependency('gsettings-desktop-schemas', version: '>= 40.alpha')
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
#include <colord-session/cd-session.h>
|
||||
|
||||
#define GNOME_DESKTOP_USE_UNSTABLE_API
|
||||
#include <libgnome-desktop/gnome-rr.h>
|
||||
#include <gnome-rr/gnome-rr.h>
|
||||
|
||||
#include "cc-color-calibrate.h"
|
||||
|
||||
|
@ -170,7 +170,7 @@ cc_color_calibrate_calib_setup_screen (CcColorCalibrate *calibrate,
|
|||
gboolean ret = TRUE;
|
||||
|
||||
/* get screen */
|
||||
calibrate->x11_screen = gnome_rr_screen_new (gdk_screen_get_default (), error);
|
||||
calibrate->x11_screen = gnome_rr_screen_new (gdk_display_get_default (), error);
|
||||
if (calibrate->x11_screen == NULL)
|
||||
{
|
||||
ret = FALSE;
|
||||
|
@ -608,25 +608,28 @@ cc_color_calibrate_move_and_resize_window (GtkWindow *window,
|
|||
CdDevice *device,
|
||||
GError **error)
|
||||
{
|
||||
g_autoptr(GListModel) monitors = NULL;
|
||||
g_autoptr(GdkMonitor) monitor = NULL;
|
||||
const gchar *xrandr_name;
|
||||
gboolean ret = TRUE;
|
||||
GdkRectangle rect;
|
||||
GdkDisplay *display;
|
||||
GdkMonitor *monitor;
|
||||
gint i;
|
||||
gint monitor_num = -1;
|
||||
gint num_monitors;
|
||||
|
||||
/* find the monitor num of the device output */
|
||||
display = gdk_display_get_default ();
|
||||
num_monitors = gdk_display_get_n_monitors (display);
|
||||
monitors = gdk_display_get_monitors (display);
|
||||
num_monitors = g_list_model_get_n_items (monitors);
|
||||
xrandr_name = cd_device_get_metadata_item (device, CD_DEVICE_METADATA_XRANDR_NAME);
|
||||
for (i = 0; i < num_monitors; i++)
|
||||
{
|
||||
g_autoptr(GdkMonitor) m = NULL;
|
||||
const gchar *plug_name;
|
||||
|
||||
monitor = gdk_display_get_monitor (display, i);
|
||||
plug_name = gdk_monitor_get_model (monitor);
|
||||
m = g_list_model_get_item (monitors, i);
|
||||
plug_name = gdk_monitor_get_model (m);
|
||||
|
||||
if (g_strcmp0 (plug_name, xrandr_name) == 0)
|
||||
monitor_num = i;
|
||||
|
@ -643,16 +646,14 @@ cc_color_calibrate_move_and_resize_window (GtkWindow *window,
|
|||
}
|
||||
|
||||
/* move the window, and set it to the right size */
|
||||
monitor = gdk_display_get_monitor (display, monitor_num);
|
||||
monitor = g_list_model_get_item (monitors, monitor_num);
|
||||
gdk_monitor_get_geometry (monitor, &rect);
|
||||
gtk_window_move (window, rect.x, rect.y);
|
||||
gtk_window_resize (window, rect.width, rect.height);
|
||||
g_debug ("Setting window to %ix%i with size %ix%i",
|
||||
rect.x, rect.y, rect.width, rect.height);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
||||
#if 0
|
||||
static void
|
||||
cc_color_calibrate_window_realize_cb (CcColorCalibrate *self)
|
||||
{
|
||||
|
@ -690,6 +691,7 @@ cc_color_calibrate_window_state_cb (CcColorCalibrate *calibrate,
|
|||
g_warning ("Failed to resize window: %s", error->message);
|
||||
return TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
cc_color_calibrate_button_done_cb (CcColorCalibrate *calibrate)
|
||||
|
@ -730,6 +732,7 @@ cc_color_calibrate_button_cancel_cb (CcColorCalibrate *calibrate)
|
|||
cc_color_calibrate_cancel (calibrate);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static gboolean
|
||||
cc_color_calibrate_alpha_window_draw (CcColorCalibrate *calibrate, cairo_t *cr)
|
||||
{
|
||||
|
@ -769,6 +772,7 @@ cc_color_calibrate_alpha_screen_changed_cb (CcColorCalibrate *calibrate)
|
|||
visual = gdk_screen_get_system_visual (screen);
|
||||
gtk_widget_set_visual (GTK_WIDGET (window), visual);
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
cc_color_calibrate_uninhibit (CcColorCalibrate *calibrate)
|
||||
|
@ -998,7 +1002,7 @@ cc_color_calibrate_finalize (GObject *object)
|
|||
{
|
||||
CcColorCalibrate *calibrate = CC_COLOR_CALIBRATE (object);
|
||||
|
||||
g_clear_pointer ((GtkWidget **)&calibrate->window, gtk_widget_destroy);
|
||||
g_clear_pointer (&calibrate->window, gtk_window_destroy);
|
||||
g_clear_object (&calibrate->builder);
|
||||
g_clear_object (&calibrate->device);
|
||||
g_clear_object (&calibrate->proxy_helper);
|
||||
|
@ -1044,8 +1048,7 @@ cc_color_calibrate_init (CcColorCalibrate *calibrate)
|
|||
"vbox_status"));
|
||||
calibrate->sample_widget = cd_sample_widget_new ();
|
||||
gtk_widget_set_size_request (calibrate->sample_widget, 400, 400);
|
||||
gtk_box_pack_start (box, calibrate->sample_widget, FALSE, FALSE, 0);
|
||||
gtk_box_reorder_child (box, calibrate->sample_widget, 0);
|
||||
gtk_box_prepend (box, calibrate->sample_widget);
|
||||
gtk_widget_set_vexpand (calibrate->sample_widget, FALSE);
|
||||
gtk_widget_set_hexpand (calibrate->sample_widget, FALSE);
|
||||
|
||||
|
@ -1076,6 +1079,7 @@ cc_color_calibrate_init (CcColorCalibrate *calibrate)
|
|||
/* setup the specialist calibration window */
|
||||
window = GTK_WINDOW (gtk_builder_get_object (calibrate->builder,
|
||||
"dialog_calibrate"));
|
||||
/*
|
||||
g_signal_connect_object (window, "draw",
|
||||
G_CALLBACK (cc_color_calibrate_alpha_window_draw), calibrate, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (window, "realize",
|
||||
|
@ -1084,11 +1088,10 @@ cc_color_calibrate_init (CcColorCalibrate *calibrate)
|
|||
G_CALLBACK (cc_color_calibrate_window_state_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (window, "delete-event",
|
||||
G_CALLBACK (cc_color_calibrate_delete_event_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
gtk_widget_set_app_paintable (GTK_WIDGET (window), TRUE);
|
||||
gtk_window_set_keep_above (window, TRUE);
|
||||
cc_color_calibrate_alpha_screen_changed_cb (calibrate);
|
||||
g_signal_connect_object (window, "screen-changed",
|
||||
G_CALLBACK (cc_color_calibrate_alpha_screen_changed_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
*/
|
||||
calibrate->window = window;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,114 +2,65 @@
|
|||
<interface>
|
||||
<!-- interface-requires gtk+ 3.0 -->
|
||||
<object class="GtkDialog" id="dialog_calibrate">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="border_width">12</property>
|
||||
<property name="margin_top">32</property>
|
||||
<property name="margin_bottom">32</property>
|
||||
<property name="margin_start">12</property>
|
||||
<property name="margin_end">12</property>
|
||||
<property name="title" translatable="yes">Display Calibration</property>
|
||||
<property name="hide_titlebar_when_maximized">True</property>
|
||||
<property name="type_hint">dialog</property>
|
||||
<property name="deletable">False</property>
|
||||
<style>
|
||||
<class name="osd"/>
|
||||
</style>
|
||||
<child internal-child="vbox">
|
||||
<child>
|
||||
<object class="GtkBox" id="dialog-vbox4">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">12</property>
|
||||
<child internal-child="action_area">
|
||||
<object class="GtkButtonBox" id="dialog-action_area1">
|
||||
<property name="can_focus">False</property>
|
||||
<property name="layout_style">end</property>
|
||||
<object class="GtkBox" id="dialog-action_area1">
|
||||
<child>
|
||||
<object class="GtkButton" id="button_cancel">
|
||||
<property name="label" translatable="yes">_Cancel</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<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="button_start">
|
||||
<property name="label" translatable="yes" comments="This starts the calibration process">_Start</property>
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button_resume">
|
||||
<property name="label" translatable="yes" comments="This resumes the calibration process">_Resume</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button_done">
|
||||
<property name="label" translatable="yes" comments="This button returns the user back to the color control panel">_Done</property>
|
||||
<property name="can_focus">True</property>
|
||||
<property name="receives_default">True</property>
|
||||
<property name="use_underline">True</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="position">3</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="pack_type">end</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkBox" id="vbox_status">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="halign">center</property>
|
||||
<property name="valign">center</property>
|
||||
<property name="hexpand">True</property>
|
||||
<property name="vexpand">True</property>
|
||||
<property name="orientation">vertical</property>
|
||||
<property name="spacing">15</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="image_status">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">1</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="pixel_size">192</property>
|
||||
<property name="icon_name">address-book-new</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">0</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkLabel" id="label_status">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
<property name="yalign">0</property>
|
||||
<property name="valign">start</property>
|
||||
<property name="label">Do not disturb the calibration device while in progress</property>
|
||||
<property name="justify">center</property>
|
||||
<property name="wrap">True</property>
|
||||
|
@ -118,30 +69,12 @@
|
|||
<attribute name="foreground" value="#ffffffffffff"/>
|
||||
</attributes>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">False</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkProgressBar" id="progressbar_status">
|
||||
<property name="visible">True</property>
|
||||
<property name="can_focus">False</property>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">True</property>
|
||||
<property name="padding">25</property>
|
||||
<property name="position">2</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
<packing>
|
||||
<property name="expand">True</property>
|
||||
<property name="fill">False</property>
|
||||
<property name="position">1</property>
|
||||
</packing>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
|
|
|
@ -77,12 +77,12 @@ cc_color_cell_renderer_text_set_property (GObject *object, guint param_id,
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_cell_renderer_render (GtkCellRenderer *cell,
|
||||
cairo_t *cr,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *background_area,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
cc_color_cell_renderer_snapshot (GtkCellRenderer *cell,
|
||||
GtkSnapshot *snapshot,
|
||||
GtkWidget *widget,
|
||||
const GdkRectangle *background_area,
|
||||
const GdkRectangle *cell_area,
|
||||
GtkCellRendererState flags)
|
||||
{
|
||||
CcColorCellRendererText *renderer;
|
||||
GtkStyleContext *context;
|
||||
|
@ -94,9 +94,9 @@ cc_color_cell_renderer_render (GtkCellRenderer *cell,
|
|||
gtk_style_context_add_class (context, "dim-label");
|
||||
else
|
||||
gtk_style_context_remove_class (context, "dim-label");
|
||||
GTK_CELL_RENDERER_CLASS (parent_class)->render (cell, cr, widget,
|
||||
background_area,
|
||||
cell_area, flags);
|
||||
GTK_CELL_RENDERER_CLASS (parent_class)->snapshot (cell, snapshot, widget,
|
||||
background_area,
|
||||
cell_area, flags);
|
||||
gtk_style_context_restore (context);
|
||||
}
|
||||
|
||||
|
@ -105,7 +105,7 @@ cc_color_cell_renderer_text_class_init (CcColorCellRendererTextClass *class)
|
|||
{
|
||||
GObjectClass *object_class = G_OBJECT_CLASS (class);
|
||||
GtkCellRendererClass *object_class_gcr = GTK_CELL_RENDERER_CLASS (class);
|
||||
object_class_gcr->render = cc_color_cell_renderer_render;
|
||||
object_class_gcr->snapshot = cc_color_cell_renderer_snapshot;
|
||||
|
||||
parent_class = g_type_class_peek_parent (class);
|
||||
|
||||
|
|
|
@ -63,7 +63,6 @@ cc_color_device_refresh (CcColorDevice *color_device)
|
|||
{
|
||||
g_autofree gchar *title = NULL;
|
||||
g_autoptr(GPtrArray) profiles = NULL;
|
||||
AtkObject *accessible;
|
||||
g_autofree gchar *name1 = NULL;
|
||||
g_autofree gchar *name2 = NULL;
|
||||
|
||||
|
@ -79,20 +78,21 @@ cc_color_device_refresh (CcColorDevice *color_device)
|
|||
gtk_widget_set_visible (color_device->widget_switch, profiles->len > 0);
|
||||
gtk_widget_set_visible (color_device->widget_button, profiles->len > 0);
|
||||
gtk_image_set_from_icon_name (GTK_IMAGE (color_device->widget_arrow),
|
||||
color_device->expanded ? "pan-down-symbolic" : "pan-end-symbolic",
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
color_device->expanded ? "pan-down-symbolic" : "pan-end-symbolic");
|
||||
gtk_widget_set_visible (color_device->widget_nocalib, profiles->len == 0);
|
||||
gtk_widget_set_sensitive (color_device->widget_button, cd_device_get_enabled (color_device->device));
|
||||
gtk_switch_set_active (GTK_SWITCH (color_device->widget_switch),
|
||||
cd_device_get_enabled (color_device->device));
|
||||
|
||||
accessible = gtk_widget_get_accessible (color_device->widget_switch);
|
||||
name1 = g_strdup_printf (_("Enable color management for %s"), title);
|
||||
atk_object_set_name (accessible, name1);
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (color_device->widget_switch),
|
||||
GTK_ACCESSIBLE_PROPERTY_LABEL, name1,
|
||||
-1);
|
||||
|
||||
name2 = g_strdup_printf (_("Show color profiles for %s"), title);
|
||||
accessible = gtk_widget_get_accessible (color_device->widget_button);
|
||||
atk_object_set_name (accessible, name2);
|
||||
gtk_accessible_update_property (GTK_ACCESSIBLE (color_device->widget_button),
|
||||
GTK_ACCESSIBLE_PROPERTY_LABEL, name2,
|
||||
-1);
|
||||
}
|
||||
|
||||
CdDevice *
|
||||
|
@ -263,41 +263,40 @@ cc_color_device_init (CcColorDevice *color_device)
|
|||
gtk_widget_set_margin_top (color_device->widget_description, 12);
|
||||
gtk_widget_set_margin_bottom (color_device->widget_description, 12);
|
||||
gtk_widget_set_halign (color_device->widget_description, GTK_ALIGN_START);
|
||||
gtk_widget_set_hexpand (color_device->widget_description, TRUE);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (color_device->widget_description), PANGO_ELLIPSIZE_END);
|
||||
gtk_label_set_xalign (GTK_LABEL (color_device->widget_description), 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), color_device->widget_description, TRUE, TRUE, 0);
|
||||
gtk_box_append (GTK_BOX (box), color_device->widget_description);
|
||||
|
||||
/* switch */
|
||||
color_device->widget_switch = gtk_switch_new ();
|
||||
gtk_widget_set_valign (color_device->widget_switch, GTK_ALIGN_CENTER);
|
||||
gtk_box_pack_start (GTK_BOX (box), color_device->widget_switch, FALSE, FALSE, 0);
|
||||
gtk_box_append (GTK_BOX (box), color_device->widget_switch);
|
||||
|
||||
/* arrow button */
|
||||
color_device->widget_arrow = gtk_image_new_from_icon_name ("pan-end-symbolic",
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
color_device->widget_arrow = gtk_image_new_from_icon_name ("pan-end-symbolic");
|
||||
color_device->widget_button = gtk_button_new ();
|
||||
g_signal_connect_object (color_device->widget_button, "clicked",
|
||||
G_CALLBACK (cc_color_device_clicked_expander_cb),
|
||||
color_device, G_CONNECT_SWAPPED);
|
||||
gtk_widget_set_valign (color_device->widget_button, GTK_ALIGN_CENTER);
|
||||
gtk_button_set_relief (GTK_BUTTON (color_device->widget_button), GTK_RELIEF_NONE);
|
||||
gtk_container_add (GTK_CONTAINER (color_device->widget_button), color_device->widget_arrow);
|
||||
gtk_widget_add_css_class (color_device->widget_button, "flat");
|
||||
gtk_button_set_child (GTK_BUTTON (color_device->widget_button), color_device->widget_arrow);
|
||||
gtk_widget_set_visible (color_device->widget_arrow, TRUE);
|
||||
gtk_widget_set_margin_top (color_device->widget_button, 9);
|
||||
gtk_widget_set_margin_bottom (color_device->widget_button, 9);
|
||||
gtk_widget_set_margin_end (color_device->widget_button, 12);
|
||||
gtk_box_pack_start (GTK_BOX (box), color_device->widget_button, FALSE, FALSE, 0);
|
||||
gtk_box_append (GTK_BOX (box), color_device->widget_button);
|
||||
|
||||
/* not calibrated */
|
||||
color_device->widget_nocalib = gtk_label_new (_("Not calibrated"));
|
||||
context = gtk_widget_get_style_context (color_device->widget_nocalib);
|
||||
gtk_style_context_add_class (context, "dim-label");
|
||||
gtk_widget_set_margin_end (color_device->widget_nocalib, 18);
|
||||
gtk_box_pack_start (GTK_BOX (box), color_device->widget_nocalib, FALSE, FALSE, 0);
|
||||
gtk_box_append (GTK_BOX (box), color_device->widget_nocalib);
|
||||
|
||||
/* refresh */
|
||||
gtk_container_add (GTK_CONTAINER (color_device), box);
|
||||
gtk_widget_set_visible (box, TRUE);
|
||||
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (color_device), box);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
|
|
@ -23,9 +23,8 @@
|
|||
#include <glib/gi18n.h>
|
||||
#include <colord.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include <gdk/gdkx.h>
|
||||
#include <gdk/x11/gdkx.h>
|
||||
|
||||
#include "list-box-helper.h"
|
||||
#include "cc-color-calibrate.h"
|
||||
#include "cc-color-cell-renderer-text.h"
|
||||
#include "cc-color-panel.h"
|
||||
|
@ -54,20 +53,17 @@ struct _CcColorPanel
|
|||
GtkWidget *box_calib_temp;
|
||||
GtkWidget *box_calib_title;
|
||||
GtkWidget *box_devices;
|
||||
GtkWidget *button_assign_cancel;
|
||||
GtkWidget *button_assign_import;
|
||||
GtkWidget *button_assign_ok;
|
||||
GtkWidget *button_calib_export;
|
||||
GtkWidget *dialog_assign;
|
||||
GtkWidget *entry_calib_title;
|
||||
GtkWidget *frame_devices;
|
||||
GtkWidget *label_assign_warning;
|
||||
GtkWidget *label_calib_summary_message;
|
||||
GtkWidget *label_no_devices;
|
||||
GtkTreeModel *liststore_assign;
|
||||
GtkTreeModel *liststore_calib_kind;
|
||||
GtkTreeModel *liststore_calib_sensor;
|
||||
GtkWidget *main_window;
|
||||
GtkWidget *toolbar_devices;
|
||||
GtkWidget *toolbutton_device_calibrate;
|
||||
GtkWidget *toolbutton_device_default;
|
||||
|
@ -219,9 +215,62 @@ gcm_prefs_default_cb (CcColorPanel *prefs)
|
|||
error->message);
|
||||
}
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GtkResponseType response;
|
||||
GMainLoop *mainloop;
|
||||
} DialogRunData;
|
||||
|
||||
static void
|
||||
dialog_response_cb (GtkDialog *dialog,
|
||||
GtkResponseType response,
|
||||
DialogRunData *run_data)
|
||||
{
|
||||
run_data->response = response;
|
||||
g_main_loop_quit (run_data->mainloop);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
dialog_close_cb (GtkDialog *dialog,
|
||||
GtkResponseType response,
|
||||
DialogRunData *run_data)
|
||||
{
|
||||
g_main_loop_quit (run_data->mainloop);
|
||||
return GDK_EVENT_PROPAGATE;
|
||||
}
|
||||
|
||||
static GtkResponseType
|
||||
run_dialog (GtkDialog *dialog)
|
||||
{
|
||||
g_autoptr(GMainLoop) mainloop = NULL;
|
||||
DialogRunData run_data;
|
||||
guint response_id;
|
||||
guint close_id;
|
||||
|
||||
mainloop = g_main_loop_new (NULL, FALSE);
|
||||
|
||||
run_data = (DialogRunData) {
|
||||
.response = GTK_RESPONSE_DELETE_EVENT,
|
||||
.mainloop = mainloop,
|
||||
};
|
||||
|
||||
response_id = g_signal_connect (dialog, "response", G_CALLBACK (dialog_response_cb), &run_data);
|
||||
close_id = g_signal_connect (dialog, "close-request", G_CALLBACK (dialog_close_cb), &run_data);
|
||||
|
||||
gtk_window_present (GTK_WINDOW (dialog));
|
||||
|
||||
g_main_loop_run (mainloop);
|
||||
|
||||
g_signal_handler_disconnect (dialog, response_id);
|
||||
g_signal_handler_disconnect (dialog, close_id);
|
||||
|
||||
return run_data.response;
|
||||
}
|
||||
|
||||
static GFile *
|
||||
gcm_prefs_file_chooser_get_icc_profile (CcColorPanel *prefs)
|
||||
{
|
||||
g_autoptr(GFile) current_folder = NULL;
|
||||
GtkWindow *window;
|
||||
GtkWidget *dialog;
|
||||
GFile *file = NULL;
|
||||
|
@ -235,9 +284,9 @@ gcm_prefs_file_chooser_get_icc_profile (CcColorPanel *prefs)
|
|||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_Import"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(dialog), g_get_home_dir ());
|
||||
current_folder = g_file_new_for_path (g_get_home_dir ());
|
||||
gtk_file_chooser_set_current_folder (GTK_FILE_CHOOSER(dialog), current_folder, NULL);
|
||||
gtk_file_chooser_set_create_folders (GTK_FILE_CHOOSER(dialog), FALSE);
|
||||
gtk_file_chooser_set_local_only (GTK_FILE_CHOOSER(dialog), FALSE);
|
||||
|
||||
/* setup the filter */
|
||||
filter = gtk_file_filter_new ();
|
||||
|
@ -255,11 +304,11 @@ gcm_prefs_file_chooser_get_icc_profile (CcColorPanel *prefs)
|
|||
gtk_file_chooser_add_filter (GTK_FILE_CHOOSER(dialog), filter);
|
||||
|
||||
/* did user choose file */
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
if (run_dialog (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
file = gtk_file_chooser_get_file (GTK_FILE_CHOOSER(dialog));
|
||||
|
||||
/* we're done */
|
||||
gtk_widget_destroy (dialog);
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
|
||||
/* or NULL for missing */
|
||||
return file;
|
||||
|
@ -334,14 +383,6 @@ gcm_prefs_calib_apply_cb (CcColorPanel *prefs)
|
|||
gtk_widget_hide (GTK_WIDGET (window));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gcm_prefs_calib_delete_event_cb (CcColorPanel *prefs)
|
||||
{
|
||||
/* do not destroy the window */
|
||||
gcm_prefs_calib_cancel_cb (prefs);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_temp_treeview_clicked_cb (CcColorPanel *prefs,
|
||||
GtkTreeSelection *selection)
|
||||
|
@ -543,7 +584,7 @@ gcm_prefs_calibrate_display (CcColorPanel *prefs)
|
|||
tmp = cd_device_get_vendor (prefs->current_device);
|
||||
if (tmp == NULL)
|
||||
tmp = _("Screen");
|
||||
gtk_entry_set_text (GTK_ENTRY (prefs->entry_calib_title), tmp);
|
||||
gtk_editable_set_text (GTK_EDITABLE (prefs->entry_calib_title), tmp);
|
||||
cc_color_calibrate_set_title (prefs->calibrate, tmp);
|
||||
|
||||
/* set the display whitepoint to D65 by default */
|
||||
|
@ -551,7 +592,7 @@ gcm_prefs_calibrate_display (CcColorPanel *prefs)
|
|||
|
||||
/* show ui */
|
||||
gtk_window_set_transient_for (GTK_WINDOW (prefs->assistant_calib),
|
||||
GTK_WINDOW (prefs->main_window));
|
||||
GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (prefs))));
|
||||
gtk_widget_show (prefs->assistant_calib);
|
||||
}
|
||||
|
||||
|
@ -562,7 +603,7 @@ gcm_prefs_title_entry_changed_cb (CcColorPanel *prefs)
|
|||
const gchar *value;
|
||||
|
||||
assistant = GTK_ASSISTANT (prefs->assistant_calib);
|
||||
value = gtk_entry_get_text (GTK_ENTRY (prefs->entry_calib_title));
|
||||
value = gtk_editable_get_text (GTK_EDITABLE (prefs->entry_calib_title));
|
||||
cc_color_calibrate_set_title (prefs->calibrate, value);
|
||||
gtk_assistant_set_page_complete (assistant, prefs->box_calib_title, value[0] != '\0');
|
||||
}
|
||||
|
@ -570,9 +611,11 @@ gcm_prefs_title_entry_changed_cb (CcColorPanel *prefs)
|
|||
static void
|
||||
gcm_prefs_calibrate_cb (CcColorPanel *prefs)
|
||||
{
|
||||
GtkNative *native;
|
||||
GdkSurface *surface;
|
||||
gboolean ret;
|
||||
g_autoptr(GError) error = NULL;
|
||||
guint xid;
|
||||
guint xid = 0;
|
||||
g_autoptr(GPtrArray) argv = NULL;
|
||||
|
||||
/* use the new-style calibration helper */
|
||||
|
@ -583,7 +626,11 @@ gcm_prefs_calibrate_cb (CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
/* get xid */
|
||||
xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (prefs->main_window)));
|
||||
native = gtk_widget_get_native (GTK_WIDGET (prefs));
|
||||
surface = gtk_native_get_surface (native);
|
||||
|
||||
if (GDK_IS_X11_SURFACE (surface))
|
||||
xid = gdk_x11_surface_get_xid (GDK_X11_SURFACE (surface));
|
||||
|
||||
/* run with modal set */
|
||||
argv = g_ptr_array_new_with_free_func (g_free);
|
||||
|
@ -792,17 +839,16 @@ gcm_prefs_calib_export_cb (CcColorPanel *prefs)
|
|||
|
||||
/* TRANSLATORS: this is the dialog to save the ICC profile */
|
||||
dialog = gtk_file_chooser_dialog_new (_("Save Profile"),
|
||||
GTK_WINDOW (prefs->main_window),
|
||||
GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (prefs))),
|
||||
GTK_FILE_CHOOSER_ACTION_SAVE,
|
||||
_("_Cancel"), GTK_RESPONSE_CANCEL,
|
||||
_("_Save"), GTK_RESPONSE_ACCEPT,
|
||||
NULL);
|
||||
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog), TRUE);
|
||||
|
||||
default_name = g_strdup_printf ("%s.icc", cd_profile_get_title (profile));
|
||||
gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dialog), default_name);
|
||||
|
||||
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
if (run_dialog (GTK_DIALOG (dialog)) == GTK_RESPONSE_ACCEPT)
|
||||
{
|
||||
source = g_file_new_for_path (cd_profile_get_filename (profile));
|
||||
destination = gtk_file_chooser_get_file (GTK_FILE_CHOOSER (dialog));
|
||||
|
@ -817,17 +863,16 @@ gcm_prefs_calib_export_cb (CcColorPanel *prefs)
|
|||
g_warning ("Failed to copy profile: %s", error->message);
|
||||
}
|
||||
|
||||
gtk_widget_destroy (dialog);
|
||||
gtk_window_destroy (GTK_WINDOW (dialog));
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_export_link_cb (CcColorPanel *prefs,
|
||||
const gchar *url)
|
||||
{
|
||||
gtk_show_uri_on_window (GTK_WINDOW (prefs->main_window),
|
||||
"help:gnome-help/color-howtoimport",
|
||||
GDK_CURRENT_TIME,
|
||||
NULL);
|
||||
gtk_show_uri (GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (prefs))),
|
||||
"help:gnome-help/color-howtoimport",
|
||||
GDK_CURRENT_TIME);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -843,8 +888,10 @@ gcm_prefs_profile_add_cb (CcColorPanel *prefs)
|
|||
gtk_widget_set_sensitive (prefs->button_assign_ok, FALSE);
|
||||
|
||||
/* show the dialog */
|
||||
gtk_window_set_transient_for (GTK_WINDOW (prefs->dialog_assign),
|
||||
GTK_WINDOW (gtk_widget_get_native (GTK_WIDGET (prefs))));
|
||||
|
||||
gtk_widget_show (prefs->dialog_assign);
|
||||
gtk_window_set_transient_for (GTK_WINDOW (prefs->dialog_assign), GTK_WINDOW (prefs->main_window));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -930,13 +977,19 @@ gcm_prefs_device_profile_enable_cb (CcColorPanel *prefs)
|
|||
static void
|
||||
gcm_prefs_profile_view (CcColorPanel *prefs, CdProfile *profile)
|
||||
{
|
||||
GtkNative *native;
|
||||
GdkSurface *surface;
|
||||
g_autoptr(GPtrArray) argv = NULL;
|
||||
guint xid;
|
||||
guint xid = 0;
|
||||
gboolean ret;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
/* get xid */
|
||||
xid = gdk_x11_window_get_xid (gtk_widget_get_window (GTK_WIDGET (prefs->main_window)));
|
||||
native = gtk_widget_get_native (GTK_WIDGET (prefs));
|
||||
surface = gtk_native_get_surface (native);
|
||||
|
||||
if (GDK_IS_X11_SURFACE (surface))
|
||||
xid = gdk_x11_surface_get_xid (GDK_X11_SURFACE (surface));
|
||||
|
||||
/* open up gcm-viewer as a info pane */
|
||||
argv = g_ptr_array_new_with_free_func (g_free);
|
||||
|
@ -995,12 +1048,6 @@ gcm_prefs_profile_view_cb (CcColorPanel *prefs)
|
|||
gcm_prefs_profile_view (prefs, profile);
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_button_assign_cancel_cb (CcColorPanel *prefs)
|
||||
{
|
||||
gtk_widget_hide (prefs->dialog_assign);
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_button_assign_ok_cb (CcColorPanel *prefs)
|
||||
{
|
||||
|
@ -1062,13 +1109,6 @@ gcm_prefs_button_assign_ok_cb (CcColorPanel *prefs)
|
|||
prefs);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
gcm_prefs_profile_delete_event_cb (CcColorPanel *prefs)
|
||||
{
|
||||
gcm_prefs_button_assign_cancel_cb (prefs);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_add_profiles_columns (CcColorPanel *prefs,
|
||||
GtkTreeView *treeview)
|
||||
|
@ -1088,7 +1128,6 @@ gcm_prefs_add_profiles_columns (CcColorPanel *prefs,
|
|||
/* image */
|
||||
column = gtk_tree_view_column_new ();
|
||||
renderer = gtk_cell_renderer_pixbuf_new ();
|
||||
g_object_set (renderer, "stock-size", GTK_ICON_SIZE_MENU, NULL);
|
||||
gtk_tree_view_column_pack_start (column, renderer, FALSE);
|
||||
gtk_tree_view_column_add_attribute (column, renderer,
|
||||
"icon-name", GCM_PREFS_COMBO_COLUMN_WARNING_FILENAME);
|
||||
|
@ -1361,8 +1400,7 @@ gcm_prefs_add_device_profile (CcColorPanel *prefs,
|
|||
|
||||
/* add to listbox */
|
||||
widget = cc_color_profile_new (device, profile, is_default);
|
||||
gtk_widget_show (widget);
|
||||
gtk_container_add (GTK_CONTAINER (prefs->list_box), widget);
|
||||
gtk_list_box_append (prefs->list_box, widget);
|
||||
gtk_size_group_add_widget (prefs->list_box_size, widget);
|
||||
}
|
||||
|
||||
|
@ -1438,37 +1476,47 @@ gcm_prefs_find_widget_by_object_path (GList *list,
|
|||
static void
|
||||
gcm_prefs_device_changed_cb (CcColorPanel *prefs, CdDevice *device)
|
||||
{
|
||||
GtkWidget *child;
|
||||
CdDevice *device_tmp;
|
||||
CdProfile *profile_tmp;
|
||||
gboolean ret;
|
||||
GList *l;
|
||||
g_autoptr(GList) list = NULL;
|
||||
GPtrArray *profiles;
|
||||
guint i;
|
||||
|
||||
/* remove anything in the list view that's not in Device.Profiles */
|
||||
profiles = cd_device_get_profiles (device);
|
||||
list = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
|
||||
for (l = list; l != NULL; l = l->next)
|
||||
child = gtk_widget_get_first_child (GTK_WIDGET (prefs->list_box));
|
||||
while (child)
|
||||
{
|
||||
if (!CC_IS_COLOR_PROFILE (l->data))
|
||||
continue;
|
||||
GtkWidget *next = gtk_widget_get_next_sibling (child);
|
||||
|
||||
if (!CC_IS_COLOR_PROFILE (child))
|
||||
{
|
||||
list = g_list_prepend (list, child);
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* correct device ? */
|
||||
device_tmp = cc_color_profile_get_device (CC_COLOR_PROFILE (l->data));
|
||||
device_tmp = cc_color_profile_get_device (CC_COLOR_PROFILE (child));
|
||||
if (g_strcmp0 (cd_device_get_id (device),
|
||||
cd_device_get_id (device_tmp)) != 0)
|
||||
continue;
|
||||
{
|
||||
list = g_list_prepend (list, child);
|
||||
goto next;
|
||||
}
|
||||
|
||||
/* if profile is not in Device.Profiles then remove */
|
||||
profile_tmp = cc_color_profile_get_profile (CC_COLOR_PROFILE (l->data));
|
||||
profile_tmp = cc_color_profile_get_profile (CC_COLOR_PROFILE (child));
|
||||
ret = gcm_prefs_find_profile_by_object_path (profiles,
|
||||
cd_profile_get_object_path (profile_tmp));
|
||||
if (!ret) {
|
||||
gtk_widget_destroy (GTK_WIDGET (l->data));
|
||||
/* Don't look at the destroyed widget below */
|
||||
l->data = NULL;
|
||||
}
|
||||
if (!ret)
|
||||
gtk_list_box_remove (prefs->list_box, child);
|
||||
else
|
||||
list = g_list_prepend (list, child);
|
||||
|
||||
next:
|
||||
child = next;
|
||||
}
|
||||
|
||||
/* add anything in Device.Profiles that's not in the list view */
|
||||
|
@ -1498,20 +1546,20 @@ gcm_prefs_device_expanded_changed_cb (CcColorPanel *prefs,
|
|||
g_free (prefs->list_box_filter);
|
||||
if (is_expanded)
|
||||
{
|
||||
g_autoptr(GList) list = NULL;
|
||||
GList *l;
|
||||
GtkWidget *child;
|
||||
|
||||
prefs->list_box_filter = g_strdup (cd_device_get_id (cc_color_device_get_device (widget)));
|
||||
|
||||
/* unexpand other device widgets */
|
||||
list = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
|
||||
prefs->model_is_changing = TRUE;
|
||||
for (l = list; l != NULL; l = l->next)
|
||||
for (child = gtk_widget_get_first_child (GTK_WIDGET (prefs->list_box));
|
||||
child != NULL;
|
||||
child = gtk_widget_get_next_sibling (child))
|
||||
{
|
||||
if (!CC_IS_COLOR_DEVICE (l->data))
|
||||
if (!CC_IS_COLOR_DEVICE (child))
|
||||
continue;
|
||||
if (l->data != widget)
|
||||
cc_color_device_set_expanded (CC_COLOR_DEVICE (l->data), FALSE);
|
||||
if (CC_COLOR_DEVICE (child) != widget)
|
||||
cc_color_device_set_expanded (CC_COLOR_DEVICE (child), FALSE);
|
||||
}
|
||||
prefs->model_is_changing = FALSE;
|
||||
}
|
||||
|
@ -1541,8 +1589,7 @@ gcm_prefs_add_device (CcColorPanel *prefs, CdDevice *device)
|
|||
widget = cc_color_device_new (device);
|
||||
g_signal_connect_object (widget, "expanded-changed",
|
||||
G_CALLBACK (gcm_prefs_device_expanded_changed_cb), prefs, G_CONNECT_SWAPPED);
|
||||
gtk_widget_show (widget);
|
||||
gtk_container_add (GTK_CONTAINER (prefs->list_box), widget);
|
||||
gtk_list_box_append (prefs->list_box, widget);
|
||||
gtk_size_group_add_widget (prefs->list_box_size, widget);
|
||||
|
||||
/* add profiles */
|
||||
|
@ -1558,22 +1605,25 @@ gcm_prefs_add_device (CcColorPanel *prefs, CdDevice *device)
|
|||
static void
|
||||
gcm_prefs_remove_device (CcColorPanel *prefs, CdDevice *device)
|
||||
{
|
||||
GtkWidget *child;
|
||||
CdDevice *device_tmp;
|
||||
GList *l;
|
||||
g_autoptr(GList) list = NULL;
|
||||
|
||||
list = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
|
||||
for (l = list; l != NULL; l = l->next)
|
||||
child = gtk_widget_get_first_child (GTK_WIDGET (prefs->list_box));
|
||||
while (child)
|
||||
{
|
||||
if (CC_IS_COLOR_DEVICE (l->data))
|
||||
device_tmp = cc_color_device_get_device (CC_COLOR_DEVICE (l->data));
|
||||
GtkWidget *next = gtk_widget_get_next_sibling (child);
|
||||
|
||||
if (CC_IS_COLOR_DEVICE (child))
|
||||
device_tmp = cc_color_device_get_device (CC_COLOR_DEVICE (child));
|
||||
else
|
||||
device_tmp = cc_color_profile_get_device (CC_COLOR_PROFILE (l->data));
|
||||
device_tmp = cc_color_profile_get_device (CC_COLOR_PROFILE (child));
|
||||
if (g_strcmp0 (cd_device_get_object_path (device),
|
||||
cd_device_get_object_path (device_tmp)) == 0)
|
||||
{
|
||||
gtk_widget_destroy (GTK_WIDGET (l->data));
|
||||
gtk_list_box_remove (prefs->list_box, child);
|
||||
}
|
||||
|
||||
child = next;
|
||||
}
|
||||
g_signal_handlers_disconnect_by_func (device,
|
||||
G_CALLBACK (gcm_prefs_device_changed_cb),
|
||||
|
@ -1584,18 +1634,16 @@ gcm_prefs_remove_device (CcColorPanel *prefs, CdDevice *device)
|
|||
static void
|
||||
gcm_prefs_update_device_list_extra_entry (CcColorPanel *prefs)
|
||||
{
|
||||
g_autoptr(GList) device_widgets = NULL;
|
||||
guint number_of_devices;
|
||||
GtkListBoxRow *first_row;
|
||||
|
||||
/* any devices to show? */
|
||||
device_widgets = gtk_container_get_children (GTK_CONTAINER (prefs->list_box));
|
||||
number_of_devices = g_list_length (device_widgets);
|
||||
gtk_widget_set_visible (prefs->label_no_devices, number_of_devices == 0);
|
||||
gtk_widget_set_visible (prefs->box_devices, number_of_devices > 0);
|
||||
first_row = gtk_list_box_get_row_at_index (prefs->list_box, 0);
|
||||
gtk_widget_set_visible (prefs->label_no_devices, first_row == NULL);
|
||||
gtk_widget_set_visible (prefs->box_devices, first_row != NULL);
|
||||
|
||||
/* if we have only one device expand it by default */
|
||||
if (number_of_devices == 1)
|
||||
cc_color_device_set_expanded (CC_COLOR_DEVICE (device_widgets->data), TRUE);
|
||||
if (gtk_list_box_get_row_at_index (prefs->list_box, 1) == NULL)
|
||||
cc_color_device_set_expanded (CC_COLOR_DEVICE (first_row), TRUE);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1776,12 +1824,6 @@ gcm_prefs_is_livecd (void)
|
|||
#endif
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_window_realize_cb (CcColorPanel *prefs)
|
||||
{
|
||||
prefs->main_window = gtk_widget_get_toplevel (GTK_WIDGET (prefs));
|
||||
}
|
||||
|
||||
static const char *
|
||||
cc_color_panel_get_help_uri (CcPanel *panel)
|
||||
{
|
||||
|
@ -1828,7 +1870,7 @@ cc_color_panel_dispose (GObject *object)
|
|||
g_clear_object (&prefs->list_box_size);
|
||||
g_clear_pointer (&prefs->sensors, g_ptr_array_unref);
|
||||
g_clear_pointer (&prefs->list_box_filter, g_free);
|
||||
g_clear_pointer (&prefs->dialog_assign, gtk_widget_destroy);
|
||||
g_clear_pointer ((GtkWindow **)&prefs->dialog_assign, gtk_window_destroy);
|
||||
|
||||
G_OBJECT_CLASS (cc_color_panel_parent_class)->dispose (object);
|
||||
}
|
||||
|
@ -1864,16 +1906,15 @@ cc_color_panel_class_init (CcColorPanelClass *klass)
|
|||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, box_calib_temp);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, box_calib_title);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, box_devices);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, button_assign_cancel);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, button_assign_import);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, button_assign_ok);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, button_calib_export);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, dialog_assign);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, entry_calib_title);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, frame_devices);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, label_assign_warning);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, label_calib_summary_message);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, label_no_devices);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, list_box);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, liststore_assign);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, liststore_calib_kind);
|
||||
gtk_widget_class_bind_template_child (widget_class, CcColorPanel, liststore_calib_sensor);
|
||||
|
@ -1948,7 +1989,6 @@ static void
|
|||
cc_color_panel_init (CcColorPanel *prefs)
|
||||
{
|
||||
GtkCellRenderer *renderer;
|
||||
GtkStyleContext *context;
|
||||
GtkTreeModel *model;
|
||||
GtkTreeModel *model_filter;
|
||||
GtkTreeSelection *selection;
|
||||
|
@ -1997,16 +2037,7 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
g_signal_connect_object (prefs->toolbutton_device_calibrate, "clicked",
|
||||
G_CALLBACK (gcm_prefs_calibrate_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
context = gtk_widget_get_style_context (prefs->toolbar_devices);
|
||||
gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
|
||||
gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
|
||||
|
||||
/* set up assign dialog */
|
||||
g_signal_connect_object (prefs->dialog_assign, "delete-event",
|
||||
G_CALLBACK (gcm_prefs_profile_delete_event_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect_object (prefs->button_assign_cancel, "clicked",
|
||||
G_CALLBACK (gcm_prefs_button_assign_cancel_cb), prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->button_assign_ok, "clicked",
|
||||
G_CALLBACK (gcm_prefs_button_assign_ok_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
|
@ -2015,9 +2046,6 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
G_CALLBACK (gcm_prefs_button_assign_import_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
/* setup the calibration helper */
|
||||
g_signal_connect_object (prefs->assistant_calib, "delete-event",
|
||||
G_CALLBACK (gcm_prefs_calib_delete_event_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->assistant_calib, "apply",
|
||||
G_CALLBACK (gcm_prefs_calib_apply_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
|
@ -2133,7 +2161,6 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
G_CALLBACK (gcm_prefs_device_removed_cb), prefs, 0);
|
||||
|
||||
/* use a listbox for the main UI */
|
||||
prefs->list_box = GTK_LIST_BOX (gtk_list_box_new ());
|
||||
gtk_list_box_set_filter_func (prefs->list_box,
|
||||
cc_color_panel_filter_func,
|
||||
prefs,
|
||||
|
@ -2142,12 +2169,6 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
cc_color_panel_sort_func,
|
||||
prefs,
|
||||
NULL);
|
||||
gtk_list_box_set_header_func (prefs->list_box,
|
||||
cc_list_box_update_header_func,
|
||||
prefs, NULL);
|
||||
gtk_list_box_set_selection_mode (prefs->list_box,
|
||||
GTK_SELECTION_SINGLE);
|
||||
gtk_list_box_set_activate_on_single_click (prefs->list_box, FALSE);
|
||||
g_signal_connect_object (prefs->list_box, "row-selected",
|
||||
G_CALLBACK (gcm_prefs_list_box_row_selected_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
|
@ -2156,9 +2177,6 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
prefs, G_CONNECT_SWAPPED);
|
||||
prefs->list_box_size = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
|
||||
|
||||
gtk_container_add (GTK_CONTAINER (prefs->frame_devices), GTK_WIDGET (prefs->list_box));
|
||||
gtk_widget_show (GTK_WIDGET (prefs->list_box));
|
||||
|
||||
/* connect to colord */
|
||||
cd_client_connect (prefs->client,
|
||||
cc_panel_get_cancellable (CC_PANEL (prefs)),
|
||||
|
@ -2183,8 +2201,4 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
G_CALLBACK (gcm_prefs_calib_export_cb), prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->label_calib_summary_message, "activate-link",
|
||||
G_CALLBACK (gcm_prefs_calib_export_link_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect (prefs, "realize",
|
||||
G_CALLBACK (gcm_prefs_window_realize_cb),
|
||||
NULL);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -435,10 +435,10 @@ cc_color_profile_init (CcColorProfile *color_profile)
|
|||
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 9);
|
||||
|
||||
/* default tick */
|
||||
color_profile->widget_image = gtk_image_new_from_icon_name ("object-select-symbolic", GTK_ICON_SIZE_MENU);
|
||||
color_profile->widget_image = gtk_image_new_from_icon_name ("object-select-symbolic");
|
||||
gtk_widget_set_margin_start (color_profile->widget_image, IMAGE_WIDGET_PADDING);
|
||||
gtk_widget_set_margin_end (color_profile->widget_image, IMAGE_WIDGET_PADDING);
|
||||
gtk_box_pack_start (GTK_BOX (box), color_profile->widget_image, FALSE, FALSE, 0);
|
||||
gtk_box_append (GTK_BOX (box), color_profile->widget_image);
|
||||
|
||||
/* description */
|
||||
color_profile->widget_description = gtk_label_new ("");
|
||||
|
@ -447,18 +447,18 @@ cc_color_profile_init (CcColorProfile *color_profile)
|
|||
gtk_widget_set_halign (color_profile->widget_description, GTK_ALIGN_START);
|
||||
gtk_label_set_ellipsize (GTK_LABEL (color_profile->widget_description), PANGO_ELLIPSIZE_END);
|
||||
gtk_label_set_xalign (GTK_LABEL (color_profile->widget_description), 0);
|
||||
gtk_box_pack_start (GTK_BOX (box), color_profile->widget_description, TRUE, TRUE, 0);
|
||||
gtk_widget_show (color_profile->widget_description);
|
||||
gtk_widget_set_hexpand (color_profile->widget_description, TRUE);
|
||||
gtk_widget_set_vexpand (color_profile->widget_description, TRUE);
|
||||
gtk_box_append (GTK_BOX (box), color_profile->widget_description);
|
||||
|
||||
/* profile warnings/info */
|
||||
color_profile->widget_info = gtk_image_new_from_icon_name ("dialog-information-symbolic", GTK_ICON_SIZE_MENU);
|
||||
color_profile->widget_info = gtk_image_new_from_icon_name ("dialog-information-symbolic");
|
||||
gtk_widget_set_margin_start (color_profile->widget_info, IMAGE_WIDGET_PADDING);
|
||||
gtk_widget_set_margin_end (color_profile->widget_info, IMAGE_WIDGET_PADDING);
|
||||
gtk_box_pack_start (GTK_BOX (box), color_profile->widget_info, FALSE, FALSE, 0);
|
||||
gtk_box_append (GTK_BOX (box), color_profile->widget_info);
|
||||
|
||||
/* refresh */
|
||||
gtk_container_add (GTK_CONTAINER (color_profile), box);
|
||||
gtk_widget_set_visible (box, TRUE);
|
||||
gtk_list_box_row_set_child (GTK_LIST_BOX_ROW (color_profile), box);
|
||||
}
|
||||
|
||||
GtkWidget *
|
||||
|
|
|
@ -41,9 +41,9 @@ sources += gnome.compile_resources(
|
|||
|
||||
deps = common_deps + [
|
||||
colord_dep,
|
||||
gnome_desktop_dep,
|
||||
gnome_rr_dep,
|
||||
m_dep,
|
||||
dependency('colord-gtk', version: '>= 0.1.24'),
|
||||
dependency('colord-gtk4', version: '>= 0.1.24'),
|
||||
]
|
||||
|
||||
panels_libs += static_library(
|
||||
|
|
|
@ -4,7 +4,7 @@ panels = [
|
|||
'applications',
|
||||
'background',
|
||||
'camera',
|
||||
# 'color',
|
||||
'color',
|
||||
'datetime',
|
||||
'default-apps',
|
||||
'diagnostics',
|
||||
|
|
|
@ -36,7 +36,7 @@ extern GType cc_background_panel_get_type (void);
|
|||
#ifdef BUILD_BLUETOOTH
|
||||
extern GType cc_bluetooth_panel_get_type (void);
|
||||
#endif /* BUILD_BLUETOOTH */
|
||||
//extern GType cc_color_panel_get_type (void);
|
||||
extern GType cc_color_panel_get_type (void);
|
||||
extern GType cc_date_time_panel_get_type (void);
|
||||
extern GType cc_default_apps_panel_get_type (void);
|
||||
//extern GType cc_display_panel_get_type (void);
|
||||
|
@ -103,7 +103,7 @@ static CcPanelLoaderVtable default_panels[] =
|
|||
PANEL_TYPE("bluetooth", cc_bluetooth_panel_get_type, NULL),
|
||||
#endif
|
||||
PANEL_TYPE("camera", cc_camera_panel_get_type, NULL),
|
||||
//PANEL_TYPE("color", cc_color_panel_get_type, NULL),
|
||||
PANEL_TYPE("color", cc_color_panel_get_type, NULL),
|
||||
PANEL_TYPE("datetime", cc_date_time_panel_get_type, NULL),
|
||||
PANEL_TYPE("default-apps", cc_default_apps_panel_get_type, NULL),
|
||||
PANEL_TYPE("diagnostics", cc_diagnostics_panel_get_type, cc_diagnostics_panel_static_init_func),
|
||||
|
|
Loading…
Add table
Reference in a new issue