summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefano Karapetsas <[email protected]>2012-12-15 12:33:17 -0800
committerStefano Karapetsas <[email protected]>2012-12-15 12:33:17 -0800
commit85c5ae14d75e3413b8f3f3aa38205ea852dcb20d (patch)
tree4750b8d23dfcb17aea6cbc62c7e1c788a6976a7b
parent12dcf19aa5f51901053c273cd7f5c17ce85e909d (diff)
parentc6a6cbde72489a0055ba63341a153fe365058072 (diff)
downloadmate-settings-daemon-85c5ae14d75e3413b8f3f3aa38205ea852dcb20d.tar.bz2
mate-settings-daemon-85c5ae14d75e3413b8f3f3aa38205ea852dcb20d.tar.xz
Merge pull request #31 from jasmineaura/develop
background revised, various other fixes & improvements
-rw-r--r--configure.ac12
-rw-r--r--data/Makefile.am2
-rw-r--r--data/mate-settings-daemon-uninstalled.pc.in1
-rw-r--r--data/mate-settings-daemon.pc.in1
-rw-r--r--mate-settings-daemon/Makefile.am4
-rw-r--r--plugins/a11y-keyboard/msd-a11y-preferences-dialog.c1
-rw-r--r--plugins/background/Makefile.am10
-rw-r--r--plugins/background/msd-background-manager.c685
-rw-r--r--plugins/common/eggaccelerators.c18
-rw-r--r--plugins/common/msd-keygrab.c2
-rw-r--r--plugins/datetime/Makefile.am2
-rw-r--r--plugins/datetime/msd-datetime-mechanism.c10
-rw-r--r--plugins/housekeeping/msd-disk-space.c2
-rw-r--r--plugins/housekeeping/msd-housekeeping-manager.c106
-rw-r--r--plugins/housekeeping/msd-ldsm-dialog.c37
-rw-r--r--plugins/housekeeping/msd-ldsm-trash-empty.c2
-rw-r--r--plugins/keyboard/msd-keyboard-xkb.c58
-rw-r--r--plugins/media-keys/Makefile.am6
-rw-r--r--plugins/media-keys/msd-media-keys-manager.c42
-rw-r--r--plugins/mouse/msd-locate-pointer.c29
-rw-r--r--plugins/mouse/msd-mouse-manager.c1
-rw-r--r--plugins/xrandr/Makefile.am6
-rw-r--r--plugins/xrandr/msd-xrandr-manager.c3
23 files changed, 508 insertions, 532 deletions
diff --git a/configure.ac b/configure.ac
index 2743ab6..f4311ab 100644
--- a/configure.ac
+++ b/configure.ac
@@ -14,6 +14,8 @@ AC_CONFIG_SRCDIR([mate-settings-daemon/mate-settings-manager.c])
AM_INIT_AUTOMAKE([1.9 no-dist-gzip dist-bzip2 tar-ustar])
+m4_ifdef([AM_SILENT_RULES],[AM_SILENT_RULES([yes])])
+
AC_STDC_HEADERS
AC_PROG_CXX
AM_PROG_CC_C_O
@@ -66,7 +68,6 @@ PKG_CHECK_MODULES(SETTINGS_DAEMON,
PKG_CHECK_MODULES(SETTINGS_PLUGIN,
gtk+-2.0 >= $GTK_REQUIRED_VERSION
- mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED_VERSION
gio-2.0 >= $GIO_REQUIRED_VERSION
dbus-glib-1 >= $DBUS_GLIB_REQUIRED_VERSION
)
@@ -84,6 +85,11 @@ AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal)
GLIB_GSETTINGS
dnl ---------------------------------------------------------------------------
+dnl - Check for mate-desktop
+dnl ---------------------------------------------------------------------------
+PKG_CHECK_MODULES(MATE_DESKTOP, mate-desktop-2.0 >= $MATE_DESKTOP_REQUIRED_VERSION)
+
+dnl ---------------------------------------------------------------------------
dnl - Check for libmatenotify
dnl ---------------------------------------------------------------------------
@@ -343,10 +349,8 @@ AC_SUBST(NSS_DATABASE)
# PolicyKit
# ---------------------------------------------------------------------------
-POLKIT_REQUIRED=0.91
-DBUS_GLIB_REQUIRED=0.71
+POLKIT_REQUIRED=0.97
DBUS_REQUIRED=1.1.2
-NETWORK_MANAGER_REQUIRED=0.6
# PolicyKit detection; defaults to 'auto' (use it if it's available)
#
diff --git a/data/Makefile.am b/data/Makefile.am
index 975daf9..3ba2e7e 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -35,7 +35,7 @@ service_in_files = org.mate.SettingsDaemon.service.in
service_DATA = $(service_in_files:.service.in=.service)
org.mate.SettingsDaemon.service: org.mate.SettingsDaemon.service.in Makefile
- @sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
+ $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@
pkgconfigdir = $(libdir)/pkgconfig
pkgconfig_DATA = mate-settings-daemon.pc
diff --git a/data/mate-settings-daemon-uninstalled.pc.in b/data/mate-settings-daemon-uninstalled.pc.in
index 29bcd91..89dadcd 100644
--- a/data/mate-settings-daemon-uninstalled.pc.in
+++ b/data/mate-settings-daemon-uninstalled.pc.in
@@ -2,6 +2,7 @@ prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
+binary=${pc_top_builddir}/mate-settings-daemon/mate-settings-daemon
Name: mate-settings-daemon
Description: Utility library for accessing mate-settings-daemon over DBUS
diff --git a/data/mate-settings-daemon.pc.in b/data/mate-settings-daemon.pc.in
index 764ffdb..26bde7e 100644
--- a/data/mate-settings-daemon.pc.in
+++ b/data/mate-settings-daemon.pc.in
@@ -4,6 +4,7 @@ libdir=@libdir@
includedir=@includedir@
libexecdir=@libexecdir@
plugindir=${libdir}/mate-settings-daemon-2.0
+binary=${libexecdir}/mate-settings-daemon
Name: mate-settings-daemon
Description: Utility library for accessing mate-settings-daemon over DBUS
diff --git a/mate-settings-daemon/Makefile.am b/mate-settings-daemon/Makefile.am
index 6ba7d37..fcf4520 100644
--- a/mate-settings-daemon/Makefile.am
+++ b/mate-settings-daemon/Makefile.am
@@ -40,10 +40,10 @@ msd_PROGRAMS = \
mate-settings-daemon
mate-settings-manager-glue.h: mate-settings-manager.xml Makefile.am
- dbus-binding-tool --prefix=mate_settings_manager --mode=glib-server $< > $@
+ $(AM_V_GEN) dbus-binding-tool --prefix=mate_settings_manager --mode=glib-server $< > $@
mate-settings-client.h: mate-settings-manager.xml Makefile.am
- dbus-binding-tool --prefix=mate_settings_manager --mode=glib-client $< > $@
+ $(AM_V_GEN) dbus-binding-tool --prefix=mate_settings_manager --mode=glib-client $< > $@
BUILT_SOURCES = \
mate-settings-manager-glue.h \
diff --git a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
index e77900e..72d42ff 100644
--- a/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
+++ b/plugins/a11y-keyboard/msd-a11y-preferences-dialog.c
@@ -810,7 +810,6 @@ msd_a11y_preferences_dialog_init (MsdA11yPreferencesDialog *dialog)
g_object_unref (builder);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
gtk_window_set_title (GTK_WINDOW (dialog), _("Universal Access Preferences"));
gtk_window_set_icon_name (GTK_WINDOW (dialog), "preferences-desktop-accessibility");
g_object_set (dialog,
diff --git a/plugins/background/Makefile.am b/plugins/background/Makefile.am
index a047573..01f0fc5 100644
--- a/plugins/background/Makefile.am
+++ b/plugins/background/Makefile.am
@@ -17,11 +17,13 @@ test_background_CPPFLAGS = \
test_background_CFLAGS = \
$(SETTINGS_PLUGIN_CFLAGS) \
+ $(MATE_DESKTOP_CFLAGS) \
$(AM_CFLAGS)
test_background_LDADD = \
$(top_builddir)/mate-settings-daemon/libmsd-profile.la \
$(SETTINGS_PLUGIN_LIBS) \
+ $(MATE_DESKTOP_LIBS) \
$(X11_LIBS) \
$(NULL)
@@ -30,8 +32,8 @@ plugin_LTLIBRARIES = \
$(NULL)
libbackground_la_SOURCES = \
- msd-background-plugin.h \
- msd-background-plugin.c \
+ msd-background-plugin.h \
+ msd-background-plugin.c \
msd-background-manager.h \
msd-background-manager.c \
$(NULL)
@@ -44,14 +46,16 @@ libbackground_la_CPPFLAGS = \
libbackground_la_CFLAGS = \
$(SETTINGS_PLUGIN_CFLAGS) \
+ $(MATE_DESKTOP_CFLAGS) \
$(AM_CFLAGS)
libbackground_la_LDFLAGS = \
- $(MSD_PLUGIN_LDFLAGS) \
+ $(MSD_PLUGIN_LDFLAGS) \
$(NULL)
libbackground_la_LIBADD = \
$(SETTINGS_PLUGIN_LIBS) \
+ $(MATE_DESKTOP_LIBS) \
$(NULL)
plugin_in_files = \
diff --git a/plugins/background/msd-background-manager.c b/plugins/background/msd-background-manager.c
index 84e49db..e1a366f 100644
--- a/plugins/background/msd-background-manager.c
+++ b/plugins/background/msd-background-manager.c
@@ -1,8 +1,9 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
*
- * Copyright © 2001 Ximian, Inc.
+ * Copyright (C) 2001 Ximian, Inc.
* Copyright (C) 2007 William Jon McCann <[email protected]>
- * Copyright 2007 Red Hat, Inc.
+ * Copyright (C) 2007 Red Hat, Inc.
+ * Copyright (C) 2012 Jasmine Hassan <[email protected]>
*
* 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
@@ -59,295 +60,364 @@
#define MSD_BACKGROUND_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_BACKGROUND_MANAGER, MsdBackgroundManagerPrivate))
struct MsdBackgroundManagerPrivate {
- GSettings *settings;
- MateBG *bg;
- guint timeout_id;
-
+ GSettings *settings;
+ MateBG *bg;
+ cairo_surface_t *surface;
MateBGCrossfade *fade;
+ GList *scr_sizes;
- GDBusProxy *proxy;
- guint proxy_signal_id;
-};
+ gboolean msd_can_draw;
+ gboolean caja_can_draw;
+ gboolean do_fade;
+ gboolean draw_in_progress;
-static void
-msd_background_manager_class_init (MsdBackgroundManagerClass* klass);
+ guint timeout_id;
-static void
-
-msd_background_manager_init (MsdBackgroundManager* background_manager);
-
-static void
-msd_background_manager_finalize (GObject* object);
-
-static void setup_bg (MsdBackgroundManager *manager);
-static void connect_screen_signals (MsdBackgroundManager *manager);
+ GDBusProxy *proxy;
+ guint proxy_signal_id;
+};
-G_DEFINE_TYPE(MsdBackgroundManager, msd_background_manager, G_TYPE_OBJECT)
+G_DEFINE_TYPE (MsdBackgroundManager, msd_background_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
+/* Whether MSD is allowed to draw background */
static gboolean
-do_draw_background (MsdBackgroundManager *manager)
+msd_can_draw_bg (MsdBackgroundManager *manager)
{
- return g_settings_get_boolean (manager->priv->settings,
- MATE_BG_KEY_DRAW_BACKGROUND);
+ return g_settings_get_boolean (manager->priv->settings, MATE_BG_KEY_DRAW_BACKGROUND);
}
+/* Whether to change background with a fade effect */
static gboolean
-do_crossfade_background (MsdBackgroundManager *manager)
+can_fade_bg (MsdBackgroundManager *manager)
{
- return g_settings_get_boolean (manager->priv->settings,
- MATE_BG_KEY_BACKGROUND_FADE);
+ return g_settings_get_boolean (manager->priv->settings, MATE_BG_KEY_BACKGROUND_FADE);
}
+/* Whether Caja is configured to draw desktop (show-desktop-icons) */
static gboolean
-caja_is_drawing_background (MsdBackgroundManager *manager)
+caja_can_draw_bg (MsdBackgroundManager *manager)
{
- Atom window_id_atom;
- Window caja_xid;
- Atom actual_type;
- int actual_format;
- unsigned long nitems;
- unsigned long bytes_after;
- unsigned char* data;
- Atom wmclass_atom;
- gboolean running;
- gint error;
- gboolean show_desktop_icons;
-
- show_desktop_icons = g_settings_get_boolean (manager->priv->settings,
- MATE_BG_KEY_SHOW_DESKTOP);
- if (!show_desktop_icons) {
- return FALSE;
- }
-
- window_id_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
- "CAJA_DESKTOP_WINDOW_ID", True);
+ return g_settings_get_boolean (manager->priv->settings, MATE_BG_KEY_SHOW_DESKTOP);
+}
- if (window_id_atom == None) {
+static gboolean
+caja_is_drawing_bg (MsdBackgroundManager *manager)
+{
+ Display *display = gdk_x11_get_default_xdisplay ();
+ Window window = gdk_x11_get_default_root_xwindow ();
+ Atom caja_prop, wmclass_prop, type;
+ Window caja_window;
+ int format;
+ unsigned long nitems, after;
+ unsigned char *data;
+ gboolean running = FALSE;
+
+ if (!manager->priv->caja_can_draw)
return FALSE;
- }
- XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
- GDK_ROOT_WINDOW(),
- window_id_atom,
- 0,
- 1,
- False,
- XA_WINDOW,
- &actual_type,
- &actual_format,
- &nitems,
- &bytes_after,
- &data);
-
- if (data != NULL)
- {
- caja_xid = *(Window*) data;
- XFree(data);
- }
- else
- {
+ caja_prop = XInternAtom (display, "CAJA_DESKTOP_WINDOW_ID", True);
+ if (caja_prop == None)
return FALSE;
- }
- if (actual_type != XA_WINDOW)
- {
+ XGetWindowProperty (display, window, caja_prop, 0, 1, False,
+ XA_WINDOW, &type, &format, &nitems, &after, &data);
+
+ if (data == NULL)
return FALSE;
- }
- if (actual_format != 32)
- {
+ caja_window = *(Window *) data;
+ XFree (data);
+
+ if (type != XA_WINDOW || format != 32)
return FALSE;
- }
- wmclass_atom = XInternAtom(GDK_DISPLAY_XDISPLAY(gdk_display_get_default()), "WM_CLASS", False);
+ wmclass_prop = XInternAtom (display, "WM_CLASS", True);
+ if (wmclass_prop == None)
+ return FALSE;
gdk_error_trap_push();
- XGetWindowProperty (GDK_DISPLAY_XDISPLAY(gdk_display_get_default()),
- caja_xid,
- wmclass_atom,
- 0,
- 20,
- False,
- XA_STRING,
- &actual_type,
- &actual_format,
- &nitems,
- &bytes_after,
- &data);
-
- error = gdk_error_trap_pop();
-
- if (error == BadWindow)
- {
+ XGetWindowProperty (display, caja_window, wmclass_prop, 0, 20, False,
+ XA_STRING, &type, &format, &nitems, &after, &data);
+
+ XSync (display, False);
+
+ if (gdk_error_trap_pop() == BadWindow || data == NULL)
return FALSE;
- }
- if (actual_type == XA_STRING &&
- nitems == 20 &&
- bytes_after == 0 &&
- actual_format == 8 &&
- data != NULL &&
- !strcmp((char*) data, "desktop_window") &&
- !strcmp((char*) data + strlen((char*) data) + 1, "Caja"))
+ /* See: caja_desktop_window_new(), in src/caja-desktop-window.c */
+ if (nitems == 20 && after == 0 && format == 8 &&
+ !strcmp((char*) data, "desktop_window") &&
+ !strcmp((char*) data + strlen((char*) data) + 1, "Caja"))
{
running = TRUE;
}
- else
- {
- running = FALSE;
- }
-
- if (data != NULL)
- {
- XFree(data);
- }
+ XFree (data);
return running;
}
static void
-on_crossfade_finished (MsdBackgroundManager *manager)
+free_fade (MsdBackgroundManager *manager)
{
- g_object_unref (manager->priv->fade);
- manager->priv->fade = NULL;
+ if (manager->priv->fade != NULL) {
+ g_object_unref (manager->priv->fade);
+ manager->priv->fade = NULL;
+ }
}
static void
-draw_background (MsdBackgroundManager *manager,
- gboolean use_crossfade)
+free_bg_surface (MsdBackgroundManager *manager)
{
- GdkDisplay *display;
- int n_screens;
- int i;
+ if (manager->priv->surface != NULL) {
+ cairo_surface_destroy (manager->priv->surface);
+ manager->priv->surface = NULL;
+ }
+}
- if (caja_is_drawing_background (manager) || !do_draw_background (manager))
- {
- return;
+static void
+free_scr_sizes (MsdBackgroundManager *manager)
+{
+ if (manager->priv->scr_sizes != NULL) {
+ g_list_foreach (manager->priv->scr_sizes, (GFunc)g_free, NULL);
+ g_list_free (manager->priv->scr_sizes);
+ manager->priv->scr_sizes = NULL;
}
+}
- mate_settings_profile_start(NULL);
+static gboolean
+real_draw_bg (MsdBackgroundManager *manager,
+ GdkScreen *screen)
+{
+ MsdBackgroundManagerPrivate *p = manager->priv;
+ GdkWindow *window = gdk_screen_get_root_window (screen);
+ gint scr_num = gdk_screen_get_number (screen);
+ gint width = gdk_screen_get_width (screen);
+ gint height = gdk_screen_get_height (screen);
- display = gdk_display_get_default();
- n_screens = gdk_display_get_n_screens(display);
+ free_bg_surface (manager);
+ p->surface = mate_bg_create_surface (p->bg, window, width, height, TRUE);
- for (i = 0; i < n_screens; ++i)
+ if (p->do_fade)
+ {
+ free_fade (manager);
+ p->fade = mate_bg_set_surface_as_root_with_crossfade (screen, p->surface);
+ g_signal_connect_swapped (p->fade, "finished", G_CALLBACK (free_fade), manager);
+ }
+ else
{
- GdkScreen *screen;
- cairo_surface_t *surface;
+ mate_bg_set_surface_as_root (screen, p->surface);
+ }
+ p->scr_sizes = g_list_prepend (p->scr_sizes, g_strdup_printf ("%dx%d", width, height));
+}
- screen = gdk_display_get_screen(display, i);
+static void
+draw_background (MsdBackgroundManager *manager,
+ gboolean may_fade)
+{
+ MsdBackgroundManagerPrivate *p = manager->priv;
- surface = mate_bg_create_surface (manager->priv->bg,
- gdk_screen_get_root_window (screen),
- gdk_screen_get_width (screen),
- gdk_screen_get_height (screen),
- TRUE);
+ if (!p->msd_can_draw || p->draw_in_progress || caja_is_drawing_bg (manager))
+ return;
- if (use_crossfade && do_crossfade_background (manager))
- {
- if (manager->priv->fade != NULL)
- g_object_unref (manager->priv->fade);
-
- manager->priv->fade = mate_bg_set_surface_as_root_with_crossfade (screen,
- surface);
- g_signal_connect_swapped (manager->priv->fade, "finished",
- G_CALLBACK (on_crossfade_finished),
- manager);
- } else {
- mate_bg_set_surface_as_root (screen, surface);
- }
+ mate_settings_profile_start (NULL);
- cairo_surface_destroy (surface);
+ GdkDisplay *display = gdk_display_get_default ();
+ int n_screens = gdk_display_get_n_screens (display);
+ int scr;
+
+ p->draw_in_progress = TRUE;
+ p->do_fade = may_fade && can_fade_bg (manager);
+ free_scr_sizes (manager);
+
+ for (scr = 0; scr < n_screens; scr++)
+ {
+ g_debug ("Drawing background on Screen%d", scr);
+ real_draw_bg (manager, gdk_display_get_screen (display, scr));
}
+ p->scr_sizes = g_list_reverse (p->scr_sizes);
- mate_settings_profile_end(NULL);
+ p->draw_in_progress = FALSE;
+ mate_settings_profile_end (NULL);
+}
+
+static void
+on_bg_changed (MateBG *bg,
+ MsdBackgroundManager *manager)
+{
+ g_debug ("Background changed");
+ draw_background (manager, TRUE);
}
static void
on_bg_transitioned (MateBG *bg,
- MsdBackgroundManager *manager)
+ MsdBackgroundManager *manager)
{
+ g_debug ("Background transitioned");
draw_background (manager, FALSE);
}
+static void
+on_screen_size_changed (GdkScreen *screen,
+ MsdBackgroundManager *manager)
+{
+ gint scr_num = gdk_screen_get_number (screen);
+ gchar *old_size = g_list_nth (manager->priv->scr_sizes, scr_num)->data;
+ gchar *new_size = g_strdup_printf ("%dx%d", gdk_screen_get_width (screen),
+ gdk_screen_get_height (screen));
+ if (g_strcmp0 (old_size, new_size) != 0)
+ {
+ g_debug ("Screen%d size changed: %s -> %s", scr_num, old_size, new_size);
+ draw_background (manager, FALSE);
+ } else {
+ g_debug ("Screen%d size unchanged (%s). Ignoring.", scr_num, old_size);
+ }
+ g_free (new_size);
+}
+
+static void
+disconnect_screen_signals (MsdBackgroundManager *manager)
+{
+ GdkDisplay *display = gdk_display_get_default();
+ int n_screens = gdk_display_get_n_screens (display);
+ int i;
+
+ for (i = 0; i < n_screens; i++)
+ {
+ g_signal_handlers_disconnect_by_func
+ (gdk_display_get_screen (display, i),
+ G_CALLBACK (on_screen_size_changed), manager);
+ }
+}
+
+static void
+connect_screen_signals (MsdBackgroundManager *manager)
+{
+ GdkDisplay *display = gdk_display_get_default();
+ int n_screens = gdk_display_get_n_screens (display);
+ int i;
+
+ for (i = 0; i < n_screens; i++)
+ {
+ GdkScreen *screen = gdk_display_get_screen (display, i);
+
+ g_signal_connect (screen, "monitors-changed",
+ G_CALLBACK (on_screen_size_changed), manager);
+ g_signal_connect (screen, "size-changed",
+ G_CALLBACK (on_screen_size_changed), manager);
+ }
+}
+
static gboolean
settings_change_event_idle_cb (MsdBackgroundManager *manager)
{
+ mate_settings_profile_start ("settings_change_event_idle_cb");
+
mate_bg_load_from_gsettings (manager->priv->bg,
- manager->priv->settings);
+ manager->priv->settings);
+
+ mate_settings_profile_end ("settings_change_event_idle_cb");
return FALSE; /* remove from the list of event sources */
}
static gboolean
settings_change_event_cb (GSettings *settings,
- gpointer keys,
- gint n_keys,
- MsdBackgroundManager *manager)
+ gpointer keys,
+ gint n_keys,
+ MsdBackgroundManager *manager)
{
- /* Defer signal processing to avoid making the dconf backend deadlock */
- g_idle_add ((GSourceFunc) settings_change_event_idle_cb, manager);
+ MsdBackgroundManagerPrivate *p = manager->priv;
+
+ /* Complements on_bg_handling_changed() */
+ p->msd_can_draw = msd_can_draw_bg (manager);
+ p->caja_can_draw = caja_can_draw_bg (manager);
+
+ if (p->msd_can_draw && p->bg != NULL && !caja_is_drawing_bg (manager))
+ {
+ /* Defer signal processing to avoid making the dconf backend deadlock */
+ g_idle_add ((GSourceFunc) settings_change_event_idle_cb, manager);
+ }
return FALSE; /* let the event propagate further */
}
static void
-on_screen_size_changed (GdkScreen *screen,
- MsdBackgroundManager *manager)
+setup_background (MsdBackgroundManager *manager)
{
- draw_background (manager, FALSE);
+ MsdBackgroundManagerPrivate *p = manager->priv;
+ g_return_if_fail (p->bg == NULL);
+
+ p->bg = mate_bg_new();
+
+ p->draw_in_progress = FALSE;
+
+ g_signal_connect(p->bg, "changed", G_CALLBACK (on_bg_changed), manager);
+
+ g_signal_connect(p->bg, "transitioned", G_CALLBACK (on_bg_transitioned), manager);
+
+ mate_bg_load_from_gsettings (p->bg, p->settings);
+
+ connect_screen_signals (manager);
+
+ g_signal_connect (p->settings, "change-event",
+ G_CALLBACK (settings_change_event_cb), manager);
}
static void
-on_bg_changed (MateBG *bg,
- MsdBackgroundManager *manager)
+remove_background (MsdBackgroundManager *manager)
{
- draw_background (manager, TRUE);
+ MsdBackgroundManagerPrivate *p = manager->priv;
+
+ disconnect_screen_signals (manager);
+
+ g_signal_handlers_disconnect_by_func (p->settings, settings_change_event_cb, manager);
+
+ if (p->settings != NULL) {
+ g_object_unref (G_OBJECT (p->settings));
+ p->settings = NULL;
+ }
+
+ if (p->bg != NULL) {
+ g_object_unref (G_OBJECT (p->bg));
+ p->bg = NULL;
+ }
+
+ free_scr_sizes (manager);
+ free_bg_surface (manager);
+ free_fade (manager);
}
static void
-setup_bg (MsdBackgroundManager *manager)
+on_bg_handling_changed (GSettings *settings,
+ const char *key,
+ MsdBackgroundManager *manager)
{
- g_return_if_fail (manager->priv->bg == NULL);
-
- manager->priv->bg = mate_bg_new();
-
- g_signal_connect(manager->priv->bg,
- "changed",
- G_CALLBACK (on_bg_changed),
- manager);
+ MsdBackgroundManagerPrivate *p = manager->priv;
- g_signal_connect(manager->priv->bg,
- "transitioned",
- G_CALLBACK (on_bg_transitioned),
- manager);
+ mate_settings_profile_start (NULL);
- connect_screen_signals (manager);
+ if (caja_is_drawing_bg (manager))
+ {
+ if (p->bg != NULL)
+ remove_background (manager);
+ }
+ else if (p->msd_can_draw && p->bg == NULL)
+ {
+ setup_background (manager);
+ }
- mate_bg_load_from_gsettings (manager->priv->bg,
- manager->priv->settings);
-
- /* Connect to "change-event" signal to receive *groups of changes* before
- * they are split out into multiple emissions of the "changed" signal.
- */
- g_signal_connect (manager->priv->settings,
- "change-event",
- G_CALLBACK (settings_change_event_cb),
- manager);
+ mate_settings_profile_end (NULL);
}
static gboolean
-queue_draw_background (MsdBackgroundManager *manager)
+queue_setup_background (MsdBackgroundManager *manager)
{
manager->priv->timeout_id = 0;
- if (manager->priv->bg == NULL)
- setup_bg (manager);
-
- draw_background (manager, FALSE);
+ setup_background (manager);
return FALSE;
}
@@ -358,16 +428,14 @@ queue_timeout (MsdBackgroundManager *manager)
if (manager->priv->timeout_id > 0)
return;
- /* If the session finishes then check if caja is
- * running and if not, set the background.
+ /* SessionRunning: now check if Caja is drawing background, and if not, set it.
*
- * We wait a few seconds after the session is up
- * because caja tells the session manager that its
- * ready before it sets the background.
+ * FIXME: We wait a few seconds after the session is up because Caja tells the
+ * session manager that its ready before it sets the background.
+ * https://bugzilla.gnome.org/show_bug.cgi?id=568588
*/
- manager->priv->timeout_id = g_timeout_add_seconds(8,
- (GSourceFunc) queue_draw_background,
- manager);
+ manager->priv->timeout_id =
+ g_timeout_add_seconds (8, (GSourceFunc) queue_setup_background, manager);
}
static void
@@ -396,7 +464,7 @@ on_session_manager_signal (GDBusProxy *proxy,
}
static void
-draw_background_after_session_loads (MsdBackgroundManager *manager)
+draw_bg_after_session_loads (MsdBackgroundManager *manager)
{
GError *error = NULL;
GDBusProxyFlags flags;
@@ -424,101 +492,42 @@ draw_background_after_session_loads (MsdBackgroundManager *manager)
manager);
}
-static void
-disconnect_screen_signals (MsdBackgroundManager* manager)
+gboolean
+msd_background_manager_start (MsdBackgroundManager *manager,
+ GError **error)
{
- GdkDisplay* display;
- int i;
- int n_screens;
-
- display = gdk_display_get_default();
- n_screens = gdk_display_get_n_screens(display);
+ MsdBackgroundManagerPrivate *p = manager->priv;
- for (i = 0; i < n_screens; ++i)
- {
- GdkScreen *screen;
+ g_debug ("Starting background manager");
+ mate_settings_profile_start (NULL);
- screen = gdk_display_get_screen(display, i);
+ p->settings = g_settings_new (MATE_BG_SCHEMA);
- g_signal_handlers_disconnect_by_func(screen,
- G_CALLBACK(on_screen_size_changed),
- manager);
- }
-}
+ p->msd_can_draw = msd_can_draw_bg (manager);
+ p->caja_can_draw = caja_can_draw_bg (manager);
-static void
-connect_screen_signals (MsdBackgroundManager* manager)
-{
- GdkDisplay* display;
- int i;
- int n_screens;
-
- display = gdk_display_get_default();
- n_screens = gdk_display_get_n_screens(display);
-
- for (i = 0; i < n_screens; ++i)
- {
- GdkScreen* screen;
- screen = gdk_display_get_screen(display, i);
- g_signal_connect(screen,
- "monitors-changed",
- G_CALLBACK(on_screen_size_changed),
- manager);
-
- g_signal_connect(screen,
- "size-changed",
- G_CALLBACK(on_screen_size_changed),
- manager);
- }
-}
-
-static void
-background_handling_changed (GSettings *settings,
- const char *key,
- MsdBackgroundManager *manager)
-{
- if (do_draw_background (manager) &&
- !caja_is_drawing_background (manager))
- {
- queue_timeout (manager);
- }
-}
+ g_signal_connect (p->settings, "changed::" MATE_BG_KEY_DRAW_BACKGROUND,
+ G_CALLBACK (on_bg_handling_changed), manager);
+ g_signal_connect (p->settings, "changed::" MATE_BG_KEY_SHOW_DESKTOP,
+ G_CALLBACK (on_bg_handling_changed), manager);
-gboolean
-msd_background_manager_start (MsdBackgroundManager *manager,
- GError **error)
-{
- gboolean show_desktop_icons;
-
- g_debug("Starting background manager");
- mate_settings_profile_start(NULL);
-
- manager->priv->settings = g_settings_new (MATE_BG_SCHEMA);
- g_signal_connect (manager->priv->settings, "changed::" MATE_BG_KEY_DRAW_BACKGROUND,
- G_CALLBACK (background_handling_changed), manager);
- g_signal_connect (manager->priv->settings, "changed::" MATE_BG_KEY_SHOW_DESKTOP,
- G_CALLBACK (background_handling_changed), manager);
-
- /* If this is set, caja will draw the background and is
- * almost definitely in our session. however, it may not be
- * running yet (so is_caja_running() will fail). so, on
- * startup, just don't do anything if this key is set so we
- * don't waste time setting the background only to have
- * caja overwrite it.
+ /* If Caja is set to draw the background, it is very likely in our session.
+ * But it might not be started yet, so caja_is_drawing_bg() would fail.
+ * In this case, we wait till the session is loaded, to avoid double-draws.
*/
- show_desktop_icons = g_settings_get_boolean (manager->priv->settings,
- MATE_BG_KEY_SHOW_DESKTOP);
-
- if (!show_desktop_icons)
+ if (p->msd_can_draw)
{
- setup_bg(manager);
- }
- else
- {
- draw_background_after_session_loads(manager);
+ if (p->caja_can_draw)
+ {
+ draw_bg_after_session_loads (manager);
+ }
+ else
+ {
+ setup_background (manager);
+ }
}
- mate_settings_profile_end(NULL);
+ mate_settings_profile_end (NULL);
return TRUE;
}
@@ -526,11 +535,7 @@ msd_background_manager_start (MsdBackgroundManager *manager,
void
msd_background_manager_stop (MsdBackgroundManager *manager)
{
- MsdBackgroundManagerPrivate* p = manager->priv;
-
- g_debug("Stopping background manager");
-
- disconnect_screen_signals(manager);
+ g_debug ("Stopping background manager");
if (manager->priv->proxy)
{
@@ -538,88 +543,38 @@ msd_background_manager_stop (MsdBackgroundManager *manager)
g_object_unref (manager->priv->proxy);
}
- g_signal_handlers_disconnect_by_func (manager->priv->settings,
- settings_change_event_cb,
- manager);
-
- if (p->settings != NULL)
- {
- g_object_unref(p->settings);
- p->settings = NULL;
- }
-
- if (p->timeout_id != 0)
- {
- g_source_remove(p->timeout_id);
- p->timeout_id = 0;
- }
-
- if (p->bg != NULL)
- {
- g_object_unref(p->bg);
- p->bg = NULL;
- }
-}
-
-static void
-msd_background_manager_set_property (GObject* object,
- guint prop_id,
- const GValue* value,
- GParamSpec* pspec)
-{
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
+ if (manager->priv->timeout_id != 0) {
+ g_source_remove (manager->priv->timeout_id);
+ manager->priv->timeout_id = 0;
}
-}
-static void
-msd_background_manager_get_property (GObject* object,
- guint prop_id,
- GValue* value,
- GParamSpec* pspec)
-{
- switch (prop_id)
- {
- default:
- G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
- break;
- }
+ remove_background (manager);
}
static GObject*
msd_background_manager_constructor (GType type,
- guint n_construct_properties,
- GObjectConstructParam* construct_properties)
+ guint n_construct_properties,
+ GObjectConstructParam* construct_properties)
{
- MsdBackgroundManager* background_manager;
+ MsdBackgroundManager *manager =
+ MSD_BACKGROUND_MANAGER (
+ G_OBJECT_CLASS (msd_background_manager_parent_class)->constructor (
+ type, n_construct_properties, construct_properties));
- background_manager = MSD_BACKGROUND_MANAGER(G_OBJECT_CLASS(msd_background_manager_parent_class)->constructor(type,
- n_construct_properties,
- construct_properties));
- return G_OBJECT(background_manager);
+ return G_OBJECT(manager);
}
static void
-msd_background_manager_dispose (GObject* object)
+msd_background_manager_finalize (GObject *object)
{
- G_OBJECT_CLASS(msd_background_manager_parent_class)->dispose(object);
-}
+ g_return_if_fail (object != NULL);
+ g_return_if_fail (MSD_IS_BACKGROUND_MANAGER (object));
-static void
-msd_background_manager_class_init (MsdBackgroundManagerClass* klass)
-{
- GObjectClass* object_class = G_OBJECT_CLASS(klass);
+ MsdBackgroundManager *manager = MSD_BACKGROUND_MANAGER (object);
- object_class->get_property = msd_background_manager_get_property;
- object_class->set_property = msd_background_manager_set_property;
- object_class->constructor = msd_background_manager_constructor;
- object_class->dispose = msd_background_manager_dispose;
- object_class->finalize = msd_background_manager_finalize;
+ g_return_if_fail (manager->priv != NULL);
- g_type_class_add_private(klass, sizeof(MsdBackgroundManagerPrivate));
+ G_OBJECT_CLASS(msd_background_manager_parent_class)->finalize(object);
}
static void
@@ -629,18 +584,14 @@ msd_background_manager_init (MsdBackgroundManager* manager)
}
static void
-msd_background_manager_finalize (GObject* object)
+msd_background_manager_class_init (MsdBackgroundManagerClass *klass)
{
- MsdBackgroundManager* background_manager;
+ GObjectClass *object_class = G_OBJECT_CLASS(klass);
- g_return_if_fail(object != NULL);
- g_return_if_fail(MSD_IS_BACKGROUND_MANAGER(object));
-
- background_manager = MSD_BACKGROUND_MANAGER(object);
-
- g_return_if_fail(background_manager->priv != NULL);
+ object_class->constructor = msd_background_manager_constructor;
+ object_class->finalize = msd_background_manager_finalize;
- G_OBJECT_CLASS(msd_background_manager_parent_class)->finalize(object);
+ g_type_class_add_private(klass, sizeof(MsdBackgroundManagerPrivate));
}
MsdBackgroundManager*
diff --git a/plugins/common/eggaccelerators.c b/plugins/common/eggaccelerators.c
index 448fb02..171a369 100644
--- a/plugins/common/eggaccelerators.c
+++ b/plugins/common/eggaccelerators.c
@@ -601,20 +601,20 @@ reload_modmap (GdkKeymap *keymap,
mask = 0;
for (j = 0; j < n_entries; ++j)
{
- if (keyvals[j] == GDK_Num_Lock)
+ if (keyvals[j] == GDK_KEY_Num_Lock)
mask |= EGG_VIRTUAL_NUM_LOCK_MASK;
- else if (keyvals[j] == GDK_Scroll_Lock)
+ else if (keyvals[j] == GDK_KEY_Scroll_Lock)
mask |= EGG_VIRTUAL_SCROLL_LOCK_MASK;
- else if (keyvals[j] == GDK_Meta_L ||
- keyvals[j] == GDK_Meta_R)
+ else if (keyvals[j] == GDK_KEY_Meta_L ||
+ keyvals[j] == GDK_KEY_Meta_R)
mask |= EGG_VIRTUAL_META_MASK;
- else if (keyvals[j] == GDK_Hyper_L ||
- keyvals[j] == GDK_Hyper_R)
+ else if (keyvals[j] == GDK_KEY_Hyper_L ||
+ keyvals[j] == GDK_KEY_Hyper_R)
mask |= EGG_VIRTUAL_HYPER_MASK;
- else if (keyvals[j] == GDK_Super_L ||
- keyvals[j] == GDK_Super_R)
+ else if (keyvals[j] == GDK_KEY_Super_L ||
+ keyvals[j] == GDK_KEY_Super_R)
mask |= EGG_VIRTUAL_SUPER_MASK;
- else if (keyvals[j] == GDK_Mode_switch)
+ else if (keyvals[j] == GDK_KEY_Mode_switch)
mask |= EGG_VIRTUAL_MODE_SWITCH_MASK;
}
diff --git a/plugins/common/msd-keygrab.c b/plugins/common/msd-keygrab.c
index c096758..722656b 100644
--- a/plugins/common/msd-keygrab.c
+++ b/plugins/common/msd-keygrab.c
@@ -219,7 +219,7 @@ match_key (Key *key, XEvent *event)
group = XkbGroupForCoreState (event->xkey.state);
else
#endif
- group = (event->xkey.state & GDK_Mode_switch) ? 1 : 0;
+ group = (event->xkey.state & GDK_KEY_Mode_switch) ? 1 : 0;
/* Check if we find a keysym that matches our current state */
if (gdk_keymap_translate_keyboard_state (NULL, event->xkey.keycode,
diff --git a/plugins/datetime/Makefile.am b/plugins/datetime/Makefile.am
index 061443f..7c3b76a 100644
--- a/plugins/datetime/Makefile.am
+++ b/plugins/datetime/Makefile.am
@@ -6,7 +6,7 @@ dbus_services_in_files = org.mate.SettingsDaemon.DateTimeMechanism.service.in
polkit_in_files = org.mate.settingsdaemon.datetimemechanism.policy.in
msd-datetime-mechanism-glue.h: $(srcdir)/msd-datetime-mechanism.xml
- $(AM_V_GEN)dbus-binding-tool \
+ $(AM_V_GEN) dbus-binding-tool \
--prefix=msd_datetime_mechanism --mode=glib-server \
--output=msd-datetime-mechanism-glue.h \
$(srcdir)/msd-datetime-mechanism.xml
diff --git a/plugins/datetime/msd-datetime-mechanism.c b/plugins/datetime/msd-datetime-mechanism.c
index f03018f..6fc3399 100644
--- a/plugins/datetime/msd-datetime-mechanism.c
+++ b/plugins/datetime/msd-datetime-mechanism.c
@@ -176,9 +176,15 @@ register_mechanism (MsdDatetimeMechanism *mechanism)
{
GError *error = NULL;
- mechanism->priv->auth = polkit_authority_get ();
+ mechanism->priv->auth = polkit_authority_get_sync (NULL, &error);
+ if (mechanism->priv->auth == NULL) {
+ if (error != NULL) {
+ g_critical ("error getting system bus: %s", error->message);
+ g_error_free (error);
+ }
+ goto error;
+ }
- error = NULL;
mechanism->priv->system_bus_connection = dbus_g_bus_get (DBUS_BUS_SYSTEM, &error);
if (mechanism->priv->system_bus_connection == NULL) {
if (error != NULL) {
diff --git a/plugins/housekeeping/msd-disk-space.c b/plugins/housekeeping/msd-disk-space.c
index 3065b39..59c7527 100644
--- a/plugins/housekeeping/msd-disk-space.c
+++ b/plugins/housekeeping/msd-disk-space.c
@@ -207,7 +207,7 @@ ldsm_notify_for_mount (LdsmMountInfo *mount,
g_object_ref (G_OBJECT (dialog));
response = gtk_dialog_run (GTK_DIALOG (dialog));
- gtk_object_destroy (GTK_OBJECT (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
dialog = NULL;
switch (response) {
diff --git a/plugins/housekeeping/msd-housekeeping-manager.c b/plugins/housekeeping/msd-housekeeping-manager.c
index e9e27c9..cbb1143 100644
--- a/plugins/housekeeping/msd-housekeeping-manager.c
+++ b/plugins/housekeeping/msd-housekeeping-manager.c
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2008 Michael J. Chudobiak <[email protected]>
+ * Copyright (C) 2012 Jasmine Hassan <[email protected]>
*
* 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
@@ -32,14 +33,12 @@
#define INTERVAL_ONCE_A_DAY 24*60*60
#define INTERVAL_TWO_MINUTES 2*60
-
/* Thumbnail cleaner */
-#define GSETTINGS_THUMB_SCHEMA "org.mate.thumbnail-cache"
-#define GSETTINGS_THUMB_AGE "maximum-age"
-#define DEFAULT_MAX_AGE_IN_DAYS 180
-#define GSETTINGS_THUMB_SIZE "maximum-size"
-#define DEFAULT_MAX_SIZE_IN_MB 512
-
+#define THUMB_CACHE_SCHEMA "org.mate.thumbnail-cache"
+#define THUMB_CACHE_KEY_AGE "maximum-age"
+#define THUMB_CACHE_KEY_SIZE "maximum-size"
+#define DEFAULT_MAX_AGE 180 /* in Days */
+#define DEFAULT_MAX_SIZE 512 /* in MB */
struct MsdHousekeepingManagerPrivate {
guint long_term_cb;
@@ -47,7 +46,6 @@ struct MsdHousekeepingManagerPrivate {
GSettings *settings;
};
-
#define MSD_HOUSEKEEPING_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MSD_TYPE_HOUSEKEEPING_MANAGER, MsdHousekeepingManagerPrivate))
static void msd_housekeeping_manager_class_init (MsdHousekeepingManagerClass *klass);
@@ -84,7 +82,6 @@ thumb_data_free (gpointer data)
}
}
-
static GList *
read_dir_for_purge (const char *path, GList *files)
{
@@ -134,7 +131,6 @@ read_dir_for_purge (const char *path, GList *files)
return files;
}
-
static void
purge_old_thumbnails (ThumbData *info, PurgeData *purge_data)
{
@@ -146,29 +142,55 @@ purge_old_thumbnails (ThumbData *info, PurgeData *purge_data)
}
}
-
static int
sort_file_mtime (ThumbData *file1, ThumbData *file2)
{
return file1->mtime - file2->mtime;
}
+static gboolean
+int_gsettings_mapping (GVariant *value,
+ gpointer *result,
+ gpointer int_ptr)
+{
+ gint32 key_value = g_variant_get_int32 (value);
+
+ /* NULL value means the "last chance" for us to return a valid value */
+ if (value == NULL) {
+ *result = int_ptr; /* use the supplied default value */
+ return TRUE;
+ }
+
+ /* For either AGE/SIZE keys, -1 disables cleaning.
+ * A zero value corresponds to an extra-paranoid level of cleaning
+ */
+ if (key_value >= -1) {
+ *result = &key_value;
+ return TRUE;
+ }
+
+ return FALSE;
+}
static int
-get_gsettings_int_with_default (GSettings *settings, char *key, int default_value)
+get_max_age (MsdHousekeepingManager *manager)
{
- /* If the key is unset, we use a non-zero default value.
- A zero value corresponds to an extra-paranoid level
- of cleaning - it deletes all files. We don't want that
- as a default condition. */
- int value = g_settings_get_int (settings, key);
-
- if (value == NULL || value == 0)
- value = default_value;
-
- return value;
+ int *age = g_settings_get_mapped (manager->priv->settings,
+ THUMB_CACHE_KEY_AGE,
+ int_gsettings_mapping,
+ GINT_TO_POINTER(DEFAULT_MAX_AGE));
+ return *age * 24 * 60 * 60;
}
+static int
+get_max_size (MsdHousekeepingManager *manager)
+{
+ int *size = g_settings_get_mapped (manager->priv->settings,
+ THUMB_CACHE_KEY_SIZE,
+ int_gsettings_mapping,
+ GINT_TO_POINTER(DEFAULT_MAX_SIZE));
+ return *size * 1024 * 1024;
+}
static void
purge_thumbnail_cache (MsdHousekeepingManager *manager)
@@ -206,8 +228,8 @@ purge_thumbnail_cache (MsdHousekeepingManager *manager)
g_get_current_time (&current_time);
purge_data.now = current_time.tv_sec;
- purge_data.max_age = get_gsettings_int_with_default (manager->priv->settings, GSETTINGS_THUMB_AGE, DEFAULT_MAX_AGE_IN_DAYS) * 24 * 60 * 60;
- purge_data.max_size = get_gsettings_int_with_default (manager->priv->settings, GSETTINGS_THUMB_SIZE, DEFAULT_MAX_SIZE_IN_MB) * 1024 * 1024;
+ purge_data.max_age = get_max_age (manager);
+ purge_data.max_size = get_max_size (manager);
purge_data.total_size = 0;
if (purge_data.max_age >= 0)
@@ -227,7 +249,6 @@ purge_thumbnail_cache (MsdHousekeepingManager *manager)
g_list_free (files);
}
-
static gboolean
do_cleanup (MsdHousekeepingManager *manager)
{
@@ -235,7 +256,6 @@ do_cleanup (MsdHousekeepingManager *manager)
return TRUE;
}
-
static gboolean
do_cleanup_once (MsdHousekeepingManager *manager)
{
@@ -244,7 +264,6 @@ do_cleanup_once (MsdHousekeepingManager *manager)
return FALSE;
}
-
static void
do_cleanup_soon (MsdHousekeepingManager *manager)
{
@@ -256,14 +275,14 @@ do_cleanup_soon (MsdHousekeepingManager *manager)
}
}
-
static void
-bindings_callback (GSettings *settings, gchar *key, MsdHousekeepingManager *manager)
+settings_changed_callback (GSettings *settings,
+ const char *key,
+ MsdHousekeepingManager *manager)
{
do_cleanup_soon (manager);
}
-
gboolean
msd_housekeeping_manager_start (MsdHousekeepingManager *manager,
GError **error)
@@ -273,9 +292,10 @@ msd_housekeeping_manager_start (MsdHousekeepingManager *manager,
msd_ldsm_setup (FALSE);
- manager->priv->settings = g_settings_new (GSETTINGS_THUMB_SCHEMA);
+ manager->priv->settings = g_settings_new (THUMB_CACHE_SCHEMA);
- g_signal_connect (manager->priv->settings, "changed", G_CALLBACK (bindings_callback), manager);
+ g_signal_connect (manager->priv->settings, "changed",
+ G_CALLBACK (settings_changed_callback), manager);
/* Clean once, a few minutes after start-up */
do_cleanup_soon (manager);
@@ -289,7 +309,6 @@ msd_housekeeping_manager_start (MsdHousekeepingManager *manager,
return TRUE;
}
-
void
msd_housekeeping_manager_stop (MsdHousekeepingManager *manager)
{
@@ -297,8 +316,6 @@ msd_housekeeping_manager_stop (MsdHousekeepingManager *manager)
g_debug ("Stopping housekeeping manager");
- g_object_unref (p->settings);
-
if (p->short_term_cb) {
g_source_remove (p->short_term_cb);
p->short_term_cb = 0;
@@ -308,32 +325,33 @@ msd_housekeeping_manager_stop (MsdHousekeepingManager *manager)
g_source_remove (p->long_term_cb);
p->long_term_cb = 0;
- /* Do a clean-up on shutdown if and only if the size or age
- limits have been set to paranoid levels (zero) */
- if ((get_gsettings_int_with_default (p->settings, GSETTINGS_THUMB_AGE, DEFAULT_MAX_AGE_IN_DAYS) == 0) ||
- (get_gsettings_int_with_default (p->settings, GSETTINGS_THUMB_SIZE, DEFAULT_MAX_SIZE_IN_MB) == 0)) {
- do_cleanup (manager);
- }
+ /* Do a clean-up on shutdown if and only if the size or age
+ * limits have been set to a paranoid level of cleaning (zero)
+ */
+ if (get_max_age (manager) == 0 || get_max_size (manager) == 0)
+ {
+ do_cleanup (manager);
+ }
}
+ g_object_unref (p->settings);
+ p->settings = NULL;
+
msd_ldsm_clean ();
}
-
static void
msd_housekeeping_manager_class_init (MsdHousekeepingManagerClass *klass)
{
g_type_class_add_private (klass, sizeof (MsdHousekeepingManagerPrivate));
}
-
static void
msd_housekeeping_manager_init (MsdHousekeepingManager *manager)
{
manager->priv = MSD_HOUSEKEEPING_MANAGER_GET_PRIVATE (manager);
}
-
MsdHousekeepingManager *
msd_housekeeping_manager_new (void)
{
diff --git a/plugins/housekeeping/msd-ldsm-dialog.c b/plugins/housekeeping/msd-ldsm-dialog.c
index 7615206..0624448 100644
--- a/plugins/housekeeping/msd-ldsm-dialog.c
+++ b/plugins/housekeeping/msd-ldsm-dialog.c
@@ -17,11 +17,16 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
+#include <glib.h>
#include <glib/gi18n.h>
#include <gio/gio.h>
#include "msd-ldsm-dialog.h"
+#if GLIB_CHECK_VERSION (2, 30, 0)
+#define g_format_size_for_display g_format_size
+#endif
+
#define SETTINGS_SCHEMA "org.mate.SettingsDaemon.plugins.housekeeping"
#define SETTINGS_IGNORE_PATHS "ignore-paths"
@@ -151,25 +156,25 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
{
MsdLdsmDialog *dialog = (MsdLdsmDialog *)user_data;
GSettings *settings;
- GSList *ignore_paths;
+ gchar **settings_list;
+ GSList *ignore_paths = NULL;
GError *error = NULL;
gboolean ignore, ret, updated;
- gchar **settings_list;
-
+ gint i;
+
settings = g_settings_new (SETTINGS_SCHEMA);
-
+
settings_list = g_settings_get_strv (settings, SETTINGS_IGNORE_PATHS);
- if (settings_list != NULL) {
- gint i;
- for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
- if (settings_list[i] != NULL)
- ignore_paths = g_slist_append (ignore_paths, g_strdup (settings_list[i]));
- }
- g_strfreev (settings_list);
+ for (i = 0; i < G_N_ELEMENTS (settings_list); i++) {
+ if (settings_list[i] != NULL)
+ ignore_paths = g_slist_prepend (ignore_paths, g_strdup (settings_list[i]));
}
-
-
+ g_strfreev (settings_list);
+
+ if (i > 0)
+ ignore_paths = g_slist_reverse (ignore_paths);
+
ignore = gtk_toggle_button_get_active (button);
updated = update_ignore_paths (&ignore_paths, dialog->priv->mount_path, ignore);
@@ -179,9 +184,10 @@ ignore_check_button_toggled_cb (GtkToggleButton *button,
for (l = ignore_paths; l != NULL; l = l->next)
g_ptr_array_add (array, l->data);
+
g_ptr_array_add (array, NULL);
- if (!g_settings_set_strv (settings, "ignore-paths", (const gchar **) array->pdata)) {
+ if (!g_settings_set_strv (settings, SETTINGS_IGNORE_PATHS, (const gchar **) array->pdata)) {
g_warning ("Cannot change ignore preference - failed to commit changes");
}
@@ -213,9 +219,6 @@ msd_ldsm_dialog_init (MsdLdsmDialog *dialog)
gtk_window_set_focus_on_map (GTK_WINDOW (dialog), FALSE);
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- /* We don't want a separator - they're really ugly */
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
-
/* Create the image */
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_DIALOG);
gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
diff --git a/plugins/housekeeping/msd-ldsm-trash-empty.c b/plugins/housekeeping/msd-ldsm-trash-empty.c
index af01aa1..a12f8ce 100644
--- a/plugins/housekeeping/msd-ldsm-trash-empty.c
+++ b/plugins/housekeeping/msd-ldsm-trash-empty.c
@@ -318,7 +318,7 @@ trash_empty_confirmation_response (GtkDialog *dialog,
if (response_id == GTK_RESPONSE_YES)
trash_empty_start ();
- gtk_object_destroy (GTK_OBJECT (dialog));
+ gtk_widget_destroy (GTK_WIDGET (dialog));
trash_empty_confirm_dialog = NULL;
}
diff --git a/plugins/keyboard/msd-keyboard-xkb.c b/plugins/keyboard/msd-keyboard-xkb.c
index d922210..b9b5c24 100644
--- a/plugins/keyboard/msd-keyboard-xkb.c
+++ b/plugins/keyboard/msd-keyboard-xkb.c
@@ -103,22 +103,14 @@ static void msd_keyboard_log_appender(const char file[], const char function[],
}
#endif
-static void g_strv_delete_str (gchar **a, gchar *str)
+static void
+g_strv_behead (gchar **arr)
{
- int i;
- int j;
- gchar **b;
- b = g_new0 (gchar *, g_strv_length (a) - 1);
-
- j = 0;
- for (i = 0; a[i] != NULL; i++) {
- if (g_strcmp0 (a[i], str) != 0) {
- b[j] = g_strdup (a[i]);
- j++;
- }
- }
- g_strfreev (a);
- a = b;
+ if (arr == NULL || *arr == NULL)
+ return;
+
+ g_free (*arr);
+ memmove (arr, arr + 1, g_strv_length (arr) * sizeof (gchar *));
}
static void
@@ -245,7 +237,11 @@ popup_menu_show_layout ()
matekbd_keyboard_drawing_new_dialog (xkl_state->group,
group_names
[xkl_state->group]);
+# if GTK_CHECK_VERSION(3,0,0)
+ g_signal_connect (dialog, "destroy",
+# else
g_signal_connect (GTK_OBJECT (dialog), "destroy",
+#endif
G_CALLBACK (show_layout_destroy),
GINT_TO_POINTER (xkl_state->group));
g_hash_table_insert (preview_dialogs,
@@ -352,6 +348,7 @@ show_hide_icon ()
xkl_debug (150, "Creating new icon\n");
icon = matekbd_status_new ();
+ gtk_status_icon_set_name (icon, "keyboard");
g_signal_connect (icon, "popup-menu",
G_CALLBACK
(status_icon_popup_menu_cb),
@@ -393,7 +390,6 @@ filter_xkb_config (void)
gchar *lname;
gchar *vname;
gchar **lv;
- int i;
gboolean any_change = FALSE;
xkl_debug (100, "Filtering configuration against the registry\n");
@@ -407,24 +403,20 @@ filter_xkb_config (void)
return FALSE;
}
}
- lv = g_strdupv(current_kbd_config.layouts_variants);
+ lv = current_kbd_config.layouts_variants;
item = xkl_config_item_new ();
- for (lv = 0; lv[i] != NULL; i++) {
- xkl_debug (100, "Checking [%s]\n", lv[i]);
- if (matekbd_keyboard_config_split_items
- (lv[i], &lname, &vname)) {
+ while (*lv) {
+ xkl_debug (100, "Checking [%s]\n", *lv);
+ if (matekbd_keyboard_config_split_items (*lv, &lname, &vname)) {
+ gboolean should_be_dropped = FALSE;
g_snprintf (item->name, sizeof (item->name), "%s",
lname);
if (!xkl_config_registry_find_layout
(xkl_registry, item)) {
xkl_debug (100, "Bad layout [%s]\n",
lname);
- g_strv_delete_str (current_kbd_config.layouts_variants,
- lv[i]);
- any_change = TRUE;
- continue;
- }
- if (vname) {
+ should_be_dropped = TRUE;
+ } else if (vname) {
g_snprintf (item->name,
sizeof (item->name), "%s",
vname);
@@ -433,14 +425,16 @@ filter_xkb_config (void)
xkl_debug (100,
"Bad variant [%s(%s)]\n",
lname, vname);
- g_strv_delete_str
- (current_kbd_config.layouts_variants,
- lv[i]);
- any_change = TRUE;
- continue;
+ should_be_dropped = TRUE;
}
}
+ if (should_be_dropped) {
+ g_strv_behead (lv);
+ any_change = TRUE;
+ continue;
+ }
}
+ lv++;
}
g_object_unref (item);
return any_change;
diff --git a/plugins/media-keys/Makefile.am b/plugins/media-keys/Makefile.am
index 9bd9553..d0a7b6a 100644
--- a/plugins/media-keys/Makefile.am
+++ b/plugins/media-keys/Makefile.am
@@ -56,15 +56,15 @@ uninstall-local:
rm -f $(DESTDIR)$(icondir)/scalable/$(context)/touchpad-disabled.svg
msd-media-keys-manager-glue.h: msd-media-keys-manager.xml Makefile
- dbus-binding-tool --prefix=msd_media_keys_manager --mode=glib-server $< > xgen-$(@F) \
+ $(AM_V_GEN) dbus-binding-tool --prefix=msd_media_keys_manager --mode=glib-server $< > xgen-$(@F) \
&& ( cmp -s xgen-$(@F) $@ || cp xgen-$(@F) $@ ) \
&& rm -f xgen-$(@F)
msd-marshal.c: msd-marshal.list
- $(GLIB_GENMARSHAL) --prefix=msd_marshal $< --header --body --internal > $@
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=msd_marshal $< --header --body --internal > $@
msd-marshal.h: msd-marshal.list
- $(GLIB_GENMARSHAL) --prefix=msd_marshal $< --header --internal > $@
+ $(AM_V_GEN) $(GLIB_GENMARSHAL) --prefix=msd_marshal $< --header --internal > $@
libmedia_keys_la_SOURCES = \
msd-media-keys-plugin.h \
diff --git a/plugins/media-keys/msd-media-keys-manager.c b/plugins/media-keys/msd-media-keys-manager.c
index 0741f12..5583416 100644
--- a/plugins/media-keys/msd-media-keys-manager.c
+++ b/plugins/media-keys/msd-media-keys-manager.c
@@ -157,28 +157,23 @@ acme_error (char * msg)
static char *
get_term_command (MsdMediaKeysManager *manager)
{
- char *cmd_term;
- char *cmd = NULL;
-
- GSettings *settings_terminal;
- settings_terminal = g_settings_new ("org.mate.applications-terminal");
-
- cmd_term = g_settings_get_string (settings_terminal, "exec");
- if ((cmd_term != NULL) && (strcmp (cmd_term, "") != 0)) {
- char *cmd_args;
- cmd_args = g_settings_get_string (settings_terminal, "exec_arg");
- if ((cmd_args != NULL) && (strcmp (cmd_term, "") != 0)) {
- cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args);
- } else {
- cmd = g_strdup_printf ("%s -e", cmd_term);
- }
-
- g_free (cmd_args);
- }
-
- g_free (cmd_term);
+ char *cmd_term, *cmd_args;
+ char *cmd = NULL;
+ GSettings *settings;
+
+ settings = g_settings_new ("org.mate.applications-terminal");
+ cmd_term = g_settings_get_string (settings, "exec");
+ cmd_args = g_settings_get_string (settings, "exec_arg");
+
+ if (cmd_term[0] != '\0') {
+ cmd = g_strdup_printf ("%s %s -e", cmd_term, cmd_args);
+ } else {
+ cmd = g_strdup_printf ("mate-terminal -e");
+ }
- g_object_unref (settings_terminal);
+ g_free (cmd_args);
+ g_free (cmd_term);
+ g_object_unref (settings);
return cmd;
}
@@ -662,10 +657,7 @@ do_sound_action (MsdMediaKeysManager *manager,
return;
#endif
- vol_step = g_settings_get_int (manager->priv->settings, "volume-step");
-
- if (vol_step <= 0 || vol_step > 100)
- vol_step = VOLUME_STEP;
+ vol_step = VOLUME_STEP;
#ifdef HAVE_PULSE
norm_vol_step = PA_VOLUME_NORM * vol_step / 100;
diff --git a/plugins/mouse/msd-locate-pointer.c b/plugins/mouse/msd-locate-pointer.c
index 8f44646..f13f7a0 100644
--- a/plugins/mouse/msd-locate-pointer.c
+++ b/plugins/mouse/msd-locate-pointer.c
@@ -242,15 +242,15 @@ create_window (MsdLocatePointerData *data,
GdkColormap *colormap;
GdkVisual *visual;
GdkWindowAttr attributes;
+ gint attributes_mask;
colormap = gdk_screen_get_rgba_colormap (screen);
visual = gdk_screen_get_rgba_visual (screen);
- if (!colormap)
- {
- colormap = gdk_screen_get_rgb_colormap (screen);
- visual = gdk_screen_get_rgb_visual (screen);
- }
+ attributes_mask = GDK_WA_X | GDK_WA_Y;
+
+ if (colormap)
+ attributes_mask = attributes_mask | GDK_WA_VISUAL | GDK_WA_COLORMAP;
attributes.window_type = GDK_WINDOW_TEMP;
attributes.wclass = GDK_INPUT_OUTPUT;
@@ -262,7 +262,7 @@ create_window (MsdLocatePointerData *data,
data->window = gdk_window_new (gdk_screen_get_root_window (screen),
&attributes,
- GDK_WA_X | GDK_WA_Y | GDK_WA_VISUAL | GDK_WA_COLORMAP);
+ attributes_mask);
gdk_window_set_user_data (data->window, data->widget);
}
@@ -301,8 +301,7 @@ move_locate_pointer_window (MsdLocatePointerData *data,
{
gint cursor_x, cursor_y;
GdkBitmap *mask;
- GdkColor col;
- GdkGC *gc;
+ cairo_t *cr;
gdk_window_get_pointer (gdk_screen_get_root_window (screen), &cursor_x, &cursor_y, NULL);
@@ -311,18 +310,18 @@ move_locate_pointer_window (MsdLocatePointerData *data,
cursor_y - WINDOW_SIZE / 2,
WINDOW_SIZE, WINDOW_SIZE);
- col.pixel = 0;
mask = gdk_pixmap_new (data->window, WINDOW_SIZE, WINDOW_SIZE, 1);
- gc = gdk_gc_new (mask);
- gdk_gc_set_foreground (gc, &col);
- gdk_draw_rectangle (mask, gc, TRUE, 0, 0, WINDOW_SIZE, WINDOW_SIZE);
+ cr = gdk_cairo_create (mask);
+ cairo_set_source_rgb (cr, 0., 0., 0.);
+ cairo_rectangle (cr, 0., 0., WINDOW_SIZE, WINDOW_SIZE);
+ cairo_fill (cr);
+ cairo_destroy (cr);
/* allow events to happen through the window */
gdk_window_input_shape_combine_mask (data->window, mask, 0, 0);
g_object_unref (mask);
- g_object_unref (gc);
}
void
@@ -381,7 +380,7 @@ filter (GdkXEvent *xevent,
group,
&keyval,
NULL, NULL, NULL);
- if (keyval == GDK_Control_L || keyval == GDK_Control_R)
+ if (keyval == GDK_KEY_Control_L || keyval == GDK_KEY_Control_R)
{
if (xev->type == KeyPress)
{
@@ -418,7 +417,7 @@ set_locate_pointer (void)
int n_screens;
int n_keys;
gboolean has_entries;
- static const guint keyvals[] = { GDK_Control_L, GDK_Control_R };
+ static const guint keyvals[] = { GDK_KEY_Control_L, GDK_KEY_Control_R };
unsigned j;
display = gdk_display_get_default ();
diff --git a/plugins/mouse/msd-mouse-manager.c b/plugins/mouse/msd-mouse-manager.c
index 3e6381a..fe89da2 100644
--- a/plugins/mouse/msd-mouse-manager.c
+++ b/plugins/mouse/msd-mouse-manager.c
@@ -320,6 +320,7 @@ set_xinput_devices_left_handed (gboolean left_handed)
if ((device_info[i].use == IsXPointer) ||
(device_info[i].use == IsXKeyboard) ||
+ (g_strcmp0 ("Virtual core XTEST pointer", device_info[i].name) == 0) ||
(!xinput_device_has_buttons (&device_info[i])))
continue;
diff --git a/plugins/xrandr/Makefile.am b/plugins/xrandr/Makefile.am
index 1a398d7..b4afb93 100644
--- a/plugins/xrandr/Makefile.am
+++ b/plugins/xrandr/Makefile.am
@@ -35,7 +35,7 @@ plugin_LTLIBRARIES = \
libxrandr.la
msd-xrandr-manager-glue.h: msd-xrandr-manager.xml Makefile
- dbus-binding-tool --prefix=msd_xrandr_manager --mode=glib-server $< > xgen-$(@F) \
+ $(AM_V_GEN) dbus-binding-tool --prefix=msd_xrandr_manager --mode=glib-server $< > xgen-$(@F) \
&& ( cmp -s xgen-$(@F) $@ || cp xgen-$(@F) $@ ) \
&& rm -f xgen-$(@F)
@@ -55,6 +55,7 @@ libxrandr_la_CPPFLAGS = \
libxrandr_la_CFLAGS = \
$(SETTINGS_PLUGIN_CFLAGS) \
$(LIBMATENOTIFY_CFLAGS) \
+ $(MATE_DESKTOP_CFLAGS) \
$(AM_CFLAGS)
libxrandr_la_LDFLAGS = \
@@ -62,7 +63,8 @@ libxrandr_la_LDFLAGS = \
libxrandr_la_LIBADD = \
$(SETTINGS_PLUGIN_LIBS) \
- $(LIBMATENOTIFY_LIBS)
+ $(LIBMATENOTIFY_LIBS) \
+ $(MATE_DESKTOP_LIBS)
plugin_in_files = \
xrandr.mate-settings-plugin.in
diff --git a/plugins/xrandr/msd-xrandr-manager.c b/plugins/xrandr/msd-xrandr-manager.c
index 7c6a046..c56cd51 100644
--- a/plugins/xrandr/msd-xrandr-manager.c
+++ b/plugins/xrandr/msd-xrandr-manager.c
@@ -2156,7 +2156,8 @@ on_config_changed (GSettings *settings,
gchar *key,
MsdXrandrManager *manager)
{
- start_or_stop_icon (manager);
+ if (g_strcmp0 (key, CONF_KEY_SHOW_NOTIFICATION_ICON) == 0)
+ start_or_stop_icon (manager);
}
static gboolean