monitor-manager: add API to get the display configuration timeout

Instead of hardcoding this into two different places, add an API so that
gnome-shell can fetch it.

https://bugzilla.gnome.org/show_bug.cgi?id=767805
This commit is contained in:
Cosimo Cecchi 2014-08-20 17:07:13 -07:00 committed by Cosimo Cecchi
parent 4c1fe4c30d
commit 1455c402b9
2 changed files with 11 additions and 1 deletions

View File

@ -44,6 +44,8 @@
#include "backends/x11/meta-monitor-manager-xrandr.h"
#include "meta-backend-private.h"
#define DEFAULT_DISPLAY_CONFIGURATION_TIMEOUT 20
enum {
CONFIRM_DISPLAY_CHANGE,
SIGNALS_LAST
@ -1245,6 +1247,12 @@ restore_previous_config (MetaMonitorManager *manager)
meta_monitor_manager_ensure_configured (manager);
}
gint
meta_monitor_manager_get_display_configuration_timeout (void)
{
return DEFAULT_DISPLAY_CONFIGURATION_TIMEOUT;
}
static gboolean
save_config_timeout (gpointer user_data)
{
@ -1276,7 +1284,7 @@ request_persistent_confirmation (MetaMonitorManager *manager,
MetaMonitorConfigSystem system)
{
manager->pending_persistent_system = system;
manager->persistent_timeout_id = g_timeout_add_seconds (20,
manager->persistent_timeout_id = g_timeout_add_seconds (meta_monitor_manager_get_display_configuration_timeout (),
save_config_timeout,
manager);
g_source_set_name_by_id (manager->persistent_timeout_id,

View File

@ -55,4 +55,6 @@ gboolean meta_monitor_manager_can_switch_config (MetaMonitorManager *manager);
MetaMonitorSwitchConfigType meta_monitor_manager_get_switch_config (MetaMonitorManager *manager);
gint meta_monitor_manager_get_display_configuration_timeout (void);
#endif /* META_MONITOR_MANAGER_H */