display: Add some signals to the new configuration API

These will be useful to keep track of changes across different places
in the new UI.

https://bugzilla.gnome.org/show_bug.cgi?id=785949
This commit is contained in:
Rui Matos 2017-08-02 22:44:50 +02:00
parent 9b0cf3391c
commit 7c89e30a47
3 changed files with 49 additions and 4 deletions

View file

@ -448,6 +448,8 @@ cc_display_monitor_dbus_set_active (CcDisplayMonitor *pself,
cc_display_monitor_dbus_set_logical_monitor (self, NULL);
cc_display_config_dbus_ensure_gapless (self->config);
}
g_signal_emit_by_name (self, "active");
}
static CcDisplayRotation
@ -476,6 +478,8 @@ cc_display_monitor_dbus_set_rotation (CcDisplayMonitor *pself,
/* See comment in ensure_gapless() for why we disregard the
existing layout here. */
cc_display_config_dbus_make_linear (self->config);
g_signal_emit_by_name (self, "rotation");
}
}
@ -662,6 +666,8 @@ cc_display_monitor_dbus_set_mode (CcDisplayMonitor *pself,
if (!cc_display_mode_dbus_is_supported_scale (mode, cc_display_monitor_get_scale (pself)))
cc_display_monitor_set_scale (pself, cc_display_mode_get_preferred_scale (mode));
g_signal_emit_by_name (self, "mode");
}
static void
@ -1095,10 +1101,16 @@ cc_display_config_dbus_set_primary (CcDisplayConfigDBus *self,
return;
if (self->primary && self->primary->logical_monitor)
self->primary->logical_monitor->primary = FALSE;
{
self->primary->logical_monitor->primary = FALSE;
g_signal_emit_by_name (self->primary, "primary");
}
self->primary = new_primary;
self->primary->logical_monitor->primary = TRUE;
g_signal_emit_by_name (self->primary, "primary");
g_signal_emit_by_name (self, "primary");
}
static void

View file

@ -215,7 +215,8 @@ cc_display_monitor_rr_set_active (CcDisplayMonitor *pself,
{
CcDisplayMonitorRR *self = CC_DISPLAY_MONITOR_RR (pself);
return gnome_rr_output_info_set_active (self->output_info, active);
gnome_rr_output_info_set_active (self->output_info, active);
g_signal_emit_by_name (self, "active");
}
static CcDisplayRotation
@ -237,8 +238,9 @@ cc_display_monitor_rr_set_rotation (CcDisplayMonitor *pself,
{
CcDisplayMonitorRR *self = CC_DISPLAY_MONITOR_RR (pself);
return gnome_rr_output_info_set_rotation (self->output_info,
rotation_map[rotation]);
gnome_rr_output_info_set_rotation (self->output_info,
rotation_map[rotation]);
g_signal_emit_by_name (self, "rotation");
}
static gboolean
@ -339,6 +341,7 @@ cc_display_monitor_rr_set_mode (CcDisplayMonitor *pself,
gnome_rr_output_info_set_refresh_rate (self->output_info,
cc_display_mode_get_freq (mode));
g_signal_emit_by_name (self, "mode");
}
static void
@ -475,8 +478,13 @@ cc_display_config_rr_set_primary (CcDisplayConfigRR *self,
return;
gnome_rr_output_info_set_primary (self->primary->output_info, FALSE);
g_signal_emit_by_name (self->primary, "primary");
self->primary = new_primary;
gnome_rr_output_info_set_primary (self->primary->output_info, TRUE);
g_signal_emit_by_name (self->primary, "primary");
g_signal_emit_by_name (self, "primary");
}
static void

View file

@ -82,6 +82,26 @@ cc_display_monitor_init (CcDisplayMonitor *self)
static void
cc_display_monitor_class_init (CcDisplayMonitorClass *klass)
{
g_signal_new ("rotation",
CC_TYPE_DISPLAY_MONITOR,
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_signal_new ("mode",
CC_TYPE_DISPLAY_MONITOR,
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_signal_new ("primary",
CC_TYPE_DISPLAY_MONITOR,
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
g_signal_new ("active",
CC_TYPE_DISPLAY_MONITOR,
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
const char *
@ -237,6 +257,11 @@ cc_display_config_init (CcDisplayConfig *self)
static void
cc_display_config_class_init (CcDisplayConfigClass *klass)
{
g_signal_new ("primary",
CC_TYPE_DISPLAY_CONFIG,
G_SIGNAL_RUN_LAST,
0, NULL, NULL, NULL,
G_TYPE_NONE, 0);
}
GList *