From 505cabbd3036081f26586cabc64c26e7769c0ec9 Mon Sep 17 00:00:00 2001 From: Perberos Date: Thu, 1 Dec 2011 23:53:21 -0300 Subject: moving from https://github.com/perberos/mate-desktop-environment --- mate-settings-daemon/Makefile.am | 93 +++ mate-settings-daemon/Makefile.in | 828 +++++++++++++++++++++++ mate-settings-daemon/main.c | 519 ++++++++++++++ mate-settings-daemon/mate-settings-manager.c | 557 +++++++++++++++ mate-settings-daemon/mate-settings-manager.h | 81 +++ mate-settings-daemon/mate-settings-manager.xml | 17 + mate-settings-daemon/mate-settings-module.c | 166 +++++ mate-settings-daemon/mate-settings-module.h | 51 ++ mate-settings-daemon/mate-settings-plugin-info.c | 616 +++++++++++++++++ mate-settings-daemon/mate-settings-plugin-info.h | 81 +++ mate-settings-daemon/mate-settings-plugin.c | 61 ++ mate-settings-daemon/mate-settings-plugin.h | 183 +++++ mate-settings-daemon/mate-settings-profile.c | 65 ++ mate-settings-daemon/mate-settings-profile.h | 57 ++ 14 files changed, 3375 insertions(+) create mode 100644 mate-settings-daemon/Makefile.am create mode 100644 mate-settings-daemon/Makefile.in create mode 100644 mate-settings-daemon/main.c create mode 100644 mate-settings-daemon/mate-settings-manager.c create mode 100644 mate-settings-daemon/mate-settings-manager.h create mode 100644 mate-settings-daemon/mate-settings-manager.xml create mode 100644 mate-settings-daemon/mate-settings-module.c create mode 100644 mate-settings-daemon/mate-settings-module.h create mode 100644 mate-settings-daemon/mate-settings-plugin-info.c create mode 100644 mate-settings-daemon/mate-settings-plugin-info.h create mode 100644 mate-settings-daemon/mate-settings-plugin.c create mode 100644 mate-settings-daemon/mate-settings-plugin.h create mode 100644 mate-settings-daemon/mate-settings-profile.c create mode 100644 mate-settings-daemon/mate-settings-profile.h (limited to 'mate-settings-daemon') diff --git a/mate-settings-daemon/Makefile.am b/mate-settings-daemon/Makefile.am new file mode 100644 index 0000000..80150e1 --- /dev/null +++ b/mate-settings-daemon/Makefile.am @@ -0,0 +1,93 @@ +NULL = + +INCLUDES = \ + -DDATADIR=\""$(datadir)"\" \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DMATE_SETTINGS_PLUGINDIR=\""$(plugindir)"\" \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(SETTINGS_DAEMON_CFLAGS) \ + $(NULL) + +noinst_LTLIBRARIES = \ + libgsd-profile.la \ + $(NULL) + +libgsd_profile_la_SOURCES = \ + mate-settings-profile.c \ + mate-settings-profile.h \ + $(NULL) + +libgsd_profile_la_CPPFLAGS = \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(NULL) + +libgsd_profile_la_CFLAGS = \ + $(SIMPLE_GREETER_CFLAGS) \ + $(NULL) + +libgsd_profile_la_LIBADD = \ + $(NULL) + +libgsd_profile_la_LDFLAGS = \ + -export-dynamic \ + $(NULL) + +gsddir = $(libexecdir) + +gsd_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 $< > $@ + +mate-settings-client.h: mate-settings-manager.xml Makefile.am + dbus-binding-tool --prefix=mate_settings_manager --mode=glib-client $< > $@ + +BUILT_SOURCES = \ + mate-settings-manager-glue.h \ + mate-settings-client.h \ + $(NULL) + +apidir = $(includedir)/mate-settings-daemon +api_DATA = \ + mate-settings-client.h \ + mate-settings-plugin.h + +mate_settings_daemon_SOURCES = \ + main.c \ + mate-settings-manager.c \ + mate-settings-manager.h \ + mate-settings-plugin.c \ + mate-settings-plugin.h \ + mate-settings-plugin-info.c \ + mate-settings-plugin-info.h \ + mate-settings-module.c \ + mate-settings-module.h \ + $(NULL) + +mate_settings_daemon_CPPFLAGS = \ + $(AM_CPPFLAGS) + +mate_settings_daemon_CFLAGS = \ + $(AM_CFLAGS) + +mate_settings_daemon_LDFLAGS = \ + $(AM_LDFLAGS) + +mate_settings_daemon_LDADD = \ + libgsd-profile.la \ + $(SETTINGS_DAEMON_LIBS) + +EXTRA_DIST = \ + $(Dbusapi_DATA) \ + mate-settings-manager.xml \ + $(NULL) + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(NULL) + + +# vim: ts=8 diff --git a/mate-settings-daemon/Makefile.in b/mate-settings-daemon/Makefile.in new file mode 100644 index 0000000..5e8e515 --- /dev/null +++ b/mate-settings-daemon/Makefile.in @@ -0,0 +1,828 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +gsd_PROGRAMS = mate-settings-daemon$(EXEEXT) +subdir = mate-settings-daemon +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs +CONFIG_HEADER = $(top_builddir)/config.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +LTLIBRARIES = $(noinst_LTLIBRARIES) +am__DEPENDENCIES_1 = +libgsd_profile_la_DEPENDENCIES = $(am__DEPENDENCIES_1) +am__objects_1 = +am_libgsd_profile_la_OBJECTS = \ + libgsd_profile_la-mate-settings-profile.lo $(am__objects_1) +libgsd_profile_la_OBJECTS = $(am_libgsd_profile_la_OBJECTS) +libgsd_profile_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(libgsd_profile_la_CFLAGS) $(CFLAGS) \ + $(libgsd_profile_la_LDFLAGS) $(LDFLAGS) -o $@ +am__installdirs = "$(DESTDIR)$(gsddir)" "$(DESTDIR)$(apidir)" +PROGRAMS = $(gsd_PROGRAMS) +am_mate_settings_daemon_OBJECTS = mate_settings_daemon-main.$(OBJEXT) \ + mate_settings_daemon-mate-settings-manager.$(OBJEXT) \ + mate_settings_daemon-mate-settings-plugin.$(OBJEXT) \ + mate_settings_daemon-mate-settings-plugin-info.$(OBJEXT) \ + mate_settings_daemon-mate-settings-module.$(OBJEXT) \ + $(am__objects_1) +mate_settings_daemon_OBJECTS = $(am_mate_settings_daemon_OBJECTS) +mate_settings_daemon_DEPENDENCIES = libgsd-profile.la \ + $(am__DEPENDENCIES_1) +mate_settings_daemon_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) \ + $(mate_settings_daemon_CFLAGS) $(CFLAGS) \ + $(mate_settings_daemon_LDFLAGS) $(LDFLAGS) -o $@ +DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir) +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libgsd_profile_la_SOURCES) $(mate_settings_daemon_SOURCES) +DIST_SOURCES = $(libgsd_profile_la_SOURCES) \ + $(mate_settings_daemon_SOURCES) +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +DATA = $(api_DATA) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALL_LINGUAS = @ALL_LINGUAS@ +AMTAR = @AMTAR@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CATALOGS = @CATALOGS@ +CATOBJEXT = @CATOBJEXT@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DATADIRNAME = @DATADIRNAME@ +DBUS_SYS_DIR = @DBUS_SYS_DIR@ +DEBUG_CFLAGS = @DEBUG_CFLAGS@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FGREP = @FGREP@ +FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@ +FONTCONFIG_LIBS = @FONTCONFIG_LIBS@ +GETTEXT_PACKAGE = @GETTEXT_PACKAGE@ +GIOUNIX_CFLAGS = @GIOUNIX_CFLAGS@ +GIOUNIX_LIBS = @GIOUNIX_LIBS@ +GLIB_GENMARSHAL = @GLIB_GENMARSHAL@ +GMOFILES = @GMOFILES@ +GMSGFMT = @GMSGFMT@ +GREP = @GREP@ +GSD_INTLTOOL_PLUGIN_RULE = @GSD_INTLTOOL_PLUGIN_RULE@ +GSD_PLUGIN_LDFLAGS = @GSD_PLUGIN_LDFLAGS@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +INSTOBJEXT = @INSTOBJEXT@ +INTLLIBS = @INTLLIBS@ +INTLTOOL_EXTRACT = @INTLTOOL_EXTRACT@ +INTLTOOL_MERGE = @INTLTOOL_MERGE@ +INTLTOOL_PERL = @INTLTOOL_PERL@ +INTLTOOL_UPDATE = @INTLTOOL_UPDATE@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBEXECDIR = @LIBEXECDIR@ +LIBMATEKBDUI_CFLAGS = @LIBMATEKBDUI_CFLAGS@ +LIBMATEKBDUI_LIBS = @LIBMATEKBDUI_LIBS@ +LIBMATENOTIFY_CFLAGS = @LIBMATENOTIFY_CFLAGS@ +LIBMATENOTIFY_LIBS = @LIBMATENOTIFY_LIBS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MATECONFTOOL = @MATECONFTOOL@ +MATECONF_SCHEMA_CONFIG_SOURCE = @MATECONF_SCHEMA_CONFIG_SOURCE@ +MATECONF_SCHEMA_FILE_DIR = @MATECONF_SCHEMA_FILE_DIR@ +MATE_KEYBINDINGS_KEYSDIR = @MATE_KEYBINDINGS_KEYSDIR@ +MKDIR_P = @MKDIR_P@ +MKINSTALLDIRS = @MKINSTALLDIRS@ +MSGFMT = @MSGFMT@ +MSGFMT_OPTS = @MSGFMT_OPTS@ +MSGMERGE = @MSGMERGE@ +NM = @NM@ +NMEDIT = @NMEDIT@ +NSS_CFLAGS = @NSS_CFLAGS@ +NSS_DATABASE = @NSS_DATABASE@ +NSS_LIBS = @NSS_LIBS@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKG_CONFIG = @PKG_CONFIG@ +PKG_CONFIG_LIBDIR = @PKG_CONFIG_LIBDIR@ +PKG_CONFIG_PATH = @PKG_CONFIG_PATH@ +POFILES = @POFILES@ +POLKIT_CFLAGS = @POLKIT_CFLAGS@ +POLKIT_LIBS = @POLKIT_LIBS@ +POSUB = @POSUB@ +PO_IN_DATADIR_FALSE = @PO_IN_DATADIR_FALSE@ +PO_IN_DATADIR_TRUE = @PO_IN_DATADIR_TRUE@ +PULSE_CFLAGS = @PULSE_CFLAGS@ +PULSE_LIBS = @PULSE_LIBS@ +RANLIB = @RANLIB@ +SED = @SED@ +SETTINGS_DAEMON_CFLAGS = @SETTINGS_DAEMON_CFLAGS@ +SETTINGS_DAEMON_LIBS = @SETTINGS_DAEMON_LIBS@ +SETTINGS_PLUGIN_CFLAGS = @SETTINGS_PLUGIN_CFLAGS@ +SETTINGS_PLUGIN_LIBS = @SETTINGS_PLUGIN_LIBS@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +USE_NLS = @USE_NLS@ +VERSION = @VERSION@ +WARN_CFLAGS = @WARN_CFLAGS@ +X11_LIBS = @X11_LIBS@ +XF86MISC_LIBS = @XF86MISC_LIBS@ +XGETTEXT = @XGETTEXT@ +XINPUT_LIBS = @XINPUT_LIBS@ +XMKMF = @XMKMF@ +X_CFLAGS = @X_CFLAGS@ +X_EXTRA_LIBS = @X_EXTRA_LIBS@ +X_LIBS = @X_LIBS@ +X_PRE_LIBS = @X_PRE_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +plugindir = @plugindir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sysconfdir = @sysconfdir@ +target_alias = @target_alias@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +NULL = +INCLUDES = \ + -DDATADIR=\""$(datadir)"\" \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + -DLIBEXECDIR=\""$(libexecdir)"\" \ + -DMATE_SETTINGS_PLUGINDIR=\""$(plugindir)"\" \ + $(WARN_CFLAGS) \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(SETTINGS_DAEMON_CFLAGS) \ + $(NULL) + +noinst_LTLIBRARIES = \ + libgsd-profile.la \ + $(NULL) + +libgsd_profile_la_SOURCES = \ + mate-settings-profile.c \ + mate-settings-profile.h \ + $(NULL) + +libgsd_profile_la_CPPFLAGS = \ + $(DISABLE_DEPRECATED_CFLAGS) \ + $(NULL) + +libgsd_profile_la_CFLAGS = \ + $(SIMPLE_GREETER_CFLAGS) \ + $(NULL) + +libgsd_profile_la_LIBADD = \ + $(NULL) + +libgsd_profile_la_LDFLAGS = \ + -export-dynamic \ + $(NULL) + +gsddir = $(libexecdir) +BUILT_SOURCES = \ + mate-settings-manager-glue.h \ + mate-settings-client.h \ + $(NULL) + +apidir = $(includedir)/mate-settings-daemon +api_DATA = \ + mate-settings-client.h \ + mate-settings-plugin.h + +mate_settings_daemon_SOURCES = \ + main.c \ + mate-settings-manager.c \ + mate-settings-manager.h \ + mate-settings-plugin.c \ + mate-settings-plugin.h \ + mate-settings-plugin-info.c \ + mate-settings-plugin-info.h \ + mate-settings-module.c \ + mate-settings-module.h \ + $(NULL) + +mate_settings_daemon_CPPFLAGS = \ + $(AM_CPPFLAGS) + +mate_settings_daemon_CFLAGS = \ + $(AM_CFLAGS) + +mate_settings_daemon_LDFLAGS = \ + $(AM_LDFLAGS) + +mate_settings_daemon_LDADD = \ + libgsd-profile.la \ + $(SETTINGS_DAEMON_LIBS) + +EXTRA_DIST = \ + $(Dbusapi_DATA) \ + mate-settings-manager.xml \ + $(NULL) + +CLEANFILES = \ + $(BUILT_SOURCES) \ + $(NULL) + +all: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) all-am + +.SUFFIXES: +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu mate-settings-daemon/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu mate-settings-daemon/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +libgsd-profile.la: $(libgsd_profile_la_OBJECTS) $(libgsd_profile_la_DEPENDENCIES) + $(libgsd_profile_la_LINK) $(libgsd_profile_la_OBJECTS) $(libgsd_profile_la_LIBADD) $(LIBS) +install-gsdPROGRAMS: $(gsd_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(gsddir)" || $(MKDIR_P) "$(DESTDIR)$(gsddir)" + @list='$(gsd_PROGRAMS)'; test -n "$(gsddir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(gsddir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(gsddir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-gsdPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(gsd_PROGRAMS)'; test -n "$(gsddir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(gsddir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(gsddir)" && rm -f $$files + +clean-gsdPROGRAMS: + @list='$(gsd_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +mate-settings-daemon$(EXEEXT): $(mate_settings_daemon_OBJECTS) $(mate_settings_daemon_DEPENDENCIES) + @rm -f mate-settings-daemon$(EXEEXT) + $(mate_settings_daemon_LINK) $(mate_settings_daemon_OBJECTS) $(mate_settings_daemon_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libgsd_profile_la-mate-settings-profile.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mate_settings_daemon-main.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mate_settings_daemon-mate-settings-manager.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mate_settings_daemon-mate-settings-module.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mate_settings_daemon-mate-settings-plugin-info.Po@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mate_settings_daemon-mate-settings-plugin.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c $< + +.c.obj: +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +libgsd_profile_la-mate-settings-profile.lo: mate-settings-profile.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsd_profile_la_CPPFLAGS) $(CPPFLAGS) $(libgsd_profile_la_CFLAGS) $(CFLAGS) -MT libgsd_profile_la-mate-settings-profile.lo -MD -MP -MF $(DEPDIR)/libgsd_profile_la-mate-settings-profile.Tpo -c -o libgsd_profile_la-mate-settings-profile.lo `test -f 'mate-settings-profile.c' || echo '$(srcdir)/'`mate-settings-profile.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libgsd_profile_la-mate-settings-profile.Tpo $(DEPDIR)/libgsd_profile_la-mate-settings-profile.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-profile.c' object='libgsd_profile_la-mate-settings-profile.lo' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgsd_profile_la_CPPFLAGS) $(CPPFLAGS) $(libgsd_profile_la_CFLAGS) $(CFLAGS) -c -o libgsd_profile_la-mate-settings-profile.lo `test -f 'mate-settings-profile.c' || echo '$(srcdir)/'`mate-settings-profile.c + +mate_settings_daemon-main.o: main.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-main.o -MD -MP -MF $(DEPDIR)/mate_settings_daemon-main.Tpo -c -o mate_settings_daemon-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-main.Tpo $(DEPDIR)/mate_settings_daemon-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='mate_settings_daemon-main.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-main.o `test -f 'main.c' || echo '$(srcdir)/'`main.c + +mate_settings_daemon-main.obj: main.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-main.obj -MD -MP -MF $(DEPDIR)/mate_settings_daemon-main.Tpo -c -o mate_settings_daemon-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-main.Tpo $(DEPDIR)/mate_settings_daemon-main.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='main.c' object='mate_settings_daemon-main.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-main.obj `if test -f 'main.c'; then $(CYGPATH_W) 'main.c'; else $(CYGPATH_W) '$(srcdir)/main.c'; fi` + +mate_settings_daemon-mate-settings-manager.o: mate-settings-manager.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-manager.o -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-manager.Tpo -c -o mate_settings_daemon-mate-settings-manager.o `test -f 'mate-settings-manager.c' || echo '$(srcdir)/'`mate-settings-manager.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-manager.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-manager.c' object='mate_settings_daemon-mate-settings-manager.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-manager.o `test -f 'mate-settings-manager.c' || echo '$(srcdir)/'`mate-settings-manager.c + +mate_settings_daemon-mate-settings-manager.obj: mate-settings-manager.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-manager.obj -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-manager.Tpo -c -o mate_settings_daemon-mate-settings-manager.obj `if test -f 'mate-settings-manager.c'; then $(CYGPATH_W) 'mate-settings-manager.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-manager.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-manager.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-manager.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-manager.c' object='mate_settings_daemon-mate-settings-manager.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-manager.obj `if test -f 'mate-settings-manager.c'; then $(CYGPATH_W) 'mate-settings-manager.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-manager.c'; fi` + +mate_settings_daemon-mate-settings-plugin.o: mate-settings-plugin.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-plugin.o -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-plugin.Tpo -c -o mate_settings_daemon-mate-settings-plugin.o `test -f 'mate-settings-plugin.c' || echo '$(srcdir)/'`mate-settings-plugin.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-plugin.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-plugin.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-plugin.c' object='mate_settings_daemon-mate-settings-plugin.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-plugin.o `test -f 'mate-settings-plugin.c' || echo '$(srcdir)/'`mate-settings-plugin.c + +mate_settings_daemon-mate-settings-plugin.obj: mate-settings-plugin.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-plugin.obj -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-plugin.Tpo -c -o mate_settings_daemon-mate-settings-plugin.obj `if test -f 'mate-settings-plugin.c'; then $(CYGPATH_W) 'mate-settings-plugin.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-plugin.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-plugin.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-plugin.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-plugin.c' object='mate_settings_daemon-mate-settings-plugin.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-plugin.obj `if test -f 'mate-settings-plugin.c'; then $(CYGPATH_W) 'mate-settings-plugin.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-plugin.c'; fi` + +mate_settings_daemon-mate-settings-plugin-info.o: mate-settings-plugin-info.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-plugin-info.o -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-plugin-info.Tpo -c -o mate_settings_daemon-mate-settings-plugin-info.o `test -f 'mate-settings-plugin-info.c' || echo '$(srcdir)/'`mate-settings-plugin-info.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-plugin-info.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-plugin-info.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-plugin-info.c' object='mate_settings_daemon-mate-settings-plugin-info.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-plugin-info.o `test -f 'mate-settings-plugin-info.c' || echo '$(srcdir)/'`mate-settings-plugin-info.c + +mate_settings_daemon-mate-settings-plugin-info.obj: mate-settings-plugin-info.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-plugin-info.obj -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-plugin-info.Tpo -c -o mate_settings_daemon-mate-settings-plugin-info.obj `if test -f 'mate-settings-plugin-info.c'; then $(CYGPATH_W) 'mate-settings-plugin-info.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-plugin-info.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-plugin-info.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-plugin-info.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-plugin-info.c' object='mate_settings_daemon-mate-settings-plugin-info.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-plugin-info.obj `if test -f 'mate-settings-plugin-info.c'; then $(CYGPATH_W) 'mate-settings-plugin-info.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-plugin-info.c'; fi` + +mate_settings_daemon-mate-settings-module.o: mate-settings-module.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-module.o -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-module.Tpo -c -o mate_settings_daemon-mate-settings-module.o `test -f 'mate-settings-module.c' || echo '$(srcdir)/'`mate-settings-module.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-module.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-module.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-module.c' object='mate_settings_daemon-mate-settings-module.o' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-module.o `test -f 'mate-settings-module.c' || echo '$(srcdir)/'`mate-settings-module.c + +mate_settings_daemon-mate-settings-module.obj: mate-settings-module.c +@am__fastdepCC_TRUE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -MT mate_settings_daemon-mate-settings-module.obj -MD -MP -MF $(DEPDIR)/mate_settings_daemon-mate-settings-module.Tpo -c -o mate_settings_daemon-mate-settings-module.obj `if test -f 'mate-settings-module.c'; then $(CYGPATH_W) 'mate-settings-module.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-module.c'; fi` +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/mate_settings_daemon-mate-settings-module.Tpo $(DEPDIR)/mate_settings_daemon-mate-settings-module.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='mate-settings-module.c' object='mate_settings_daemon-mate-settings-module.obj' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(mate_settings_daemon_CPPFLAGS) $(CPPFLAGS) $(mate_settings_daemon_CFLAGS) $(CFLAGS) -c -o mate_settings_daemon-mate-settings-module.obj `if test -f 'mate-settings-module.c'; then $(CYGPATH_W) 'mate-settings-module.c'; else $(CYGPATH_W) '$(srcdir)/mate-settings-module.c'; fi` + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-apiDATA: $(api_DATA) + @$(NORMAL_INSTALL) + test -z "$(apidir)" || $(MKDIR_P) "$(DESTDIR)$(apidir)" + @list='$(api_DATA)'; test -n "$(apidir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(apidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(apidir)" || exit $$?; \ + done + +uninstall-apiDATA: + @$(NORMAL_UNINSTALL) + @list='$(api_DATA)'; test -n "$(apidir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(apidir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(apidir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) check-am +all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(gsddir)" "$(DESTDIR)$(apidir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: $(BUILT_SOURCES) + $(MAKE) $(AM_MAKEFLAGS) install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." + -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES) +clean: clean-am + +clean-am: clean-generic clean-gsdPROGRAMS clean-libtool \ + clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-apiDATA install-gsdPROGRAMS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-apiDATA uninstall-gsdPROGRAMS + +.MAKE: all check install install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-gsdPROGRAMS clean-libtool clean-noinstLTLIBRARIES ctags \ + distclean distclean-compile distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-apiDATA \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-gsdPROGRAMS install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + pdf pdf-am ps ps-am tags uninstall uninstall-am \ + uninstall-apiDATA uninstall-gsdPROGRAMS + + +mate-settings-manager-glue.h: mate-settings-manager.xml Makefile.am + 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 $< > $@ + +# vim: ts=8 + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/mate-settings-daemon/main.c b/mate-settings-daemon/main.c new file mode 100644 index 0000000..8ba3620 --- /dev/null +++ b/mate-settings-daemon/main.c @@ -0,0 +1,519 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +#include "mate-settings-manager.h" +#include "mate-settings-profile.h" + +#define GSD_DBUS_NAME "org.mate.SettingsDaemon" + +#define MATE_SESSION_DBUS_NAME "org.mate.SessionManager" +#define MATE_SESSION_DBUS_OBJECT "/org/mate/SessionManager" +#define MATE_SESSION_DBUS_INTERFACE "org.mate.SessionManager" + +static char *mateconf_prefix = NULL; +static gboolean no_daemon = FALSE; +static gboolean debug = FALSE; +static gboolean do_timed_exit = FALSE; +static int daemon_pipe_fds[2]; +static int term_signal_pipe_fds[2]; + +static GOptionEntry entries[] = { + {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL }, + {"no-daemon", 0, 0, G_OPTION_ARG_NONE, &no_daemon, N_("Don't become a daemon"), NULL }, + {"mateconf-prefix", 0, 0, G_OPTION_ARG_STRING, &mateconf_prefix, N_("MateConf prefix from which to load plugin settings"), NULL}, + { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL }, + {NULL} +}; + +static gboolean +timed_exit_cb (void) +{ + gtk_main_quit (); + return FALSE; +} + +static DBusGProxy * +get_bus_proxy (DBusGConnection *connection) +{ + DBusGProxy *bus_proxy; + + bus_proxy = dbus_g_proxy_new_for_name (connection, + DBUS_SERVICE_DBUS, + DBUS_PATH_DBUS, + DBUS_INTERFACE_DBUS); + return bus_proxy; +} + +static gboolean +acquire_name_on_proxy (DBusGProxy *bus_proxy) +{ + GError *error; + guint result; + gboolean res; + gboolean ret; + + ret = FALSE; + + error = NULL; + res = dbus_g_proxy_call (bus_proxy, + "RequestName", + &error, + G_TYPE_STRING, GSD_DBUS_NAME, + G_TYPE_UINT, 0, + G_TYPE_INVALID, + G_TYPE_UINT, &result, + G_TYPE_INVALID); + if (! res) { + if (error != NULL) { + g_warning ("Failed to acquire %s: %s", GSD_DBUS_NAME, error->message); + g_error_free (error); + } else { + g_warning ("Failed to acquire %s", GSD_DBUS_NAME); + } + goto out; + } + + if (result != DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER) { + if (error != NULL) { + g_warning ("Failed to acquire %s: %s", GSD_DBUS_NAME, error->message); + g_error_free (error); + } else { + g_warning ("Failed to acquire %s", GSD_DBUS_NAME); + } + goto out; + } + + ret = TRUE; + + out: + return ret; +} + +static DBusHandlerResult +bus_message_handler (DBusConnection *connection, + DBusMessage *message, + void *user_data) +{ + if (dbus_message_is_signal (message, + DBUS_INTERFACE_LOCAL, + "Disconnected")) { + gtk_main_quit (); + return DBUS_HANDLER_RESULT_HANDLED; + } + + return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; +} + +static DBusGConnection * +get_session_bus (void) +{ + GError *error; + DBusGConnection *bus; + DBusConnection *connection; + + error = NULL; + bus = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (bus == NULL) { + g_warning ("Couldn't connect to session bus: %s", + error->message); + g_error_free (error); + goto out; + } + + connection = dbus_g_connection_get_connection (bus); + dbus_connection_add_filter (connection, + (DBusHandleMessageFunction) + bus_message_handler, + NULL, NULL); + + dbus_connection_set_exit_on_disconnect (connection, FALSE); + + out: + return bus; +} + +static gboolean +bus_register (DBusGConnection *bus) +{ + DBusGProxy *bus_proxy; + gboolean ret; + + mate_settings_profile_start (NULL); + + ret = FALSE; + + bus_proxy = get_bus_proxy (bus); + + if (bus_proxy == NULL) { + g_warning ("Could not construct bus_proxy object"); + goto out; + } + + ret = acquire_name_on_proxy (bus_proxy); + g_object_unref (bus_proxy); + + if (!ret) { + g_warning ("Could not acquire name"); + goto out; + } + + g_debug ("Successfully connected to D-Bus"); + + out: + mate_settings_profile_end (NULL); + + return ret; +} + +static void +on_session_over (DBusGProxy *proxy, MateSettingsManager *manager) +{ + mate_settings_manager_stop (manager); + gtk_main_quit (); +} + +static void +on_term_signal (int signal) +{ + /* Wake up main loop to tell it to shutdown */ + close (term_signal_pipe_fds[1]); + term_signal_pipe_fds[1] = -1; +} + +static gboolean +on_term_signal_pipe_closed (GIOChannel *source, + GIOCondition condition, + gpointer data) +{ + MateSettingsManager *manager; + + manager = MATE_SETTINGS_MANAGER (data); + + term_signal_pipe_fds[0] = -1; + + /* Got SIGTERM, time to clean up and get out + */ + gtk_main_quit (); + + return FALSE; +} + +static void +watch_for_term_signal (MateSettingsManager *manager) +{ + GIOChannel *channel; + + if (-1 == pipe (term_signal_pipe_fds) || + -1 == fcntl (term_signal_pipe_fds[0], F_SETFD, FD_CLOEXEC) || + -1 == fcntl (term_signal_pipe_fds[1], F_SETFD, FD_CLOEXEC)) { + g_error ("Could not create pipe: %s", g_strerror (errno)); + exit (EXIT_FAILURE); + } + + channel = g_io_channel_unix_new (term_signal_pipe_fds[0]); + g_io_channel_set_encoding (channel, NULL, NULL); + g_io_channel_set_buffered (channel, FALSE); + g_io_add_watch (channel, G_IO_HUP, on_term_signal_pipe_closed, manager); + g_io_channel_unref (channel); + + signal (SIGTERM, on_term_signal); + +} + +static void +set_session_over_handler (DBusGConnection *bus, MateSettingsManager *manager) +{ + DBusGProxy *session_proxy; + + g_assert (bus != NULL); + + mate_settings_profile_start (NULL); + + session_proxy = + dbus_g_proxy_new_for_name (bus, + MATE_SESSION_DBUS_NAME, + MATE_SESSION_DBUS_OBJECT, + MATE_SESSION_DBUS_INTERFACE); + + dbus_g_object_register_marshaller ( + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + G_TYPE_INVALID); + + dbus_g_proxy_add_signal (session_proxy, + "SessionOver", + G_TYPE_INVALID); + + dbus_g_proxy_connect_signal (session_proxy, + "SessionOver", + G_CALLBACK (on_session_over), + manager, + NULL); + + watch_for_term_signal (manager); + mate_settings_profile_end (NULL); +} + +static void +gsd_log_default_handler (const gchar *log_domain, + GLogLevelFlags log_level, + const gchar *message, + gpointer unused_data) +{ + /* filter out DEBUG messages if debug isn't set */ + if ((log_level & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_DEBUG + && ! debug) { + return; + } + + g_log_default_handler (log_domain, + log_level, + message, + unused_data); +} + + +/* We want the parent process to quit after initializing all plugins, + * but we have to do all the work in the child process. We can't + * initialize in parent and then fork here: that is not clean with + * X display and DBUS where we would make the connection from one + * process and continue using it from the other. So, we just make the + * parent to fork early and wait. */ + +static void +daemon_start (void) +{ + int child_pid; + char buf[1]; + + if (no_daemon) + return; + + mate_settings_profile_msg ("forking daemon"); + + signal (SIGPIPE, SIG_IGN); + if (-1 == pipe (daemon_pipe_fds)) { + g_error ("Could not create pipe: %s", g_strerror (errno)); + exit (EXIT_FAILURE); + } + + child_pid = fork (); + + switch (child_pid) { + case -1: + g_error ("Could not daemonize: %s", g_strerror (errno)); + exit (EXIT_FAILURE); + + case 0: + /* child */ + + close (daemon_pipe_fds[0]); + + return; + + default: + /* parent */ + + close (daemon_pipe_fds[1]); + + /* Wait for child to signal that we are good to go. */ + read (daemon_pipe_fds[0], buf, 1); + + exit (EXIT_SUCCESS); + } +} + +static void +daemon_detach (void) +{ + if (no_daemon) + return; + + mate_settings_profile_msg ("detaching daemon"); + + /* disconnect */ + setsid (); + close (0); + close (1); + open ("/dev/null", O_RDONLY); + open ("/dev/null", O_WRONLY); + + /* get outta the way */ + chdir ("/"); +} + +static void +daemon_terminate_parent (void) +{ + if (no_daemon) + return; + + mate_settings_profile_msg ("terminating parent"); + + write (daemon_pipe_fds[1], "1", 1); + close (daemon_pipe_fds[1]); +} + +static void +parse_args (int *argc, char ***argv) +{ + GError *error; + GOptionContext *context; + + mate_settings_profile_start (NULL); + + + context = g_option_context_new (NULL); + + g_option_context_add_main_entries (context, entries, NULL); + g_option_context_add_group (context, gtk_get_option_group (FALSE)); + + error = NULL; + if (!g_option_context_parse (context, argc, argv, &error)) { + if (error != NULL) { + g_warning ("%s", error->message); + g_error_free (error); + } else { + g_warning ("Unable to initialize GTK+"); + } + exit (EXIT_FAILURE); + } + + g_option_context_free (context); + + mate_settings_profile_end (NULL); +} + +int +main (int argc, char *argv[]) +{ + MateSettingsManager *manager; + DBusGConnection *bus; + gboolean res; + GError *error; + + manager = NULL; + + if (!g_thread_supported ()) { + g_thread_init (NULL); + } + + mate_settings_profile_start (NULL); + + bindtextdomain (GETTEXT_PACKAGE, MATE_SETTINGS_LOCALEDIR); + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); + textdomain (GETTEXT_PACKAGE); + setlocale (LC_ALL, ""); + + parse_args (&argc, &argv); + + daemon_start (); + + g_type_init (); + + mate_settings_profile_start ("opening gtk display"); + if (! gtk_init_check (NULL, NULL)) { + g_warning ("Unable to initialize GTK+"); + daemon_terminate_parent (); + exit (EXIT_FAILURE); + } + mate_settings_profile_end ("opening gtk display"); + + daemon_detach (); + + g_log_set_default_handler (gsd_log_default_handler, NULL); + + bus = get_session_bus (); + if (bus == NULL) { + g_warning ("Could not get a connection to the bus"); + goto out; + } + + if (! bus_register (bus)) { + goto out; + } + + mate_settings_profile_start ("mate_settings_manager_new"); + manager = mate_settings_manager_new (); + mate_settings_profile_end ("mate_settings_manager_new"); + if (manager == NULL) { + g_warning ("Unable to register object"); + goto out; + } + + set_session_over_handler (bus, manager); + + /* If we aren't started by dbus then load the plugins + automatically. Otherwise, wait for an Awake etc. */ + if (g_getenv ("DBUS_STARTER_BUS_TYPE") == NULL) { + error = NULL; + if (mateconf_prefix != NULL) { + res = mate_settings_manager_start_with_settings_prefix (manager, mateconf_prefix, &error); + } else { + res = mate_settings_manager_start (manager, &error); + } + if (! res) { + g_warning ("Unable to start: %s", error->message); + g_error_free (error); + goto out; + } + } + + daemon_terminate_parent (); + + if (do_timed_exit) { + g_timeout_add (1000 * 30, (GSourceFunc) timed_exit_cb, NULL); + } + + gtk_main (); + + out: + g_free (mateconf_prefix); + + if (bus != NULL) { + dbus_g_connection_unref (bus); + } + + if (manager != NULL) { + g_object_unref (manager); + } + + g_debug ("SettingsDaemon finished"); + mate_settings_profile_end (NULL); + + return 0; +} diff --git a/mate-settings-daemon/mate-settings-manager.c b/mate-settings-daemon/mate-settings-manager.c new file mode 100644 index 0000000..06015ec --- /dev/null +++ b/mate-settings-daemon/mate-settings-manager.c @@ -0,0 +1,557 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#include "config.h" + +#include +#include +#include +#include + +#include +#include +#include +#define DBUS_API_SUBJECT_TO_CHANGE +#include +#include +#include + +#include "mate-settings-plugin-info.h" +#include "mate-settings-manager.h" +#include "mate-settings-manager-glue.h" +#include "mate-settings-profile.h" + +#define GSD_MANAGER_DBUS_PATH "/org/mate/SettingsDaemon" + +#define DEFAULT_SETTINGS_PREFIX "/apps/mate_settings_daemon/plugins" + +#define PLUGIN_EXT ".mate-settings-plugin" + +#define MATE_SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MATE_TYPE_SETTINGS_MANAGER, MateSettingsManagerPrivate)) + +struct MateSettingsManagerPrivate +{ + DBusGConnection *connection; + MateConfClient *mateconf_client; + char *settings_prefix; + GSList *plugins; +}; + +enum { + PROP_0, + PROP_SETTINGS_PREFIX, +}; + +enum { + PLUGIN_ACTIVATED, + PLUGIN_DEACTIVATED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + +static void mate_settings_manager_class_init (MateSettingsManagerClass *klass); +static void mate_settings_manager_init (MateSettingsManager *settings_manager); +static void mate_settings_manager_finalize (GObject *object); + +G_DEFINE_TYPE (MateSettingsManager, mate_settings_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +GQuark +mate_settings_manager_error_quark (void) +{ + static GQuark ret = 0; + if (ret == 0) { + ret = g_quark_from_static_string ("mate_settings_manager_error"); + } + + return ret; +} + +static void +maybe_activate_plugin (MateSettingsPluginInfo *info, gpointer user_data) +{ + if (mate_settings_plugin_info_get_enabled (info)) { + gboolean res; + res = mate_settings_plugin_info_activate (info); + if (res) { + g_debug ("Plugin %s: active", mate_settings_plugin_info_get_location (info)); + } else { + g_debug ("Plugin %s: activation failed", mate_settings_plugin_info_get_location (info)); + } + } else { + g_debug ("Plugin %s: inactive", mate_settings_plugin_info_get_location (info)); + } +} + +static gint +compare_location (MateSettingsPluginInfo *a, + MateSettingsPluginInfo *b) +{ + const char *loc_a; + const char *loc_b; + + loc_a = mate_settings_plugin_info_get_location (a); + loc_b = mate_settings_plugin_info_get_location (b); + + if (loc_a == NULL || loc_b == NULL) { + return -1; + } + + return strcmp (loc_a, loc_b); +} + +static int +compare_priority (MateSettingsPluginInfo *a, + MateSettingsPluginInfo *b) +{ + int prio_a; + int prio_b; + + prio_a = mate_settings_plugin_info_get_priority (a); + prio_b = mate_settings_plugin_info_get_priority (b); + + return prio_a - prio_b; +} + +static void +on_plugin_activated (MateSettingsPluginInfo *info, + MateSettingsManager *manager) +{ + const char *name; + name = mate_settings_plugin_info_get_location (info); + g_debug ("MateSettingsManager: emitting plugin-activated %s", name); + g_signal_emit (manager, signals [PLUGIN_ACTIVATED], 0, name); +} + +static void +on_plugin_deactivated (MateSettingsPluginInfo *info, + MateSettingsManager *manager) +{ + const char *name; + name = mate_settings_plugin_info_get_location (info); + g_debug ("MateSettingsManager: emitting plugin-deactivated %s", name); + g_signal_emit (manager, signals [PLUGIN_DEACTIVATED], 0, name); +} + +static void +_load_file (MateSettingsManager *manager, + const char *filename) +{ + MateSettingsPluginInfo *info; + char *key_name; + int priority; + GError *error; + GSList *l; + + g_debug ("Loading plugin: %s", filename); + mate_settings_profile_start ("%s", filename); + + info = mate_settings_plugin_info_new_from_file (filename); + if (info == NULL) { + goto out; + } + + l = g_slist_find_custom (manager->priv->plugins, + info, + (GCompareFunc) compare_location); + if (l != NULL) { + goto out; + } + + manager->priv->plugins = g_slist_prepend (manager->priv->plugins, + g_object_ref (info)); + + g_signal_connect (info, "activated", + G_CALLBACK (on_plugin_activated), manager); + g_signal_connect (info, "deactivated", + G_CALLBACK (on_plugin_deactivated), manager); + + key_name = g_strdup_printf ("%s/%s/active", + manager->priv->settings_prefix, + mate_settings_plugin_info_get_location (info)); + mate_settings_plugin_info_set_enabled_key_name (info, key_name); + g_free (key_name); + + key_name = g_strdup_printf ("%s/%s/priority", + manager->priv->settings_prefix, + mate_settings_plugin_info_get_location (info)); + error = NULL; + priority = mateconf_client_get_int (manager->priv->mateconf_client, key_name, &error); + if (error == NULL) { + if (priority > 0) { + mate_settings_plugin_info_set_priority (info, priority); + } + } else { + g_error_free (error); + } + g_free (key_name); + + out: + if (info != NULL) { + g_object_unref (info); + } + + mate_settings_profile_end ("%s", filename); +} + +static void +_load_dir (MateSettingsManager *manager, + const char *path) +{ + GError *error; + GDir *d; + const char *name; + + g_debug ("Loading settings plugins from dir: %s", path); + mate_settings_profile_start (NULL); + + error = NULL; + d = g_dir_open (path, 0, &error); + if (d == NULL) { + g_warning ("%s", error->message); + g_error_free (error); + return; + } + + while ((name = g_dir_read_name (d))) { + char *filename; + + if (!g_str_has_suffix (name, PLUGIN_EXT)) { + continue; + } + + filename = g_build_filename (path, name, NULL); + if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { + _load_file (manager, filename); + } + g_free (filename); + } + + g_dir_close (d); + + mate_settings_profile_end (NULL); +} + +static void +_load_all (MateSettingsManager *manager) +{ + mate_settings_profile_start (NULL); + + /* load system plugins */ + _load_dir (manager, MATE_SETTINGS_PLUGINDIR G_DIR_SEPARATOR_S); + + manager->priv->plugins = g_slist_sort (manager->priv->plugins, (GCompareFunc) compare_priority); + g_slist_foreach (manager->priv->plugins, (GFunc) maybe_activate_plugin, NULL); + mate_settings_profile_end (NULL); +} + +static void +_unload_plugin (MateSettingsPluginInfo *info, gpointer user_data) +{ + if (mate_settings_plugin_info_get_enabled (info)) { + mate_settings_plugin_info_deactivate (info); + } + g_object_unref (info); +} + +static void +_unload_all (MateSettingsManager *manager) +{ + g_slist_foreach (manager->priv->plugins, (GFunc) _unload_plugin, NULL); + g_slist_free (manager->priv->plugins); + manager->priv->plugins = NULL; +} + +/* + Example: + dbus-send --session --dest=org.mate.SettingsDaemon \ + --type=method_call --print-reply --reply-timeout=2000 \ + /org/mate/SettingsDaemon \ + org.mate.SettingsDaemon.Awake +*/ +gboolean +mate_settings_manager_awake (MateSettingsManager *manager, + GError **error) +{ + g_debug ("Awake called"); + return mate_settings_manager_start (manager, error); +} + +static gboolean +register_manager (MateSettingsManager *manager) +{ + GError *error = NULL; + + manager->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (manager->priv->connection == NULL) { + if (error != NULL) { + g_critical ("error getting system bus: %s", error->message); + g_error_free (error); + } + return FALSE; + } + + dbus_g_connection_register_g_object (manager->priv->connection, GSD_MANAGER_DBUS_PATH, G_OBJECT (manager)); + + return TRUE; +} + +gboolean +mate_settings_manager_start (MateSettingsManager *manager, + GError **error) +{ + gboolean ret; + + g_debug ("Starting settings manager"); + + ret = FALSE; + + mate_settings_profile_start (NULL); + + if (!g_module_supported ()) { + g_warning ("mate-settings-daemon is not able to initialize the plugins."); + g_set_error (error, + MATE_SETTINGS_MANAGER_ERROR, + MATE_SETTINGS_MANAGER_ERROR_GENERAL, + "Plugins not supported"); + + goto out; + } + + manager->priv->mateconf_client = mateconf_client_get_default (); + + mate_settings_profile_start ("preloading mateconf keys"); + mateconf_client_add_dir (manager->priv->mateconf_client, + manager->priv->settings_prefix, + MATECONF_CLIENT_PRELOAD_RECURSIVE, + NULL); + mate_settings_profile_end ("preloading mateconf keys"); + + _load_all (manager); + + ret = TRUE; + out: + mate_settings_profile_end (NULL); + + return ret; +} + +gboolean +mate_settings_manager_start_with_settings_prefix (MateSettingsManager *manager, + const char *settings_prefix, + GError **error) +{ + g_object_set (manager, "settings-prefix", settings_prefix, NULL); + + return mate_settings_manager_start (manager, error); +} + +void +mate_settings_manager_stop (MateSettingsManager *manager) +{ + g_debug ("Stopping settings manager"); + +#ifdef ENABLE_PYTHON + /* Note: that this may cause finalization of objects by + * running the garbage collector. Since some of the plugin may + * have installed callbacks upon object finalization it must + * run before we get rid of the plugins. + */ + mate_settings_python_shutdown (); +#endif + + _unload_all (manager); + + mateconf_client_remove_dir (manager->priv->mateconf_client, + manager->priv->settings_prefix, + NULL); + g_object_unref (manager->priv->mateconf_client); + manager->priv->mateconf_client = NULL; +} + +static void +_set_settings_prefix (MateSettingsManager *self, + const char *prefix) +{ + g_free (self->priv->settings_prefix); + self->priv->settings_prefix = g_strdup (prefix); +} + +static void +mate_settings_manager_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + MateSettingsManager *self; + + self = MATE_SETTINGS_MANAGER (object); + + switch (prop_id) { + case PROP_SETTINGS_PREFIX: + _set_settings_prefix (self, g_value_get_string (value)); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +mate_settings_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + MateSettingsManager *self; + + self = MATE_SETTINGS_MANAGER (object); + + switch (prop_id) { + case PROP_SETTINGS_PREFIX: + g_value_set_string (value, self->priv->settings_prefix); + break; + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +mate_settings_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + MateSettingsManager *manager; + MateSettingsManagerClass *klass; + + klass = MATE_SETTINGS_MANAGER_CLASS (g_type_class_peek (MATE_TYPE_SETTINGS_MANAGER)); + + manager = MATE_SETTINGS_MANAGER (G_OBJECT_CLASS (mate_settings_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (manager); +} + +static void +mate_settings_manager_dispose (GObject *object) +{ + MateSettingsManager *manager; + + manager = MATE_SETTINGS_MANAGER (object); + + mate_settings_manager_stop (manager); + + G_OBJECT_CLASS (mate_settings_manager_parent_class)->dispose (object); +} + +static void +mate_settings_manager_class_init (MateSettingsManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = mate_settings_manager_get_property; + object_class->set_property = mate_settings_manager_set_property; + object_class->constructor = mate_settings_manager_constructor; + object_class->dispose = mate_settings_manager_dispose; + object_class->finalize = mate_settings_manager_finalize; + + signals [PLUGIN_ACTIVATED] = + g_signal_new ("plugin-activated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (MateSettingsManagerClass, plugin_activated), + NULL, + NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, G_TYPE_STRING); + signals [PLUGIN_DEACTIVATED] = + g_signal_new ("plugin-deactivated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (MateSettingsManagerClass, plugin_deactivated), + NULL, + NULL, + g_cclosure_marshal_VOID__STRING, + G_TYPE_NONE, + 1, G_TYPE_STRING); + + g_object_class_install_property (object_class, + PROP_SETTINGS_PREFIX, + g_param_spec_string ("settings-prefix", + "settings-prefix", + "settings-prefix", + DEFAULT_SETTINGS_PREFIX, + G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); + + g_type_class_add_private (klass, sizeof (MateSettingsManagerPrivate)); + + dbus_g_object_type_install_info (MATE_TYPE_SETTINGS_MANAGER, &dbus_glib_mate_settings_manager_object_info); +} + +static void +mate_settings_manager_init (MateSettingsManager *manager) +{ + + manager->priv = MATE_SETTINGS_MANAGER_GET_PRIVATE (manager); +} + +static void +mate_settings_manager_finalize (GObject *object) +{ + MateSettingsManager *manager; + + g_return_if_fail (object != NULL); + g_return_if_fail (MATE_IS_SETTINGS_MANAGER (object)); + + manager = MATE_SETTINGS_MANAGER (object); + + g_return_if_fail (manager->priv != NULL); + + g_free (manager->priv->settings_prefix); + + G_OBJECT_CLASS (mate_settings_manager_parent_class)->finalize (object); +} + +MateSettingsManager * +mate_settings_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + gboolean res; + + manager_object = g_object_new (MATE_TYPE_SETTINGS_MANAGER, + NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + res = register_manager (manager_object); + if (! res) { + g_object_unref (manager_object); + return NULL; + } + } + + return MATE_SETTINGS_MANAGER (manager_object); +} diff --git a/mate-settings-daemon/mate-settings-manager.h b/mate-settings-daemon/mate-settings-manager.h new file mode 100644 index 0000000..f831b8c --- /dev/null +++ b/mate-settings-daemon/mate-settings-manager.h @@ -0,0 +1,81 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + */ + +#ifndef __MATE_SETTINGS_MANAGER_H +#define __MATE_SETTINGS_MANAGER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define MATE_TYPE_SETTINGS_MANAGER (mate_settings_manager_get_type ()) +#define MATE_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), MATE_TYPE_SETTINGS_MANAGER, MateSettingsManager)) +#define MATE_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), MATE_TYPE_SETTINGS_MANAGER, MateSettingsManagerClass)) +#define MATE_IS_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), MATE_TYPE_SETTINGS_MANAGER)) +#define MATE_IS_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), MATE_TYPE_SETTINGS_MANAGER)) +#define MATE_SETTINGS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), MATE_TYPE_SETTINGS_MANAGER, MateSettingsManagerClass)) + +typedef struct MateSettingsManagerPrivate MateSettingsManagerPrivate; + +typedef struct +{ + GObject parent; + MateSettingsManagerPrivate *priv; +} MateSettingsManager; + +typedef struct +{ + GObjectClass parent_class; + + void (* plugin_activated) (MateSettingsManager *manager, + const char *name); + void (* plugin_deactivated) (MateSettingsManager *manager, + const char *name); +} MateSettingsManagerClass; + +typedef enum +{ + MATE_SETTINGS_MANAGER_ERROR_GENERAL +} MateSettingsManagerError; + +#define MATE_SETTINGS_MANAGER_ERROR mate_settings_manager_error_quark () + +GQuark mate_settings_manager_error_quark (void); +GType mate_settings_manager_get_type (void); + +MateSettingsManager * mate_settings_manager_new (void); +gboolean mate_settings_manager_start_with_settings_prefix + (MateSettingsManager *manager, + const char *settings_prefix, + GError **error); +gboolean mate_settings_manager_start (MateSettingsManager *manager, + GError **error); +void mate_settings_manager_stop (MateSettingsManager *manager); + +gboolean mate_settings_manager_awake (MateSettingsManager *manager, + GError **error); + +#ifdef __cplusplus +} +#endif + +#endif /* __MATE_SETTINGS_MANAGER_H */ diff --git a/mate-settings-daemon/mate-settings-manager.xml b/mate-settings-daemon/mate-settings-manager.xml new file mode 100644 index 0000000..ad68f5d --- /dev/null +++ b/mate-settings-daemon/mate-settings-manager.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/mate-settings-daemon/mate-settings-module.c b/mate-settings-daemon/mate-settings-module.c new file mode 100644 index 0000000..f5c1df4 --- /dev/null +++ b/mate-settings-daemon/mate-settings-module.c @@ -0,0 +1,166 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 - Paolo Maggi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "mate-settings-module.h" + +#include + +typedef struct _MateSettingsModuleClass MateSettingsModuleClass; + +struct _MateSettingsModuleClass +{ + GTypeModuleClass parent_class; +}; + +struct _MateSettingsModule +{ + GTypeModule parent_instance; + + GModule *library; + + char *path; + GType type; +}; + +typedef GType (*MateSettingsModuleRegisterFunc) (GTypeModule *); + +G_DEFINE_TYPE (MateSettingsModule, mate_settings_module, G_TYPE_TYPE_MODULE) + +static gboolean +mate_settings_module_load (GTypeModule *gmodule) +{ + MateSettingsModule *module; + MateSettingsModuleRegisterFunc register_func; + gboolean res; + + module = MATE_SETTINGS_MODULE (gmodule); + + g_debug ("Loading %s", module->path); + + module->library = g_module_open (module->path, 0); + + if (module->library == NULL) { + g_warning ("%s", g_module_error ()); + + return FALSE; + } + + /* extract symbols from the lib */ + res = g_module_symbol (module->library, "register_mate_settings_plugin", (void *) ®ister_func); + if (! res) { + g_warning ("%s", g_module_error ()); + g_module_close (module->library); + + return FALSE; + } + + g_assert (register_func); + + module->type = register_func (gmodule); + + if (module->type == 0) { + g_warning ("Invalid mate settings plugin in module %s", module->path); + return FALSE; + } + + return TRUE; +} + +static void +mate_settings_module_unload (GTypeModule *gmodule) +{ + MateSettingsModule *module = MATE_SETTINGS_MODULE (gmodule); + + g_debug ("Unloading %s", module->path); + + g_module_close (module->library); + + module->library = NULL; + module->type = 0; +} + +const gchar * +mate_settings_module_get_path (MateSettingsModule *module) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_MODULE (module), NULL); + + return module->path; +} + +GObject * +mate_settings_module_new_object (MateSettingsModule *module) +{ + g_debug ("Creating object of type %s", g_type_name (module->type)); + + if (module->type == 0) { + return NULL; + } + + return g_object_new (module->type, NULL); +} + +static void +mate_settings_module_init (MateSettingsModule *module) +{ + g_debug ("MateSettingsModule %p initialising", module); +} + +static void +mate_settings_module_finalize (GObject *object) +{ + MateSettingsModule *module = MATE_SETTINGS_MODULE (object); + + g_debug ("MateSettingsModule %p finalizing", module); + + g_free (module->path); + + G_OBJECT_CLASS (mate_settings_module_parent_class)->finalize (object); +} + +static void +mate_settings_module_class_init (MateSettingsModuleClass *class) +{ + GObjectClass *object_class = G_OBJECT_CLASS (class); + GTypeModuleClass *module_class = G_TYPE_MODULE_CLASS (class); + + object_class->finalize = mate_settings_module_finalize; + + module_class->load = mate_settings_module_load; + module_class->unload = mate_settings_module_unload; +} + +MateSettingsModule * +mate_settings_module_new (const char *path) +{ + MateSettingsModule *result; + + if (path == NULL || path[0] == '\0') { + return NULL; + } + + result = g_object_new (MATE_TYPE_SETTINGS_MODULE, NULL); + + g_type_module_set_name (G_TYPE_MODULE (result), path); + result->path = g_strdup (path); + + return result; +} diff --git a/mate-settings-daemon/mate-settings-module.h b/mate-settings-daemon/mate-settings-module.h new file mode 100644 index 0000000..1efe41a --- /dev/null +++ b/mate-settings-daemon/mate-settings-module.h @@ -0,0 +1,51 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 - Paolo Maggi + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef MATE_SETTINGS_MODULE_H +#define MATE_SETTINGS_MODULE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define MATE_TYPE_SETTINGS_MODULE (mate_settings_module_get_type ()) +#define MATE_SETTINGS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), MATE_TYPE_SETTINGS_MODULE, MateSettingsModule)) +#define MATE_SETTINGS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), MATE_TYPE_SETTINGS_MODULE, MateSettingsModuleClass)) +#define MATE_IS_SETTINGS_MODULE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), MATE_TYPE_SETTINGS_MODULE)) +#define MATE_IS_SETTINGS_MODULE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), MATE_TYPE_SETTINGS_MODULE)) +#define MATE_SETTINGS_MODULE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), MATE_TYPE_SETTINGS_MODULE, MateSettingsModuleClass)) + +typedef struct _MateSettingsModule MateSettingsModule; + +GType mate_settings_module_get_type (void) G_GNUC_CONST; + +MateSettingsModule *mate_settings_module_new (const gchar *path); + +const char *mate_settings_module_get_path (MateSettingsModule *module); + +GObject *mate_settings_module_new_object (MateSettingsModule *module); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/mate-settings-daemon/mate-settings-plugin-info.c b/mate-settings-daemon/mate-settings-plugin-info.c new file mode 100644 index 0000000..c5cd494 --- /dev/null +++ b/mate-settings-daemon/mate-settings-plugin-info.c @@ -0,0 +1,616 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include + +#include +#include +#include +#include + +#include "mate-settings-plugin-info.h" +#include "mate-settings-module.h" +#include "mate-settings-plugin.h" +#include "mate-settings-profile.h" + +#define MATE_SETTINGS_PLUGIN_INFO_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), MATE_TYPE_SETTINGS_PLUGIN_INFO, MateSettingsPluginInfoPrivate)) + +#define PLUGIN_GROUP "MATE Settings Plugin" + +#define PLUGIN_PRIORITY_MAX 1 +#define PLUGIN_PRIORITY_DEFAULT 100 + +typedef enum +{ + MATE_SETTINGS_PLUGIN_LOADER_C, + MATE_SETTINGS_PLUGIN_LOADER_PY +} MateSettingsPluginLoader; + +struct MateSettingsPluginInfoPrivate +{ + char *file; + MateConfClient *client; + + char *location; + MateSettingsPluginLoader loader; + GTypeModule *module; + + char *name; + char *desc; + char **authors; + char *copyright; + char *website; + + MateSettingsPlugin *plugin; + + int enabled : 1; + int active : 1; + + /* A plugin is unavailable if it is not possible to activate it + due to an error loading the plugin module (e.g. for Python plugins + when the interpreter has not been correctly initializated) */ + int available : 1; + + guint enabled_notification_id; + + /* Priority determines the order in which plugins are started and + * stopped. A lower number means higher priority. */ + guint priority; +}; + + +enum { + ACTIVATED, + DEACTIVATED, + LAST_SIGNAL +}; + +static guint signals [LAST_SIGNAL] = { 0, }; + +G_DEFINE_TYPE (MateSettingsPluginInfo, mate_settings_plugin_info, G_TYPE_OBJECT) + +static void +mate_settings_plugin_info_finalize (GObject *object) +{ + MateSettingsPluginInfo *info; + + g_return_if_fail (object != NULL); + g_return_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (object)); + + info = MATE_SETTINGS_PLUGIN_INFO (object); + + g_return_if_fail (info->priv != NULL); + + if (info->priv->plugin != NULL) { + g_debug ("Unref plugin %s", info->priv->name); + + g_object_unref (info->priv->plugin); + + /* info->priv->module must not be unref since it is not possible to finalize + * a type module */ + } + + g_free (info->priv->file); + g_free (info->priv->location); + g_free (info->priv->name); + g_free (info->priv->desc); + g_free (info->priv->website); + g_free (info->priv->copyright); + g_strfreev (info->priv->authors); + + if (info->priv->enabled_notification_id != 0) { + mateconf_client_notify_remove (info->priv->client, + info->priv->enabled_notification_id); + + info->priv->enabled_notification_id = 0; + } + + g_object_unref (info->priv->client); + + G_OBJECT_CLASS (mate_settings_plugin_info_parent_class)->finalize (object); +} + +static void +mate_settings_plugin_info_class_init (MateSettingsPluginInfoClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->finalize = mate_settings_plugin_info_finalize; + + signals [ACTIVATED] = + g_signal_new ("activated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (MateSettingsPluginInfoClass, activated), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + signals [DEACTIVATED] = + g_signal_new ("deactivated", + G_TYPE_FROM_CLASS (object_class), + G_SIGNAL_RUN_LAST, + G_STRUCT_OFFSET (MateSettingsPluginInfoClass, deactivated), + NULL, + NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, + 0); + + g_type_class_add_private (klass, sizeof (MateSettingsPluginInfoPrivate)); +} + +static void +mate_settings_plugin_info_init (MateSettingsPluginInfo *info) +{ + info->priv = MATE_SETTINGS_PLUGIN_INFO_GET_PRIVATE (info); + info->priv->client = mateconf_client_get_default (); +} + +static void +debug_info (MateSettingsPluginInfo *info) +{ + g_debug ("MateSettingsPluginInfo: name='%s' file='%s' location='%s'", + info->priv->name, + info->priv->file, + info->priv->location); +} + +static gboolean +mate_settings_plugin_info_fill_from_file (MateSettingsPluginInfo *info, + const char *filename) +{ + GKeyFile *plugin_file = NULL; + char *str; + int priority; + gboolean ret; + + mate_settings_profile_start ("%s", filename); + + ret = FALSE; + + info->priv->file = g_strdup (filename); + + plugin_file = g_key_file_new (); + if (! g_key_file_load_from_file (plugin_file, filename, G_KEY_FILE_NONE, NULL)) { + g_warning ("Bad plugin file: %s", filename); + goto out; + } + + if (! g_key_file_has_key (plugin_file, PLUGIN_GROUP, "IAge", NULL)) { + g_debug ("IAge key does not exist in file: %s", filename); + goto out; + } + + /* Check IAge=2 */ + if (g_key_file_get_integer (plugin_file, PLUGIN_GROUP, "IAge", NULL) != 0) { + g_debug ("Wrong IAge in file: %s", filename); + goto out; + } + + /* Get Location */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Module", NULL); + + if ((str != NULL) && (*str != '\0')) { + info->priv->location = str; + } else { + g_free (str); + g_warning ("Could not find 'Module' in %s", filename); + goto out; + } + + /* Get the loader for this plugin */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Loader", NULL); + if (str != NULL && strcmp (str, "python") == 0) { + info->priv->loader = MATE_SETTINGS_PLUGIN_LOADER_PY; +#ifndef ENABLE_PYTHON + g_warning ("Cannot load Python plugin '%s' since mate_settings was not " + "compiled with Python support.", filename); + goto out; +#endif + } else { + info->priv->loader = MATE_SETTINGS_PLUGIN_LOADER_C; + } + g_free (str); + + /* Get Name */ + str = g_key_file_get_locale_string (plugin_file, PLUGIN_GROUP, "Name", NULL, NULL); + if (str != NULL) { + info->priv->name = str; + } else { + g_warning ("Could not find 'Name' in %s", filename); + goto out; + } + + /* Get Description */ + str = g_key_file_get_locale_string (plugin_file, PLUGIN_GROUP, "Description", NULL, NULL); + if (str != NULL) { + info->priv->desc = str; + } else { + g_debug ("Could not find 'Description' in %s", filename); + } + + /* Get Authors */ + info->priv->authors = g_key_file_get_string_list (plugin_file, PLUGIN_GROUP, "Authors", NULL, NULL); + if (info->priv->authors == NULL) { + g_debug ("Could not find 'Authors' in %s", filename); + } + + /* Get Copyright */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Copyright", NULL); + if (str != NULL) { + info->priv->copyright = str; + } else { + g_debug ("Could not find 'Copyright' in %s", filename); + } + + /* Get Website */ + str = g_key_file_get_string (plugin_file, PLUGIN_GROUP, "Website", NULL); + if (str != NULL) { + info->priv->website = str; + } else { + g_debug ("Could not find 'Website' in %s", filename); + } + + /* Get Priority */ + priority = g_key_file_get_integer (plugin_file, PLUGIN_GROUP, "Priority", NULL); + if (priority >= PLUGIN_PRIORITY_MAX) { + info->priv->priority = priority; + } else { + info->priv->priority = PLUGIN_PRIORITY_DEFAULT; + } + + g_key_file_free (plugin_file); + + debug_info (info); + + /* If we know nothing about the availability of the plugin, + set it as available */ + info->priv->available = TRUE; + + ret = TRUE; + out: + mate_settings_profile_end ("%s", filename); + + return ret; +} + +static void +plugin_enabled_cb (MateConfClient *client, + guint cnxn_id, + MateConfEntry *entry, + MateSettingsPluginInfo *info) +{ + if (mateconf_value_get_bool (entry->value)) { + mate_settings_plugin_info_activate (info); + } else { + mate_settings_plugin_info_deactivate (info); + } +} + +void +mate_settings_plugin_info_set_enabled_key_name (MateSettingsPluginInfo *info, + const char *key_name) +{ + info->priv->enabled_notification_id = mateconf_client_notify_add (info->priv->client, + key_name, + (MateConfClientNotifyFunc)plugin_enabled_cb, + info, + NULL, + NULL); + + info->priv->enabled = mateconf_client_get_bool (info->priv->client, key_name, NULL); +} + +MateSettingsPluginInfo * +mate_settings_plugin_info_new_from_file (const char *filename) +{ + MateSettingsPluginInfo *info; + gboolean res; + + info = g_object_new (MATE_TYPE_SETTINGS_PLUGIN_INFO, NULL); + + res = mate_settings_plugin_info_fill_from_file (info, filename); + if (! res) { + g_object_unref (info); + info = NULL; + } + + return info; +} + +static void +_deactivate_plugin (MateSettingsPluginInfo *info) +{ + mate_settings_plugin_deactivate (info->priv->plugin); + g_signal_emit (info, signals [DEACTIVATED], 0); +} + +gboolean +mate_settings_plugin_info_deactivate (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + if (!info->priv->active || !info->priv->available) { + return TRUE; + } + + _deactivate_plugin (info); + + /* Update plugin state */ + info->priv->active = FALSE; + + return TRUE; +} + + +static gboolean +load_plugin_module (MateSettingsPluginInfo *info) +{ + char *path; + char *dirname; + gboolean ret; + + ret = FALSE; + + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + g_return_val_if_fail (info->priv->file != NULL, FALSE); + g_return_val_if_fail (info->priv->location != NULL, FALSE); + g_return_val_if_fail (info->priv->plugin == NULL, FALSE); + g_return_val_if_fail (info->priv->available, FALSE); + + mate_settings_profile_start ("%s", info->priv->location); + + switch (info->priv->loader) { + case MATE_SETTINGS_PLUGIN_LOADER_C: + dirname = g_path_get_dirname (info->priv->file); + g_return_val_if_fail (dirname != NULL, FALSE); + + path = g_module_build_path (dirname, info->priv->location); + g_free (dirname); + g_return_val_if_fail (path != NULL, FALSE); + + info->priv->module = G_TYPE_MODULE (mate_settings_module_new (path)); + g_free (path); + + break; + +#ifdef ENABLE_PYTHON + case MATE_SETTINGS_PLUGIN_LOADER_PY: + { + char *dir; + + if (!mate_settings_python_init ()) { + /* Mark plugin as unavailable and fails */ + info->priv->available = FALSE; + + g_warning ("Cannot load Python plugin '%s' since mate_settings " + "was not able to initialize the Python interpreter.", + info->priv->name); + + goto out; + } + + dir = g_path_get_dirname (info->priv->file); + + g_return_val_if_fail ((info->priv->location != NULL) && + (info->priv->location[0] != '\0'), + FALSE); + + info->priv->module = G_TYPE_MODULE ( + mate_settings_python_module_new (dir, info->priv->location)); + + g_free (dir); + break; + } +#endif + default: + g_return_val_if_reached (FALSE); + } + + if (!g_type_module_use (info->priv->module)) { + switch (info->priv->loader) { + case MATE_SETTINGS_PLUGIN_LOADER_C: + g_warning ("Cannot load plugin '%s' since file '%s' cannot be read.", + info->priv->name, + mate_settings_module_get_path (MATE_SETTINGS_MODULE (info->priv->module))); + break; + + case MATE_SETTINGS_PLUGIN_LOADER_PY: + g_warning ("Cannot load Python plugin '%s' since file '%s' cannot be read.", + info->priv->name, + info->priv->location); + break; + + default: + g_return_val_if_reached (FALSE); + } + + g_object_unref (G_OBJECT (info->priv->module)); + info->priv->module = NULL; + + /* Mark plugin as unavailable and fails */ + info->priv->available = FALSE; + + goto out; + } + + switch (info->priv->loader) { + case MATE_SETTINGS_PLUGIN_LOADER_C: + info->priv->plugin = + MATE_SETTINGS_PLUGIN (mate_settings_module_new_object (MATE_SETTINGS_MODULE (info->priv->module))); + break; + +#ifdef ENABLE_PYTHON + case MATE_SETTINGS_PLUGIN_LOADER_PY: + info->priv->plugin = + MATE_SETTINGS_PLUGIN (mate_settings_python_module_new_object (MATE_SETTINGS_PYTHON_MODULE (info->priv->module))); + break; +#endif + + default: + g_return_val_if_reached (FALSE); + } + + g_type_module_unuse (info->priv->module); + ret = TRUE; + out: + mate_settings_profile_end ("%s", info->priv->location); + return ret; +} + +static gboolean +_activate_plugin (MateSettingsPluginInfo *info) +{ + gboolean res = TRUE; + + if (!info->priv->available) { + /* Plugin is not available, don't try to activate/load it */ + return FALSE; + } + + if (info->priv->plugin == NULL) { + res = load_plugin_module (info); + } + + if (res) { + mate_settings_plugin_activate (info->priv->plugin); + g_signal_emit (info, signals [ACTIVATED], 0); + } else { + g_warning ("Error activating plugin '%s'", info->priv->name); + } + + return res; +} + +gboolean +mate_settings_plugin_info_activate (MateSettingsPluginInfo *info) +{ + + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + if (! info->priv->available) { + return FALSE; + } + + if (info->priv->active) { + return TRUE; + } + + if (_activate_plugin (info)) { + info->priv->active = TRUE; + return TRUE; + } + + return FALSE; +} + +gboolean +mate_settings_plugin_info_is_active (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->available && info->priv->active); +} + +gboolean +mate_settings_plugin_info_get_enabled (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->enabled); +} + +gboolean +mate_settings_plugin_info_is_available (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), FALSE); + + return (info->priv->available != FALSE); +} + +const char * +mate_settings_plugin_info_get_name (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->name; +} + +const char * +mate_settings_plugin_info_get_description (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->desc; +} + +const char ** +mate_settings_plugin_info_get_authors (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), (const char **)NULL); + + return (const char **)info->priv->authors; +} + +const char * +mate_settings_plugin_info_get_website (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->website; +} + +const char * +mate_settings_plugin_info_get_copyright (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->copyright; +} + + +const char * +mate_settings_plugin_info_get_location (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), NULL); + + return info->priv->location; +} + +int +mate_settings_plugin_info_get_priority (MateSettingsPluginInfo *info) +{ + g_return_val_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info), PLUGIN_PRIORITY_DEFAULT); + + return info->priv->priority; +} + +void +mate_settings_plugin_info_set_priority (MateSettingsPluginInfo *info, + int priority) +{ + g_return_if_fail (MATE_IS_SETTINGS_PLUGIN_INFO (info)); + + info->priv->priority = priority; +} diff --git a/mate-settings-daemon/mate-settings-plugin-info.h b/mate-settings-daemon/mate-settings-plugin-info.h new file mode 100644 index 0000000..b99036a --- /dev/null +++ b/mate-settings-daemon/mate-settings-plugin-info.h @@ -0,0 +1,81 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2008 Red Hat, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __MATE_SETTINGS_PLUGIN_INFO_H__ +#define __MATE_SETTINGS_PLUGIN_INFO_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +#define MATE_TYPE_SETTINGS_PLUGIN_INFO (mate_settings_plugin_info_get_type()) +#define MATE_SETTINGS_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), MATE_TYPE_SETTINGS_PLUGIN_INFO, MateSettingsPluginInfo)) +#define MATE_SETTINGS_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), MATE_TYPE_SETTINGS_PLUGIN_INFO, MateSettingsPluginInfoClass)) +#define MATE_IS_SETTINGS_PLUGIN_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), MATE_TYPE_SETTINGS_PLUGIN_INFO)) +#define MATE_IS_SETTINGS_PLUGIN_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_SETTINGS_PLUGIN_INFO)) +#define MATE_SETTINGS_PLUGIN_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), MATE_TYPE_SETTINGS_PLUGIN_INFO, MateSettingsPluginInfoClass)) + +typedef struct MateSettingsPluginInfoPrivate MateSettingsPluginInfoPrivate; + +typedef struct +{ + GObject parent; + MateSettingsPluginInfoPrivate *priv; +} MateSettingsPluginInfo; + +typedef struct +{ + GObjectClass parent_class; + + void (* activated) (MateSettingsPluginInfo *info); + void (* deactivated) (MateSettingsPluginInfo *info); +} MateSettingsPluginInfoClass; + +GType mate_settings_plugin_info_get_type (void) G_GNUC_CONST; + +MateSettingsPluginInfo *mate_settings_plugin_info_new_from_file (const char *filename); + +void mate_settings_plugin_info_set_enabled_key_name (MateSettingsPluginInfo *info, + const char *key_name); +gboolean mate_settings_plugin_info_activate (MateSettingsPluginInfo *info); +gboolean mate_settings_plugin_info_deactivate (MateSettingsPluginInfo *info); + +gboolean mate_settings_plugin_info_is_active (MateSettingsPluginInfo *info); +gboolean mate_settings_plugin_info_get_enabled (MateSettingsPluginInfo *info); +gboolean mate_settings_plugin_info_is_available (MateSettingsPluginInfo *info); + +const char *mate_settings_plugin_info_get_name (MateSettingsPluginInfo *info); +const char *mate_settings_plugin_info_get_description (MateSettingsPluginInfo *info); +const char **mate_settings_plugin_info_get_authors (MateSettingsPluginInfo *info); +const char *mate_settings_plugin_info_get_website (MateSettingsPluginInfo *info); +const char *mate_settings_plugin_info_get_copyright (MateSettingsPluginInfo *info); +const char *mate_settings_plugin_info_get_location (MateSettingsPluginInfo *info); +int mate_settings_plugin_info_get_priority (MateSettingsPluginInfo *info); + +void mate_settings_plugin_info_set_priority (MateSettingsPluginInfo *info, + int priority); + +#ifdef __cplusplus +} +#endif + +#endif /* __MATE_SETTINGS_PLUGIN_INFO_H__ */ diff --git a/mate-settings-daemon/mate-settings-plugin.c b/mate-settings-daemon/mate-settings-plugin.c new file mode 100644 index 0000000..7fbb693 --- /dev/null +++ b/mate-settings-daemon/mate-settings-plugin.c @@ -0,0 +1,61 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2002-2005 Paolo Maggi + * Copyright (C) 2007 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#include "config.h" + +#include "mate-settings-plugin.h" + +G_DEFINE_TYPE (MateSettingsPlugin, mate_settings_plugin, G_TYPE_OBJECT) + +static void +dummy (MateSettingsPlugin *plugin) +{ + /* Empty */ +} + +static void +mate_settings_plugin_class_init (MateSettingsPluginClass *klass) +{ + klass->activate = dummy; + klass->deactivate = dummy; +} + +static void +mate_settings_plugin_init (MateSettingsPlugin *plugin) +{ + /* Empty */ +} + +void +mate_settings_plugin_activate (MateSettingsPlugin *plugin) +{ + g_return_if_fail (MATE_IS_SETTINGS_PLUGIN (plugin)); + + MATE_SETTINGS_PLUGIN_GET_CLASS (plugin)->activate (plugin); +} + +void +mate_settings_plugin_deactivate (MateSettingsPlugin *plugin) +{ + g_return_if_fail (MATE_IS_SETTINGS_PLUGIN (plugin)); + + MATE_SETTINGS_PLUGIN_GET_CLASS (plugin)->deactivate (plugin); +} diff --git a/mate-settings-daemon/mate-settings-plugin.h b/mate-settings-daemon/mate-settings-plugin.h new file mode 100644 index 0000000..1786f02 --- /dev/null +++ b/mate-settings-daemon/mate-settings-plugin.h @@ -0,0 +1,183 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2002-2005 Paolo Maggi + * Copyright (C) 2007 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + */ + +#ifndef __MATE_SETTINGS_PLUGIN_H__ +#define __MATE_SETTINGS_PLUGIN_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif +#define MATE_TYPE_SETTINGS_PLUGIN (mate_settings_plugin_get_type()) +#define MATE_SETTINGS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), MATE_TYPE_SETTINGS_PLUGIN, MateSettingsPlugin)) +#define MATE_SETTINGS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), MATE_TYPE_SETTINGS_PLUGIN, MateSettingsPluginClass)) +#define MATE_IS_SETTINGS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), MATE_TYPE_SETTINGS_PLUGIN)) +#define MATE_IS_SETTINGS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), MATE_TYPE_SETTINGS_PLUGIN)) +#define MATE_SETTINGS_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), MATE_TYPE_SETTINGS_PLUGIN, MateSettingsPluginClass)) + +typedef struct +{ + GObject parent; +} MateSettingsPlugin; + +typedef struct +{ + GObjectClass parent_class; + + /* Virtual public methods */ + void (*activate) (MateSettingsPlugin *plugin); + void (*deactivate) (MateSettingsPlugin *plugin); +} MateSettingsPluginClass; + +GType mate_settings_plugin_get_type (void) G_GNUC_CONST; + +void mate_settings_plugin_activate (MateSettingsPlugin *plugin); +void mate_settings_plugin_deactivate (MateSettingsPlugin *plugin); + +/* + * Utility macro used to register plugins + * + * use: MATE_SETTINGS_PLUGIN_REGISTER (PluginName, plugin_name) + */ +#define MATE_SETTINGS_PLUGIN_REGISTER(PluginName, plugin_name) \ + \ +static GType plugin_name##_type = 0; \ +static GTypeModule *plugin_module_type = 0; \ + \ +GType \ +plugin_name##_get_type (void) \ +{ \ + return plugin_name##_type; \ +} \ + \ +static void plugin_name##_init (PluginName *self); \ +static void plugin_name##_class_init (PluginName##Class *klass); \ +static gpointer plugin_name##_parent_class = NULL; \ +static void plugin_name##_class_intern_init (gpointer klass) \ +{ \ + plugin_name##_parent_class = g_type_class_peek_parent (klass); \ + plugin_name##_class_init ((PluginName##Class *) klass); \ +} \ + \ +G_MODULE_EXPORT GType \ +register_mate_settings_plugin (GTypeModule *module) \ +{ \ + static const GTypeInfo our_info = \ + { \ + sizeof (PluginName##Class), \ + NULL, /* base_init */ \ + NULL, /* base_finalize */ \ + (GClassInitFunc) plugin_name##_class_intern_init, \ + NULL, \ + NULL, /* class_data */ \ + sizeof (PluginName), \ + 0, /* n_preallocs */ \ + (GInstanceInitFunc) plugin_name##_init \ + }; \ + \ + g_debug ("Registering " #PluginName); \ + \ + /* Initialise the i18n stuff */ \ + bindtextdomain (GETTEXT_PACKAGE, MATE_SETTINGS_LOCALEDIR); \ + bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); \ + \ + plugin_module_type = module; \ + plugin_name##_type = g_type_module_register_type (module, \ + MATE_TYPE_SETTINGS_PLUGIN, \ + #PluginName, \ + &our_info, \ + 0); \ + \ + return plugin_name##_type; \ +} + +/* + * Utility macro used to register gobject types in plugins with additional code + * + * use: MATE_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) + */ +#define MATE_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, CODE) \ +static void object_name##_init (ObjectName *self); \ +static void object_name##_class_init (ObjectName##Class *klass); \ +static gpointer object_name##_parent_class = ((void *)0); \ +static GType ojbect_name##_type_id = 0; \ + \ +static void object_name##_class_intern_init (gpointer klass) \ +{ \ + object_name##_parent_class = g_type_class_peek_parent (klass); \ + object_name##_class_init ((ObjectName##Class *) klass); \ +} \ + \ + \ +GType \ +object_name##_get_type (void) \ +{ \ + g_assert (object_name##_type_id != 0); \ + \ + return object_name##_type_id; \ +} \ + \ +GType \ +object_name##_register_type (GTypeModule *module) \ +{ \ + if ((object_name##_type_id == 0)) { \ + const GTypeInfo g_define_type_info = { \ + sizeof (ObjectName##Class), \ + (GBaseInitFunc) ((void *)0), \ + (GBaseFinalizeFunc) ((void *)0), \ + (GClassInitFunc) object_name##_class_intern_init, \ + (GClassFinalizeFunc) ((void *)0), \ + ((void *)0), \ + sizeof (ObjectName), \ + 0, \ + (GInstanceInitFunc) object_name##_init, \ + ((void *)0) \ + }; \ + object_name##_type_id = \ + g_type_module_register_type (module, \ + PARENT_TYPE, \ + #ObjectName, \ + &g_define_type_info, \ + (GTypeFlags) 0); \ + } \ + \ + g_debug ("Registering " #ObjectName); \ + \ + CODE \ + \ + return type_name##_type_id; \ +} + +/* + * Utility macro used to register gobject types in plugins + * + * use: MATE_SETTINGS_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) + */ +#define MATE_SETTINGS_PLUGIN_DEFINE_TYPE(ObjectName, object_name, PARENT_TYPE) \ + MATE_SETTINGS_PLUGIN_DEFINE_TYPE_WITH_CODE(ObjectName, object_name, PARENT_TYPE, ;) + +#ifdef __cplusplus +} +#endif + +#endif /* __MATE_SETTINGS_PLUGIN_H__ */ diff --git a/mate-settings-daemon/mate-settings-profile.c b/mate-settings-daemon/mate-settings-profile.c new file mode 100644 index 0000000..330327a --- /dev/null +++ b/mate-settings-daemon/mate-settings-profile.c @@ -0,0 +1,65 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: William Jon McCann + * + */ + +#include "config.h" + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include "mate-settings-profile.h" + +void +_mate_settings_profile_log (const char *func, + const char *note, + const char *format, + ...) +{ + va_list args; + char *str; + char *formatted; + + if (format == NULL) { + formatted = g_strdup (""); + } else { + va_start (args, format); + formatted = g_strdup_vprintf (format, args); + va_end (args); + } + + if (func != NULL) { + str = g_strdup_printf ("MARK: %s %s: %s %s", g_get_prgname(), func, note ? note : "", formatted); + } else { + str = g_strdup_printf ("MARK: %s: %s %s", g_get_prgname(), note ? note : "", formatted); + } + + g_free (formatted); + + g_access (str, F_OK); + g_free (str); +} diff --git a/mate-settings-daemon/mate-settings-profile.h b/mate-settings-daemon/mate-settings-profile.h new file mode 100644 index 0000000..6740488 --- /dev/null +++ b/mate-settings-daemon/mate-settings-profile.h @@ -0,0 +1,57 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2005 William Jon McCann + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * Authors: William Jon McCann + * + */ + +#ifndef __MATE_SETTINGS_PROFILE_H +#define __MATE_SETTINGS_PROFILE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef ENABLE_PROFILING +#ifdef G_HAVE_ISO_VARARGS +#define mate_settings_profile_start(...) _mate_settings_profile_log (G_STRFUNC, "start", __VA_ARGS__) +#define mate_settings_profile_end(...) _mate_settings_profile_log (G_STRFUNC, "end", __VA_ARGS__) +#define mate_settings_profile_msg(...) _mate_settings_profile_log (NULL, NULL, __VA_ARGS__) +#elif defined(G_HAVE_GNUC_VARARGS) +#define mate_settings_profile_start(format...) _mate_settings_profile_log (G_STRFUNC, "start", format) +#define mate_settings_profile_end(format...) _mate_settings_profile_log (G_STRFUNC, "end", format) +#define mate_settings_profile_msg(format...) _mate_settings_profile_log (NULL, NULL, format) +#endif +#else +#define mate_settings_profile_start(...) +#define mate_settings_profile_end(...) +#define mate_settings_profile_msg(...) +#endif + +void _mate_settings_profile_log (const char *func, + const char *note, + const char *format, + ...) G_GNUC_PRINTF (3, 4); + +#ifdef __cplusplus +} +#endif + +#endif /* __MATE_SETTINGS_PROFILE_H */ -- cgit v1.2.1