[nautilus] background: assume the widget is an IconContainer



commit 5653060d93db2686997faa8f6a10b87659d09c0a
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Sun Oct 10 12:33:21 2010 +0200

    background: assume the widget is an IconContainer

 libnautilus-private/nautilus-desktop-background.c |   19 +++++--------------
 libnautilus-private/nautilus-desktop-background.h |    4 +++-
 libnautilus-private/nautilus-icon-dnd.c           |    2 +-
 src/file-manager/fm-desktop-icon-view.c           |    2 +-
 4 files changed, 10 insertions(+), 17 deletions(-)
---
diff --git a/libnautilus-private/nautilus-desktop-background.c b/libnautilus-private/nautilus-desktop-background.c
index d737f59..b2df4aa 100644
--- a/libnautilus-private/nautilus-desktop-background.c
+++ b/libnautilus-private/nautilus-desktop-background.c
@@ -30,9 +30,9 @@
 
 #include "nautilus-desktop-background.h"
 
-#include <eel/eel-canvas.h>
 #include <eel/eel-gdk-extensions.h>
 #include <eel/eel-gtk-extensions.h>
+
 #include "nautilus-global-preferences.h"
 
 #define GNOME_DESKTOP_USE_UNSTABLE_API
@@ -279,9 +279,7 @@ fade_to_surface (NautilusDesktopBackground *self,
 static void
 nautilus_desktop_background_set_up_widget (NautilusDesktopBackground *self)
 {
-	GtkStyle *style;
 	GdkWindow *window;
-	GdkWindow *widget_window;
 	gboolean in_fade = FALSE;
         GtkWidget *widget;
 
@@ -291,15 +289,8 @@ nautilus_desktop_background_set_up_widget (NautilusDesktopBackground *self)
 		return;
 	}
 
-	widget_window = gtk_widget_get_window (widget);
 	nautilus_desktop_background_ensure_realized (self);
-	style = gtk_widget_get_style (widget);
-
-	if (EEL_IS_CANVAS (widget)) {
-		window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
-	} else {
-		window = widget_window;
-	}
+        window = gtk_layout_get_bin_window (GTK_LAYOUT (widget));
 
 	in_fade = fade_to_surface (self, window,
 				   self->details->background_surface);
@@ -550,7 +541,7 @@ nautilus_desktop_background_class_init (NautilusDesktopBackgroundClass *klass)
 
         pspec = g_param_spec_object ("widget", "The widget for this background",
                                      "The widget that gets its background set",
-                                     GTK_TYPE_WIDGET,
+                                     NAUTILUS_TYPE_ICON_CONTAINER,
                                      G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS);
         g_object_class_install_property (object_class, PROP_WIDGET, pspec);
 
@@ -590,9 +581,9 @@ nautilus_desktop_background_receive_dropped_background_image (NautilusDesktopBac
 }
 
 NautilusDesktopBackground *
-nautilus_desktop_background_new (GtkWidget *widget)
+nautilus_desktop_background_new (NautilusIconContainer *container)
 {
         return g_object_new (NAUTILUS_TYPE_DESKTOP_BACKGROUND,
-                             "widget", widget,
+                             "widget", container,
                              NULL);
 }
diff --git a/libnautilus-private/nautilus-desktop-background.h b/libnautilus-private/nautilus-desktop-background.h
index 69fd35c..8b9926f 100644
--- a/libnautilus-private/nautilus-desktop-background.h
+++ b/libnautilus-private/nautilus-desktop-background.h
@@ -31,6 +31,8 @@
 
 #include <gtk/gtk.h>
 
+#include "nautilus-icon-container.h"
+
 typedef struct NautilusDesktopBackground NautilusDesktopBackground;
 typedef struct NautilusDesktopBackgroundClass NautilusDesktopBackgroundClass;
 
@@ -47,7 +49,7 @@ typedef struct NautilusDesktopBackgroundClass NautilusDesktopBackgroundClass;
   (G_TYPE_INSTANCE_GET_CLASS ((obj), NAUTILUS_TYPE_DESKTOP_BACKGROUND, NautilusDesktopBackgroundClass))
 
 GType nautilus_desktop_background_get_type (void);
-NautilusDesktopBackground * nautilus_desktop_background_new (GtkWidget *widget);
+NautilusDesktopBackground * nautilus_desktop_background_new (NautilusIconContainer *container);
 
 void nautilus_desktop_background_receive_dropped_background_image (NautilusDesktopBackground *self,
 								   const gchar *image_uri);
diff --git a/libnautilus-private/nautilus-icon-dnd.c b/libnautilus-private/nautilus-icon-dnd.c
index 21f90cb..aeb10e9 100644
--- a/libnautilus-private/nautilus-icon-dnd.c
+++ b/libnautilus-private/nautilus-icon-dnd.c
@@ -1069,7 +1069,7 @@ nautilus_icon_container_receive_dropped_icons (NautilusIconContainer *container,
 	if (real_action == (GdkDragAction) NAUTILUS_DND_ACTION_SET_AS_BACKGROUND) {
 		NautilusDesktopBackground *background;
 
-		background = nautilus_desktop_background_new (GTK_WIDGET (container));
+		background = nautilus_desktop_background_new (container);
 		selected_item = container->details->dnd_info->drag_info.selection_list->data;
 
 		nautilus_desktop_background_receive_dropped_background_image (background,
diff --git a/src/file-manager/fm-desktop-icon-view.c b/src/file-manager/fm-desktop-icon-view.c
index e486282..47e5716 100644
--- a/src/file-manager/fm-desktop-icon-view.c
+++ b/src/file-manager/fm-desktop-icon-view.c
@@ -258,7 +258,7 @@ real_begin_loading (FMDirectoryView *object)
 
 	icon_container = get_icon_container (view);
 	if (view->details->background == NULL) {
-		view->details->background = nautilus_desktop_background_new (GTK_WIDGET (icon_container));
+		view->details->background = nautilus_desktop_background_new (icon_container);
 	}
 
 	FM_DIRECTORY_VIEW_CLASS (fm_desktop_icon_view_parent_class)->begin_loading (object);



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