diff options
author | Bastien Nocera <hadess@hadess.net> | 2015-07-02 19:11:27 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2015-07-02 19:11:27 +0200 |
commit | 27ce2df1ef6f8606c082137a2132f4be535572f4 (patch) | |
tree | ecfafe0596bc2a4ce8e2246447c13e17cb997832 | |
parent | 367bfb724a4f8c00b613023a3141f70588f12242 (diff) | |
download | gnome-desktop-27ce2df1ef6f8606c082137a2132f4be535572f4.tar.gz |
gnome-rr: Add dpms-mode information in debug
When the DPMS mode changes, print the new value.
-rw-r--r-- | libgnome-desktop/gnome-rr-debug.c | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/libgnome-desktop/gnome-rr-debug.c b/libgnome-desktop/gnome-rr-debug.c index 682e721e..16d841e5 100644 --- a/libgnome-desktop/gnome-rr-debug.c +++ b/libgnome-desktop/gnome-rr-debug.c @@ -25,6 +25,25 @@ #include <gtk/gtk.h> #include <libgnome-desktop/gnome-rr.h> +static const char * +dpms_mode_to_str (GnomeRRDpmsMode mode) +{ + switch (mode) { + case GNOME_RR_DPMS_ON: + return "on"; + case GNOME_RR_DPMS_STANDBY: + return "standby"; + case GNOME_RR_DPMS_SUSPEND: + return "suspend"; + case GNOME_RR_DPMS_OFF: + return "off"; + case GNOME_RR_DPMS_UNKNOWN: + return "unknown"; + default: + g_assert_not_reached (); + } +} + static void print_output (GnomeRROutput *output, const char *message) { @@ -92,6 +111,16 @@ output_connected (GnomeRRScreen *screen, GnomeRROutput *output, gpointer user_da print_output (output, "connected"); } +static void +dpms_mode_changed (GnomeRRScreen *screen, GParamSpec *pspec, gpointer user_data) +{ + GnomeRRDpmsMode mode; + + gnome_rr_screen_get_dpms_mode (screen, &mode, NULL); + g_print ("DPMS mode changed to: %s\n", dpms_mode_to_str (mode)); + g_print ("\n"); +} + /** * main: **/ @@ -117,6 +146,7 @@ main (int argc, char *argv[]) g_signal_connect (screen, "changed", G_CALLBACK (screen_changed), NULL); g_signal_connect (screen, "output-disconnected", G_CALLBACK (output_disconnected), NULL); g_signal_connect (screen, "output-connected", G_CALLBACK (output_connected), NULL); + g_signal_connect (screen, "notify::dpms-mode", G_CALLBACK (dpms_mode_changed), NULL); gtk_main (); |