eel r2117 - in trunk: . eel



Author: ssp
Date: Mon Jun  2 00:25:01 2008
New Revision: 2117
URL: http://svn.gnome.org/viewvc/eel?rev=2117&view=rev

Log:
Sun Jun  1 20:24:12 2008  SÃren Sandmann  <sandmann redhat com>

	* eel/eel-background.c (struct EelBackgroundDetails): Don't store
	an EelBackgroundPlacement; instead compute it from the GnomeBG.



Modified:
   trunk/ChangeLog
   trunk/eel/eel-background.c

Modified: trunk/eel/eel-background.c
==============================================================================
--- trunk/eel/eel-background.c	(original)
+++ trunk/eel/eel-background.c	Mon Jun  2 00:25:01 2008
@@ -82,7 +82,6 @@
 	time_t image_mtime;
 	GFileMonitor *image_file_monitor;
 	GnomeBG *bg;
-	EelBackgroundImagePlacement image_placement;
 
 	/* Realized data: */
 	gboolean background_changes_with_size;
@@ -206,12 +205,50 @@
 	EEL_CALL_PARENT (G_OBJECT_CLASS, finalize, (object));
 }
 
+static EelBackgroundImagePlacement
+placement_gnome_to_eel (GnomeBGPlacement p)
+{
+	switch (p) {
+	case GNOME_BG_PLACEMENT_CENTERED:
+		return EEL_BACKGROUND_CENTERED;
+	case GNOME_BG_PLACEMENT_FILL_SCREEN:
+		return EEL_BACKGROUND_SCALED;
+	case GNOME_BG_PLACEMENT_SCALED:
+		return EEL_BACKGROUND_SCALED_ASPECT;
+	case GNOME_BG_PLACEMENT_ZOOMED:
+		return EEL_BACKGROUND_ZOOM;
+	case GNOME_BG_PLACEMENT_TILED:
+		return EEL_BACKGROUND_TILED;
+	}
+
+	return EEL_BACKGROUND_TILED;
+}
+
+static GnomeBGPlacement
+placement_eel_to_gnome (EelBackgroundImagePlacement p)
+{
+	switch (p) {
+	case EEL_BACKGROUND_CENTERED:
+		return GNOME_BG_PLACEMENT_CENTERED;
+	case EEL_BACKGROUND_SCALED:
+		return GNOME_BG_PLACEMENT_FILL_SCREEN;
+	case EEL_BACKGROUND_SCALED_ASPECT:
+		return GNOME_BG_PLACEMENT_SCALED;
+	case EEL_BACKGROUND_ZOOM:
+		return GNOME_BG_PLACEMENT_ZOOMED;
+	case EEL_BACKGROUND_TILED:
+		return GNOME_BG_PLACEMENT_TILED;
+	}
+
+	return GNOME_BG_PLACEMENT_TILED;
+}
+
 EelBackgroundImagePlacement
 eel_background_get_image_placement (EelBackground *background)
 {
 	g_return_val_if_fail (EEL_IS_BACKGROUND (background), EEL_BACKGROUND_TILED);
 
-	return background->details->image_placement;
+	return placement_gnome_to_eel (gnome_bg_get_placement (background->details->bg));
 }
 
 void
@@ -220,11 +257,8 @@
 {
 	g_return_if_fail (EEL_IS_BACKGROUND (background));
 
-	if (new_placement != background->details->image_placement) {
-		background->details->image_placement = new_placement;
-
-		set_image_properties (background);
-	}
+	gnome_bg_set_placement (background->details->bg,
+				placement_eel_to_gnome (new_placement));
 }
 
 EelBackground *
@@ -437,8 +471,6 @@
 static void
 set_image_properties (EelBackground *background)
 {
-	GnomeBGPlacement placement;
-
 	if (!background->details->color) {
 		gnome_bg_set_color (background->details->bg, GNOME_BG_COLOR_SOLID,
 				 &background->details->default_color, NULL);
@@ -467,29 +499,6 @@
 			gnome_bg_set_color (background->details->bg, GNOME_BG_COLOR_V_GRADIENT, &c1, &c2);
 
 	}
-
-	switch (background->details->image_placement) {
-	case EEL_BACKGROUND_CENTERED:
-		placement = GNOME_BG_PLACEMENT_CENTERED;
-		break;
-	case EEL_BACKGROUND_SCALED:
-		placement = GNOME_BG_PLACEMENT_FILL_SCREEN;
-		break;
-	case EEL_BACKGROUND_SCALED_ASPECT:
-		placement = GNOME_BG_PLACEMENT_SCALED;
-		break;
-	case EEL_BACKGROUND_ZOOM:
-		placement = GNOME_BG_PLACEMENT_ZOOMED;
-		break;
-	case EEL_BACKGROUND_TILED:
-		placement = GNOME_BG_PLACEMENT_TILED;
-		break;
-	default:
-		placement = GNOME_BG_PLACEMENT_TILED;
-		break;
-	}
-	
-	gnome_bg_set_placement (background->details->bg, placement);
 }
 
 char *



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