[gnome-desktop] gnome-rr-labeler: Add ability to show and hide the monitor labels (to make the display properties ca



commit f08da5c0e4b042508a0735bff841361f75463817
Author: Robert Ancell <robert ancell canonical com>
Date:   Mon May 2 15:42:33 2011 +1000

    gnome-rr-labeler: Add ability to show and hide the monitor labels (to make the display properties capplet able to hide them when it loses focus)
    
    https://bugzilla.gnome.org/show_bug.cgi?id=589562

 .../gnome-desktop3/gnome-desktop3-sections.txt     |    1 +
 libgnome-desktop/gnome-rr-labeler.c                |   50 +++++++++++---------
 libgnome-desktop/gnome-rr-labeler.h                |    2 +
 3 files changed, 31 insertions(+), 22 deletions(-)
---
diff --git a/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt b/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt
index 9609529..4e5f156 100644
--- a/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt
+++ b/docs/reference/gnome-desktop3/gnome-desktop3-sections.txt
@@ -87,6 +87,7 @@ GNOME_BG_CROSSFADE_GET_CLASS
 <SECTION>
 <FILE>gnome-rr-labeler</FILE>
 gnome_rr_labeler_new
+gnome_rr_labeler_show
 gnome_rr_labeler_hide
 gnome_rr_labeler_get_color_for_output
 GnomeRRLabeler
diff --git a/libgnome-desktop/gnome-rr-labeler.c b/libgnome-desktop/gnome-rr-labeler.c
index b316864..5e4db1d 100644
--- a/libgnome-desktop/gnome-rr-labeler.c
+++ b/libgnome-desktop/gnome-rr-labeler.c
@@ -60,7 +60,6 @@ enum {
 G_DEFINE_TYPE (GnomeRRLabeler, gnome_rr_labeler, G_TYPE_OBJECT);
 
 static void gnome_rr_labeler_finalize (GObject *object);
-static void create_label_windows (GnomeRRLabeler *labeler);
 static void setup_from_config (GnomeRRLabeler *labeler);
 
 static int
@@ -174,8 +173,10 @@ screen_xevent_filter (GdkXEvent      *xevent,
 	if (xev->type == PropertyNotify &&
 	    xev->xproperty.atom == labeler->priv->workarea_atom) {
 		/* update label positions */
-		gnome_rr_labeler_hide (labeler);
-		create_label_windows (labeler);
+		if (labeler->priv->windows != NULL) {
+			gnome_rr_labeler_hide (labeler);
+			gnome_rr_labeler_show (labeler);
+		}
 	}
 
 	return GDK_FILTER_CONTINUE;
@@ -434,12 +435,35 @@ create_label_window (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColo
 }
 
 static void
-create_label_windows (GnomeRRLabeler *labeler)
+setup_from_config (GnomeRRLabeler *labeler)
+{
+	labeler->priv->num_outputs = count_outputs (labeler->priv->config);
+
+	make_palette (labeler);
+
+	gnome_rr_labeler_show (labeler);
+}
+
+GnomeRRLabeler *
+gnome_rr_labeler_new (GnomeRRConfig *config)
+{
+	g_return_val_if_fail (GNOME_IS_RR_CONFIG (config), NULL);
+
+	return g_object_new (GNOME_TYPE_RR_LABELER, "config", config, NULL);
+}
+
+void
+gnome_rr_labeler_show (GnomeRRLabeler *labeler)
 {
 	int i;
 	gboolean created_window_for_clone;
 	GnomeRROutputInfo **outputs;
 
+	g_return_if_fail (GNOME_IS_RR_LABELER (labeler));
+
+	if (labeler->priv->windows != NULL)
+		return;
+
 	labeler->priv->windows = g_new (GtkWidget *, labeler->priv->num_outputs);
 
 	created_window_for_clone = FALSE;
@@ -457,24 +481,6 @@ create_label_windows (GnomeRRLabeler *labeler)
 	}
 }
 
-static void
-setup_from_config (GnomeRRLabeler *labeler)
-{
-	labeler->priv->num_outputs = count_outputs (labeler->priv->config);
-
-	make_palette (labeler);
-
-	create_label_windows (labeler);
-}
-
-GnomeRRLabeler *
-gnome_rr_labeler_new (GnomeRRConfig *config)
-{
-	g_return_val_if_fail (GNOME_IS_RR_CONFIG (config), NULL);
-
-	return g_object_new (GNOME_TYPE_RR_LABELER, "config", config, NULL);
-}
-
 void
 gnome_rr_labeler_hide (GnomeRRLabeler *labeler)
 {
diff --git a/libgnome-desktop/gnome-rr-labeler.h b/libgnome-desktop/gnome-rr-labeler.h
index 155731c..22ac4f2 100644
--- a/libgnome-desktop/gnome-rr-labeler.h
+++ b/libgnome-desktop/gnome-rr-labeler.h
@@ -58,6 +58,8 @@ GType gnome_rr_labeler_get_type (void);
 
 GnomeRRLabeler *gnome_rr_labeler_new (GnomeRRConfig *config);
 
+void gnome_rr_labeler_show (GnomeRRLabeler *labeler);
+
 void gnome_rr_labeler_hide (GnomeRRLabeler *labeler);
 
 void gnome_rr_labeler_get_color_for_output (GnomeRRLabeler *labeler, GnomeRROutputInfo *output, GdkColor *color_out);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]