Author: kelnos Date: 2008-06-27 08:31:15 +0000 (Fri, 27 Jun 2008) New Revision: 27157
Added: xfdesktop/trunk/doc/README.xfconf xfdesktop/trunk/scripts/ xfdesktop/trunk/scripts/Makefile.am xfdesktop/trunk/scripts/xfconf-xfdesktop-migration-4.6.desktop.in xfdesktop/trunk/scripts/xfdesktop-xfconf-migration.pl.in Removed: xfdesktop/trunk/src/settings.c xfdesktop/trunk/src/settings.h Modified: xfdesktop/trunk/Makefile.am xfdesktop/trunk/configure.ac.in xfdesktop/trunk/src/Makefile.am xfdesktop/trunk/src/main.c xfdesktop/trunk/src/menu.c xfdesktop/trunk/src/menu.h xfdesktop/trunk/src/windowlist.c xfdesktop/trunk/src/windowlist.h xfdesktop/trunk/src/xfce-desktop-settings.c xfdesktop/trunk/src/xfce-desktop-settings.h Log: WIP: xfconf migration Modified: xfdesktop/trunk/Makefile.am =================================================================== --- xfdesktop/trunk/Makefile.am 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/Makefile.am 2008-06-27 08:31:15 UTC (rev 27157) @@ -15,6 +15,7 @@ $(panel_plugin_dir) \ po \ po-doc \ + scripts \ settings \ src \ $(menueditor_dir) \ Modified: xfdesktop/trunk/configure.ac.in =================================================================== --- xfdesktop/trunk/configure.ac.in 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/configure.ac.in 2008-06-27 08:31:15 UTC (rev 27157) @@ -68,10 +68,8 @@ XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [libxfce4util_minimum_version]) XDT_CHECK_PACKAGE([LIBXFCEGUI4], [libxfcegui4-1.0], [xfce_minimum_version]) -XDT_CHECK_PACKAGE([LIBXFCE4MCS_CLIENT], [libxfce4mcs-client-1.0], - [xfce_minimum_version]) XDT_CHECK_PACKAGE([LIBWNCK], [libwnck-1.0], [wnck_minimum_version]) -XDT_XFCE_MCS_PLUGIN([XFCE_MCS_MANAGER], [xfce_minimum_version]) +XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [0.1.0svn-r26876]) dnl do we want desktop icons at all? AC_ARG_ENABLE([desktop-icons], @@ -244,7 +242,7 @@ AC_ARG_ENABLE([xml2po], [AC_HELP_STRING([--enable-xml2po], [Use xml2po to translate documentation @<:@default=no@:>@])], - , [enable_xml2po=no]) + [], [enable_xml2po=no]) if test "x$enable_xml2po" = "xyes"; then AC_PATH_PROG([XML2PO], [xml2po], [no]) if test "x$XML2PO" = "xno"; then @@ -253,6 +251,25 @@ fi AM_CONDITIONAL([ENABLE_XML2PO], [test "x$enable_xml2po" = "xyes"]) +dnl the xfconf migration requires perl with XML::Parser +AC_ARG_ENABLE([xfconf-migration], + [AC_HELP_STRING([--disable-xfconf-migration], + [Don't require perl/XML::Parser for Xfconf settings migration @<:@default=required@:>@])], + [do_xfconf_migration=$enableval], [do_xfconf_migration=yes]) +if test "x$do_xfconf_migration" = "xyes"; then + AC_PATH_PROGS([PERL], [perl5 perl]) + if test -z "$PERL"; then + AC_MSG_ERROR([perl not found; required for Xfconf migration. Pass --disable-xfconf-migration to ignore this.]) + fi + AC_MSG_CHECKING([for XML::Parser]) + if `$PERL -e 'require XML::Parser;' >/dev/null 2>&1`; then + AC_MSG_RESULT([found]) + else + AC_MSG_RESULT([not found]) + AC_MSG_ERROR([perl module XML::Parser not found; required for Xfconf migration. Pass --disable-xfconf-migration to ignore this.]) + fi +fi + dnl check for debugging support XDT_FEATURE_DEBUG @@ -276,6 +293,7 @@ pixmaps/Makefile po/Makefile.in po-doc/Makefile +scripts/Makefile settings/Makefile src/Makefile xfdesktop.spec Added: xfdesktop/trunk/doc/README.xfconf =================================================================== --- xfdesktop/trunk/doc/README.xfconf (rev 0) +++ xfdesktop/trunk/doc/README.xfconf 2008-06-27 08:31:15 UTC (rev 27157) @@ -0,0 +1,46 @@ +Xfdesktop now uses Xfconf to store its configuration. Xfconf is a +hierarchical configuration system. The channel name that xfdesktop uses +is 'xfce4-desktop'. Property names below should be referred to with each +component separated by a slash ('/') character. The data type of each +property is listd after the name. + +<manage-desktop> + <show-warning-off bool> + <show-warning-on bool> +</manage-desktop> +<backdrop> + <screen0> + <xinerama-stretch bool> + <monitor0> + <brightness int> + <color1 array:uint16,uint16,uint16> + <color2 array:uint16,uint16,uint16> + <color-style int> + <image-path string> + <image-style int> + <image-show bool> + </monitor0> + </screen0> +</backdrop> +<windowlist-menu> + <show bool> + <show-workspace-names bool> + <show-sticky-once bool> + <show-submenus bool> +</windowlist> +<desktop-menu> + <show bool> + <show-menu-icons bool> +</desktop-menu> +<desktop-icons> + <style int> + <use-system-font-size bool> + <font-size uint> + <icon-size uint> + <file-icons> + <show-filesystem bool> + <show-home bool> + <show-trash bool> + <show-removable bool> + </file-icons> +</desktop-icons> Added: xfdesktop/trunk/scripts/Makefile.am =================================================================== --- xfdesktop/trunk/scripts/Makefile.am (rev 0) +++ xfdesktop/trunk/scripts/Makefile.am 2008-06-27 08:31:15 UTC (rev 27157) @@ -0,0 +1,19 @@ +migrationscriptdir = $(datadir)/xfce4/xfconf-migration +migrationscript_in_files = xfdesktop-xfconf-migration.pl.in +migrationscript_DATA = $(migrationscript_in_files:.pl.in=.pl) + +%.pl: $(srcdir)/%.pl.in + sed 's,[EMAIL PROTECTED]@,$(sysconfdir),g' < $< > $@ + +autostartdir = $(sysconfdir)/xdg/autostart +autostart_in_files = xfconf-xfdesktop-migration-4.6.desktop +autostart_DATA = $(autostart_in_files:.desktop.in=.desktop) + +%.desktop: $(srcdir)/%.desktop.in + sed 's,[EMAIL PROTECTED]@,$(datadir),' < $< >$@ + +EXTRA_DIST = \ + $(migrationscript_in_files) + +DISTCLEANFILES = \ + $(migrationscript_DATA) Added: xfdesktop/trunk/scripts/xfconf-xfdesktop-migration-4.6.desktop.in =================================================================== --- xfdesktop/trunk/scripts/xfconf-xfdesktop-migration-4.6.desktop.in (rev 0) +++ xfdesktop/trunk/scripts/xfconf-xfdesktop-migration-4.6.desktop.in 2008-06-27 08:31:15 UTC (rev 27157) @@ -0,0 +1,9 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Name=Xfconf Xfdesktop Migration Script [EMAIL PROTECTED]@/xfce4/xfconf-migration/xfdesktop-xfconf-migration.pl +Terminal=false +Type=Application +StartupNotify=false +Terminal=false Added: xfdesktop/trunk/scripts/xfdesktop-xfconf-migration.pl.in =================================================================== --- xfdesktop/trunk/scripts/xfdesktop-xfconf-migration.pl.in (rev 0) +++ xfdesktop/trunk/scripts/xfdesktop-xfconf-migration.pl.in 2008-06-27 08:31:15 UTC (rev 27157) @@ -0,0 +1,210 @@ +#!/usr/bin/perl -w + +use XML::Parser; +use strict; + +my $xfconf_channel = 'xfce4-desktop'; +my $mcs_channel = 'backdrop'; +my $autostart_file = 'xfconf-xfdesktop-migration-4.6.desktop'; + +sub xfconf_set { + my ($prop, $type, $val) = @_; + my $cmd = qq(xfconf-query -n -c $xfconf_channel -p $prop -t $type -s "$val"); + print $cmd."\n"; + system($cmd); +} + +sub xfconf_set_color { + my ($prop, $val) = @_; + + if($val =~ /\s*(\d+),\s*(\d+),\s*(\d+),\s*(\d+)/) { + my ($r,$g,$b) = ($1,$2,$3); + + my $cmd = "xfconf-query -n -c $xfconf_channel -p $prop "; + $cmd .= "-t uint16 -t uint16 -t uint16 "; + $cmd .= "-s $r -s $g -s $b"; + + print $cmd."\n"; + system($cmd); + } else { + print STDERR "Couldn't parse color \"$val\""; + } +} + +sub tobool { + my $val = shift; + return ($val == 0 || lc($val) eq 'false' ? 'false' : 'true'); +} + +if(!defined($ENV{'XDG_CONFIG_HOME'})) { + $ENV{'XDG_CONFIG_HOME'} = $ENV{'HOME'}.'/.config'; +} + +my $p = XML::Parser->new(Style => 'Tree'); +my $mcs = $p->parsefile($ENV{'XDG_CONFIG_HOME'}.'/xfce4/mcs_settings/$mcs_channel.xml') or do { + print STDERR "No $mcs_channel.xml; nothing to migrate\n"; + exit(0); +}; + +my $mcs_option_element = -1; +for(my $i = 0; $i < scalar(@{$mcs}); $i++) { + if(${$mcs}[$i] eq 'mcs-option') { + $mcs_option_element = $i; + last; + } +} + +my @mcs_option = @{${$mcs}[$mcs_option_element+1]}; +my %options = (); +for(my $i = 0; $i < scalar(@mcs_option); $i++) { + if($mcs_option[$i] eq 'option') { + $options{${${$mcs_option[$i+1]}[0]}{'name'}} = ${$mcs_option[$i+1]}[0]; + } +} + +if(defined($options{'managedesktop-show-warning'})) { + xfconf_set('/manage-desktop/show-warning-off', + 'bool', + tobool($options{'managedesktop-show-warning'}->{'value'})); +} + +if(defined($options{'managedesktop-show-warning-on'})) { + xfconf_set('/manage-desktop/show-warning-on', + 'bool', + tobool($options{'managedesktop-show-warning-on'}->{'value'})); +} + +if(defined($options{'desktopiconstyle'})) { + xfconf_set('/desktop-icons/style', + 'int', + $options{'desktopiconstyle'}->{'value'}); +} + +if(defined($options{'icons_font_size'})) { + xfconf_set('/desktop-icons/font-size', + 'uint', + $options{'icons_font_size'}->{'value'}); +} + +if(defined($options{'icons_icon_size'})) { + xfconf_set('/desktop-icons/icon-size', + 'uint', + $options{'icons_icon_size'}->{'value'}); +} + +if(defined($options{'icons_use_system_font_size'})) { + xfconf_set('/desktop-icons/use-system-font-size', + 'bool', + tobool($options{'icons_use_system_font_size'}->{'value'})); +} + +if(defined($options{'showdm'})) { + xfconf_set('/desktop-menu/show', + 'bool', + tobool($options{'showdm'}->{'value'})); +} + +if(defined($options{'showdmi'})) { + xfconf_set('/desktop-menu/show-icons', + 'bool', + tobool($options{'showdmi'}->{'value'})); +} + +if(defined($options{'showwl'})) { + xfconf_set('/windowlist-menu/show', + 'bool', + tobool($options{'showwl'}->{'value'})); +} + +if(defined($options{'wl_show_ws_names'})) { + xfconf_set('/windowlist-menu/show-workspace-names', + 'bool', + tobool($options{'wl_show_ws_names'}->{'value'})); +} + +if(defined($options{'wl_sticky_once'})) { + xfconf_set('/windowlist-menu/show-sticky-once', + 'bool', + tobool($options{'wl_sticky_once'}->{'value'})); +} + +if(defined($options{'wl_submenus'})) { + xfconf_set('/windowlist-menu/show-submenus', + 'bool', + tobool($options{'wl_submenus'}->{'value'})); +} + +# this is a bit overkill. attempt up to 8 screens, 8 monitors +for(my $s = 0; $s < 8; $s++) { + for(my $m = 0; $m < 8; $m++) { + my $suf = '_'.$s.'_'.$m; + my $p = "/backdrop/screen$s/monitor$m"; + + # this is a crappy non-screen-numbered setting + if(defined($options{'xineramastretch'})) { + xfconf_set("/backdrop/screen$s/xinerama-stretch", + 'bool', + tobool($options{'xineramastretch'}->{'value'})); + } + + if(defined($options{'brightness'.$suf})) { + xfconf_set("$p/brightness", + 'int', + $options{'brightness'.$suf}->{'value'}); + } + + if(defined($options{'color1'.$suf})) { + xfconf_set_color("$p/color1", + $options{'color1'.$suf}->{'value'}); + } + + if(defined($options{'color2'.$suf})) { + xfconf_set_color("$p/color2", + $options{'color2'.$suf}->{'value'}); + } + + if(defined($options{'colorstyle'.$suf})) { + xfconf_set("$p/color-style", + 'int', + $options{'colorstyle'.$suf}->{'value'}); + } + + if(defined($options{'imagepath'.$suf})) { + xfconf_set("$p/image-path", + 'string', + $options{'imagepath'.$suf}->{'value'}); + } + + if(defined($options{'imagestyle'.$suf})) { + xfconf_set("$p/image-style", + 'int', + $options{'imagestyle'.$suf}->{'value'}); + } + + if(defined($options{'showimage'.$suf})) { + xfconf_set("$p/image-show", + 'bool', + tobool($options{'showimage'.$suf}->{'value'})); + } + } +} + +# 'hidden' options +open(RCFILE, '<'.$ENV{'XDG_CONFIG_HOME'}.'/xfce4/desktop/xfdesktoprc') and do { + while(<RCFILE>) { + my ($key, $val) = split(/\s*=\s*/, $_, 2); + if(defined($key) && ($key eq 'show-filesystem' || $key eq 'show-home' + || $key eq 'show-trash' || $key eq 'show-removable') + && defined($val)) + { + xfconf_set("/desktop-icons/file-icons/$key", 'bool', + tobool($val)); + } + } + close(RCFILE); +}; + +# do it this way so as not to require File::Copy +open(D, '>>@sysconfdir@/xdg/autostart/'.$autostart_file) or die("Unable to open @sysconfdir@/xdg/autostart/$autostart_file in append mode"); +print D "Hidden=true\n"; +close(D); Property changes on: xfdesktop/trunk/scripts/xfdesktop-xfconf-migration.pl.in ___________________________________________________________________ Name: svn:executable + * Modified: xfdesktop/trunk/src/Makefile.am =================================================================== --- xfdesktop/trunk/src/Makefile.am 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/Makefile.am 2008-06-27 08:31:15 UTC (rev 27157) @@ -4,8 +4,6 @@ main.c \ menu.c \ menu.h \ - settings.c \ - settings.h \ windowlist.c \ windowlist.h \ xfce-backdrop.c \ @@ -62,8 +60,8 @@ $(GTHREAD_CFLAGS) \ $(GMODULE_CFLAGS) \ $(LIBXFCEGUI4_CFLAGS) \ - $(LIBXFCE4MCS_CLIENT_CFLAGS) \ - $(LIBWNCK_CFLAGS) + $(LIBWNCK_CFLAGS) \ + $(XFCONF_CFLAGS) xfdesktop_LDFLAGS = \ -export-dynamic @@ -79,10 +77,9 @@ $(LIBX11_LIBS) \ $(GTHREAD_LIBS) \ $(LIBXFCEGUI4_LIBS) \ - $(LIBXFCE4MCS_CLIENT_LIBS) \ - $(LIBWNCK_LIBS) + $(LIBWNCK_LIBS) \ + $(XFCONF_LIBS) - if ENABLE_DESKTOP_ICONS xfdesktop_SOURCES += $(desktop_icon_sources) Modified: xfdesktop/trunk/src/main.c =================================================================== --- xfdesktop/trunk/src/main.c 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/main.c 2008-06-27 08:31:15 UTC (rev 27157) @@ -1,7 +1,7 @@ /* * xfdesktop - xfce4's desktop manager * - * Copyright (c) 2004 Brian Tarricone, <[EMAIL PROTECTED]> + * Copyright (c) 2004-2008 Brian Tarricone, <[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 @@ -46,7 +46,7 @@ #include <gdk/gdkx.h> #include <gtk/gtk.h> -#include <libxfce4mcs/mcs-client.h> +#include <xfconf/xfconf.h> #include <libxfcegui4/libxfcegui4.h> #ifdef ENABLE_FILE_ICONS @@ -54,20 +54,15 @@ #include <thunar-vfs/thunar-vfs.h> #endif -#if defined(ENABLE_FILE_ICONS) || defined(HAVE_THUNAR_VFS) -#endif - #include "xfdesktop-common.h" #include "xfce-backdrop.h" #include "xfce-desktop.h" #include "xfce-desktop-settings.h" #include "menu.h" #include "windowlist.h" -#include "settings.h" static SessionClient *client_session = NULL; static gboolean is_session_managed = FALSE; -static gboolean desktop_gtk_menu_images = TRUE; static void session_logout() @@ -83,18 +78,6 @@ } static void -desktop_settings_menu_images_notify(GObject *gobject, - GParamSpec *arg1, - gpointer user_data) -{ - g_object_get(G_OBJECT(gobject), - "gtk-menu-images", &desktop_gtk_menu_images, - NULL); - windowlist_set_show_icons(desktop_gtk_menu_images); - menu_set_show_icons(desktop_gtk_menu_images); -} - -static void event_forward_to_rootwin(GdkScreen *gscreen, GdkEvent *event) { XButtonEvent xev, xev2; @@ -170,7 +153,7 @@ static gboolean reload_idle_cb(gpointer data) { - settings_reload_all(); + //settings_reload_all(); /* FIXME */ menu_reload(); return FALSE; } @@ -203,7 +186,7 @@ xfdesktop_handle_SIGUSR1(gint signal, gpointer user_data) { - settings_reload_all(); + //settings_reload_all(); /* FIXME */ menu_reload(); } @@ -221,11 +204,10 @@ main(int argc, char **argv) { GdkDisplay *gdpy; - GtkWidget **desktops, *dummy; + GtkWidget **desktops; gint i, nscreens; Window xid; - McsClient *mcs_client; - GtkSettings *settings; + XfconfChannel *channel = NULL; const gchar *message = NULL; gboolean already_running; GError *error = NULL; @@ -324,19 +306,15 @@ #endif gdpy = gdk_display_get_default(); - mcs_client = settings_init(); - - /* need GtkImageMenuItem to install the property */ - dummy = gtk_image_menu_item_new(); - gtk_widget_destroy(dummy); - - settings = gtk_settings_get_for_screen(gdk_display_get_default_screen(gdpy)); - g_object_get(G_OBJECT(settings), - "gtk-menu-images", &desktop_gtk_menu_images, - NULL); - g_signal_connect(G_OBJECT(settings), "notify::gtk-menu-images", - G_CALLBACK(desktop_settings_menu_images_notify), NULL); - + + if(!xfconf_init(&error)) { + g_warning("%s: unable to connect to settings daemon: %s. Defaults will be used", + PACKAGE, error->message); + g_error_free(error); + error = NULL; + } else + channel = xfconf_channel_new(XFDESKTOP_CHANNEL); + nscreens = gdk_display_get_n_screens(gdpy); desktops = g_new(GtkWidget *, nscreens); for(i = 0; i < nscreens; i++) { @@ -349,10 +327,12 @@ G_CALLBACK(client_message_received), NULL); menu_attach(XFCE_DESKTOP(desktops[i])); windowlist_attach(XFCE_DESKTOP(desktops[i])); - if(mcs_client) { - settings_register_callback(xfce_desktop_settings_changed, desktops[i]); + if(channel) { + g_signal_connect(G_OBJECT(channel), "property-changed", + G_CALLBACK(xfce_desktop_settings_changed), + desktops[i]); xfce_desktop_settings_load_initial(XFCE_DESKTOP(desktops[i]), - mcs_client); + channel); } gtk_widget_show(desktops[i]); gdk_window_lower(desktops[i]->window); @@ -371,17 +351,9 @@ session_logout); } - menu_init(mcs_client); - menu_set_show_icons(desktop_gtk_menu_images); + menu_init(channel); + windowlist_init(channel); - windowlist_init(mcs_client); - windowlist_set_show_icons(desktop_gtk_menu_images); - - if(mcs_client) { - settings_register_callback(menu_settings_changed, desktops[0]); - settings_register_callback(windowlist_settings_changed, desktops[0]); - } - if(xfce_posix_signal_handler_init(&error)) { xfce_posix_signal_handler_set_handler(SIGHUP, xfdesktop_handle_quit_signals, @@ -409,7 +381,7 @@ gtk_widget_destroy(desktops[i]); g_free(desktops); - settings_cleanup(); + xfconf_shutdown(); #ifdef ENABLE_FILE_ICONS thunar_vfs_shutdown(); Modified: xfdesktop/trunk/src/menu.c =================================================================== --- xfdesktop/trunk/src/menu.c 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/menu.c 2008-06-27 08:31:15 UTC (rev 27157) @@ -1,7 +1,7 @@ /* * xfdesktop - xfce4's desktop manager * - * Copyright (c) 2004 Brian Tarricone, <[EMAIL PROTECTED]> + * Copyright (c) 2004-2008 Brian J. Tarricone <[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 @@ -126,26 +126,50 @@ } #endif +#ifdef USE_DESKTOP_MENU +static void +menu_settings_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + gpointer user_data) +{ + if(!strcmp(property, "/desktop-menu/show")) { + if(!G_VALUE_TYPE(value) || g_value_get_boolean(value)) { + if(!desktop_menu) + _start_menu_module(); + } else { + if(desktop_menu) + _stop_menu_module(); + } + } else if(!strcmp(property, "/desktop-menu/show-icons")) { + show_desktop_menu_icons = G_VALUE_TYPE(value) + ? g_value_get_boolean(value) + : TRUE; + if(desktop_menu) + xfce_desktop_menu_set_show_icons(desktop_menu, FALSE); + } +} +#endif + void -menu_init(McsClient *mcs_client) +menu_init(XfconfChannel *channel) { #ifdef USE_DESKTOP_MENU - McsSetting *setting = NULL; - - if(!mcs_client) + if(!channel + || xfconf_channel_get_bool(channel, "/desktop-menu/show", TRUE)) + { + if(channel) { + show_desktop_menu_icons = xfconf_channel_get_bool(channel, + "/desktop-menu/show-icons", + TRUE); + } _start_menu_module(); - else { - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, "showdm", - BACKDROP_CHANNEL, &setting)) - { - if(setting->data.v_int) - _start_menu_module(); - else - _stop_menu_module(); - mcs_setting_free(setting); - setting = NULL; - } else - _start_menu_module(); + } else + _stop_menu_module(); + + if(channel) { + g_signal_connect(G_OBJECT(channel), "property-changed", + G_CALLBACK(menu_settings_changed), NULL); } #endif } @@ -160,53 +184,7 @@ #endif } -gboolean -menu_settings_changed(McsClient *client, McsAction action, McsSetting *setting, - gpointer user_data) -{ -#ifdef USE_DESKTOP_MENU - McsSetting *setting1 = NULL; - - switch(action) { - case MCS_ACTION_NEW: - case MCS_ACTION_CHANGED: - if(!strcmp(setting->name, "showdm")) { - if(setting->data.v_int && !desktop_menu) { - _start_menu_module(); - if(desktop_menu - && MCS_SUCCESS == mcs_client_get_setting(client, - "showdmi", BACKDROP_CHANNEL, &setting1)) - { - if(!setting1->data.v_int) - xfce_desktop_menu_set_show_icons(desktop_menu, FALSE); - mcs_setting_free(setting1); - setting1 = NULL; - } - } else if(!setting->data.v_int && desktop_menu) - _stop_menu_module(); - return TRUE; - } - break; - - case MCS_ACTION_DELETED: - break; - } -#endif - - return FALSE; -} - void -menu_set_show_icons(gboolean show_icons) -{ -#ifdef USE_DESKTOP_MENU - show_desktop_menu_icons = show_icons; - if(desktop_menu) - xfce_desktop_menu_set_show_icons(desktop_menu, show_icons); -#endif -} - -void menu_reload() { #ifdef USE_DESKTOP_MENU Modified: xfdesktop/trunk/src/menu.h =================================================================== --- xfdesktop/trunk/src/menu.h 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/menu.h 2008-06-27 08:31:15 UTC (rev 27157) @@ -27,14 +27,12 @@ #include "xfce-desktop.h" -#include <libxfce4mcs/mcs-client.h> +#include <xfconf/xfconf.h> G_BEGIN_DECLS -void menu_init(McsClient *mcs_client); +void menu_init(XfconfChannel *channel); void menu_attach(XfceDesktop *desktop); -gboolean menu_settings_changed(McsClient *client, McsAction action, McsSetting *setting, gpointer user_data); -void menu_set_show_icons(gboolean show_icons); void menu_reload(); void menu_cleanup(); Deleted: xfdesktop/trunk/src/settings.c Deleted: xfdesktop/trunk/src/settings.h Modified: xfdesktop/trunk/src/windowlist.c =================================================================== --- xfdesktop/trunk/src/windowlist.c 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/windowlist.c 2008-06-27 08:31:15 UTC (rev 27157) @@ -1,7 +1,7 @@ /* * xfdesktop - xfce4's desktop manager * - * Copyright (c) 2004 Brian Tarricone, <[EMAIL PROTECTED]> + * Copyright (c) 2004-2008 Brian Tarricone <[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 @@ -399,46 +399,44 @@ G_CALLBACK(set_num_workspaces), GINT_TO_POINTER(nworkspaces-1)); } +static void +windowlist_settings_changed(XfconfChannel *channel, + const gchar *property, + const GValue *value, + gpointer user_data) +{ + if(!strcmp(property, "/windowlist-menu/show")) + show_windowlist = G_VALUE_TYPE(value) ? g_value_get_boolean(value) : TRUE; + else if(!strcmp(property, "/windowlist-menu/show-workspace-names")) + wl_show_ws_names = G_VALUE_TYPE(value) ? g_value_get_boolean(value) : TRUE; + else if(!strcmp(property, "/windowlist-menu/show-submenus")) + wl_submenus = G_VALUE_TYPE(value) ? g_value_get_boolean(value) : FALSE; + else if(!strcmp(property, "/windowlist-menu/show-sticky-once")) + wl_sticky_once = G_VALUE_TYPE(value) ? g_value_get_boolean(value) : FALSE; +} + void -windowlist_init(McsClient *mcs_client) +windowlist_init(XfconfChannel *channel) { - McsSetting *setting = NULL; - - if(mcs_client) { - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, "showwl", - BACKDROP_CHANNEL, &setting)) - { - show_windowlist = setting->data.v_int; - mcs_setting_free(setting); - setting = NULL; - } + if(channel) { + show_windowlist = xfconf_channel_get_bool(channel, + "/windowlist-menu/show", + TRUE); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, - "wl_show_ws_names", - BACKDROP_CHANNEL, &setting)) - { - wl_show_ws_names = setting->data.v_int; - mcs_setting_free(setting); - setting = NULL; - } + wl_show_ws_names = xfconf_channel_get_bool(channel, + "/windowlist-menu/show-workspace-names", + TRUE); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, - "wl_submenus", - BACKDROP_CHANNEL, &setting)) - { - wl_submenus = setting->data.v_int; - mcs_setting_free(setting); - setting = NULL; - } - - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, - "wl_sticky_once", - BACKDROP_CHANNEL, &setting)) - { - wl_sticky_once = setting->data.v_int; - mcs_setting_free(setting); - setting = NULL; - } + wl_submenus = xfconf_channel_get_bool(channel, + "/windowlist-menu/show-submenus", + FALSE); + + wl_sticky_once = xfconf_channel_get_bool(channel, + "/windowlist-menu/show-sticky-once", + FALSE); + + g_signal_connect(G_OBJECT(channel), "property-changed", + G_CALLBACK(windowlist_settings_changed), NULL); } } @@ -449,43 +447,7 @@ G_CALLBACK(windowlist_populate), NULL); } -gboolean -windowlist_settings_changed(McsClient *client, McsAction action, - McsSetting *setting, gpointer user_data) -{ - switch(action) { - case MCS_ACTION_NEW: - case MCS_ACTION_CHANGED: - if(!strcmp(setting->name, "showwl")) { - show_windowlist = setting->data.v_int; - return TRUE; - } else if(!strcmp(setting->name, "wl_show_ws_names")) { - wl_show_ws_names = setting->data.v_int; - return TRUE; - } else if(!strcmp(setting->name, "wl_submenus")) { - wl_submenus = setting->data.v_int; - return TRUE; - } else if(!strcmp(setting->name, "wl_sticky_once")) { - wl_sticky_once = setting->data.v_int; - return TRUE; - } - - break; - - case MCS_ACTION_DELETED: - break; - } - - return FALSE; -} - void -windowlist_set_show_icons(gboolean show_icons) -{ - show_windowlist_icons = show_icons; -} - -void windowlist_cleanup() { /* notused */ Modified: xfdesktop/trunk/src/windowlist.h =================================================================== --- xfdesktop/trunk/src/windowlist.h 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/windowlist.h 2008-06-27 08:31:15 UTC (rev 27157) @@ -27,14 +27,12 @@ #include "xfce-desktop.h" -#include <libxfce4mcs/mcs-client.h> +#include <xfconf/xfconf.h> G_BEGIN_DECLS -void windowlist_init(McsClient *mcs_client); +void windowlist_init(XfconfChannel *channel); void windowlist_attach(XfceDesktop *desktop); -gboolean windowlist_settings_changed(McsClient *client, McsAction action, McsSetting *setting, gpointer user_data); -void windowlist_set_show_icons(gboolean show_icons); void windowlist_cleanup(); G_END_DECLS Modified: xfdesktop/trunk/src/xfce-desktop-settings.c =================================================================== --- xfdesktop/trunk/src/xfce-desktop-settings.c 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/xfce-desktop-settings.c 2008-06-27 08:31:15 UTC (rev 27157) @@ -1,7 +1,7 @@ /* * xfdesktop - xfce4's desktop manager * - * Copyright (c) 2004 Brian Tarricone, <[EMAIL PROTECTED]> + * Copyright (c) 2004-2008 Brian J. Tarricone <[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 @@ -56,6 +56,7 @@ #include <libxfce4util/libxfce4util.h> #include <libxfcegui4/libxfcegui4.h> +#include <dbus/dbus-gtype-specialized.h> #include "xfdesktop-common.h" #include "xfce-desktop-settings.h" @@ -210,16 +211,16 @@ void xfce_desktop_settings_load_initial(XfceDesktop *desktop, - McsClient *mcs_client) + XfconfChannel *channel) { - gchar setting_name[64]; - McsSetting *setting = NULL; GdkScreen *gscreen = GTK_WINDOW(desktop)->screen; gint screen, i, nmonitors; XfceBackdrop *backdrop; - GdkColor color; + gchar prop[256]; TRACE("entering"); + + g_return_if_fail(XFCONF_IS_CHANNEL(channel)); xfce_desktop_freeze_updates(desktop); @@ -227,143 +228,105 @@ screen = gdk_screen_get_number(gscreen); nmonitors = xfce_desktop_get_n_monitors(desktop); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, "xineramastretch", - BACKDROP_CHANNEL, &setting)) - { - xfce_desktop_set_xinerama_stretch(desktop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } - + g_snprintf(prop, sizeof(prop), "/backdrop/screen%d/xinerama-stretch", + screen); + xfce_desktop_set_xinerama_stretch(desktop, + xfconf_channel_get_bool(channel, + prop, + FALSE)); + #ifdef ENABLE_DESKTOP_ICONS - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, "desktopiconstyle", - BACKDROP_CHANNEL, &setting)) - { - xfce_desktop_set_icon_style(desktop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } else - xfce_desktop_set_icon_style(desktop, XFCE_DESKTOP_ICON_STYLE_WINDOWS); + xfce_desktop_set_icon_style(desktop, + xfconf_channel_get_int(channel, + "/desktop-icons/style", +#ifdef ENABLE_FILE_ICONS + XFCE_DESKTOP_ICON_STYLE_FILES +#else + XFCE_DESKTOP_ICON_STYLE_WINDOWS +#endif + )); + + xfce_desktop_set_icon_font_size(desktop, + xfconf_channel_get_uint(channel, + "/desktop-icons/font-size", + DEFAULT_ICON_FONT_SIZE)); + + xfce_desktop_set_icon_use_system_font_size(desktop, + xfconf_channel_get_bool(channel, + "/desktop-icons/use-system-font-size", + TRUE)); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, "icons_font_size", - BACKDROP_CHANNEL, &setting)) - { - xfce_desktop_set_icon_font_size(desktop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } - - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, - "icons_use_system_font_size", - BACKDROP_CHANNEL, &setting)) - { - xfce_desktop_set_icon_use_system_font_size(desktop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } - - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, "icons_icon_size", - BACKDROP_CHANNEL, &setting)) - { - xfce_desktop_set_icon_size(desktop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } + xfce_desktop_set_icon_size(desktop, + xfconf_channel_get_uint(channel, + "/desktop-icons/icon-size", + DEFAULT_ICON_SIZE)); #endif for(i = 0; i < nmonitors; i++) { + gchar *v_str; + GdkColor color; + backdrop = xfce_desktop_peek_backdrop(desktop, i); - g_snprintf(setting_name, 64, "showimage_%d_%d", screen, i); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, setting_name, - BACKDROP_CHANNEL, &setting)) - { - xfce_backdrop_set_show_image(backdrop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } - - g_snprintf(setting_name, 64, "imagepath_%d_%d", screen, i); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, setting_name, - BACKDROP_CHANNEL, &setting)) - { - if(is_backdrop_list(setting->data.v_string)) { - const gchar *imgfile = get_path_from_listfile(setting->data.v_string); - xfce_backdrop_set_image_filename(backdrop, imgfile); - } else { - xfce_backdrop_set_image_filename(backdrop, - setting->data.v_string); - } - mcs_setting_free(setting); - setting = NULL; + g_snprintf(prop, sizeof(prop), + "/backdrop/screen%d/monitor%d/image-show", screen, i); + xfce_backdrop_set_show_image(backdrop, + xfconf_channel_get_bool(channel, prop, + TRUE)); + + g_snprintf(prop, sizeof(prop), + "/backdrop/screen%d/monitor%d/image-path", screen, i); + v_str = xfconf_channel_get_string(channel, prop, DEFAULT_BACKDROP); + if(is_backdrop_list(v_str)) { + const gchar *imgfile = get_path_from_listfile(v_str); + xfce_backdrop_set_image_filename(backdrop, imgfile); } else - xfce_backdrop_set_image_filename(backdrop, DEFAULT_BACKDROP); + xfce_backdrop_set_image_filename(backdrop, v_str); + g_free(v_str); - g_snprintf(setting_name, 64, "imagestyle_%d_%d", screen, i); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, setting_name, - BACKDROP_CHANNEL, &setting)) - { - xfce_backdrop_set_image_style(backdrop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } else - xfce_backdrop_set_image_style(backdrop, XFCE_BACKDROP_IMAGE_STRETCHED); + g_snprintf(prop, sizeof(prop), + "/backdrop/screen%d/monitor%d/image-style", screen, i); + xfce_backdrop_set_image_style(backdrop, + xfconf_channel_get_int(channel, prop, + XFCE_BACKDROP_IMAGE_AUTO)); - g_snprintf(setting_name, 64, "color1_%d_%d", screen, i); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, setting_name, - BACKDROP_CHANNEL, &setting)) - { - color.red = setting->data.v_color.red; - color.green = setting->data.v_color.green; - color.blue = setting->data.v_color.blue; - xfce_backdrop_set_first_color(backdrop, &color); - mcs_setting_free(setting); - setting = NULL; - } else { - /* default color1 is #3b5b89 */ - color.red = (guint16)0x3b00; - color.green = (guint16)0x5b00; - color.blue = (guint16)0x8900; - xfce_backdrop_set_first_color(backdrop, &color); - } + g_snprintf(prop, sizeof(prop), + "/backdrop/screen%d/monitor%d/color1", screen, i); + /* default color1 is #3b5b89 */ + color.red = (guint16)0x3b00; + color.green = (guint16)0x5b00; + color.blue = (guint16)0x8900; + xfconf_channel_get_struct(channel, prop, &(color.red), + XFCONF_TYPE_UINT16, + XFCONF_TYPE_UINT16, + XFCONF_TYPE_UINT16, + G_TYPE_INVALID); + xfce_backdrop_set_first_color(backdrop, &color); + + g_snprintf(prop, sizeof(prop), + "/backdrop/screen%d/monitor%d/color1", screen, i); + /* default color2 is #3e689e */ + color.red = (guint16)0x3e00; + color.green = (guint16)0x6800; + color.blue = (guint16)0x9e00; + xfconf_channel_get_struct(channel, prop, &(color.red), + XFCONF_TYPE_UINT16, + XFCONF_TYPE_UINT16, + XFCONF_TYPE_UINT16, + G_TYPE_INVALID); + xfce_backdrop_set_second_color(backdrop, &color); - g_snprintf(setting_name, 64, "color2_%d_%d", screen, i); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, setting_name, - BACKDROP_CHANNEL, &setting)) - { - color.red = setting->data.v_color.red; - color.green = setting->data.v_color.green; - color.blue = setting->data.v_color.blue; - xfce_backdrop_set_second_color(backdrop, &color); - mcs_setting_free(setting); - setting = NULL; - } else { - /* default color2 is #3e689e */ - color.red = (guint16)0x3e00; - color.green = (guint16)0x6800; - color.blue = (guint16)0x9e00; - xfce_backdrop_set_second_color(backdrop, &color); - } - - g_snprintf(setting_name, 64, "colorstyle_%d_%d", screen, i); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, setting_name, - BACKDROP_CHANNEL, &setting)) - { - xfce_backdrop_set_color_style(backdrop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } else - xfce_backdrop_set_color_style(backdrop, XFCE_BACKDROP_COLOR_VERT_GRADIENT); - - g_snprintf(setting_name, 64, "brightness_%d_%d", screen, i); - if(MCS_SUCCESS == mcs_client_get_setting(mcs_client, setting_name, - BACKDROP_CHANNEL, &setting)) - { - xfce_backdrop_set_brightness(backdrop, setting->data.v_int); - mcs_setting_free(setting); - setting = NULL; - } else - xfce_backdrop_set_brightness(backdrop, 0); + g_snprintf(prop, sizeof(prop), + "/backdrop/screen%d/monitor%d/color-style", screen, i); + xfce_backdrop_set_color_style(backdrop, + xfconf_channel_get_int(channel, prop, + XFCE_BACKDROP_COLOR_VERT_GRADIENT)); + + g_snprintf(prop, sizeof(prop), + "/backdrop/screen%d/monitor%d/brightness", screen, i); + xfce_backdrop_set_brightness(backdrop, + xfconf_channel_get_int(channel, prop, + 0)); } xfce_desktop_thaw_updates(desktop); @@ -371,123 +334,175 @@ TRACE("exiting"); } -gboolean -xfce_desktop_settings_changed(McsClient *client, - McsAction action, - McsSetting *setting, +void +xfce_desktop_settings_changed(XfconfChannel *channel, + const gchar *property, + GValue *value, gpointer user_data) { XfceDesktop *desktop = user_data; XfceBackdrop *backdrop; gchar *sname, *p, *q; - gint screen, monitor; + gint screen = -1, monitor = -1; GdkColor color; - gboolean handled = FALSE; GdkScreen *gscreen; TRACE("dummy"); - g_return_val_if_fail(XFCE_IS_DESKTOP(desktop), FALSE); - - if(!strcmp(setting->name, "xineramastretch")) { - xfce_desktop_set_xinerama_stretch(desktop, setting->data.v_int); - return TRUE; - } - #ifdef ENABLE_DESKTOP_ICONS - if(!strcmp(setting->name, "desktopiconstyle")) { - xfce_desktop_set_icon_style(desktop, setting->data.v_int); - return TRUE; + if(!strcmp(property, "/desktop-icons/style")) { + xfce_desktop_set_icon_style(desktop, G_VALUE_TYPE(value) + ? g_value_get_int(value) + : +#ifdef ENABLE_FILE_ICONS + XFCE_DESKTOP_ICON_STYLE_FILES +#else + XFCE_DESKTOP_ICON_STYLE_WINDOWS +#endif + ); + return; + } else if(!strcmp(property, "/desktop-icons/icon-size")) { + xfce_desktop_set_icon_size(desktop, G_VALUE_TYPE(value) + ? g_value_get_uint(value) + : DEFAULT_ICON_SIZE); + return; + } else if(!strcmp(property, "/desktop-icons/use-system-font-size")) { + xfce_desktop_set_icon_use_system_font_size(desktop, + G_VALUE_TYPE(value) + ? g_value_get_boolean(value) + : TRUE); + return; + } else if(!strcmp(property, "/desktop-icons/font-size")) { + xfce_desktop_set_icon_font_size(desktop, G_VALUE_TYPE(value) + ? g_value_get_uint(value) + : DEFAULT_ICON_FONT_SIZE); + return; } - - if(!strcmp(setting->name, "icons_icon_size")) { - xfce_desktop_set_icon_size(desktop, setting->data.v_int); - return TRUE; - } - - if(!strcmp(setting->name, "icons_use_system_font_size")) { - xfce_desktop_set_icon_use_system_font_size(desktop, setting->data.v_int); - return TRUE; - } - - if(!strcmp(setting->name, "icons_font_size")) { - xfce_desktop_set_icon_font_size(desktop, setting->data.v_int); - return TRUE; - } #endif + + /* from here on we only handle /backdrop/ properties */ + if(strncmp(property, "/backdrop/screen", 16)) + return; /* get the screen and monitor number */ - sname = g_strdup(setting->name); - q = g_strrstr(sname, "_"); - if(!q || q == sname) { + sname = g_strdup(property); + + p = strstr(sname, "/screen"); + if(p) { + q = strstr(p+7, "/"); + if(q) { + gchar *endptr = NULL; + + *q = 0; + errno = 0; + screen = strtoul(p+7, &endptr, 10); + if((screen == ULONG_MAX && errno == ERANGE) || errno == EINVAL + || (!endptr || *endptr)) + { + screen = -1; + } + *q = '/'; + } + } + + if(screen == -1) { g_free(sname); - return FALSE; + return; } - p = strstr(sname, "_"); - if(!p || p == q) { + + gscreen = gtk_widget_get_screen(GTK_WIDGET(desktop)); + if(screen != gdk_screen_get_number(gscreen)) { g_free(sname); - return FALSE; + return; } - *q = 0; - screen = atoi(p+1); - monitor = atoi(q+1); + + /* this guy is per-screen, no per-monitor variant */ + if(strstr(property, "/xinerama-stretch")) { + xfce_desktop_set_xinerama_stretch(desktop, G_VALUE_TYPE(value) + ? g_value_get_boolean(value) + : FALSE); + g_free(sname); + return; + } + + p = strstr(sname, "/monitor"); + if(p) { + q = strstr(p+8, "/"); + if(q) { + gchar *endptr = NULL; + + *q = 0; + errno = 0; + monitor = strtoul(p+8, &endptr, 10); + if((monitor == ULONG_MAX && errno == ERANGE) || errno == EINVAL + || (!endptr || *endptr)) + { + monitor = -1; + } + *q = '/'; + } + } + g_free(sname); + + if(monitor == -1 || monitor >= gdk_screen_get_n_monitors(gscreen)) + return; - gscreen = gtk_widget_get_screen(GTK_WIDGET(desktop)); - if(monitor < 0 || screen != gdk_screen_get_number(gscreen) - || monitor >= gdk_screen_get_n_monitors(gscreen)) - { - /* not ours */ - return FALSE; - } - backdrop = xfce_desktop_peek_backdrop(desktop, monitor); if(!backdrop) - return FALSE; + return; - switch(action) { - case MCS_ACTION_NEW: - case MCS_ACTION_CHANGED: - if(strstr(setting->name, "showimage") == setting->name) { - xfce_backdrop_set_show_image(backdrop, setting->data.v_int); - handled = TRUE; - } else if(strstr(setting->name, "imagepath") == setting->name) { - if(is_backdrop_list(setting->data.v_string)) { - const gchar *imgfile = get_path_from_listfile(setting->data.v_string); - xfce_backdrop_set_image_filename(backdrop, imgfile); - } else { - xfce_backdrop_set_image_filename(backdrop, - setting->data.v_string); - } - handled = TRUE; - } else if(strstr(setting->name, "imagestyle") == setting->name) { - xfce_backdrop_set_image_style(backdrop, setting->data.v_int); - handled = TRUE; - } else if(strstr(setting->name, "color1") == setting->name) { - color.red = setting->data.v_color.red; - color.blue = setting->data.v_color.blue; - color.green = setting->data.v_color.green; - xfce_backdrop_set_first_color(backdrop, &color); - handled = TRUE; - } else if(strstr(setting->name, "color2") == setting->name) { - color.red = setting->data.v_color.red; - color.blue = setting->data.v_color.blue; - color.green = setting->data.v_color.green; - xfce_backdrop_set_second_color(backdrop, &color); - handled = TRUE; - } else if(strstr(setting->name, "colorstyle") == setting->name) { - xfce_backdrop_set_color_style(backdrop, setting->data.v_int); - handled = TRUE; - } else if(strstr(setting->name, "brightness") == setting->name) { - xfce_backdrop_set_brightness(backdrop, setting->data.v_int); - handled = TRUE; - } - - break; - - case MCS_ACTION_DELETED: - break; + if(strstr(property, "/image-show")) { + xfce_backdrop_set_show_image(backdrop, G_VALUE_TYPE(value) + ? g_value_get_boolean(value) + : TRUE); + } else if(strstr(property, "/image-path")) { + const gchar *v_str = G_VALUE_TYPE(value) ? g_value_get_string(value) + : DEFAULT_BACKDROP; + if(is_backdrop_list(v_str)) { + const gchar *imgfile = get_path_from_listfile(v_str); + xfce_backdrop_set_image_filename(backdrop, imgfile); + } else + xfce_backdrop_set_image_filename(backdrop, v_str); + } else if(strstr(property, "/image-style")) { + xfce_backdrop_set_image_style(backdrop, G_VALUE_TYPE(value) + ? g_value_get_int(value) + : XFCE_BACKDROP_IMAGE_AUTO); + } else if(strstr(property, "/color1")) { + /* FIXME: use |value| */ + /* default color1 is #3b5b89 */ + color.red = (guint16)0x3b00; + color.green = (guint16)0x5b00; + color.blue = (guint16)0x8900; + if(G_VALUE_TYPE(value)) { + dbus_g_type_struct_get(value, + 0, &color.red, + 1, &color.green, + 2, &color.blue, + G_MAXUINT); + } + xfce_backdrop_set_first_color(backdrop, &color); + } else if(strstr(property, "/color2")) { + /* FIXME: use |value| */ + /* default color2 is #3e689e */ + color.red = (guint16)0x3e00; + color.green = (guint16)0x6800; + color.blue = (guint16)0x9e00; + if(G_VALUE_TYPE(value)) { + dbus_g_type_struct_get(value, + 0, &color.red, + 1, &color.green, + 2, &color.blue, + G_MAXUINT); + } + xfce_backdrop_set_second_color(backdrop, &color); + } else if(strstr(property, "/color-style")) { + xfce_backdrop_set_color_style(backdrop, G_VALUE_TYPE(value) + ? g_value_get_int(value) + : XFCE_BACKDROP_COLOR_VERT_GRADIENT); + } else if(strstr(property, "/brightness")) { + xfce_backdrop_set_brightness(backdrop, + G_VALUE_TYPE(value) + ? g_value_get_int(value) : 0); } - - return handled; } Modified: xfdesktop/trunk/src/xfce-desktop-settings.h =================================================================== --- xfdesktop/trunk/src/xfce-desktop-settings.h 2008-06-27 01:10:54 UTC (rev 27156) +++ xfdesktop/trunk/src/xfce-desktop-settings.h 2008-06-27 08:31:15 UTC (rev 27157) @@ -21,18 +21,18 @@ #ifndef __XFCE_DESKTOP_SETTINGS_H__ #define __XFCE_DESKTOP_SETTINGS_H__ -#include <libxfce4mcs/mcs-client.h> +#include <xfconf/xfconf.h> #include "xfce-desktop.h" G_BEGIN_DECLS void xfce_desktop_settings_load_initial(XfceDesktop *desktop, - McsClient *mcs_client); -gboolean xfce_desktop_settings_changed(McsClient *client, - McsAction action, - McsSetting *setting, - gpointer user_data); + XfconfChannel *channel); +void xfce_desktop_settings_changed(XfconfChannel *channel, + const gchar *property, + GValue *value, + gpointer user_data); G_END_DECLS _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org http://foo-projects.org/mailman/listinfo/xfce4-commits