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 --- plugins/font/Makefile.am | 51 +++ plugins/font/Makefile.in | 687 ++++++++++++++++++++++++++++++ plugins/font/delayed-dialog.c | 122 ++++++ plugins/font/delayed-dialog.h | 36 ++ plugins/font/font.mate-settings-plugin.in | 8 + plugins/font/gsd-font-manager.c | 440 +++++++++++++++++++ plugins/font/gsd-font-manager.h | 61 +++ plugins/font/gsd-font-plugin.c | 104 +++++ plugins/font/gsd-font-plugin.h | 63 +++ 9 files changed, 1572 insertions(+) create mode 100644 plugins/font/Makefile.am create mode 100644 plugins/font/Makefile.in create mode 100644 plugins/font/delayed-dialog.c create mode 100644 plugins/font/delayed-dialog.h create mode 100644 plugins/font/font.mate-settings-plugin.in create mode 100644 plugins/font/gsd-font-manager.c create mode 100644 plugins/font/gsd-font-manager.h create mode 100644 plugins/font/gsd-font-plugin.c create mode 100644 plugins/font/gsd-font-plugin.h (limited to 'plugins/font') diff --git a/plugins/font/Makefile.am b/plugins/font/Makefile.am new file mode 100644 index 0000000..99dff34 --- /dev/null +++ b/plugins/font/Makefile.am @@ -0,0 +1,51 @@ +NULL = + +plugin_LTLIBRARIES = \ + libfont.la \ + $(NULL) + +libfont_la_SOURCES = \ + gsd-font-plugin.h \ + gsd-font-plugin.c \ + gsd-font-manager.h \ + gsd-font-manager.c \ + delayed-dialog.h \ + delayed-dialog.c \ + $(NULL) + +libfont_la_CPPFLAGS = \ + -I$(top_srcdir)/mate-settings-daemon \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libfont_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libfont_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libfont_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_in_files = \ + font.mate-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin) + +EXTRA_DIST = \ + $(plugin_in_files) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +@GSD_INTLTOOL_PLUGIN_RULE@ diff --git a/plugins/font/Makefile.in b/plugins/font/Makefile.in new file mode 100644 index 0000000..a3c90ea --- /dev/null +++ b/plugins/font/Makefile.in @@ -0,0 +1,687 @@ +# 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@ +subdir = plugins/font +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 = +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' +am__installdirs = "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)" +LTLIBRARIES = $(plugin_LTLIBRARIES) +am__DEPENDENCIES_1 = +libfont_la_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1) +am__objects_1 = +am_libfont_la_OBJECTS = libfont_la-gsd-font-plugin.lo \ + libfont_la-gsd-font-manager.lo libfont_la-delayed-dialog.lo \ + $(am__objects_1) +libfont_la_OBJECTS = $(am_libfont_la_OBJECTS) +libfont_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(libfont_la_CFLAGS) \ + $(CFLAGS) $(libfont_la_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 = $(libfont_la_SOURCES) +DIST_SOURCES = $(libfont_la_SOURCES) +DATA = $(plugin_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 = +plugin_LTLIBRARIES = \ + libfont.la \ + $(NULL) + +libfont_la_SOURCES = \ + gsd-font-plugin.h \ + gsd-font-plugin.c \ + gsd-font-manager.h \ + gsd-font-manager.c \ + delayed-dialog.h \ + delayed-dialog.c \ + $(NULL) + +libfont_la_CPPFLAGS = \ + -I$(top_srcdir)/mate-settings-daemon \ + -DMATE_SETTINGS_LOCALEDIR=\""$(datadir)/locale"\" \ + $(AM_CPPFLAGS) + +libfont_la_CFLAGS = \ + $(SETTINGS_PLUGIN_CFLAGS) \ + $(AM_CFLAGS) + +libfont_la_LDFLAGS = \ + $(GSD_PLUGIN_LDFLAGS) \ + $(NULL) + +libfont_la_LIBADD = \ + $(SETTINGS_PLUGIN_LIBS) \ + $(NULL) + +plugin_in_files = \ + font.mate-settings-plugin.in \ + $(NULL) + +plugin_DATA = $(plugin_in_files:.mate-settings-plugin.in=.mate-settings-plugin) +EXTRA_DIST = \ + $(plugin_in_files) \ + $(NULL) + +CLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +DISTCLEANFILES = \ + $(plugin_DATA) \ + $(NULL) + +all: 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 plugins/font/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --gnu plugins/font/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): +install-pluginLTLIBRARIES: $(plugin_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(plugindir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(plugindir)"; \ + } + +uninstall-pluginLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(plugin_LTLIBRARIES)'; test -n "$(plugindir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(plugindir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(plugindir)/$$f"; \ + done + +clean-pluginLTLIBRARIES: + -test -z "$(plugin_LTLIBRARIES)" || rm -f $(plugin_LTLIBRARIES) + @list='$(plugin_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 +libfont.la: $(libfont_la_OBJECTS) $(libfont_la_DEPENDENCIES) + $(libfont_la_LINK) -rpath $(plugindir) $(libfont_la_OBJECTS) $(libfont_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfont_la-delayed-dialog.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfont_la-gsd-font-manager.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libfont_la-gsd-font-plugin.Plo@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 $@ $< + +libfont_la-gsd-font-plugin.lo: gsd-font-plugin.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfont_la_CPPFLAGS) $(CPPFLAGS) $(libfont_la_CFLAGS) $(CFLAGS) -MT libfont_la-gsd-font-plugin.lo -MD -MP -MF $(DEPDIR)/libfont_la-gsd-font-plugin.Tpo -c -o libfont_la-gsd-font-plugin.lo `test -f 'gsd-font-plugin.c' || echo '$(srcdir)/'`gsd-font-plugin.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfont_la-gsd-font-plugin.Tpo $(DEPDIR)/libfont_la-gsd-font-plugin.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-font-plugin.c' object='libfont_la-gsd-font-plugin.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) $(libfont_la_CPPFLAGS) $(CPPFLAGS) $(libfont_la_CFLAGS) $(CFLAGS) -c -o libfont_la-gsd-font-plugin.lo `test -f 'gsd-font-plugin.c' || echo '$(srcdir)/'`gsd-font-plugin.c + +libfont_la-gsd-font-manager.lo: gsd-font-manager.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfont_la_CPPFLAGS) $(CPPFLAGS) $(libfont_la_CFLAGS) $(CFLAGS) -MT libfont_la-gsd-font-manager.lo -MD -MP -MF $(DEPDIR)/libfont_la-gsd-font-manager.Tpo -c -o libfont_la-gsd-font-manager.lo `test -f 'gsd-font-manager.c' || echo '$(srcdir)/'`gsd-font-manager.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfont_la-gsd-font-manager.Tpo $(DEPDIR)/libfont_la-gsd-font-manager.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='gsd-font-manager.c' object='libfont_la-gsd-font-manager.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) $(libfont_la_CPPFLAGS) $(CPPFLAGS) $(libfont_la_CFLAGS) $(CFLAGS) -c -o libfont_la-gsd-font-manager.lo `test -f 'gsd-font-manager.c' || echo '$(srcdir)/'`gsd-font-manager.c + +libfont_la-delayed-dialog.lo: delayed-dialog.c +@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libfont_la_CPPFLAGS) $(CPPFLAGS) $(libfont_la_CFLAGS) $(CFLAGS) -MT libfont_la-delayed-dialog.lo -MD -MP -MF $(DEPDIR)/libfont_la-delayed-dialog.Tpo -c -o libfont_la-delayed-dialog.lo `test -f 'delayed-dialog.c' || echo '$(srcdir)/'`delayed-dialog.c +@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/libfont_la-delayed-dialog.Tpo $(DEPDIR)/libfont_la-delayed-dialog.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='delayed-dialog.c' object='libfont_la-delayed-dialog.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) $(libfont_la_CPPFLAGS) $(CPPFLAGS) $(libfont_la_CFLAGS) $(CFLAGS) -c -o libfont_la-delayed-dialog.lo `test -f 'delayed-dialog.c' || echo '$(srcdir)/'`delayed-dialog.c + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-pluginDATA: $(plugin_DATA) + @$(NORMAL_INSTALL) + test -z "$(plugindir)" || $(MKDIR_P) "$(DESTDIR)$(plugindir)" + @list='$(plugin_DATA)'; test -n "$(plugindir)" || 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)$(plugindir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(plugindir)" || exit $$?; \ + done + +uninstall-pluginDATA: + @$(NORMAL_UNINSTALL) + @list='$(plugin_DATA)'; test -n "$(plugindir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(plugindir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(plugindir)" && 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: check-am +all-am: Makefile $(LTLIBRARIES) $(DATA) +installdirs: + for dir in "$(DESTDIR)$(plugindir)" "$(DESTDIR)$(plugindir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: 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) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool clean-pluginLTLIBRARIES \ + 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-pluginDATA install-pluginLTLIBRARIES + +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-pluginDATA uninstall-pluginLTLIBRARIES + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pluginLTLIBRARIES ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-pluginDATA \ + install-pluginLTLIBRARIES 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-pluginDATA uninstall-pluginLTLIBRARIES + + +@GSD_INTLTOOL_PLUGIN_RULE@ + +# 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/plugins/font/delayed-dialog.c b/plugins/font/delayed-dialog.c new file mode 100644 index 0000000..bfc8493 --- /dev/null +++ b/plugins/font/delayed-dialog.c @@ -0,0 +1,122 @@ +/* + * Copyright © 2006 Novell, 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, 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 +#include + +#include +#include + +#include "delayed-dialog.h" + +static gboolean delayed_show_timeout (gpointer data); +static GdkFilterReturn message_filter (GdkXEvent *xevent, + GdkEvent *event, + gpointer data); + +static GSList *dialogs = NULL; + +/** + * mate_settings_delayed_show_dialog: + * @dialog: the dialog + * + * Shows the dialog as with gtk_widget_show(), unless a window manager + * hasn't been started yet, in which case it will wait up to 5 seconds + * for that to happen before showing the dialog. + **/ +void +mate_settings_delayed_show_dialog (GtkWidget *dialog) +{ + GdkDisplay *display = gtk_widget_get_display (dialog); + Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); + GdkScreen *screen = gtk_widget_get_screen (dialog); + GdkAtom manager_atom; + char selection_name[10]; + Atom selection_atom; + + /* We can't use gdk_selection_owner_get() for this, because + * it's an unknown out-of-process window. + */ + snprintf (selection_name, sizeof (selection_name), "WM_S%d", + gdk_screen_get_number (screen)); + selection_atom = XInternAtom (xdisplay, selection_name, True); + if (selection_atom && + XGetSelectionOwner (xdisplay, selection_atom) != None) { + gtk_widget_show (dialog); + return; + } + + dialogs = g_slist_prepend (dialogs, dialog); + + manager_atom = gdk_atom_intern ("MANAGER", FALSE); + gdk_display_add_client_message_filter (display, manager_atom, + message_filter, NULL); + + g_timeout_add (5000, delayed_show_timeout, NULL); +} + +static gboolean +delayed_show_timeout (gpointer data) +{ + GSList *l; + + for (l = dialogs; l; l = l->next) + gtk_widget_show (l->data); + g_slist_free (dialogs); + dialogs = NULL; + + /* FIXME: There's no gdk_display_remove_client_message_filter */ + + return FALSE; +} + +static GdkFilterReturn +message_filter (GdkXEvent *xevent, GdkEvent *event, gpointer data) +{ + XClientMessageEvent *evt = (XClientMessageEvent *)xevent; + char *selection_name = XGetAtomName (evt->display, evt->data.l[1]); + int screen; + GSList *l, *next; + + if (!dialogs) + return GDK_FILTER_CONTINUE; + + if (strncmp (selection_name, "WM_S", 4) != 0) { + XFree (selection_name); + return GDK_FILTER_CONTINUE; + } + + screen = atoi (selection_name + 4); + + for (l = dialogs; l; l = next) { + GtkWidget *dialog = l->data; + next = l->next; + + if (gdk_screen_get_number (gtk_widget_get_screen (dialog)) == screen) { + gtk_widget_show (dialog); + dialogs = g_slist_remove (dialogs, dialog); + } + } + + if (!dialogs) { + /* FIXME: There's no gdk_display_remove_client_message_filter */ + } + + return GDK_FILTER_CONTINUE; +} diff --git a/plugins/font/delayed-dialog.h b/plugins/font/delayed-dialog.h new file mode 100644 index 0000000..0c35317 --- /dev/null +++ b/plugins/font/delayed-dialog.h @@ -0,0 +1,36 @@ +/* + * Copyright © 2006 Novell, 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, 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 __DELAYED_DIALOG_H +#define __DELAYED_DIALOG_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +void mate_settings_delayed_show_dialog (GtkWidget *dialog); + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/plugins/font/font.mate-settings-plugin.in b/plugins/font/font.mate-settings-plugin.in new file mode 100644 index 0000000..6bb1c47 --- /dev/null +++ b/plugins/font/font.mate-settings-plugin.in @@ -0,0 +1,8 @@ +[MATE Settings Plugin] +Module=font +IAge=0 +_Name=Font +_Description=Font plugin +Authors=Rodrigo Moya +Copyright=Copyright © 2007 The MATE Foundation +Website= diff --git a/plugins/font/gsd-font-manager.c b/plugins/font/gsd-font-manager.c new file mode 100644 index 0000000..ed33e1c --- /dev/null +++ b/plugins/font/gsd-font-manager.c @@ -0,0 +1,440 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- + * + * Copyright (C) 2007 The MATE Foundation + * 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 +#include +#include +#include +#include + +#include "mate-settings-profile.h" +#include "gsd-font-manager.h" +#include "delayed-dialog.h" + +static void gsd_font_manager_class_init (GsdFontManagerClass *klass); +static void gsd_font_manager_init (GsdFontManager *font_manager); + +G_DEFINE_TYPE (GsdFontManager, gsd_font_manager, G_TYPE_OBJECT) + +static gpointer manager_object = NULL; + +static void +update_property (GString *props, const gchar* key, const gchar* value) +{ + gchar* needle; + size_t needle_len; + gchar* found = NULL; + + /* update an existing property */ + needle = g_strconcat (key, ":", NULL); + needle_len = strlen (needle); + if (g_str_has_prefix (props->str, needle)) + found = props->str; + else + found = strstr (props->str, needle); + + if (found) { + size_t value_index; + gchar* end; + + end = strchr (found, '\n'); + value_index = (found - props->str) + needle_len + 1; + g_string_erase (props, value_index, end ? (end - found - needle_len) : -1); + g_string_insert (props, value_index, "\n"); + g_string_insert (props, value_index, value); + } else { + g_string_append_printf (props, "%s:\t%s\n", key, value); + } +} + +static void +load_xcursor_theme (MateConfClient *client) +{ + char *cursor_theme; + int size; + GString *add_string; + Display *dpy; + gchar numbuf[20]; + + mate_settings_profile_start (NULL); + + size = mateconf_client_get_int (client, + "/desktop/mate/peripherals/mouse/cursor_size", + NULL); + if (size <= 0) { + return; + } + + cursor_theme = mateconf_client_get_string (client, + "/desktop/mate/peripherals/mouse/cursor_theme", + NULL); + if (cursor_theme == NULL) { + return; + } + + /* get existing properties */ + dpy = XOpenDisplay (NULL); + g_return_if_fail (dpy != NULL); + add_string = g_string_new (XResourceManagerString (dpy)); + g_debug("load_xcursor_theme: existing res '%s'", add_string->str); + + update_property (add_string, "Xcursor.theme", cursor_theme); + update_property (add_string, "Xcursor.theme_core", "true"); + g_snprintf (numbuf, sizeof (numbuf), "%i", size); + update_property (add_string, "Xcursor.size", numbuf); + + g_debug("load_xcursor_theme: new res '%s'", add_string->str); + + /* Set the new X property */ + XChangeProperty(dpy, RootWindow (dpy, 0), + XA_RESOURCE_MANAGER, XA_STRING, 8, PropModeReplace, add_string->str, add_string->len); + XCloseDisplay (dpy); + + g_free (cursor_theme); + g_string_free (add_string, TRUE); + + mate_settings_profile_end (NULL); +} + +static char* +setup_dir (const char *font_dir_name, gboolean create) +{ + char *font_dir; + + font_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_home_dir (), ".mate2", "share", font_dir_name, NULL); + + if (create) { + if (g_mkdir_with_parents (font_dir, 0755) != 0) { + g_warning ("Cannot create needed directory \"%s\".", font_dir); + g_free (font_dir); + font_dir = NULL; + } + } else if (! g_file_test (font_dir, G_FILE_TEST_EXISTS)) { + g_free (font_dir); + font_dir = NULL; + } + + return font_dir; +} + +static char * +empty_check_dir (char *font_dir) +{ + char *file_name; + + if (!font_dir) + return NULL; + + /* remove the fonts.dir and fonts.scale files that mkfontdir generates. */ + + file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.dir", NULL); + unlink (file_name); + g_free (file_name); + + file_name = g_build_filename (G_DIR_SEPARATOR_S, font_dir, "fonts.scale", NULL); + unlink (file_name); + g_free (file_name); + + /* if it's empty, get rid of it. */ + if (0 == rmdir (font_dir)) { + g_free (font_dir); + font_dir = NULL; + } + + return font_dir; +} + +static char* +setup_font_dir (MateConfClient *client) +{ + return empty_check_dir (setup_dir ("fonts", FALSE)); +} + +static char* +setup_cursor_dir (MateConfClient *client) +{ + char *cursor_dir; + char *cursor_font; + DIR *dir; + struct dirent *file_dirent; + + cursor_font = mateconf_client_get_string (client, + "/desktop/mate/peripherals/mouse/cursor_font", + NULL); + if (cursor_font != NULL) { + if (!g_path_is_absolute (cursor_font) || + !g_file_test (cursor_font, G_FILE_TEST_IS_REGULAR)) { + /* font file is not usable */ + g_free (cursor_font); + cursor_font = NULL; + } + } + + cursor_dir = setup_dir ("cursor-fonts", cursor_font != NULL); + + /* remove previously made symlinks, if any */ + if (cursor_dir) { + dir = opendir (cursor_dir); + while ((file_dirent = readdir (dir)) != NULL) { + struct stat st; + char *link_name; + + link_name = g_build_filename (cursor_dir, file_dirent->d_name, NULL); + if (lstat (link_name, &st)) { + g_free (link_name); + continue; + } + g_free (link_name); + + if (S_ISLNK (st.st_mode)) + unlink (link_name); + } + closedir (dir); + } + + if (cursor_font && cursor_dir) { + char *newpath; + char *font_name; + + font_name = strrchr (cursor_font, G_DIR_SEPARATOR); + newpath = g_build_filename (cursor_dir, font_name, NULL); + symlink (cursor_font, newpath); + g_free (newpath); + g_free (cursor_font); + cursor_font = NULL; + } else { + cursor_dir = empty_check_dir (cursor_dir); + } + + return cursor_dir; +} + +static void +load_font_paths (MateConfClient *client) +{ + char *font_dir_name; + char *cursor_dir_name; + + char **font_path; + char **new_font_path; + int n_fonts; + int new_n_fonts; + + int i; + + const char *argv[4]; + int argc = 0; + + mate_settings_profile_start (NULL); + + font_dir_name = setup_font_dir (client); + cursor_dir_name = setup_cursor_dir (client); + + if (font_dir_name == NULL && cursor_dir_name == NULL) + goto done; + + /* run mkfontdir */ + argv[argc++] = "mkfontdir"; + if (font_dir_name) + argv[argc++] = font_dir_name; + if (cursor_dir_name) + argv[argc++] = cursor_dir_name; + argv[argc] = NULL; + g_spawn_sync (NULL, /* current dir */ + (char **) (void *) argv, NULL /* envp */, + G_SPAWN_SEARCH_PATH, + NULL, NULL, /* child_setup */ + NULL, NULL, NULL, NULL); + + /* Set the font path */ + font_path = XGetFontPath (gdk_x11_get_default_xdisplay (), &n_fonts); + new_n_fonts = n_fonts; + if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name))) + new_n_fonts++; + if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))) + new_n_fonts++; + + if (new_n_fonts == n_fonts) + new_font_path = font_path; + else { + new_font_path = g_new0 (char *, new_n_fonts); + + if (cursor_dir_name && (n_fonts == 0 || strcmp (font_path[0], cursor_dir_name))) { + new_font_path[0] = cursor_dir_name; + for (i = 0; i < n_fonts; i++) + new_font_path [i+1] = font_path [i]; + } else { + for (i = 0; i < n_fonts; i++) + new_font_path [i] = font_path [i]; + } + + if (font_dir_name && (n_fonts == 0 || strcmp (font_path[n_fonts-1], font_dir_name))) { + new_font_path[new_n_fonts-1] = font_dir_name; + } + } + + /* We set font path even if it was not changed, to enforce dropping + * caches in the server */ + gdk_error_trap_push (); + XSetFontPath (gdk_display, new_font_path, new_n_fonts); + gdk_flush (); + + /* if there was an error setting the new path, revert */ + if (gdk_error_trap_pop ()) { + XSetFontPath (gdk_display, font_path, n_fonts); + } + + g_free (font_dir_name); + g_free (cursor_dir_name); + + if (new_font_path != font_path) + g_free (new_font_path); + + XFreeFontPath (font_path); + +done: + mate_settings_profile_end (NULL); +} + +gboolean +gsd_font_manager_start (GsdFontManager *manager, + GError **error) +{ + MateConfClient *client; + + g_debug ("Starting font manager"); + mate_settings_profile_start (NULL); + + client = mateconf_client_get_default (); + + load_xcursor_theme (client); + load_font_paths (client); + + g_object_unref (client); + + mate_settings_profile_end (NULL); + + return TRUE; +} + +void +gsd_font_manager_stop (GsdFontManager *manager) +{ + g_debug ("Stopping font manager"); +} + +static void +gsd_font_manager_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) +{ + GsdFontManager *self; + + self = GSD_FONT_MANAGER (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static void +gsd_font_manager_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) +{ + GsdFontManager *self; + + self = GSD_FONT_MANAGER (object); + + switch (prop_id) { + default: + G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); + break; + } +} + +static GObject * +gsd_font_manager_constructor (GType type, + guint n_construct_properties, + GObjectConstructParam *construct_properties) +{ + GsdFontManager *font_manager; + GsdFontManagerClass *klass; + + klass = GSD_FONT_MANAGER_CLASS (g_type_class_peek (GSD_TYPE_FONT_MANAGER)); + + font_manager = GSD_FONT_MANAGER (G_OBJECT_CLASS (gsd_font_manager_parent_class)->constructor (type, + n_construct_properties, + construct_properties)); + + return G_OBJECT (font_manager); +} + +static void +gsd_font_manager_class_init (GsdFontManagerClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + + object_class->get_property = gsd_font_manager_get_property; + object_class->set_property = gsd_font_manager_set_property; + object_class->constructor = gsd_font_manager_constructor; +} + +static void +gsd_font_manager_init (GsdFontManager *manager) +{ +} + +GsdFontManager * +gsd_font_manager_new (void) +{ + if (manager_object != NULL) { + g_object_ref (manager_object); + } else { + manager_object = g_object_new (GSD_TYPE_FONT_MANAGER, NULL); + g_object_add_weak_pointer (manager_object, + (gpointer *) &manager_object); + } + + return GSD_FONT_MANAGER (manager_object); +} diff --git a/plugins/font/gsd-font-manager.h b/plugins/font/gsd-font-manager.h new file mode 100644 index 0000000..be53d98 --- /dev/null +++ b/plugins/font/gsd-font-manager.h @@ -0,0 +1,61 @@ +/* -*- 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 __GSD_FONT_MANAGER_H +#define __GSD_FONT_MANAGER_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define GSD_TYPE_FONT_MANAGER (gsd_font_manager_get_type ()) +#define GSD_FONT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_FONT_MANAGER, GsdFontManager)) +#define GSD_FONT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_FONT_MANAGER, GsdFontManagerClass)) +#define GSD_IS_FONT_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_FONT_MANAGER)) +#define GSD_IS_FONT_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_FONT_MANAGER)) +#define GSD_FONT_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_FONT_MANAGER, GsdFontManagerClass)) + +typedef struct GsdFontManagerPrivate GsdFontManagerPrivate; + +typedef struct +{ + GObject parent; + GsdFontManagerPrivate *priv; +} GsdFontManager; + +typedef struct +{ + GObjectClass parent_class; +} GsdFontManagerClass; + +GType gsd_font_manager_get_type (void); + +GsdFontManager * gsd_font_manager_new (void); +gboolean gsd_font_manager_start (GsdFontManager *manager, + GError **error); +void gsd_font_manager_stop (GsdFontManager *manager); + +#ifdef __cplusplus +} +#endif + +#endif /* __GSD_FONT_MANAGER_H */ diff --git a/plugins/font/gsd-font-plugin.c b/plugins/font/gsd-font-plugin.c new file mode 100644 index 0000000..dc34c6b --- /dev/null +++ b/plugins/font/gsd-font-plugin.c @@ -0,0 +1,104 @@ +/* -*- 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, 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 "mate-settings-plugin.h" +#include "gsd-font-plugin.h" +#include "gsd-font-manager.h" + +struct GsdFontPluginPrivate { + GsdFontManager *manager; +}; + +#define GSD_FONT_PLUGIN_GET_PRIVATE(object) (G_TYPE_INSTANCE_GET_PRIVATE ((object), GSD_TYPE_FONT_PLUGIN, GsdFontPluginPrivate)) + +MATE_SETTINGS_PLUGIN_REGISTER (GsdFontPlugin, gsd_font_plugin) + +static void +gsd_font_plugin_init (GsdFontPlugin *plugin) +{ + plugin->priv = GSD_FONT_PLUGIN_GET_PRIVATE (plugin); + + g_debug ("GsdFontPlugin initializing"); + + plugin->priv->manager = gsd_font_manager_new (); +} + +static void +gsd_font_plugin_finalize (GObject *object) +{ + GsdFontPlugin *plugin; + + g_return_if_fail (object != NULL); + g_return_if_fail (GSD_IS_FONT_PLUGIN (object)); + + g_debug ("GsdFontPlugin finalizing"); + + plugin = GSD_FONT_PLUGIN (object); + + g_return_if_fail (plugin->priv != NULL); + + if (plugin->priv->manager != NULL) { + g_object_unref (plugin->priv->manager); + } + + G_OBJECT_CLASS (gsd_font_plugin_parent_class)->finalize (object); +} + +static void +impl_activate (MateSettingsPlugin *plugin) +{ + gboolean res; + GError *error; + + g_debug ("Activating font plugin"); + + error = NULL; + res = gsd_font_manager_start (GSD_FONT_PLUGIN (plugin)->priv->manager, &error); + if (! res) { + g_warning ("Unable to start font manager: %s", error->message); + g_error_free (error); + } +} + +static void +impl_deactivate (MateSettingsPlugin *plugin) +{ + g_debug ("Deactivating font plugin"); + gsd_font_manager_stop (GSD_FONT_PLUGIN (plugin)->priv->manager); +} + +static void +gsd_font_plugin_class_init (GsdFontPluginClass *klass) +{ + GObjectClass *object_class = G_OBJECT_CLASS (klass); + MateSettingsPluginClass *plugin_class = MATE_SETTINGS_PLUGIN_CLASS (klass); + + object_class->finalize = gsd_font_plugin_finalize; + + plugin_class->activate = impl_activate; + plugin_class->deactivate = impl_deactivate; + + g_type_class_add_private (klass, sizeof (GsdFontPluginPrivate)); +} diff --git a/plugins/font/gsd-font-plugin.h b/plugins/font/gsd-font-plugin.h new file mode 100644 index 0000000..06dd2be --- /dev/null +++ b/plugins/font/gsd-font-plugin.h @@ -0,0 +1,63 @@ +/* -*- 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, 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 __GSD_FONT_PLUGIN_H__ +#define __GSD_FONT_PLUGIN_H__ + +#include +#include +#include + +#include "mate-settings-plugin.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define GSD_TYPE_FONT_PLUGIN (gsd_font_plugin_get_type ()) +#define GSD_FONT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GSD_TYPE_FONT_PLUGIN, GsdFontPlugin)) +#define GSD_FONT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GSD_TYPE_FONT_PLUGIN, GsdFontPluginClass)) +#define GSD_IS_FONT_PLUGIN(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GSD_TYPE_FONT_PLUGIN)) +#define GSD_IS_FONT_PLUGIN_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GSD_TYPE_FONT_PLUGIN)) +#define GSD_FONT_PLUGIN_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GSD_TYPE_FONT_PLUGIN, GsdFontPluginClass)) + +typedef struct GsdFontPluginPrivate GsdFontPluginPrivate; + +typedef struct +{ + MateSettingsPlugin parent; + GsdFontPluginPrivate *priv; +} GsdFontPlugin; + +typedef struct +{ + MateSettingsPluginClass parent_class; +} GsdFontPluginClass; + +GType gsd_font_plugin_get_type (void) G_GNUC_CONST; + +/* All the plugins must implement this function */ +G_MODULE_EXPORT GType register_mate_settings_plugin (GTypeModule *module); + +#ifdef __cplusplus +} +#endif + +#endif /* __GSD_FONT_PLUGIN_H__ */ -- cgit v1.2.1