Fix various background drawing issues

This commit is contained in:
Dan Williams 2010-12-01 12:17:17 -06:00
parent 0de820a1cc
commit d8cf270284
3 changed files with 220 additions and 4 deletions

View File

@ -0,0 +1,167 @@
commit 6cf4514d7813835040484065f93d55abdfc91087
Author: Dan Williams <dcbw@redhat.com>
Date: Wed Dec 1 11:32:17 2010 -0600
background: convert to GDBus (and fix delayed background drawing)
For some reason the signal filter with plain DBus wasn't working
correctly, leading to no background when nautilus was for whatever
reason not autolaunched, and show-desktop-icons was TRUE. In any
case it should be GDBus not libdbus, so port it. That also
happens to fix the signal listening issue.
https://bugzilla.gnome.org/show_bug.cgi?id=636233
diff --git a/plugins/background/gsd-background-manager.c b/plugins/background/gsd-background-manager.c
index 30370fa..071eb85 100644
--- a/plugins/background/gsd-background-manager.c
+++ b/plugins/background/gsd-background-manager.c
@@ -32,10 +32,9 @@
#include <locale.h>
-#include <dbus/dbus.h>
-
#include <glib.h>
#include <glib/gi18n.h>
+#include <gio/gio.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
@@ -54,7 +53,8 @@ struct GsdBackgroundManagerPrivate
GnomeBG *bg;
guint timeout_id;
- DBusConnection *dbus_connection;
+ GDBusProxy *proxy;
+ guint proxy_signal_id;
};
static void gsd_background_manager_class_init (GsdBackgroundManagerClass *klass);
@@ -287,53 +287,77 @@ queue_draw_background (GsdBackgroundManager *manager)
return FALSE;
}
-static DBusHandlerResult
-on_bus_message (DBusConnection *connection,
- DBusMessage *message,
- void *user_data)
+static void
+queue_timeout (GsdBackgroundManager *manager)
{
- GsdBackgroundManager *manager = user_data;
-
- if (dbus_message_is_signal (message,
- "org.gnome.SessionManager",
- "SessionRunning")) {
- /* If the session finishes then check if nautilus is
- * running and if not, set the background.
- *
- * We wait a few seconds after the session is up
- * because nautilus tells the session manager that its
- * ready before it sets the background.
- */
- manager->priv->timeout_id = g_timeout_add_seconds (8,
- (GSourceFunc)
- queue_draw_background,
- manager);
- dbus_connection_remove_filter (connection,
- on_bus_message,
- manager);
-
- manager->priv->dbus_connection = NULL;
- }
+ if (manager->priv->timeout_id > 0)
+ return;
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+ /* If the session finishes then check if nautilus is
+ * running and if not, set the background.
+ *
+ * We wait a few seconds after the session is up
+ * because nautilus tells the session manager that its
+ * ready before it sets the background.
+ */
+ manager->priv->timeout_id = g_timeout_add_seconds (8,
+ (GSourceFunc)
+ queue_draw_background,
+ manager);
}
static void
-draw_background_after_session_loads (GsdBackgroundManager *manager)
+disconnect_session_manager_listener (GsdBackgroundManager *manager)
{
- DBusConnection *connection;
+ if (manager->priv->proxy && manager->priv->proxy_signal_id) {
+ g_signal_handler_disconnect (manager->priv->proxy,
+ manager->priv->proxy_signal_id);
+ manager->priv->proxy_signal_id = 0;
+ }
+}
- connection = dbus_bus_get (DBUS_BUS_SESSION, NULL);
+static void
+on_session_manager_signal (GDBusProxy *proxy,
+ const gchar *sender_name,
+ const gchar *signal_name,
+ GVariant *parameters,
+ gpointer user_data)
+{
+ GsdBackgroundManager *manager = GSD_BACKGROUND_MANAGER (user_data);
- if (connection == NULL) {
- return;
+ if (g_strcmp0 (signal_name, "SessionRunning") == 0) {
+ queue_timeout (manager);
+ disconnect_session_manager_listener (manager);
}
+}
- if (!dbus_connection_add_filter (connection, on_bus_message, manager, NULL)) {
+static void
+draw_background_after_session_loads (GsdBackgroundManager *manager)
+{
+ GError *error = NULL;
+ GDBusProxyFlags flags;
+
+ flags = G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES |
+ G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START;
+ manager->priv->proxy = g_dbus_proxy_new_for_bus_sync (G_BUS_TYPE_SESSION,
+ flags,
+ NULL, /* GDBusInterfaceInfo */
+ "org.gnome.SessionManager",
+ "/org/gnome/SessionManager",
+ "org.gnome.SessionManager",
+ NULL, /* GCancellable */
+ &error);
+ if (manager->priv->proxy == NULL) {
+ g_warning ("Could not listen to session manager: %s",
+ error->message);
+ g_error_free (error);
return;
- };
+ }
- manager->priv->dbus_connection = connection;
+ manager->priv->proxy_signal_id = g_signal_connect (manager->priv->proxy,
+ "g-signal",
+ G_CALLBACK (on_session_manager_signal),
+ manager);
}
@@ -423,10 +447,9 @@ gsd_background_manager_stop (GsdBackgroundManager *manager)
disconnect_screen_signals (manager);
- if (manager->priv->dbus_connection != NULL) {
- dbus_connection_remove_filter (manager->priv->dbus_connection,
- on_bus_message,
- manager);
+ if (manager->priv->proxy) {
+ disconnect_session_manager_listener (manager);
+ g_object_unref (manager->priv->proxy);
}
g_signal_handlers_disconnect_by_func (manager->priv->settings,

View File

@ -0,0 +1,41 @@
From 5f4d6e23c0f1d37b36e3f4fcad2894af49a4dd33 Mon Sep 17 00:00:00 2001
From: Owen W. Taylor <otaylor@fishsoup.net>
Date: Tue, 30 Nov 2010 23:04:17 -0500
Subject: [PATCH] background: draw the background on startup if show-desktop-icons unset
When show-desktop-icons is not set, we need to call draw_bg() not just
setup_bg(). Also remove a duplicate call to gnome_bg_load_from_preferences()
which setup_bg already does.
https://bugzilla.gnome.org/show_bug.cgi?id=636191
---
plugins/background/gsd-background-manager.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/plugins/background/gsd-background-manager.c b/plugins/background/gsd-background-manager.c
index 30370fa..0e96f1e 100644
--- a/plugins/background/gsd-background-manager.c
+++ b/plugins/background/gsd-background-manager.c
@@ -225,9 +225,10 @@ background_changed (GsdBackgroundManager *manager,
if (!nautilus_is_running () || !show_desktop_icons) {
if (manager->priv->bg == NULL) {
setup_bg (manager);
+ } else {
+ gnome_bg_load_from_preferences (manager->priv->bg,
+ manager->priv->settings);
}
- gnome_bg_load_from_preferences (manager->priv->bg,
- manager->priv->settings);
draw_background (manager, use_crossfade);
}
}
@@ -403,6 +404,7 @@ gsd_background_manager_start (GsdBackgroundManager *manager,
if (!show_desktop_icons) {
setup_bg (manager);
+ draw_background (manager, FALSE);
} else {
draw_background_after_session_loads (manager);
}
--
1.7.3.2

View File

@ -1,6 +1,6 @@
Name: gnome-settings-daemon
Version: 2.91.5
Release: 2%{?dist}
Release: 3%{?dist}
Summary: The daemon sharing settings from GNOME to GTK+/KDE applications
Group: System Environment/Daemons
@ -32,9 +32,14 @@ BuildRequires: autoconf automake libtool
BuildRequires: libxklavier-devel
BuildRequires: gsettings-desktop-schemas-devel >= 0.1.2
# https://bugzilla.gnome.org/show_bug.cgi?id=636191
Patch0: background-draw-the-background-on-startup-if-show-.patch
# https://bugzilla.gnome.org/show_bug.cgi?id=636233
Patch1: background-convert-to-gdbus.patch
# change font rendering
#Patch3: slight-hinting.patch
Patch4: autorun-Handle-rename-of-org.gnome.media-handling.patch
%description
A daemon to share settings from GNOME to other applications. It also
@ -52,9 +57,9 @@ developing applications that use %{name}.
%prep
%setup -q
%patch0 -p1 -b .draw-background
%patch1 -p1 -b .draw-no-nautilus
#%patch3 -p1 -b .slight-hinting
# Upstream commit cb9a3a0e4144d
%patch4 -p1 -b .media-handling
%build
# https://fedoraproject.org/wiki/Features/ChangeInImplicitDSOLinking
@ -115,6 +120,9 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor >&/dev/null || :
%{_libdir}/pkgconfig/gnome-settings-daemon.pc
%changelog
* Wed Dec 1 2010 Dan Williams <dcbw@redhat.com> - 2.91.5-3
- Fix various cases of forgetting to draw the background
* Tue Nov 30 2010 Owen Taylor <otaylor@redhat.com> - 2.91.5-2
- Add a patch handling org.gnome.media-handling gsettings schema rename