From 5f82ebba474f6c1068a21f51ded2b0e26869ecaf Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 15 Apr 2013 18:44:35 -0400 Subject: [PATCH 1/6] Don't render the background. Need to fix selected icon style --- src/nemo-desktop-icon-view.c | 18 +++--------------- src/nemo-desktop-window.c | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/src/nemo-desktop-icon-view.c b/src/nemo-desktop-icon-view.c index b903c5b..37cd8cb 100644 --- a/src/nemo-desktop-icon-view.c +++ b/src/nemo-desktop-icon-view.c @@ -243,16 +243,6 @@ struct NemoDesktopIconViewDetails static void real_begin_loading (NemoView *object) { - NemoIconContainer *icon_container; - NemoDesktopIconView *view; - - view = NEMO_DESKTOP_ICON_VIEW (object); - - icon_container = get_icon_container (view); - if (view->details->background == NULL) { - view->details->background = nemo_desktop_background_new (icon_container); - } - NEMO_VIEW_CLASS (nemo_desktop_icon_view_parent_class)->begin_loading (object); } @@ -298,11 +288,6 @@ struct NemoDesktopIconViewDetails nemo_view_update_menus, icon_view); - if (icon_view->details->background != NULL) { - g_object_unref (icon_view->details->background); - icon_view->details->background = NULL; - } - G_OBJECT_CLASS (nemo_desktop_icon_view_parent_class)->dispose (object); } @@ -652,6 +637,9 @@ struct NemoDesktopIconViewDetails G_CALLBACK (nemo_view_update_menus), desktop_icon_view); + GdkRGBA transparent = { 0, 0, 0, 0 }; + gtk_widget_override_background_color (GTK_WIDGET (icon_container), GTK_STATE_FLAG_NORMAL, &transparent); + have_cinnamon_settings = g_find_program_in_path ("cinnamon-settings") != NULL; } diff --git a/src/nemo-desktop-window.c b/src/nemo-desktop-window.c index 9c80c62..2d5c4e8 100644 --- a/src/nemo-desktop-window.c +++ b/src/nemo-desktop-window.c @@ -97,6 +97,7 @@ struct NemoDesktopWindowDetails { g_signal_connect_swapped (nemo_preferences, "changed::" NEMO_PREFERENCES_DESKTOP_IS_HOME_DIR, G_CALLBACK (nemo_desktop_window_update_directory), window); + } static void @@ -189,6 +190,12 @@ struct NemoDesktopWindowDetails { /* Chain up to realize our children */ GTK_WIDGET_CLASS (nemo_desktop_window_parent_class)->map (widget); gdk_window_lower (gtk_widget_get_window (widget)); + + GdkWindow *window; + GdkRGBA transparent = { 0, 0, 0, 0 }; + + window = gtk_widget_get_window (widget); + gdk_window_set_background_rgba (window, &transparent); } static void @@ -254,6 +261,7 @@ struct NemoDesktopWindowDetails { { NemoDesktopWindow *window; NemoDesktopWindowDetails *details; + GdkVisual *visual; window = NEMO_DESKTOP_WINDOW (widget); details = window->details; @@ -261,7 +269,12 @@ struct NemoDesktopWindowDetails { /* Make sure we get keyboard events */ gtk_widget_set_events (widget, gtk_widget_get_events (widget) | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK); - + + visual = gdk_screen_get_rgba_visual (gtk_widget_get_screen (widget)); + if (visual) { + gtk_widget_set_visual (widget, visual); + } + /* Do the work of realizing. */ GTK_WIDGET_CLASS (nemo_desktop_window_parent_class)->realize (widget); -- 1.8.1.6 From 6b013acb8f0ad855d042d0e8d51350c539a37c21 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 15 Apr 2013 20:03:03 -0400 Subject: [PATCH 2/6] Remove nemo-desktop-background, the desktop window makes a transparent background and just uses the existing rendered background from muffin/g-s-d --- libnemo-private/Makefile.am | 2 - libnemo-private/nemo-desktop-background.c | 578 ------------------------------ libnemo-private/nemo-desktop-background.h | 65 ---- src/nemo-desktop-icon-view.c | 26 +- 4 files changed, 13 insertions(+), 658 deletions(-) delete mode 100644 libnemo-private/nemo-desktop-background.c delete mode 100644 libnemo-private/nemo-desktop-background.h diff --git a/libnemo-private/Makefile.am b/libnemo-private/Makefile.am index 3b46318..5fd797c 100644 --- a/libnemo-private/Makefile.am +++ b/libnemo-private/Makefile.am @@ -81,8 +81,6 @@ libnemo_private_la_SOURCES = \ nemo-debug.h \ nemo-default-file-icon.c \ nemo-default-file-icon.h \ - nemo-desktop-background.c \ - nemo-desktop-background.h \ nemo-desktop-directory-file.c \ nemo-desktop-directory-file.h \ nemo-desktop-directory.c \ diff --git a/libnemo-private/nemo-desktop-background.c b/libnemo-private/nemo-desktop-background.c deleted file mode 100644 index f8dc979..0000000 --- a/libnemo-private/nemo-desktop-background.c +++ /dev/null @@ -1,578 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* - * nemo-desktop-background.c: Helper object to handle desktop background - * changes. - * - * Copyright (C) 2000 Eazel, Inc. - * Copyright (C) 2010 Cosimo Cecchi - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street - Suite 500, - * Boston, MA 02110-1335, USA. - * - * Authors: Darin Adler - * Cosimo Cecchi - */ - -#include - -#include "nemo-desktop-background.h" - -#include -#include - -#include "nemo-global-preferences.h" - -#define GNOME_DESKTOP_USE_UNSTABLE_API -#include -#include - -#include -#include - -static void init_fade (NemoDesktopBackground *self); -static void free_fade (NemoDesktopBackground *self); -static void queue_background_change (NemoDesktopBackground *self); - -static NemoDesktopBackground *singleton = NULL; - -G_DEFINE_TYPE (NemoDesktopBackground, nemo_desktop_background, G_TYPE_OBJECT); - -enum { - PROP_WIDGET = 1, - NUM_PROPERTIES, -}; - -struct NemoDesktopBackgroundDetails { - - GtkWidget *widget; - GnomeBG *bg; - - /* Realized data: */ - cairo_surface_t *background_surface; - GnomeBGCrossfade *fade; - int background_entire_width; - int background_entire_height; - GdkColor default_color; - - /* Desktop screen size watcher */ - gulong screen_size_handler; - /* Desktop monitors configuration watcher */ - gulong screen_monitors_handler; - guint change_idle_id; -}; - - -static gboolean -background_settings_change_event_cb (GSettings *settings, - gpointer keys, - gint n_keys, - gpointer user_data); - - -static void -free_fade (NemoDesktopBackground *self) -{ - if (self->details->fade != NULL) { - g_object_unref (self->details->fade); - self->details->fade = NULL; - } -} - -static void -free_background_surface (NemoDesktopBackground *self) -{ - cairo_surface_t *surface; - - surface = self->details->background_surface; - if (surface != NULL) { - cairo_surface_destroy (surface); - self->details->background_surface = NULL; - } -} - -static void -nemo_desktop_background_finalize (GObject *object) -{ - NemoDesktopBackground *self; - - self = NEMO_DESKTOP_BACKGROUND (object); - - g_signal_handlers_disconnect_by_func (gnome_background_preferences, - background_settings_change_event_cb, - self); - - free_background_surface (self); - free_fade (self); - - g_clear_object (&self->details->bg); - - G_OBJECT_CLASS (nemo_desktop_background_parent_class)->finalize (object); -} - -static void -nemo_desktop_background_unrealize (NemoDesktopBackground *self) -{ - free_background_surface (self); - - self->details->background_entire_width = 0; - self->details->background_entire_height = 0; - self->details->default_color.red = 0xffff; - self->details->default_color.green = 0xffff; - self->details->default_color.blue = 0xffff; -} - -static void -nemo_desktop_background_set_image_uri (NemoDesktopBackground *self, - const char *image_uri) -{ - char *filename; - - if (image_uri != NULL) { - filename = g_filename_from_uri (image_uri, NULL, NULL); - } - else { - filename = NULL; - } - - gnome_bg_set_filename (self->details->bg, filename); - - g_free (filename); -} - -static void -init_fade (NemoDesktopBackground *self) -{ - GtkWidget *widget; - gboolean do_fade; - - widget = self->details->widget; - - if (widget == NULL || !gtk_widget_get_realized (widget)) - return; - - do_fade = g_settings_get_boolean (nemo_desktop_preferences, - NEMO_PREFERENCES_DESKTOP_BACKGROUND_FADE); - - if (!do_fade) { - return; - } - - if (self->details->fade == NULL) { - GdkWindow *window; - GdkScreen *screen; - int old_width, old_height, width, height; - - /* If this was the result of a screen size change, - * we don't want to crossfade - */ - window = gtk_widget_get_window (widget); - old_width = gdk_window_get_width (window); - old_height = gdk_window_get_height (window); - - screen = gtk_widget_get_screen (widget); - width = gdk_screen_get_width (screen); - height = gdk_screen_get_height (screen); - - if (old_width == width && old_height == height) { - self->details->fade = gnome_bg_crossfade_new (width, height); - g_signal_connect_swapped (self->details->fade, - "finished", - G_CALLBACK (free_fade), - self); - } - } - - if (self->details->fade != NULL && !gnome_bg_crossfade_is_started (self->details->fade)) { - cairo_surface_t *start_surface; - - if (self->details->background_surface == NULL) { - start_surface = gnome_bg_get_surface_from_root (gtk_widget_get_screen (widget)); - } else { - start_surface = cairo_surface_reference (self->details->background_surface); - } - gnome_bg_crossfade_set_start_surface (self->details->fade, - start_surface); - cairo_surface_destroy (start_surface); - } -} - -static void -screen_size_changed (GdkScreen *screen, - NemoDesktopBackground *self) -{ - queue_background_change (self); -} - -static gboolean -nemo_desktop_background_ensure_realized (NemoDesktopBackground *self) -{ - int entire_width; - int entire_height; - GdkScreen *screen; - GdkWindow *window; - - screen = gtk_widget_get_screen (self->details->widget); - entire_height = gdk_screen_get_height (screen); - entire_width = gdk_screen_get_width (screen); - - /* If the window size is the same as last time, don't update */ - if (entire_width == self->details->background_entire_width && - entire_height == self->details->background_entire_height) { - return FALSE; - } - - free_background_surface (self); - - window = gtk_widget_get_window (self->details->widget); - self->details->background_surface = gnome_bg_create_surface (self->details->bg, - window, - entire_width, entire_height, - TRUE); - - /* We got the surface and everything, so we don't care about a change - that is pending (unless things actually change after this time) */ - g_object_set_data (G_OBJECT (self), - "ignore-pending-change", GINT_TO_POINTER (TRUE)); - - self->details->background_entire_width = entire_width; - self->details->background_entire_height = entire_height; - - return TRUE; -} - -static void -on_fade_finished (GnomeBGCrossfade *fade, - GdkWindow *window, - gpointer user_data) -{ - NemoDesktopBackground *self = user_data; - - nemo_desktop_background_ensure_realized (self); - gnome_bg_set_surface_as_root (gdk_window_get_screen (window), - self->details->background_surface); -} - -static gboolean -fade_to_surface (NemoDesktopBackground *self, - GdkWindow *window, - cairo_surface_t *surface) -{ - if (self->details->fade == NULL) { - return FALSE; - } - - if (!gnome_bg_crossfade_set_end_surface (self->details->fade, - surface)) { - return FALSE; - } - - if (!gnome_bg_crossfade_is_started (self->details->fade)) { - gnome_bg_crossfade_start (self->details->fade, window); - g_signal_connect (self->details->fade, - "finished", - G_CALLBACK (on_fade_finished), self); - } - - return gnome_bg_crossfade_is_started (self->details->fade); -} - -static void -nemo_desktop_background_set_up_widget (NemoDesktopBackground *self) -{ - GdkWindow *window; - gboolean in_fade = FALSE; - GtkWidget *widget; - - widget = self->details->widget; - - if (!gtk_widget_get_realized (widget)) { - return; - } - - nemo_desktop_background_ensure_realized (self); - window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); - - in_fade = fade_to_surface (self, window, - self->details->background_surface); - - if (!in_fade) { - cairo_pattern_t *pattern; - - pattern = cairo_pattern_create_for_surface (self->details->background_surface); - gdk_window_set_background_pattern (window, pattern); - cairo_pattern_destroy (pattern); - - gnome_bg_set_surface_as_root (gtk_widget_get_screen (widget), - self->details->background_surface); - } -} - -static gboolean -background_changed_cb (NemoDesktopBackground *self) -{ - self->details->change_idle_id = 0; - - nemo_desktop_background_unrealize (self); - nemo_desktop_background_set_up_widget (self); - - gtk_widget_queue_draw (self->details->widget); - - return FALSE; -} - -static void -queue_background_change (NemoDesktopBackground *self) -{ - if (self->details->change_idle_id != 0) { - g_source_remove (self->details->change_idle_id); - } - - self->details->change_idle_id = - g_idle_add ((GSourceFunc) background_changed_cb, self); -} - -static void -nemo_desktop_background_changed (GnomeBG *bg, - gpointer user_data) -{ - NemoDesktopBackground *self; - - self = user_data; - init_fade (self); - queue_background_change (self); -} - -static void -nemo_desktop_background_transitioned (GnomeBG *bg, - gpointer user_data) -{ - NemoDesktopBackground *self; - - self = user_data; - free_fade (self); - queue_background_change (self); -} - -static void -widget_realize_cb (GtkWidget *widget, - gpointer user_data) -{ - GdkScreen *screen; - NemoDesktopBackground *self = user_data; - - screen = gtk_widget_get_screen (widget); - - if (self->details->screen_size_handler > 0) { - g_signal_handler_disconnect (screen, - self->details->screen_size_handler); - } - self->details->screen_size_handler = - g_signal_connect (screen, "size_changed", - G_CALLBACK (screen_size_changed), self); - - if (self->details->screen_monitors_handler > 0) { - g_signal_handler_disconnect (screen, - self->details->screen_monitors_handler); - } - self->details->screen_monitors_handler = - g_signal_connect (screen, "monitors-changed", - G_CALLBACK (screen_size_changed), self); - nemo_desktop_background_set_up_widget (self); -} - -static void -widget_unrealize_cb (GtkWidget *widget, - gpointer user_data) -{ - NemoDesktopBackground *self = user_data; - - if (self->details->screen_size_handler > 0) { - g_signal_handler_disconnect (gtk_widget_get_screen (GTK_WIDGET (widget)), - self->details->screen_size_handler); - self->details->screen_size_handler = 0; - } - if (self->details->screen_monitors_handler > 0) { - g_signal_handler_disconnect (gtk_widget_get_screen (GTK_WIDGET (widget)), - self->details->screen_monitors_handler); - self->details->screen_monitors_handler = 0; - } -} - -static void -on_widget_destroyed (GtkWidget *widget, - gpointer user_data) -{ - NemoDesktopBackground *self = user_data; - - if (self->details->change_idle_id != 0) { - g_source_remove (self->details->change_idle_id); - self->details->change_idle_id = 0; - } - - free_fade (self); - self->details->widget = NULL; -} - -static gboolean -background_change_event_idle_cb (NemoDesktopBackground *self) -{ - gnome_bg_load_from_preferences (self->details->bg, - gnome_background_preferences); - - g_object_unref (self); - - return FALSE; -} - -static gboolean -background_settings_change_event_cb (GSettings *settings, - gpointer keys, - gint n_keys, - gpointer user_data) -{ - NemoDesktopBackground *self = user_data; - - /* Need to defer signal processing otherwise - * we would make the dconf backend deadlock. - */ - g_idle_add ((GSourceFunc) background_change_event_idle_cb, - g_object_ref (self)); - - return FALSE; -} - -static void -nemo_desktop_background_constructed (GObject *obj) -{ - NemoDesktopBackground *self; - GtkWidget *widget; - - self = NEMO_DESKTOP_BACKGROUND (obj); - - if (G_OBJECT_CLASS (nemo_desktop_background_parent_class)->constructed != NULL) { - G_OBJECT_CLASS (nemo_desktop_background_parent_class)->constructed (obj); - } - - widget = self->details->widget; - - g_assert (widget != NULL); - - g_signal_connect_object (widget, "destroy", - G_CALLBACK (on_widget_destroyed), self, 0); - g_signal_connect_object (widget, "realize", - G_CALLBACK (widget_realize_cb), self, 0); - g_signal_connect_object (widget, "unrealize", - G_CALLBACK (widget_unrealize_cb), self, 0); - - gnome_bg_load_from_preferences (self->details->bg, - gnome_background_preferences); - - /* Let's receive batch change events instead of every single one */ - g_signal_connect (gnome_background_preferences, - "change-event", - G_CALLBACK (background_settings_change_event_cb), - self); - - queue_background_change (self); -} - -static void -nemo_desktop_background_set_property (GObject *object, - guint property_id, - const GValue *value, - GParamSpec *pspec) -{ - NemoDesktopBackground *self; - - self = NEMO_DESKTOP_BACKGROUND (object); - - switch (property_id) { - case PROP_WIDGET: - self->details->widget = g_value_get_object (value); - break; - default: - G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); - break; - } -} - -static GObject * -nemo_desktop_background_constructor (GType type, - guint n_construct_params, - GObjectConstructParam *construct_params) -{ - GObject *retval; - - if (singleton != NULL) { - return g_object_ref (singleton); - } - - retval = G_OBJECT_CLASS (nemo_desktop_background_parent_class)->constructor - (type, n_construct_params, construct_params); - - singleton = NEMO_DESKTOP_BACKGROUND (retval); - g_object_add_weak_pointer (retval, (gpointer) &singleton); - - return retval; -} - -static void -nemo_desktop_background_class_init (NemoDesktopBackgroundClass *klass) -{ - GObjectClass *object_class; - GParamSpec *pspec; - - object_class = G_OBJECT_CLASS (klass); - object_class->finalize = nemo_desktop_background_finalize; - object_class->set_property = nemo_desktop_background_set_property; - object_class->constructor = nemo_desktop_background_constructor; - object_class->constructed = nemo_desktop_background_constructed; - - pspec = g_param_spec_object ("widget", "The widget for this background", - "The widget that gets its background set", - NEMO_TYPE_ICON_CONTAINER, - G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS); - g_object_class_install_property (object_class, PROP_WIDGET, pspec); - - g_type_class_add_private (klass, sizeof (NemoDesktopBackgroundDetails)); -} - -static void -nemo_desktop_background_init (NemoDesktopBackground *self) -{ - self->details = - G_TYPE_INSTANCE_GET_PRIVATE (self, - NEMO_TYPE_DESKTOP_BACKGROUND, - NemoDesktopBackgroundDetails); - - self->details->bg = gnome_bg_new (); - self->details->default_color.red = 0xffff; - self->details->default_color.green = 0xffff; - self->details->default_color.blue = 0xffff; - - g_signal_connect (self->details->bg, "changed", - G_CALLBACK (nemo_desktop_background_changed), self); - g_signal_connect (self->details->bg, "transitioned", - G_CALLBACK (nemo_desktop_background_transitioned), self); -} - -NemoDesktopBackground * -nemo_desktop_background_new (NemoIconContainer *container) -{ - return g_object_new (NEMO_TYPE_DESKTOP_BACKGROUND, - "widget", container, - NULL); -} diff --git a/libnemo-private/nemo-desktop-background.h b/libnemo-private/nemo-desktop-background.h deleted file mode 100644 index 8755cb1..0000000 --- a/libnemo-private/nemo-desktop-background.h +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ - -/* - * nemo-desktop-background.c: Helper object to handle desktop background - * changes. - * - * Copyright (C) 2000 Eazel, Inc. - * Copyright (C) 2010 Cosimo Cecchi - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., 51 Franklin Street - Suite 500, - * Boston, MA 02110-1335, USA. - * - * Authors: Darin Adler - * Cosimo Cecchi - */ - -#ifndef __NAUTILIUS_DESKTOP_BACKGROUND_H__ -#define __NAUTILIUS_DESKTOP_BACKGROUND_H__ - -#include - -#include "nemo-icon-container.h" - -typedef struct NemoDesktopBackground NemoDesktopBackground; -typedef struct NemoDesktopBackgroundClass NemoDesktopBackgroundClass; - -#define NEMO_TYPE_DESKTOP_BACKGROUND nemo_desktop_background_get_type() -#define NEMO_DESKTOP_BACKGROUND(obj) \ - (G_TYPE_CHECK_INSTANCE_CAST ((obj), NEMO_TYPE_DESKTOP_BACKGROUND, NemoDesktopBackground)) -#define NEMO_DESKTOP_BACKGROUND_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_CAST ((klass), NEMO_TYPE_DESKTOP_BACKGROUND, NemoDesktopBackgroundClass)) -#define NEMO_IS_DESKTOP_BACKGROUND(obj) \ - (G_TYPE_CHECK_INSTANCE_TYPE ((obj), NEMO_TYPE_DESKTOP_BACKGROUND)) -#define NEMO_IS_DESKTOP_BACKGROUND_CLASS(klass) \ - (G_TYPE_CHECK_CLASS_TYPE ((klass), NEMO_TYPE_DESKTOP_BACKGROUND)) -#define NEMO_DESKTOP_BACKGROUND_GET_CLASS(obj) \ - (G_TYPE_INSTANCE_GET_CLASS ((obj), NEMO_TYPE_DESKTOP_BACKGROUND, NemoDesktopBackgroundClass)) - -GType nemo_desktop_background_get_type (void); -NemoDesktopBackground * nemo_desktop_background_new (NemoIconContainer *container); - -typedef struct NemoDesktopBackgroundDetails NemoDesktopBackgroundDetails; - -struct NemoDesktopBackground { - GObject parent; - NemoDesktopBackgroundDetails *details; -}; - -struct NemoDesktopBackgroundClass { - GObjectClass parent_class; -}; - -#endif /* __NAUTILIUS_DESKTOP_BACKGROUND_H__ */ diff --git a/src/nemo-desktop-icon-view.c b/src/nemo-desktop-icon-view.c index 37cd8cb..5dec8b5 100644 --- a/src/nemo-desktop-icon-view.c +++ b/src/nemo-desktop-icon-view.c @@ -41,7 +41,6 @@ #include #include #include -#include #include #include #include @@ -76,8 +75,6 @@ struct NemoDesktopIconViewDetails gulong delayed_init_signal; guint reload_desktop_timeout; gboolean pending_rescan; - - NemoDesktopBackground *background; }; static void default_zoom_level_changed (gpointer user_data); @@ -240,12 +237,6 @@ struct NemoDesktopIconViewDetails return GDK_FILTER_CONTINUE; } -static void -real_begin_loading (NemoView *object) -{ - NEMO_VIEW_CLASS (nemo_desktop_icon_view_parent_class)->begin_loading (object); -} - static const char * real_get_id (NemoView *view) { @@ -300,7 +291,6 @@ struct NemoDesktopIconViewDetails G_OBJECT_CLASS (class)->dispose = nemo_desktop_icon_view_dispose; - vclass->begin_loading = real_begin_loading; vclass->merge_menus = real_merge_menus; vclass->update_menus = real_update_menus; vclass->get_view_id = real_get_id; @@ -428,6 +418,17 @@ struct NemoDesktopIconViewDetails desktop_icon_view); } +static void +desktop_icon_container_realize (GtkWidget *widget, + NemoDesktopIconView *desktop_icon_view) +{ + GdkWindow *bin_window; + GdkRGBA transparent = { 0, 0, 0, 0 }; + + bin_window = gtk_layout_get_bin_window (GTK_LAYOUT (widget)); + gdk_window_set_background_rgba (bin_window, &transparent); +} + static NemoZoomLevel get_default_zoom_level (void) { @@ -614,6 +615,8 @@ struct NemoDesktopIconViewDetails g_signal_connect_object (icon_container, "middle_click", G_CALLBACK (nemo_desktop_icon_view_handle_middle_click), desktop_icon_view, 0); + g_signal_connect_object (icon_container, "realize", + G_CALLBACK (desktop_icon_container_realize), desktop_icon_view, 0); g_signal_connect_object (desktop_icon_view, "realize", G_CALLBACK (realized_callback), desktop_icon_view, 0); g_signal_connect_object (desktop_icon_view, "unrealize", @@ -637,9 +640,6 @@ struct NemoDesktopIconViewDetails G_CALLBACK (nemo_view_update_menus), desktop_icon_view); - GdkRGBA transparent = { 0, 0, 0, 0 }; - gtk_widget_override_background_color (GTK_WIDGET (icon_container), GTK_STATE_FLAG_NORMAL, &transparent); - have_cinnamon_settings = g_find_program_in_path ("cinnamon-settings") != NULL; } -- 1.8.1.6 From b40990397b6fff55878481a806a1b5574e43951f Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 15 Apr 2013 20:14:40 -0400 Subject: [PATCH 3/6] Forgot an include --- libnemo-private/nemo-icon-dnd.c | 1 - 1 file changed, 1 deletion(-) diff --git a/libnemo-private/nemo-icon-dnd.c b/libnemo-private/nemo-icon-dnd.c index 017c6a7..2ed073c 100644 --- a/libnemo-private/nemo-icon-dnd.c +++ b/libnemo-private/nemo-icon-dnd.c @@ -52,7 +52,6 @@ #include #include -#include #include #include #include -- 1.8.1.6 From 020d4dc15fa9c0e1303cef7795e45e688ede7726 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Tue, 16 Apr 2013 18:00:01 -0400 Subject: [PATCH 4/6] Change to use cinnamon background keys --- libnemo-private/nemo-global-preferences.c | 2 +- libnemo-private/nemo-global-preferences.h | 2 +- src/nemo-places-sidebar.c | 2 +- src/nemo-view.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libnemo-private/nemo-global-preferences.c b/libnemo-private/nemo-global-preferences.c index d3ad20a..336afc3 100644 --- a/libnemo-private/nemo-global-preferences.c +++ b/libnemo-private/nemo-global-preferences.c @@ -76,7 +76,7 @@ nemo_desktop_preferences = g_settings_new("org.nemo.desktop"); nemo_tree_sidebar_preferences = g_settings_new("org.nemo.sidebar-panels.tree"); gnome_lockdown_preferences = g_settings_new("org.gnome.desktop.lockdown"); - gnome_background_preferences = g_settings_new("org.gnome.desktop.background"); + cinnamon_background_preferences = g_settings_new("org.cinnamon.background"); gnome_media_handling_preferences = g_settings_new("org.gnome.desktop.media-handling"); gnome_terminal_preferences = g_settings_new("org.gnome.desktop.default-applications.terminal"); } diff --git a/libnemo-private/nemo-global-preferences.h b/libnemo-private/nemo-global-preferences.h index 2b9c56a..c1ec61a 100644 --- a/libnemo-private/nemo-global-preferences.h +++ b/libnemo-private/nemo-global-preferences.h @@ -226,7 +226,7 @@ enum GSettings *nemo_tree_sidebar_preferences; GSettings *nemo_window_state; GSettings *gnome_lockdown_preferences; -GSettings *gnome_background_preferences; +GSettings *cinnamon_background_preferences; GSettings *gnome_media_handling_preferences; GSettings *gnome_terminal_preferences; diff --git a/src/nemo-places-sidebar.c b/src/nemo-places-sidebar.c index a0bc4d4..ca32193 100644 --- a/src/nemo-places-sidebar.c +++ b/src/nemo-places-sidebar.c @@ -3825,7 +3825,7 @@ static void expand_or_collapse_category (NemoPlacesSidebar *sidebar, bookmarks_popup_menu_detach_cb, sidebar); - g_signal_handlers_disconnect_by_func (gnome_background_preferences, + g_signal_handlers_disconnect_by_func (cinnamon_background_preferences, desktop_setting_changed_callback, sidebar); diff --git a/src/nemo-view.c b/src/nemo-view.c index ab03b44..3ece32a 100644 --- a/src/nemo-view.c +++ b/src/nemo-view.c @@ -6945,7 +6945,7 @@ static void slot_changed_pane (NemoWindowSlot *slot, uri = nemo_file_info_get_uri (file); - g_settings_set_string (gnome_background_preferences, + g_settings_set_string (cinnamon_background_preferences, "picture-uri", uri); g_free (uri); } -- 1.8.1.6 From f487954ebce3f564744e9c83b5dd40fa8f8fad6d Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 22 Apr 2013 08:33:41 -0400 Subject: [PATCH 5/6] Fall back to org.gnome.desktop.background schema when cinnamon is not installed --- libnemo-private/nemo-global-preferences.c | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/libnemo-private/nemo-global-preferences.c b/libnemo-private/nemo-global-preferences.c index 336afc3..7eb04ef 100644 --- a/libnemo-private/nemo-global-preferences.c +++ b/libnemo-private/nemo-global-preferences.c @@ -76,7 +76,25 @@ nemo_desktop_preferences = g_settings_new("org.nemo.desktop"); nemo_tree_sidebar_preferences = g_settings_new("org.nemo.sidebar-panels.tree"); gnome_lockdown_preferences = g_settings_new("org.gnome.desktop.lockdown"); - cinnamon_background_preferences = g_settings_new("org.cinnamon.background"); gnome_media_handling_preferences = g_settings_new("org.gnome.desktop.media-handling"); gnome_terminal_preferences = g_settings_new("org.gnome.desktop.default-applications.terminal"); + + const gchar * const *schema_list = g_settings_list_schemas (); + int i = 0; + gboolean has_cinnamon = FALSE; + if (schema_list != NULL) { + while (schema_list[i] != NULL) { + if (g_strcmp0 (schema_list[i], "org.cinnamon.background") == 0) { + has_cinnamon = TRUE; + break; + } + i++; + } + } + + if (has_cinnamon) { + cinnamon_background_preferences = g_settings_new ("org.cinnamon.background"); + } else { + cinnamon_background_preferences = g_settings_new ("org.gnome.desktop.background"); + } } -- 1.8.1.6 From 9739a1b30603868ea6b8b12cf7aeb167be5aea22 Mon Sep 17 00:00:00 2001 From: Michael Webster Date: Mon, 22 Apr 2013 09:31:49 -0400 Subject: [PATCH 6/6] simplify schema check --- libnemo-private/nemo-global-preferences.c | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/libnemo-private/nemo-global-preferences.c b/libnemo-private/nemo-global-preferences.c index 7eb04ef..0470595 100644 --- a/libnemo-private/nemo-global-preferences.c +++ b/libnemo-private/nemo-global-preferences.c @@ -79,20 +79,9 @@ gnome_media_handling_preferences = g_settings_new("org.gnome.desktop.media-handling"); gnome_terminal_preferences = g_settings_new("org.gnome.desktop.default-applications.terminal"); - const gchar * const *schema_list = g_settings_list_schemas (); - int i = 0; - gboolean has_cinnamon = FALSE; - if (schema_list != NULL) { - while (schema_list[i] != NULL) { - if (g_strcmp0 (schema_list[i], "org.cinnamon.background") == 0) { - has_cinnamon = TRUE; - break; - } - i++; - } - } - - if (has_cinnamon) { + GSettingsSchemaSource *schema_source; + schema_source = g_settings_schema_source_get_default(); + if (g_settings_schema_source_lookup (schema_source, "org.cinnamon.background", FALSE)) { cinnamon_background_preferences = g_settings_new ("org.cinnamon.background"); } else { cinnamon_background_preferences = g_settings_new ("org.gnome.desktop.background"); -- 1.8.1.6