color: Connect signals with g_signal_connect_object in swapped form
This commit is contained in:
parent
591cd14b57
commit
f1893b8e8b
4 changed files with 200 additions and 260 deletions
|
@ -279,10 +279,9 @@ cc_color_calibrate_calib_set_output_gamma (CcColorCalibrate *calibrate,
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_calibrate_property_changed_cb (GDBusProxy *proxy,
|
||||
cc_color_calibrate_property_changed_cb (CcColorCalibrate *calibrate,
|
||||
GVariant *changed_properties,
|
||||
GStrv invalidated_properties,
|
||||
CcColorCalibrate *calibrate)
|
||||
GStrv invalidated_properties)
|
||||
{
|
||||
gboolean ret;
|
||||
GtkWidget *widget;
|
||||
|
@ -473,11 +472,10 @@ cc_color_calibrate_finished (CcColorCalibrate *calibrate,
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_calibrate_signal_cb (GDBusProxy *proxy,
|
||||
cc_color_calibrate_signal_cb (CcColorCalibrate *calibrate,
|
||||
const gchar *sender_name,
|
||||
const gchar *signal_name,
|
||||
GVariant *parameters,
|
||||
CcColorCalibrate *calibrate)
|
||||
GVariant *parameters)
|
||||
{
|
||||
CdColorRGB color;
|
||||
CdColorRGB *color_tmp;
|
||||
|
@ -656,22 +654,27 @@ out:
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_calibrate_window_realize_cb (GtkWidget *widget,
|
||||
CcColorCalibrate *calibrate)
|
||||
cc_color_calibrate_window_realize_cb (CcColorCalibrate *self)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (self->builder,
|
||||
"dialog_calibrate"));
|
||||
gtk_window_fullscreen (GTK_WINDOW (widget));
|
||||
gtk_window_maximize (GTK_WINDOW (widget));
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cc_color_calibrate_window_state_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
CcColorCalibrate *calibrate)
|
||||
cc_color_calibrate_window_state_cb (CcColorCalibrate *calibrate,
|
||||
GdkEvent *event)
|
||||
{
|
||||
gboolean ret;
|
||||
g_autoptr(GError) error = NULL;
|
||||
GdkEventWindowState *event_state = (GdkEventWindowState *) event;
|
||||
GtkWindow *window = GTK_WINDOW (widget);
|
||||
GtkWindow *window;
|
||||
|
||||
window = GTK_WINDOW (gtk_builder_get_object (calibrate->builder,
|
||||
"dialog_calibrate"));
|
||||
|
||||
/* check event */
|
||||
if (event->type != GDK_WINDOW_STATE)
|
||||
|
@ -689,16 +692,15 @@ cc_color_calibrate_window_state_cb (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_calibrate_button_done_cb (GtkWidget *widget,
|
||||
CcColorCalibrate *calibrate)
|
||||
cc_color_calibrate_button_done_cb (CcColorCalibrate *calibrate)
|
||||
{
|
||||
g_main_loop_quit (calibrate->loop);
|
||||
}
|
||||
|
||||
static void
|
||||
cc_color_calibrate_button_start_cb (GtkWidget *widget,
|
||||
CcColorCalibrate *calibrate)
|
||||
cc_color_calibrate_button_start_cb (CcColorCalibrate *calibrate)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
g_autoptr(GError) error = NULL;
|
||||
g_autoptr(GVariant) retval = NULL;
|
||||
|
||||
|
@ -723,15 +725,19 @@ cc_color_calibrate_button_start_cb (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_calibrate_button_cancel_cb (GtkWidget *widget,
|
||||
CcColorCalibrate *calibrate)
|
||||
cc_color_calibrate_button_cancel_cb (CcColorCalibrate *calibrate)
|
||||
{
|
||||
cc_color_calibrate_cancel (calibrate);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
cc_color_calibrate_alpha_window_draw (GtkWidget *widget, cairo_t *cr)
|
||||
cc_color_calibrate_alpha_window_draw (CcColorCalibrate *calibrate, cairo_t *cr)
|
||||
{
|
||||
GtkWidget *widget;
|
||||
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
|
||||
"dialog_calibrate"));
|
||||
|
||||
if (gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget)) &&
|
||||
gdk_screen_is_composited (gtk_widget_get_screen (widget)))
|
||||
{
|
||||
|
@ -749,12 +755,16 @@ cc_color_calibrate_alpha_window_draw (GtkWidget *widget, cairo_t *cr)
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_calibrate_alpha_screen_changed_cb (GtkWindow *window,
|
||||
GdkScreen *old_screen,
|
||||
gpointer user_data)
|
||||
cc_color_calibrate_alpha_screen_changed_cb (CcColorCalibrate *calibrate)
|
||||
{
|
||||
GdkScreen *screen = gtk_widget_get_screen (GTK_WIDGET (window));
|
||||
GdkVisual *visual = gdk_screen_get_rgba_visual (screen);
|
||||
GtkWidget *window;
|
||||
GdkScreen *screen;
|
||||
GdkVisual *visual;
|
||||
|
||||
window = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
|
||||
"dialog_calibrate"));
|
||||
screen = gtk_widget_get_screen (GTK_WIDGET (window));
|
||||
visual = gdk_screen_get_rgba_visual (screen);
|
||||
if (visual == NULL)
|
||||
visual = gdk_screen_get_system_visual (screen);
|
||||
gtk_widget_set_visual (GTK_WIDGET (window), visual);
|
||||
|
@ -871,11 +881,11 @@ cc_color_calibrate_setup (CcColorCalibrate *calibrate,
|
|||
g_signal_connect_object (calibrate->proxy_helper,
|
||||
"g-properties-changed",
|
||||
G_CALLBACK (cc_color_calibrate_property_changed_cb),
|
||||
calibrate, 0);
|
||||
calibrate, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (calibrate->proxy_helper,
|
||||
"g-signal",
|
||||
G_CALLBACK (cc_color_calibrate_signal_cb),
|
||||
calibrate, 0);
|
||||
calibrate, G_CONNECT_SWAPPED);
|
||||
out:
|
||||
return ret;
|
||||
}
|
||||
|
@ -976,9 +986,7 @@ cc_color_calibrate_start (CcColorCalibrate *calibrate,
|
|||
}
|
||||
|
||||
static gboolean
|
||||
cc_color_calibrate_delete_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
CcColorCalibrate *calibrate)
|
||||
cc_color_calibrate_delete_event_cb (CcColorCalibrate *calibrate)
|
||||
{
|
||||
/* do not destroy the window */
|
||||
cc_color_calibrate_cancel (calibrate);
|
||||
|
@ -1049,38 +1057,38 @@ cc_color_calibrate_init (CcColorCalibrate *calibrate)
|
|||
/* connect to buttons */
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
|
||||
"button_start"));
|
||||
g_signal_connect (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_start_cb), calibrate);
|
||||
g_signal_connect_object (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_start_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
|
||||
"button_resume"));
|
||||
g_signal_connect (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_start_cb), calibrate);
|
||||
g_signal_connect_object (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_start_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
|
||||
"button_done"));
|
||||
g_signal_connect (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_done_cb), calibrate);
|
||||
g_signal_connect_object (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_done_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
widget = GTK_WIDGET (gtk_builder_get_object (calibrate->builder,
|
||||
"button_cancel"));
|
||||
g_signal_connect (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_cancel_cb), calibrate);
|
||||
g_signal_connect_object (widget, "clicked",
|
||||
G_CALLBACK (cc_color_calibrate_button_cancel_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
gtk_widget_show (widget);
|
||||
|
||||
/* setup the specialist calibration window */
|
||||
window = GTK_WINDOW (gtk_builder_get_object (calibrate->builder,
|
||||
"dialog_calibrate"));
|
||||
g_signal_connect (window, "draw",
|
||||
G_CALLBACK (cc_color_calibrate_alpha_window_draw), calibrate);
|
||||
g_signal_connect (window, "realize",
|
||||
G_CALLBACK (cc_color_calibrate_window_realize_cb), calibrate);
|
||||
g_signal_connect (window, "window-state-event",
|
||||
G_CALLBACK (cc_color_calibrate_window_state_cb), calibrate);
|
||||
g_signal_connect (window, "delete-event",
|
||||
G_CALLBACK (cc_color_calibrate_delete_event_cb), 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",
|
||||
G_CALLBACK (cc_color_calibrate_window_realize_cb), calibrate, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (window, "window-state-event",
|
||||
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 (GTK_WINDOW (window), NULL, calibrate);
|
||||
g_signal_connect (window, "screen-changed",
|
||||
G_CALLBACK (cc_color_calibrate_alpha_screen_changed_cb), calibrate);
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,6 @@ struct _CcColorDevice
|
|||
GtkWidget *widget_switch;
|
||||
GtkWidget *widget_arrow;
|
||||
GtkWidget *widget_nocalib;
|
||||
guint device_changed_id;
|
||||
};
|
||||
|
||||
G_DEFINE_TYPE (CcColorDevice, cc_color_device, GTK_TYPE_LIST_BOX_ROW)
|
||||
|
@ -148,9 +147,6 @@ cc_color_device_finalize (GObject *object)
|
|||
{
|
||||
CcColorDevice *color_device = CC_COLOR_DEVICE (object);
|
||||
|
||||
if (color_device->device_changed_id > 0)
|
||||
g_signal_handler_disconnect (color_device->device, color_device->device_changed_id);
|
||||
|
||||
g_free (color_device->sortable);
|
||||
g_object_unref (color_device->device);
|
||||
|
||||
|
@ -174,16 +170,13 @@ cc_color_device_set_expanded (CcColorDevice *color_device,
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_device_notify_enable_device_cb (GtkSwitch *sw,
|
||||
GParamSpec *pspec,
|
||||
gpointer user_data)
|
||||
cc_color_device_notify_enable_device_cb (CcColorDevice *color_device)
|
||||
{
|
||||
CcColorDevice *color_device = CC_COLOR_DEVICE (user_data);
|
||||
gboolean enable;
|
||||
gboolean ret;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
||||
enable = gtk_switch_get_active (sw);
|
||||
enable = gtk_switch_get_active (GTK_SWITCH (color_device->widget_switch));
|
||||
g_debug ("Set %s to %i", cd_device_get_id (color_device->device), enable);
|
||||
ret = cd_device_set_enabled_sync (color_device->device,
|
||||
enable, NULL, &error);
|
||||
|
@ -196,8 +189,7 @@ cc_color_device_notify_enable_device_cb (GtkSwitch *sw,
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_device_changed_cb (CdDevice *device,
|
||||
CcColorDevice *color_device)
|
||||
cc_color_device_changed_cb (CcColorDevice *color_device)
|
||||
{
|
||||
cc_color_device_refresh (color_device);
|
||||
}
|
||||
|
@ -209,9 +201,8 @@ cc_color_device_constructed (GObject *object)
|
|||
g_autofree gchar *sortable_tmp = NULL;
|
||||
|
||||
/* watch the device for changes */
|
||||
color_device->device_changed_id =
|
||||
g_signal_connect (color_device->device, "changed",
|
||||
G_CALLBACK (cc_color_device_changed_cb), color_device);
|
||||
g_signal_connect_object (color_device->device, "changed",
|
||||
G_CALLBACK (cc_color_device_changed_cb), color_device, G_CONNECT_SWAPPED);
|
||||
|
||||
/* calculate sortable -- FIXME: we have to hack this as EggListBox
|
||||
* does not let us specify a GtkSortType:
|
||||
|
@ -222,9 +213,9 @@ cc_color_device_constructed (GObject *object)
|
|||
cc_color_device_refresh (color_device);
|
||||
|
||||
/* watch to see if the user flicked the switch */
|
||||
g_signal_connect (color_device->widget_switch, "notify::active",
|
||||
G_CALLBACK (cc_color_device_notify_enable_device_cb),
|
||||
color_device);
|
||||
g_signal_connect_object (color_device->widget_switch, "notify::active",
|
||||
G_CALLBACK (cc_color_device_notify_enable_device_cb),
|
||||
color_device, G_CONNECT_SWAPPED);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -251,10 +242,8 @@ cc_color_device_class_init (CcColorDeviceClass *klass)
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_device_clicked_expander_cb (GtkButton *button,
|
||||
gpointer user_data)
|
||||
cc_color_device_clicked_expander_cb (CcColorDevice *color_device)
|
||||
{
|
||||
CcColorDevice *color_device = CC_COLOR_DEVICE (user_data);
|
||||
color_device->expanded = !color_device->expanded;
|
||||
cc_color_device_refresh (color_device);
|
||||
g_signal_emit (color_device, signals[SIGNAL_EXPANDED_CHANGED], 0,
|
||||
|
@ -287,9 +276,9 @@ cc_color_device_init (CcColorDevice *color_device)
|
|||
color_device->widget_arrow = gtk_image_new_from_icon_name ("pan-end-symbolic",
|
||||
GTK_ICON_SIZE_BUTTON);
|
||||
color_device->widget_button = gtk_button_new ();
|
||||
g_signal_connect (color_device->widget_button, "clicked",
|
||||
G_CALLBACK (cc_color_device_clicked_expander_cb),
|
||||
color_device);
|
||||
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);
|
||||
|
|
|
@ -86,8 +86,6 @@ struct _CcColorPanel
|
|||
CcColorCalibrate *calibrate;
|
||||
GtkListBox *list_box;
|
||||
gchar *list_box_filter;
|
||||
guint list_box_selected_id;
|
||||
guint list_box_activated_id;
|
||||
GtkSizeGroup *list_box_size;
|
||||
gboolean is_live_cd;
|
||||
gboolean model_is_changing;
|
||||
|
@ -204,7 +202,7 @@ gcm_prefs_combobox_add_profile (CcColorPanel *prefs,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_default_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_default_cb (CcColorPanel *prefs)
|
||||
{
|
||||
g_autoptr(CdProfile) profile = NULL;
|
||||
gboolean ret;
|
||||
|
@ -271,7 +269,7 @@ gcm_prefs_file_chooser_get_icc_profile (CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_cancel_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_calib_cancel_cb (CcColorPanel *prefs)
|
||||
{
|
||||
gtk_widget_hide (prefs->assistant_calib);
|
||||
}
|
||||
|
@ -288,9 +286,8 @@ gcm_prefs_calib_delayed_complete_cb (gpointer user_data)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_prepare_cb (GtkAssistant *assistant,
|
||||
GtkWidget *page,
|
||||
CcColorPanel *panel)
|
||||
gcm_prefs_calib_prepare_cb (CcColorPanel *panel,
|
||||
GtkWidget *page)
|
||||
{
|
||||
/* give the user the indication they should actually manually set the
|
||||
* desired brightness rather than clicking blindly by delaying the
|
||||
|
@ -303,11 +300,11 @@ gcm_prefs_calib_prepare_cb (GtkAssistant *assistant,
|
|||
|
||||
/* disable the brightness page as we don't want to show a 'Finished'
|
||||
* button if the user goes back at any point */
|
||||
gtk_assistant_set_page_complete (assistant, panel->box_calib_brightness, FALSE);
|
||||
gtk_assistant_set_page_complete (GTK_ASSISTANT (panel->assistant_calib), panel->box_calib_brightness, FALSE);
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_apply_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_calib_apply_cb (CcColorPanel *prefs)
|
||||
{
|
||||
gboolean ret;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
@ -342,18 +339,16 @@ gcm_prefs_calib_apply_cb (GtkWidget *widget, CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gcm_prefs_calib_delete_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_calib_delete_event_cb (CcColorPanel *prefs)
|
||||
{
|
||||
/* do not destroy the window */
|
||||
gcm_prefs_calib_cancel_cb (widget, prefs);
|
||||
gcm_prefs_calib_cancel_cb (prefs);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_temp_treeview_clicked_cb (GtkTreeSelection *selection,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_calib_temp_treeview_clicked_cb (CcColorPanel *prefs,
|
||||
GtkTreeSelection *selection)
|
||||
{
|
||||
gboolean ret;
|
||||
GtkTreeIter iter;
|
||||
|
@ -375,8 +370,8 @@ gcm_prefs_calib_temp_treeview_clicked_cb (GtkTreeSelection *selection,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_kind_treeview_clicked_cb (GtkTreeSelection *selection,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_calib_kind_treeview_clicked_cb (CcColorPanel *prefs,
|
||||
GtkTreeSelection *selection)
|
||||
{
|
||||
CdSensorCap device_kind;
|
||||
gboolean ret;
|
||||
|
@ -399,8 +394,8 @@ gcm_prefs_calib_kind_treeview_clicked_cb (GtkTreeSelection *selection,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_quality_treeview_clicked_cb (GtkTreeSelection *selection,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_calib_quality_treeview_clicked_cb (CcColorPanel *prefs,
|
||||
GtkTreeSelection *selection)
|
||||
{
|
||||
CdProfileQuality quality;
|
||||
gboolean ret;
|
||||
|
@ -490,8 +485,8 @@ gcm_prefs_calib_set_sensor (CcColorPanel *prefs,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_sensor_treeview_clicked_cb (GtkTreeSelection *selection,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_calib_sensor_treeview_clicked_cb (CcColorPanel *prefs,
|
||||
GtkTreeSelection *selection)
|
||||
{
|
||||
gboolean ret;
|
||||
GtkTreeIter iter;
|
||||
|
@ -565,9 +560,7 @@ gcm_prefs_calibrate_display (CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_title_entry_changed_cb (GtkWidget *widget,
|
||||
GParamSpec *param_spec,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_title_entry_changed_cb (CcColorPanel *prefs)
|
||||
{
|
||||
GtkAssistant *assistant;
|
||||
const gchar *value;
|
||||
|
@ -579,7 +572,7 @@ gcm_prefs_title_entry_changed_cb (GtkWidget *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calibrate_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_calibrate_cb (CcColorPanel *prefs)
|
||||
{
|
||||
gboolean ret;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
@ -783,7 +776,7 @@ gcm_prefs_add_profiles_suitable_for_devices (CcColorPanel *prefs,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_upload_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_calib_upload_cb (CcColorPanel *prefs)
|
||||
{
|
||||
CdProfile *profile;
|
||||
const gchar *uri;
|
||||
|
@ -868,7 +861,7 @@ gcm_prefs_calib_upload_cb (GtkWidget *widget, CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_export_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_calib_export_cb (CcColorPanel *prefs)
|
||||
{
|
||||
CdProfile *profile;
|
||||
gboolean ret;
|
||||
|
@ -917,9 +910,8 @@ gcm_prefs_calib_export_cb (GtkWidget *widget, CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_calib_export_link_cb (GtkLabel *widget,
|
||||
const gchar *url,
|
||||
CcColorPanel *prefs)
|
||||
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",
|
||||
|
@ -928,7 +920,7 @@ gcm_prefs_calib_export_link_cb (GtkLabel *widget,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_profile_add_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_profile_add_cb (CcColorPanel *prefs)
|
||||
{
|
||||
g_autoptr(GPtrArray) profiles = NULL;
|
||||
|
||||
|
@ -945,7 +937,7 @@ gcm_prefs_profile_add_cb (GtkWidget *widget, CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_profile_remove_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_profile_remove_cb (CcColorPanel *prefs)
|
||||
{
|
||||
CdProfile *profile;
|
||||
gboolean ret = FALSE;
|
||||
|
@ -997,7 +989,7 @@ gcm_prefs_make_profile_default_cb (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_device_profile_enable_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_device_profile_enable_cb (CcColorPanel *prefs)
|
||||
{
|
||||
CdProfile *profile;
|
||||
GtkListBoxRow *row;
|
||||
|
@ -1050,9 +1042,8 @@ gcm_prefs_profile_view (CcColorPanel *prefs, CdProfile *profile)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_profile_assign_link_activate_cb (GtkLabel *label,
|
||||
const gchar *uri,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_profile_assign_link_activate_cb (CcColorPanel *prefs,
|
||||
const gchar *uri)
|
||||
{
|
||||
CdProfile *profile;
|
||||
GtkListBoxRow *row;
|
||||
|
@ -1073,7 +1064,7 @@ gcm_prefs_profile_assign_link_activate_cb (GtkLabel *label,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_profile_view_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_profile_view_cb (CcColorPanel *prefs)
|
||||
{
|
||||
CdProfile *profile;
|
||||
GtkListBoxRow *row;
|
||||
|
@ -1094,13 +1085,13 @@ gcm_prefs_profile_view_cb (GtkWidget *widget, CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_button_assign_cancel_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_button_assign_cancel_cb (CcColorPanel *prefs)
|
||||
{
|
||||
gtk_widget_hide (prefs->dialog_assign);
|
||||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_button_assign_ok_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_button_assign_ok_cb (CcColorPanel *prefs)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkTreeModel *model;
|
||||
|
@ -1110,8 +1101,7 @@ gcm_prefs_button_assign_ok_cb (GtkWidget *widget, CcColorPanel *prefs)
|
|||
GtkTreeSelection *selection;
|
||||
|
||||
/* hide window */
|
||||
widget = GTK_WIDGET (prefs->dialog_assign);
|
||||
gtk_widget_hide (widget);
|
||||
gtk_widget_hide (GTK_WIDGET (prefs->dialog_assign));
|
||||
|
||||
/* get the selected profile */
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->treeview_assign));
|
||||
|
@ -1162,11 +1152,9 @@ gcm_prefs_button_assign_ok_cb (GtkWidget *widget, CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
gcm_prefs_profile_delete_event_cb (GtkWidget *widget,
|
||||
GdkEvent *event,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_profile_delete_event_cb (CcColorPanel *prefs)
|
||||
{
|
||||
gcm_prefs_button_assign_cancel_cb (widget, prefs);
|
||||
gcm_prefs_button_assign_cancel_cb (prefs);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
@ -1302,8 +1290,8 @@ gcm_prefs_profile_clicked (CcColorPanel *prefs, CdProfile *profile, CdDevice *de
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_profiles_treeview_clicked_cb (CcColorPanel *prefs,
|
||||
GtkTreeSelection *selection)
|
||||
{
|
||||
GtkTreeModel *model;
|
||||
GtkTreeIter iter;
|
||||
|
@ -1332,24 +1320,21 @@ gcm_prefs_profiles_treeview_clicked_cb (GtkTreeSelection *selection,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_profiles_row_activated_cb (GtkTreeView *tree_view,
|
||||
GtkTreePath *path,
|
||||
GtkTreeViewColumn *column,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_profiles_row_activated_cb (CcColorPanel *prefs,
|
||||
GtkTreePath *path)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
gboolean ret;
|
||||
|
||||
ret = gtk_tree_model_get_iter (gtk_tree_view_get_model (tree_view), &iter, path);
|
||||
ret = gtk_tree_model_get_iter (gtk_tree_view_get_model (GTK_TREE_VIEW (prefs->treeview_assign)), &iter, path);
|
||||
if (!ret)
|
||||
return;
|
||||
gcm_prefs_button_assign_ok_cb (NULL, prefs);
|
||||
gcm_prefs_button_assign_ok_cb (prefs);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
gcm_prefs_button_assign_import_cb (GtkWidget *widget,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_button_assign_import_cb (CcColorPanel *prefs)
|
||||
{
|
||||
g_autoptr(GFile) file = NULL;
|
||||
g_autoptr(GError) error = NULL;
|
||||
|
@ -1359,8 +1344,7 @@ gcm_prefs_button_assign_import_cb (GtkWidget *widget,
|
|||
if (file == NULL)
|
||||
{
|
||||
g_warning ("failed to get ICC file");
|
||||
widget = GTK_WIDGET (prefs->dialog_assign);
|
||||
gtk_widget_hide (widget);
|
||||
gtk_widget_hide (GTK_WIDGET (prefs->dialog_assign));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1377,7 +1361,7 @@ gcm_prefs_button_assign_import_cb (GtkWidget *widget,
|
|||
#endif
|
||||
|
||||
/* add to list view */
|
||||
gcm_prefs_profile_add_cb (NULL, prefs);
|
||||
gcm_prefs_profile_add_cb (prefs);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -1592,9 +1576,9 @@ gcm_prefs_device_changed_cb (CdDevice *device, CcColorPanel *prefs)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_device_expanded_changed_cb (CcColorDevice *widget,
|
||||
gcm_prefs_device_expanded_changed_cb (CcColorPanel *prefs,
|
||||
gboolean is_expanded,
|
||||
CcColorPanel *prefs)
|
||||
CcColorDevice *widget)
|
||||
{
|
||||
/* ignore internal changes */
|
||||
if (prefs->model_is_changing)
|
||||
|
@ -1644,8 +1628,8 @@ gcm_prefs_add_device (CcColorPanel *prefs, CdDevice *device)
|
|||
|
||||
/* add device */
|
||||
widget = cc_color_device_new (device);
|
||||
g_signal_connect (widget, "expanded-changed",
|
||||
G_CALLBACK (gcm_prefs_device_expanded_changed_cb), prefs);
|
||||
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_size_group_add_widget (prefs->list_box_size, widget);
|
||||
|
@ -1655,8 +1639,8 @@ gcm_prefs_add_device (CcColorPanel *prefs, CdDevice *device)
|
|||
|
||||
/* watch for changes */
|
||||
g_ptr_array_add (prefs->devices, g_object_ref (device));
|
||||
g_signal_connect (device, "changed",
|
||||
G_CALLBACK (gcm_prefs_device_changed_cb), prefs);
|
||||
g_signal_connect_object (device, "changed",
|
||||
G_CALLBACK (gcm_prefs_device_changed_cb), prefs, G_CONNECT_SWAPPED);
|
||||
gtk_list_box_invalidate_sort (prefs->list_box);
|
||||
}
|
||||
|
||||
|
@ -1758,9 +1742,8 @@ gcm_prefs_get_devices_cb (GObject *object,
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_list_box_row_selected_cb (GtkListBox *list_box,
|
||||
GtkListBoxRow *row,
|
||||
CcColorPanel *panel)
|
||||
gcm_prefs_list_box_row_selected_cb (CcColorPanel *panel,
|
||||
GtkListBoxRow *row)
|
||||
{
|
||||
gcm_prefs_refresh_toolbar_buttons (panel);
|
||||
}
|
||||
|
@ -1812,13 +1795,12 @@ gcm_prefs_refresh_toolbar_buttons (CcColorPanel *panel)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_list_box_row_activated_cb (GtkListBox *list_box,
|
||||
GtkListBoxRow *row,
|
||||
CcColorPanel *prefs)
|
||||
gcm_prefs_list_box_row_activated_cb (CcColorPanel *prefs,
|
||||
GtkListBoxRow *row)
|
||||
{
|
||||
if (CC_IS_COLOR_PROFILE (row))
|
||||
{
|
||||
gcm_prefs_device_profile_enable_cb (NULL, prefs);
|
||||
gcm_prefs_device_profile_enable_cb (prefs);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1884,9 +1866,9 @@ gcm_prefs_is_livecd (void)
|
|||
}
|
||||
|
||||
static void
|
||||
gcm_prefs_window_realize_cb (GtkWidget *widget, CcColorPanel *prefs)
|
||||
gcm_prefs_window_realize_cb (CcColorPanel *prefs)
|
||||
{
|
||||
prefs->main_window = gtk_widget_get_toplevel (widget);
|
||||
prefs->main_window = gtk_widget_get_toplevel (GTK_WIDGET (prefs));
|
||||
}
|
||||
|
||||
static const char *
|
||||
|
@ -1925,39 +1907,12 @@ static void
|
|||
cc_color_panel_dispose (GObject *object)
|
||||
{
|
||||
CcColorPanel *prefs = CC_COLOR_PANEL (object);
|
||||
CdDevice *device;
|
||||
guint i;
|
||||
|
||||
/* stop the EggListView from firing when it gets disposed */
|
||||
if (prefs->list_box_selected_id != 0)
|
||||
{
|
||||
g_signal_handler_disconnect (prefs->list_box,
|
||||
prefs->list_box_selected_id);
|
||||
prefs->list_box_selected_id = 0;
|
||||
|
||||
/* row-activated event should be connected at this point */
|
||||
g_signal_handler_disconnect (prefs->list_box,
|
||||
prefs->list_box_activated_id);
|
||||
prefs->list_box_activated_id = 0;
|
||||
}
|
||||
|
||||
/* stop the devices from emitting after the ListBox has been disposed */
|
||||
if (prefs->devices != NULL)
|
||||
{
|
||||
for (i = 0; i < prefs->devices->len; i++)
|
||||
{
|
||||
device = g_ptr_array_index (prefs->devices, i);
|
||||
g_signal_handlers_disconnect_by_func (device,
|
||||
G_CALLBACK (gcm_prefs_device_changed_cb),
|
||||
CC_COLOR_PANEL (object));
|
||||
}
|
||||
g_clear_pointer (&prefs->devices, g_ptr_array_unref);
|
||||
}
|
||||
|
||||
g_clear_object (&prefs->settings);
|
||||
g_clear_object (&prefs->settings_colord);
|
||||
g_clear_object (&prefs->client);
|
||||
g_clear_object (&prefs->current_device);
|
||||
g_clear_pointer (&prefs->devices, g_ptr_array_unref);
|
||||
g_clear_object (&prefs->calibrate);
|
||||
g_clear_object (&prefs->list_box_size);
|
||||
g_clear_pointer (&prefs->sensors, g_ptr_array_unref);
|
||||
|
@ -2105,67 +2060,67 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
prefs->settings_colord = g_settings_new (COLORD_SETTINGS_SCHEMA);
|
||||
|
||||
/* assign buttons */
|
||||
g_signal_connect (prefs->toolbutton_profile_add, "clicked",
|
||||
G_CALLBACK (gcm_prefs_profile_add_cb), prefs);
|
||||
g_signal_connect (prefs->toolbutton_profile_remove, "clicked",
|
||||
G_CALLBACK (gcm_prefs_profile_remove_cb), prefs);
|
||||
g_signal_connect (prefs->toolbutton_profile_view, "clicked",
|
||||
G_CALLBACK (gcm_prefs_profile_view_cb), prefs);
|
||||
g_signal_connect_object (prefs->toolbutton_profile_add, "clicked",
|
||||
G_CALLBACK (gcm_prefs_profile_add_cb), prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->toolbutton_profile_remove, "clicked",
|
||||
G_CALLBACK (gcm_prefs_profile_remove_cb), prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->toolbutton_profile_view, "clicked",
|
||||
G_CALLBACK (gcm_prefs_profile_view_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
/* href */
|
||||
g_signal_connect (prefs->label_assign_warning, "activate-link",
|
||||
G_CALLBACK (gcm_prefs_profile_assign_link_activate_cb), prefs);
|
||||
g_signal_connect_object (prefs->label_assign_warning, "activate-link",
|
||||
G_CALLBACK (gcm_prefs_profile_assign_link_activate_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
/* add columns to profile tree view */
|
||||
gcm_prefs_add_profiles_columns (prefs, GTK_TREE_VIEW (prefs->treeview_assign));
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->treeview_assign));
|
||||
g_signal_connect (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_profiles_treeview_clicked_cb),
|
||||
prefs);
|
||||
g_signal_connect (GTK_TREE_VIEW (prefs->treeview_assign), "row-activated",
|
||||
G_CALLBACK (gcm_prefs_profiles_row_activated_cb),
|
||||
prefs);
|
||||
g_signal_connect_object (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_profiles_treeview_clicked_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->treeview_assign, "row-activated",
|
||||
G_CALLBACK (gcm_prefs_profiles_row_activated_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect (prefs->toolbutton_device_default, "clicked",
|
||||
G_CALLBACK (gcm_prefs_default_cb), prefs);
|
||||
g_signal_connect (prefs->toolbutton_device_enable, "clicked",
|
||||
G_CALLBACK (gcm_prefs_device_profile_enable_cb), prefs);
|
||||
g_signal_connect (prefs->toolbutton_device_calibrate, "clicked",
|
||||
G_CALLBACK (gcm_prefs_calibrate_cb), prefs);
|
||||
g_signal_connect_object (prefs->toolbutton_device_default, "clicked",
|
||||
G_CALLBACK (gcm_prefs_default_cb), prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->toolbutton_device_enable, "clicked",
|
||||
G_CALLBACK (gcm_prefs_device_profile_enable_cb), prefs, G_CONNECT_SWAPPED);
|
||||
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 (prefs->dialog_assign, "delete-event",
|
||||
G_CALLBACK (gcm_prefs_profile_delete_event_cb), prefs);
|
||||
g_signal_connect_object (prefs->dialog_assign, "delete-event",
|
||||
G_CALLBACK (gcm_prefs_profile_delete_event_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
g_signal_connect (prefs->button_assign_cancel, "clicked",
|
||||
G_CALLBACK (gcm_prefs_button_assign_cancel_cb), prefs);
|
||||
g_signal_connect (prefs->button_assign_ok, "clicked",
|
||||
G_CALLBACK (gcm_prefs_button_assign_ok_cb), prefs);
|
||||
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);
|
||||
|
||||
/* setup icc profiles list */
|
||||
g_signal_connect (prefs->button_assign_import, "clicked",
|
||||
G_CALLBACK (gcm_prefs_button_assign_import_cb), prefs);
|
||||
g_signal_connect_object (prefs->button_assign_import, "clicked",
|
||||
G_CALLBACK (gcm_prefs_button_assign_import_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
/* setup the calibration helper */
|
||||
g_signal_connect (prefs->assistant_calib, "delete-event",
|
||||
G_CALLBACK (gcm_prefs_calib_delete_event_cb),
|
||||
prefs);
|
||||
g_signal_connect (prefs->assistant_calib, "apply",
|
||||
G_CALLBACK (gcm_prefs_calib_apply_cb),
|
||||
prefs);
|
||||
g_signal_connect (prefs->assistant_calib, "cancel",
|
||||
G_CALLBACK (gcm_prefs_calib_cancel_cb),
|
||||
prefs);
|
||||
g_signal_connect (prefs->assistant_calib, "close",
|
||||
G_CALLBACK (gcm_prefs_calib_cancel_cb),
|
||||
prefs);
|
||||
g_signal_connect (prefs->assistant_calib, "prepare",
|
||||
G_CALLBACK (gcm_prefs_calib_prepare_cb),
|
||||
prefs);
|
||||
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);
|
||||
g_signal_connect_object (prefs->assistant_calib, "cancel",
|
||||
G_CALLBACK (gcm_prefs_calib_cancel_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->assistant_calib, "close",
|
||||
G_CALLBACK (gcm_prefs_calib_cancel_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->assistant_calib, "prepare",
|
||||
G_CALLBACK (gcm_prefs_calib_prepare_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
/* setup the calibration helper ::TreeView */
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->treeview_calib_quality));
|
||||
|
@ -2173,9 +2128,9 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
gtk_tree_model_foreach (model,
|
||||
cc_color_panel_treeview_quality_default_cb,
|
||||
selection);
|
||||
g_signal_connect (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_quality_treeview_clicked_cb),
|
||||
prefs);
|
||||
g_signal_connect_object (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_quality_treeview_clicked_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
column = gtk_tree_view_column_new ();
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
g_object_set (renderer,
|
||||
|
@ -2203,9 +2158,9 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->treeview_calib_sensor));
|
||||
g_signal_connect (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_sensor_treeview_clicked_cb),
|
||||
prefs);
|
||||
g_signal_connect_object (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_sensor_treeview_clicked_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
column = gtk_tree_view_column_new ();
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
g_object_set (renderer,
|
||||
|
@ -2220,9 +2175,9 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->treeview_calib_kind));
|
||||
g_signal_connect (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_kind_treeview_clicked_cb),
|
||||
prefs);
|
||||
g_signal_connect_object (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_kind_treeview_clicked_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
column = gtk_tree_view_column_new ();
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
g_object_set (renderer,
|
||||
|
@ -2243,9 +2198,9 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
GTK_TREE_VIEW_COLUMN (column));
|
||||
|
||||
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (prefs->treeview_calib_temp));
|
||||
g_signal_connect (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_temp_treeview_clicked_cb),
|
||||
prefs);
|
||||
g_signal_connect_object (selection, "changed",
|
||||
G_CALLBACK (gcm_prefs_calib_temp_treeview_clicked_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
column = gtk_tree_view_column_new ();
|
||||
renderer = gtk_cell_renderer_text_new ();
|
||||
g_object_set (renderer,
|
||||
|
@ -2258,8 +2213,8 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
gtk_tree_view_column_set_expand (column, TRUE);
|
||||
gtk_tree_view_append_column (GTK_TREE_VIEW (prefs->treeview_calib_temp),
|
||||
GTK_TREE_VIEW_COLUMN (column));
|
||||
g_signal_connect (prefs->entry_calib_title, "notify::text",
|
||||
G_CALLBACK (gcm_prefs_title_entry_changed_cb), prefs);
|
||||
g_signal_connect_object (prefs->entry_calib_title, "notify::text",
|
||||
G_CALLBACK (gcm_prefs_title_entry_changed_cb), prefs, G_CONNECT_SWAPPED);
|
||||
|
||||
/* use a device client array */
|
||||
prefs->client = cd_client_new ();
|
||||
|
@ -2284,14 +2239,12 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
gtk_list_box_set_selection_mode (prefs->list_box,
|
||||
GTK_SELECTION_SINGLE);
|
||||
gtk_list_box_set_activate_on_single_click (prefs->list_box, FALSE);
|
||||
prefs->list_box_selected_id =
|
||||
g_signal_connect (prefs->list_box, "row-selected",
|
||||
G_CALLBACK (gcm_prefs_list_box_row_selected_cb),
|
||||
prefs);
|
||||
prefs->list_box_activated_id =
|
||||
g_signal_connect (prefs->list_box, "row-activated",
|
||||
G_CALLBACK (gcm_prefs_list_box_row_activated_cb),
|
||||
prefs);
|
||||
g_signal_connect_object (prefs->list_box, "row-selected",
|
||||
G_CALLBACK (gcm_prefs_list_box_row_selected_cb),
|
||||
prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->list_box, "row-activated",
|
||||
G_CALLBACK (gcm_prefs_list_box_row_activated_cb),
|
||||
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));
|
||||
|
@ -2317,14 +2270,14 @@ cc_color_panel_init (CcColorPanel *prefs)
|
|||
/* show the confirmation export page if we are running from a LiveCD */
|
||||
prefs->is_live_cd = gcm_prefs_is_livecd ();
|
||||
gtk_widget_set_visible (prefs->box_calib_summary, prefs->is_live_cd);
|
||||
g_signal_connect (prefs->button_calib_export, "clicked",
|
||||
G_CALLBACK (gcm_prefs_calib_export_cb), prefs);
|
||||
g_signal_connect (prefs->button_calib_upload, "clicked",
|
||||
G_CALLBACK (gcm_prefs_calib_upload_cb), prefs);
|
||||
g_signal_connect (prefs->label_calib_summary_message, "activate-link",
|
||||
G_CALLBACK (gcm_prefs_calib_export_link_cb), prefs);
|
||||
g_signal_connect_object (prefs->button_calib_export, "clicked",
|
||||
G_CALLBACK (gcm_prefs_calib_export_cb), prefs, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (prefs->button_calib_upload, "clicked",
|
||||
G_CALLBACK (gcm_prefs_calib_upload_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),
|
||||
prefs);
|
||||
NULL);
|
||||
}
|
||||
|
|
|
@ -40,8 +40,6 @@ struct _CcColorProfile
|
|||
GtkWidget *widget_image;
|
||||
GtkWidget *widget_info;
|
||||
GSettings *settings;
|
||||
guint device_changed_id;
|
||||
guint profile_changed_id;
|
||||
};
|
||||
|
||||
#define GCM_SETTINGS_RECALIBRATE_PRINTER_THRESHOLD "recalibrate-printer-threshold"
|
||||
|
@ -332,11 +330,6 @@ cc_color_profile_finalize (GObject *object)
|
|||
{
|
||||
CcColorProfile *color_profile = CC_COLOR_PROFILE (object);
|
||||
|
||||
if (color_profile->device_changed_id > 0)
|
||||
g_signal_handler_disconnect (color_profile->device, color_profile->device_changed_id);
|
||||
if (color_profile->profile_changed_id > 0)
|
||||
g_signal_handler_disconnect (color_profile->profile, color_profile->profile_changed_id);
|
||||
|
||||
g_free (color_profile->sortable);
|
||||
g_object_unref (color_profile->device);
|
||||
g_object_unref (color_profile->profile);
|
||||
|
@ -346,13 +339,12 @@ cc_color_profile_finalize (GObject *object)
|
|||
}
|
||||
|
||||
static void
|
||||
cc_color_profile_changed_cb (CdDevice *device,
|
||||
CcColorProfile *color_profile)
|
||||
cc_color_profile_changed_cb (CcColorProfile *color_profile)
|
||||
{
|
||||
g_autoptr(CdProfile) profile = NULL;
|
||||
|
||||
/* check to see if the default has changed */
|
||||
profile = cd_device_get_default_profile (device);
|
||||
profile = cd_device_get_default_profile (color_profile->device);
|
||||
if (profile != NULL)
|
||||
color_profile->is_default = g_strcmp0 (cd_profile_get_object_path (profile),
|
||||
cd_profile_get_object_path (color_profile->profile)) == 0;
|
||||
|
@ -384,12 +376,10 @@ cc_color_profile_constructed (GObject *object)
|
|||
g_autofree gchar *title = NULL;
|
||||
|
||||
/* watch to see if the default changes */
|
||||
color_profile->device_changed_id =
|
||||
g_signal_connect (color_profile->device, "changed",
|
||||
G_CALLBACK (cc_color_profile_changed_cb), color_profile);
|
||||
color_profile->profile_changed_id =
|
||||
g_signal_connect (color_profile->profile, "changed",
|
||||
G_CALLBACK (cc_color_profile_changed_cb), color_profile);
|
||||
g_signal_connect_object (color_profile->device, "changed",
|
||||
G_CALLBACK (cc_color_profile_changed_cb), color_profile, G_CONNECT_SWAPPED);
|
||||
g_signal_connect_object (color_profile->profile, "changed",
|
||||
G_CALLBACK (cc_color_profile_changed_cb), color_profile, G_CONNECT_SWAPPED);
|
||||
|
||||
/* sort the profiles in the list by:
|
||||
* 1. thier device (required)
|
||||
|
|
Loading…
Add table
Reference in a new issue