display: Connect signals with g_signal_connect_object in swapped form
This commit is contained in:
parent
b4922526c1
commit
c0cfbeccff
2 changed files with 25 additions and 42 deletions
|
@ -389,12 +389,12 @@ reset_titlebar (CcDisplayPanel *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
active_panel_changed (CcShell *shell,
|
active_panel_changed (CcPanel *self)
|
||||||
GParamSpec *pspec,
|
|
||||||
CcPanel *self)
|
|
||||||
{
|
{
|
||||||
|
CcShell *shell;
|
||||||
g_autoptr(CcPanel) panel = NULL;
|
g_autoptr(CcPanel) panel = NULL;
|
||||||
|
|
||||||
|
shell = cc_panel_get_shell (CC_PANEL (self));
|
||||||
g_object_get (shell, "active-panel", &panel, NULL);
|
g_object_get (shell, "active-panel", &panel, NULL);
|
||||||
if (panel != self)
|
if (panel != self)
|
||||||
reset_titlebar (CC_DISPLAY_PANEL (self));
|
reset_titlebar (CC_DISPLAY_PANEL (self));
|
||||||
|
@ -404,8 +404,6 @@ static void
|
||||||
cc_display_panel_dispose (GObject *object)
|
cc_display_panel_dispose (GObject *object)
|
||||||
{
|
{
|
||||||
CcDisplayPanel *self = CC_DISPLAY_PANEL (object);
|
CcDisplayPanel *self = CC_DISPLAY_PANEL (object);
|
||||||
CcShell *shell;
|
|
||||||
GtkWidget *toplevel;
|
|
||||||
|
|
||||||
reset_titlebar (CC_DISPLAY_PANEL (object));
|
reset_titlebar (CC_DISPLAY_PANEL (object));
|
||||||
|
|
||||||
|
@ -419,11 +417,6 @@ cc_display_panel_dispose (GObject *object)
|
||||||
|
|
||||||
if (self->focus_id)
|
if (self->focus_id)
|
||||||
{
|
{
|
||||||
shell = cc_panel_get_shell (CC_PANEL (object));
|
|
||||||
toplevel = cc_shell_get_toplevel (shell);
|
|
||||||
if (toplevel != NULL)
|
|
||||||
g_signal_handler_disconnect (G_OBJECT (toplevel),
|
|
||||||
self->focus_id);
|
|
||||||
self->focus_id = 0;
|
self->focus_id = 0;
|
||||||
monitor_labeler_hide (CC_DISPLAY_PANEL (object));
|
monitor_labeler_hide (CC_DISPLAY_PANEL (object));
|
||||||
}
|
}
|
||||||
|
@ -611,7 +604,7 @@ static void
|
||||||
cc_display_panel_constructed (GObject *object)
|
cc_display_panel_constructed (GObject *object)
|
||||||
{
|
{
|
||||||
g_signal_connect_object (cc_panel_get_shell (CC_PANEL (object)), "notify::active-panel",
|
g_signal_connect_object (cc_panel_get_shell (CC_PANEL (object)), "notify::active-panel",
|
||||||
G_CALLBACK (active_panel_changed), object, 0);
|
G_CALLBACK (active_panel_changed), object, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
G_OBJECT_CLASS (cc_display_panel_parent_class)->constructed (object);
|
G_OBJECT_CLASS (cc_display_panel_parent_class)->constructed (object);
|
||||||
}
|
}
|
||||||
|
@ -1037,18 +1030,16 @@ mapped_cb (CcDisplayPanel *panel)
|
||||||
shell = cc_panel_get_shell (CC_PANEL (panel));
|
shell = cc_panel_get_shell (CC_PANEL (panel));
|
||||||
toplevel = cc_shell_get_toplevel (shell);
|
toplevel = cc_shell_get_toplevel (shell);
|
||||||
if (toplevel && !panel->focus_id)
|
if (toplevel && !panel->focus_id)
|
||||||
panel->focus_id = g_signal_connect_swapped (toplevel, "notify::has-toplevel-focus",
|
panel->focus_id = g_signal_connect_object (toplevel, "notify::has-toplevel-focus",
|
||||||
G_CALLBACK (dialog_toplevel_focus_changed), panel);
|
G_CALLBACK (dialog_toplevel_focus_changed), panel, G_CONNECT_SWAPPED);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
cc_display_panel_up_client_changed (UpClient *client,
|
cc_display_panel_up_client_changed (CcDisplayPanel *self)
|
||||||
GParamSpec *pspec,
|
|
||||||
CcDisplayPanel *self)
|
|
||||||
{
|
{
|
||||||
gboolean lid_is_closed;
|
gboolean lid_is_closed;
|
||||||
|
|
||||||
lid_is_closed = up_client_get_lid_is_closed (client);
|
lid_is_closed = up_client_get_lid_is_closed (self->up_client);
|
||||||
|
|
||||||
if (lid_is_closed != self->lid_is_closed)
|
if (lid_is_closed != self->lid_is_closed)
|
||||||
{
|
{
|
||||||
|
@ -1108,10 +1099,9 @@ update_has_accel (CcDisplayPanel *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sensor_proxy_properties_changed_cb (GDBusProxy *proxy,
|
sensor_proxy_properties_changed_cb (CcDisplayPanel *self,
|
||||||
GVariant *changed_properties,
|
GVariant *changed_properties,
|
||||||
GStrv invalidated_properties,
|
GStrv invalidated_properties)
|
||||||
CcDisplayPanel *self)
|
|
||||||
{
|
{
|
||||||
GVariantDict dict;
|
GVariantDict dict;
|
||||||
|
|
||||||
|
@ -1141,8 +1131,8 @@ sensor_proxy_appeared_cb (GDBusConnection *connection,
|
||||||
NULL);
|
NULL);
|
||||||
g_return_if_fail (self->iio_sensor_proxy);
|
g_return_if_fail (self->iio_sensor_proxy);
|
||||||
|
|
||||||
g_signal_connect (self->iio_sensor_proxy, "g-properties-changed",
|
g_signal_connect_object (self->iio_sensor_proxy, "g-properties-changed",
|
||||||
G_CALLBACK (sensor_proxy_properties_changed_cb), self);
|
G_CALLBACK (sensor_proxy_properties_changed_cb), self, G_CONNECT_SWAPPED);
|
||||||
update_has_accel (self);
|
update_has_accel (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1236,9 +1226,9 @@ cc_display_panel_init (CcDisplayPanel *self)
|
||||||
self->up_client = up_client_new ();
|
self->up_client = up_client_new ();
|
||||||
if (up_client_get_lid_is_present (self->up_client))
|
if (up_client_get_lid_is_present (self->up_client))
|
||||||
{
|
{
|
||||||
g_signal_connect (self->up_client, "notify::lid-is-closed",
|
g_signal_connect_object (self->up_client, "notify::lid-is-closed",
|
||||||
G_CALLBACK (cc_display_panel_up_client_changed), self);
|
G_CALLBACK (cc_display_panel_up_client_changed), self, G_CONNECT_SWAPPED);
|
||||||
cc_display_panel_up_client_changed (self->up_client, NULL, self);
|
cc_display_panel_up_client_changed (self);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
g_clear_object (&self->up_client);
|
g_clear_object (&self->up_client);
|
||||||
|
|
|
@ -380,10 +380,7 @@ dialog_color_temperature_value_changed_cb (GtkAdjustment *adjustment,
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_color_properties_changed_cb (GDBusProxy *proxy,
|
dialog_color_properties_changed_cb (CcNightLightPage *self)
|
||||||
GVariant *changed_properties,
|
|
||||||
GStrv invalidated_properties,
|
|
||||||
CcNightLightPage *self)
|
|
||||||
{
|
{
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
}
|
}
|
||||||
|
@ -408,7 +405,7 @@ dialog_got_proxy_cb (GObject *source_object,
|
||||||
self->proxy_color = proxy;
|
self->proxy_color = proxy;
|
||||||
|
|
||||||
g_signal_connect_object (self->proxy_color, "g-properties-changed",
|
g_signal_connect_object (self->proxy_color, "g-properties-changed",
|
||||||
G_CALLBACK (dialog_color_properties_changed_cb), self, 0);
|
G_CALLBACK (dialog_color_properties_changed_cb), self, G_CONNECT_SWAPPED);
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
self->timer_id = g_timeout_add_seconds (10, dialog_tick_cb, self);
|
self->timer_id = g_timeout_add_seconds (10, dialog_tick_cb, self);
|
||||||
}
|
}
|
||||||
|
@ -495,19 +492,15 @@ dialog_update_adjustments (CcNightLightPage *self)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_settings_changed_cb (GSettings *settings_display,
|
dialog_settings_changed_cb (CcNightLightPage *self)
|
||||||
gchar *key,
|
|
||||||
CcNightLightPage *self)
|
|
||||||
{
|
{
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dialog_clock_settings_changed_cb (GSettings *settings_display,
|
dialog_clock_settings_changed_cb (CcNightLightPage *self)
|
||||||
gchar *key,
|
|
||||||
CcNightLightPage *self)
|
|
||||||
{
|
{
|
||||||
self->clock_format = g_settings_get_enum (settings_display, CLOCK_FORMAT_KEY);
|
self->clock_format = g_settings_get_enum (self->settings_clock, CLOCK_FORMAT_KEY);
|
||||||
|
|
||||||
/* uncontionally widen this to avoid truncation */
|
/* uncontionally widen this to avoid truncation */
|
||||||
gtk_adjustment_set_lower (self->adjustment_from_hours, 0);
|
gtk_adjustment_set_lower (self->adjustment_from_hours, 0);
|
||||||
|
@ -648,7 +641,7 @@ cc_night_light_page_init (CcNightLightPage *self)
|
||||||
self->cancellable = g_cancellable_new ();
|
self->cancellable = g_cancellable_new ();
|
||||||
self->settings_display = g_settings_new (DISPLAY_SCHEMA);
|
self->settings_display = g_settings_new (DISPLAY_SCHEMA);
|
||||||
|
|
||||||
g_signal_connect (self->settings_display, "changed", G_CALLBACK (dialog_settings_changed_cb), self);
|
g_signal_connect_object (self->settings_display, "changed", G_CALLBACK (dialog_settings_changed_cb), self, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
build_schedule_combo_row (self);
|
build_schedule_combo_row (self);
|
||||||
|
|
||||||
|
@ -702,10 +695,10 @@ cc_night_light_page_init (CcNightLightPage *self)
|
||||||
self->settings_clock = g_settings_new (CLOCK_SCHEMA);
|
self->settings_clock = g_settings_new (CLOCK_SCHEMA);
|
||||||
self->clock_format = g_settings_get_enum (self->settings_clock, CLOCK_FORMAT_KEY);
|
self->clock_format = g_settings_get_enum (self->settings_clock, CLOCK_FORMAT_KEY);
|
||||||
dialog_update_adjustments (self);
|
dialog_update_adjustments (self);
|
||||||
g_signal_connect (self->settings_clock,
|
g_signal_connect_object (self->settings_clock,
|
||||||
"changed::" CLOCK_FORMAT_KEY,
|
"changed::" CLOCK_FORMAT_KEY,
|
||||||
G_CALLBACK (dialog_clock_settings_changed_cb),
|
G_CALLBACK (dialog_clock_settings_changed_cb),
|
||||||
self);
|
self, G_CONNECT_SWAPPED);
|
||||||
|
|
||||||
dialog_update_state (self);
|
dialog_update_state (self);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue