[gnome-color-manager] Use a private helper for gcm-picker
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-color-manager] Use a private helper for gcm-picker
- Date: Mon, 26 Oct 2015 15:46:52 +0000 (UTC)
commit b5e57f983a44688961db1f189d7e1bebdc454e32
Author: Richard Hughes <richard hughsie com>
Date: Sun Oct 25 21:38:23 2015 +0000
Use a private helper for gcm-picker
src/gcm-picker.c | 227 ++++++++++++++++++++++++++++--------------------------
1 files changed, 119 insertions(+), 108 deletions(-)
---
diff --git a/src/gcm-picker.c b/src/gcm-picker.c
index 5140c3f..1f03962 100644
--- a/src/gcm-picker.c
+++ b/src/gcm-picker.c
@@ -35,17 +35,19 @@
#include "gcm-utils.h"
#include "gcm-debug.h"
-static CdClient *client = NULL;
-static const gchar *profile_filename = NULL;
-static gboolean done_measure = FALSE;
-static CdColorXYZ last_sample;
-static CdSensor *sensor = NULL;
-static gdouble last_ambient = -1.0f;
-static GtkBuilder *builder = NULL;
-static GtkWidget *info_bar_hardware_label = NULL;
-static GtkWidget *info_bar_hardware = NULL;
-static guint xid = 0;
-static guint unlock_timer = 0;
+typedef struct {
+ CdClient *client;
+ const gchar *profile_filename;
+ gboolean done_measure;
+ CdColorXYZ last_sample;
+ CdSensor *sensor;
+ gdouble last_ambient;
+ GtkBuilder *builder;
+ GtkWidget *info_bar_hardware_label;
+ GtkWidget *info_bar_hardware;
+ guint xid;
+ guint unlock_timer;
+} GcmPickerPrivate;
enum {
GCM_PREFS_COMBO_COLUMN_TEXT,
@@ -71,7 +73,7 @@ gcm_picker_set_pixbuf_color (GdkPixbuf *pixbuf, gchar red, gchar green, gchar bl
/* set to all the correct colors */
for (y=0; y<height; y++) {
- for (x=0; x<width; x++) {
+ for (x = 0; x < width; x++) {
p = pixels + y * rowstride + x * n_channels;
p[0] = red;
p[1] = green;
@@ -84,7 +86,7 @@ gcm_picker_set_pixbuf_color (GdkPixbuf *pixbuf, gchar red, gchar green, gchar bl
* gcm_picker_refresh_results:
**/
static void
-gcm_picker_refresh_results (void)
+gcm_picker_refresh_results (GcmPickerPrivate *priv)
{
cmsCIExyY xyY;
cmsHPROFILE profile_lab;
@@ -111,14 +113,14 @@ gcm_picker_refresh_results (void)
g_autofree gchar *text_xyz = NULL;
/* nothing set yet */
- if (profile_filename == NULL)
+ if (priv->profile_filename == NULL)
return;
/* copy as we're modifying the value */
- cd_color_xyz_copy (&last_sample, &color_xyz);
+ cd_color_xyz_copy (&priv->last_sample, &color_xyz);
/* create new pixbuf of the right size */
- image = GTK_IMAGE (gtk_builder_get_object (builder, "image_preview"));
+ image = GTK_IMAGE (gtk_builder_get_object (priv->builder, "image_preview"));
pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, FALSE, 8,
gtk_widget_get_allocated_width (GTK_WIDGET (image)),
gtk_widget_get_allocated_height (GTK_WIDGET (image)));
@@ -130,7 +132,7 @@ gcm_picker_refresh_results (void)
/* get profiles */
profile_xyz = cmsCreateXYZProfile ();
- profile_rgb = cmsOpenProfileFromFile (profile_filename, "r");
+ profile_rgb = cmsOpenProfileFromFile (priv->profile_filename, "r");
profile_lab = cmsCreateLab4Profile (cmsD50_xyY ());
/* create transforms */
@@ -163,15 +165,15 @@ gcm_picker_refresh_results (void)
cmsCloseProfile (profile_lab);
/* set XYZ */
- label = GTK_LABEL (gtk_builder_get_object (builder, "label_xyz"));
+ label = GTK_LABEL (gtk_builder_get_object (priv->builder, "label_xyz"));
text_xyz = g_strdup_printf ("%.3f, %.3f, %.3f",
- last_sample.X,
- last_sample.Y,
- last_sample.Z);
+ priv->last_sample.X,
+ priv->last_sample.Y,
+ priv->last_sample.Z);
gtk_label_set_label (label, text_xyz);
/* set LAB */
- label = GTK_LABEL (gtk_builder_get_object (builder, "label_lab"));
+ label = GTK_LABEL (gtk_builder_get_object (priv->builder, "label_lab"));
text_lab = g_strdup_printf ("%.3f, %.3f, %.3f",
color_lab.L,
color_lab.a,
@@ -179,8 +181,8 @@ gcm_picker_refresh_results (void)
gtk_label_set_label (label, text_lab);
/* set whitepoint */
- cmsXYZ2xyY (&xyY, (cmsCIEXYZ *)&last_sample);
- label = GTK_LABEL (gtk_builder_get_object (builder, "label_whitepoint"));
+ cmsXYZ2xyY (&xyY, (cmsCIEXYZ *)&priv->last_sample);
+ label = GTK_LABEL (gtk_builder_get_object (priv->builder, "label_whitepoint"));
text_whitepoint = g_strdup_printf ("%.3f,%.3f [%.3f]",
xyY.x, xyY.y, xyY.Y);
gtk_label_set_label (label, text_whitepoint);
@@ -191,12 +193,12 @@ gcm_picker_refresh_results (void)
/* round to nearest 10K */
temperature = (((guint) temperature) / 10) * 10;
}
- label = GTK_LABEL (gtk_builder_get_object (builder, "label_temperature"));
+ label = GTK_LABEL (gtk_builder_get_object (priv->builder, "label_temperature"));
text_temperature = g_strdup_printf ("%.0fK", temperature);
gtk_label_set_label (label, text_temperature);
/* set RGB */
- label = GTK_LABEL (gtk_builder_get_object (builder, "label_rgb"));
+ label = GTK_LABEL (gtk_builder_get_object (priv->builder, "label_rgb"));
text_rgb = g_strdup_printf ("%i, %i, %i (#%02X%02X%02X)",
color_rgb.R, color_rgb.G, color_rgb.B,
color_rgb.R, color_rgb.G, color_rgb.B);
@@ -204,7 +206,7 @@ gcm_picker_refresh_results (void)
gcm_picker_set_pixbuf_color (pixbuf, color_rgb.R, color_rgb.G, color_rgb.B);
/* set error */
- label = GTK_LABEL (gtk_builder_get_object (builder, "label_error"));
+ label = GTK_LABEL (gtk_builder_get_object (priv->builder, "label_error"));
if (color_xyz.X > 0.01f &&
color_xyz.Y > 0.01f &&
color_xyz.Z > 0.01f) {
@@ -219,12 +221,12 @@ gcm_picker_refresh_results (void)
}
/* set ambient */
- label = GTK_LABEL (gtk_builder_get_object (builder, "label_ambient"));
- if (last_ambient < 0) {
+ label = GTK_LABEL (gtk_builder_get_object (priv->builder, "label_ambient"));
+ if (priv->last_ambient < 0) {
/* TRANSLATORS: this is when the ambient light level is unknown */
gtk_label_set_label (label, _("Unknown"));
} else {
- text_ambient = g_strdup_printf ("%.1f Lux", last_ambient);
+ text_ambient = g_strdup_printf ("%.1f Lux", priv->last_ambient);
gtk_label_set_label (label, text_ambient);
}
@@ -236,17 +238,17 @@ gcm_picker_refresh_results (void)
* gcm_picker_got_results:
**/
static void
-gcm_picker_got_results (void)
+gcm_picker_got_results (GcmPickerPrivate *priv)
{
GtkWidget *widget;
/* set expanded */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "expander_results"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "expander_results"));
gtk_expander_set_expanded (GTK_EXPANDER (widget), TRUE);
gtk_widget_set_sensitive (widget, TRUE);
/* we've got results so make sure it's sensitive */
- done_measure = TRUE;
+ priv->done_measure = TRUE;
}
/**
@@ -256,11 +258,12 @@ static gboolean
gcm_picker_unlock_timeout_cb (gpointer user_data)
{
g_autoptr(GError) error = NULL;
+ GcmPickerPrivate *priv = (GcmPickerPrivate *) user_data;
/* unlock */
- if (!cd_sensor_unlock_sync (sensor, NULL, &error))
+ if (!cd_sensor_unlock_sync (priv->sensor, NULL, &error))
g_warning ("failed to unlock: %s", error->message);
- unlock_timer = 0;
+ priv->unlock_timer = 0;
return FALSE;
}
@@ -270,17 +273,18 @@ gcm_picker_unlock_timeout_cb (gpointer user_data)
static void
gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
{
+ GcmPickerPrivate *priv = (GcmPickerPrivate *) data;
gboolean ret;
g_autoptr(CdColorXYZ) tmp = NULL;
g_autoptr(GError) error = NULL;
/* reset the image */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "image_preview"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_preview"));
gtk_image_set_from_file (GTK_IMAGE (widget), DATADIR
"/icons/hicolor/64x64/apps/gnome-color-manager.png");
/* lock */
- if (!cd_sensor_get_locked (sensor)) {
- ret = cd_sensor_lock_sync (sensor,
+ if (!cd_sensor_get_locked (priv->sensor)) {
+ ret = cd_sensor_lock_sync (priv->sensor,
NULL,
&error);
if (!ret) {
@@ -290,13 +294,13 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
}
/* cancel pending unlock */
- if (unlock_timer != 0) {
- g_source_remove (unlock_timer);
- unlock_timer = 0;
+ if (priv->unlock_timer != 0) {
+ g_source_remove (priv->unlock_timer);
+ priv->unlock_timer = 0;
}
/* get color */
- tmp = cd_sensor_get_sample_sync (sensor,
+ tmp = cd_sensor_get_sample_sync (priv->sensor,
CD_SENSOR_CAP_LCD,
NULL,
&error);
@@ -304,10 +308,10 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
g_warning ("failed to get sample: %s", error->message);
goto out_unlock;
}
- cd_color_xyz_copy (tmp, &last_sample);
+ cd_color_xyz_copy (tmp, &priv->last_sample);
#if 0
/* get ambient */
- ret = cd_sensor_get_sample_sync (sensor,
+ ret = cd_sensor_get_sample_sync (priv->sensor,
CD_SENSOR_CAP_AMBIENT,
NULL,
&last_ambient,
@@ -320,16 +324,16 @@ gcm_picker_measure_cb (GtkWidget *widget, gpointer data)
#endif
out_unlock:
/* unlock after a small delay */
- unlock_timer = g_timeout_add_seconds (30, gcm_picker_unlock_timeout_cb, data);
- gcm_picker_refresh_results ();
- gcm_picker_got_results ();
+ priv->unlock_timer = g_timeout_add_seconds (30, gcm_picker_unlock_timeout_cb, data);
+ gcm_picker_refresh_results (priv);
+ gcm_picker_got_results (priv);
}
/**
* gcm_picker_sensor_client_setup_ui:
**/
static void
-gcm_picker_sensor_client_setup_ui (void)
+gcm_picker_sensor_client_setup_ui (GcmPickerPrivate *priv)
{
gboolean ret = FALSE;
GtkWidget *widget;
@@ -337,40 +341,40 @@ gcm_picker_sensor_client_setup_ui (void)
g_autoptr(GPtrArray) sensors;
/* no present */
- sensors = cd_client_get_sensors_sync (client, NULL, &error);
+ sensors = cd_client_get_sensors_sync (priv->client, NULL, &error);
if (sensors == NULL) {
g_warning ("%s", error->message);
goto out;
}
if (sensors->len == 0) {
/* TRANSLATORS: this is displayed the user has not got suitable hardware */
- gtk_label_set_label (GTK_LABEL (info_bar_hardware_label),
+ gtk_label_set_label (GTK_LABEL (priv->info_bar_hardware_label),
_("No colorimeter is attached."));
goto out;
}
- sensor = g_object_ref (g_ptr_array_index (sensors, 0));
+ priv->sensor = g_object_ref (g_ptr_array_index (sensors, 0));
/* connect to the profile */
- ret = cd_sensor_connect_sync (sensor, NULL, &error);
+ ret = cd_sensor_connect_sync (priv->sensor, NULL, &error);
if (!ret) {
g_warning ("failed to connect to sensor: %s",
error->message);
goto out;
}
- if (!cd_sensor_get_native (sensor)) {
+ if (!cd_sensor_get_native (priv->sensor)) {
/* TRANSLATORS: this is displayed if VTE support is not enabled */
- gtk_label_set_label (GTK_LABEL (info_bar_hardware_label),
+ gtk_label_set_label (GTK_LABEL (priv->info_bar_hardware_label),
_("The sensor has no native driver."));
goto out;
}
#if 0
/* no support */
- ret = cd_sensor_supports_spot (sensor);
+ ret = cd_sensor_supports_spot (priv->sensor);
if (!ret) {
/* TRANSLATORS: this is displayed the user has not got suitable hardware */
- gtk_label_set_label (GTK_LABEL (info_bar_hardware_label), _("The attached colorimeter is not
capable of reading a spot color."));
+ gtk_label_set_label (GTK_LABEL (priv->info_bar_hardware_label), _("The attached colorimeter
is not capable of reading a spot color."));
goto out;
}
#else
@@ -378,11 +382,11 @@ gcm_picker_sensor_client_setup_ui (void)
#endif
out:
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_measure"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_measure"));
gtk_widget_set_sensitive (widget, ret);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "expander_results"));
- gtk_widget_set_sensitive (widget, ret && done_measure);
- gtk_widget_set_visible (info_bar_hardware, !ret);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "expander_results"));
+ gtk_widget_set_sensitive (widget, ret && priv->done_measure);
+ gtk_widget_set_visible (priv->info_bar_hardware, !ret);
}
/**
@@ -391,9 +395,9 @@ out:
static void
gcm_picker_sensor_client_changed_cb (CdClient *_client,
CdSensor *_sensor,
- gpointer user_data)
+ GcmPickerPrivate *priv)
{
- gcm_picker_sensor_client_setup_ui ();
+ gcm_picker_sensor_client_setup_ui (priv);
}
/**
@@ -428,7 +432,7 @@ gcm_picker_error_cb (cmsContext ContextID, cmsUInt32Number errorcode, const char
* gcm_prefs_space_combo_changed_cb:
**/
static void
-gcm_prefs_space_combo_changed_cb (GtkWidget *widget, gpointer data)
+gcm_prefs_space_combo_changed_cb (GtkWidget *widget, GcmPickerPrivate *priv)
{
GtkTreeIter iter;
GtkTreeModel *model;
@@ -446,10 +450,10 @@ gcm_prefs_space_combo_changed_cb (GtkWidget *widget, gpointer data)
if (profile == NULL)
return;
- profile_filename = cd_profile_get_filename (profile);
- g_debug ("changed picker space %s", profile_filename);
+ priv->profile_filename = cd_profile_get_filename (profile);
+ g_debug ("changed picker space %s", priv->profile_filename);
- gcm_picker_refresh_results ();
+ gcm_picker_refresh_results (priv);
}
/**
@@ -506,7 +510,7 @@ gcm_prefs_combobox_add_profile (GtkWidget *widget, CdProfile *profile, GtkTreeIt
* gcm_prefs_setup_space_combobox:
**/
static void
-gcm_prefs_setup_space_combobox (GtkWidget *widget)
+gcm_prefs_setup_space_combobox (GcmPickerPrivate *priv, GtkWidget *widget)
{
CdColorspace colorspace;
CdDevice *device_tmp;
@@ -525,7 +529,7 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget)
g_autoptr(GPtrArray) profile_array = NULL;
/* get new list */
- profile_array = cd_client_get_profiles_sync (client,
+ profile_array = cd_client_get_profiles_sync (priv->client,
NULL,
&error);
if (profile_array == NULL) {
@@ -565,7 +569,7 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget)
/* set active option */
if (g_strcmp0 (tmp, "adobe-rgb") == 0) {
- profile_filename = filename;
+ priv->profile_filename = filename;
gtk_combo_box_set_active_iter (GTK_COMBO_BOX (widget), &iter);
}
has_profile = TRUE;
@@ -573,7 +577,7 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget)
}
/* add device profiles */
- devices = cd_client_get_devices_by_kind_sync (client,
+ devices = cd_client_get_devices_by_kind_sync (priv->client,
CD_DEVICE_KIND_DISPLAY,
NULL,
&error);
@@ -625,10 +629,10 @@ gcm_prefs_setup_space_combobox (GtkWidget *widget)
* gcm_picker_activate_cb:
**/
static void
-gcm_picker_activate_cb (GApplication *application, gpointer user_data)
+gcm_picker_activate_cb (GApplication *application, GcmPickerPrivate *priv)
{
GtkWindow *window;
- window = GTK_WINDOW (gtk_builder_get_object (builder, "dialog_picker"));
+ window = GTK_WINDOW (gtk_builder_get_object (priv->builder, "dialog_picker"));
gtk_window_present (window);
}
@@ -636,7 +640,7 @@ gcm_picker_activate_cb (GApplication *application, gpointer user_data)
* gcm_picker_startup_cb:
**/
static void
-gcm_picker_startup_cb (GApplication *application, gpointer user_data)
+gcm_picker_startup_cb (GApplication *application, GcmPickerPrivate *priv)
{
gboolean ret;
GtkWidget *main_window;
@@ -645,8 +649,8 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
g_autoptr(GError) error = NULL;
/* get UI */
- builder = gtk_builder_new ();
- retval = gtk_builder_add_from_resource (builder,
+ priv->builder = gtk_builder_new ();
+ retval = gtk_builder_add_from_resource (priv->builder,
"/org/gnome/color-manager/gcm-picker.ui",
&error);
if (retval == 0) {
@@ -654,15 +658,15 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
return;
}
- main_window = GTK_WIDGET (gtk_builder_get_object (builder, "dialog_picker"));
+ main_window = GTK_WIDGET (gtk_builder_get_object (priv->builder, "dialog_picker"));
gtk_application_add_window (GTK_APPLICATION (application), GTK_WINDOW (main_window));
gtk_window_set_icon_name (GTK_WINDOW (main_window), GCM_STOCK_ICON);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "button_measure"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "button_measure"));
g_signal_connect (widget, "clicked",
- G_CALLBACK (gcm_picker_measure_cb), NULL);
+ G_CALLBACK (gcm_picker_measure_cb), priv);
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "image_preview"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_preview"));
gtk_widget_set_size_request (widget, 200, 200);
/* add application specific icons to search path */
@@ -673,48 +677,48 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
//cd_color_xyz_clear (&last_sample);
/* set the parent window if it is specified */
- if (xid != 0) {
- g_debug ("Setting xid %i", xid);
- gcm_window_set_parent_xid (GTK_WINDOW (main_window), xid);
+ if (priv->xid != 0) {
+ g_debug ("Setting xid %i", priv->xid);
+ gcm_window_set_parent_xid (GTK_WINDOW (main_window), priv->xid);
}
/* use an info bar if there is no device, or the wrong device */
- info_bar_hardware = gtk_info_bar_new ();
- info_bar_hardware_label = gtk_label_new (NULL);
- gtk_info_bar_set_message_type (GTK_INFO_BAR(info_bar_hardware), GTK_MESSAGE_INFO);
- widget = gtk_info_bar_get_content_area (GTK_INFO_BAR(info_bar_hardware));
- gtk_container_add (GTK_CONTAINER(widget), info_bar_hardware_label);
- gtk_widget_show (info_bar_hardware_label);
+ priv->info_bar_hardware = gtk_info_bar_new ();
+ priv->info_bar_hardware_label = gtk_label_new (NULL);
+ gtk_info_bar_set_message_type (GTK_INFO_BAR(priv->info_bar_hardware), GTK_MESSAGE_INFO);
+ widget = gtk_info_bar_get_content_area (GTK_INFO_BAR(priv->info_bar_hardware));
+ gtk_container_add (GTK_CONTAINER(widget), priv->info_bar_hardware_label);
+ gtk_widget_show (priv->info_bar_hardware_label);
/* add infobar to devices pane */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "box1"));
- gtk_box_pack_start (GTK_BOX(widget), info_bar_hardware, FALSE, FALSE, 0);
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "box1"));
+ gtk_box_pack_start (GTK_BOX(widget), priv->info_bar_hardware, FALSE, FALSE, 0);
/* maintain a list of profiles */
- client = cd_client_new ();
- ret = cd_client_connect_sync (client, NULL, &error);
+ priv->client = cd_client_new ();
+ ret = cd_client_connect_sync (priv->client, NULL, &error);
if (!ret) {
g_warning ("failed to connect to colord: %s",
error->message);
return;
}
- g_signal_connect (client, "sensor-added",
- G_CALLBACK (gcm_picker_sensor_client_changed_cb), NULL);
- g_signal_connect (client, "sensor-removed",
- G_CALLBACK (gcm_picker_sensor_client_changed_cb), NULL);
+ g_signal_connect (priv->client, "sensor-added",
+ G_CALLBACK (gcm_picker_sensor_client_changed_cb), priv);
+ g_signal_connect (priv->client, "sensor-removed",
+ G_CALLBACK (gcm_picker_sensor_client_changed_cb), priv);
/* disable some ui if no hardware */
- gcm_picker_sensor_client_setup_ui ();
+ gcm_picker_sensor_client_setup_ui (priv);
/* setup RGB combobox */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "combobox_colorspace"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "combobox_colorspace"));
gcm_prefs_set_combo_simple_text (widget);
- gcm_prefs_setup_space_combobox (widget);
+ gcm_prefs_setup_space_combobox (priv, widget);
g_signal_connect (G_OBJECT (widget), "changed",
- G_CALLBACK (gcm_prefs_space_combo_changed_cb), NULL);
+ G_CALLBACK (gcm_prefs_space_combo_changed_cb), priv);
/* setup initial preview window */
- widget = GTK_WIDGET (gtk_builder_get_object (builder, "image_preview"));
+ widget = GTK_WIDGET (gtk_builder_get_object (priv->builder, "image_preview"));
gtk_image_set_from_file (GTK_IMAGE (widget), DATADIR
"/icons/hicolor/64x64/apps/gnome-color-manager.png");
/* wait */
@@ -727,8 +731,10 @@ gcm_picker_startup_cb (GApplication *application, gpointer user_data)
int
main (int argc, char *argv[])
{
+ GcmPickerPrivate *priv;
GOptionContext *context;
GtkApplication *application;
+ guint xid = 0;
int status = 0;
const GOptionEntry options[] = {
@@ -756,20 +762,25 @@ main (int argc, char *argv[])
g_option_context_parse (context, &argc, &argv, NULL);
g_option_context_free (context);
+ /* create private */
+ priv = g_new0 (GcmPickerPrivate, 1);
+ priv->last_ambient = -1.0f;
+ priv->xid = xid;
+
/* ensure single instance */
application = gtk_application_new ("org.gnome.ColorManager.Picker", 0);
g_signal_connect (application, "startup",
- G_CALLBACK (gcm_picker_startup_cb), NULL);
+ G_CALLBACK (gcm_picker_startup_cb), priv);
g_signal_connect (application, "activate",
- G_CALLBACK (gcm_picker_activate_cb), NULL);
+ G_CALLBACK (gcm_picker_activate_cb), priv);
status = g_application_run (G_APPLICATION (application), argc, argv);
g_object_unref (application);
- if (client != NULL)
- g_object_unref (client);
- if (builder != NULL)
- g_object_unref (builder);
+ if (priv->client != NULL)
+ g_object_unref (priv->client);
+ if (priv->builder != NULL)
+ g_object_unref (priv->builder);
+ g_free (priv);
return status;
}
-
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]