summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBehdad Esfahbod <behdad@gnome.org>2008-06-03 01:28:52 +0000
committerBehdad Esfahbod <behdad@src.gnome.org>2008-06-03 01:28:52 +0000
commit501d2c6ad69bafc526cdb28e10087e16418b1a60 (patch)
tree479bcedeeecafe213ed178ba2a09a7c833fbdb45
parentcfdb1f6edf56cab7d2ec2761e563fc5239b7d1e4 (diff)
downloadgnome-settings-daemon-501d2c6ad69bafc526cdb28e10087e16418b1a60.tar.gz
Revert previous change. Working on a slightly different design. (bug
2008-06-02 Behdad Esfahbod <behdad@gnome.org> * configure.ac: * plugins/xsettings/Makefile.am: * plugins/xsettings/fontconfig-monitor.c: * plugins/xsettings/fontconfig-monitor.h: * plugins/xsettings/gsd-xsettings-manager.c (gnome_xsettings_manager_start), (gnome_xsettings_manager_stop): Revert previous change. Working on a slightly different design. (bug #490374) svn path=/trunk/; revision=364
-rw-r--r--ChangeLog11
-rw-r--r--configure.ac11
-rw-r--r--plugins/xsettings/Makefile.am12
-rw-r--r--plugins/xsettings/fontconfig-monitor.c183
-rw-r--r--plugins/xsettings/fontconfig-monitor.h37
-rw-r--r--plugins/xsettings/gsd-xsettings-manager.c43
6 files changed, 23 insertions, 274 deletions
diff --git a/ChangeLog b/ChangeLog
index e2e2e8f0..c7128da1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,16 @@
2008-06-02 Behdad Esfahbod <behdad@gnome.org>
+ * configure.ac:
+ * plugins/xsettings/Makefile.am:
+ * plugins/xsettings/fontconfig-monitor.c:
+ * plugins/xsettings/fontconfig-monitor.h:
+ * plugins/xsettings/gsd-xsettings-manager.c
+ (gnome_xsettings_manager_start), (gnome_xsettings_manager_stop):
+ Revert previous change. Working on a slightly different design.
+ (bug #490374)
+
+2008-06-02 Behdad Esfahbod <behdad@gnome.org>
+
* configure.ac: Check for fontconfig instead of xft2.
* plugins/xsettings/Makefile.am:
diff --git a/configure.ac b/configure.ac
index 11a85212..982f5245 100644
--- a/configure.ac
+++ b/configure.ac
@@ -175,15 +175,12 @@ AC_CHECK_LIB(Xrandr, XRRUpdateConfiguration,
AC_SUBST(RANDR_LIBS)
dnl ---------------------------------------------------------------------------
-dnl - Fontconfig
+dnl - XFT2
dnl ---------------------------------------------------------------------------
-have_fontconfig=no
-PKG_CHECK_MODULES(FONTCONFIG, fontconfig,
- [AC_DEFINE(HAVE_FONTCONFIG, 1, [Define if Fontconfig functionality is available])
- have_fontconfig=yes],
- AC_MSG_RESULT([no]))
-AM_CONDITIONAL(HAVE_FONTCONFIG, test x"$have_fontconfig" = "xyes")
+if $PKG_CONFIG --exists xft; then
+ AC_DEFINE(HAVE_XFT2, 1, [Define if Xft functionality is available])
+fi
dnl ---------------------------------------------------------------------------
dnl - Keyboard plugin stuff
diff --git a/plugins/xsettings/Makefile.am b/plugins/xsettings/Makefile.am
index 5274ab71..0026d88c 100644
--- a/plugins/xsettings/Makefile.am
+++ b/plugins/xsettings/Makefile.am
@@ -32,18 +32,6 @@ libxsettings_la_LIBADD = \
$(SETTINGS_PLUGIN_LIBS) \
$(NULL)
-if HAVE_FONTCONFIG
-libxsettings_la_SOURCES += \
- fontconfig-monitor.h \
- fontconfig-monitor.c \
- $(NULL)
-libxsettings_la_CFLAGS += \
- $(FONTCONFIG_CFLAGS)
-libxsettings_la_LIBADD += \
- $(FONTCONFIG_LIBS)
-endif
-
-
plugin_in_files = \
xsettings.gnome-settings-plugin.in \
$(NULL)
diff --git a/plugins/xsettings/fontconfig-monitor.c b/plugins/xsettings/fontconfig-monitor.c
deleted file mode 100644
index 5199d196..00000000
--- a/plugins/xsettings/fontconfig-monitor.c
+++ /dev/null
@@ -1,183 +0,0 @@
-/* -*- 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.
- *
- * Author: Behdad Esfahbod, Red Hat, Inc.
- */
-
-#include "fontconfig-monitor.h"
-
-#include <gio/gio.h>
-#include <fontconfig/fontconfig.h>
-
-#define TIMEOUT_SECONDS 2
-
-static void
-stuff_changed (GFileMonitor *monitor,
- GFile *file,
- GFile *other_file,
- GFileMonitorEvent event_type,
- gpointer handle);
-
-static void
-monitor_files (GPtrArray *monitors,
- FcStrList *list,
- gpointer data)
-{
- const char *str;
-
- while ((str = (const char *) FcStrListNext (list))) {
- GFile *file;
- GFileMonitor *monitor;
-
- file = g_file_new_for_path (str);
-
- if (g_file_test (str, G_FILE_TEST_IS_DIR))
- monitor = g_file_monitor_directory (file, G_FILE_MONITOR_NONE, NULL, NULL);
- else
- monitor = g_file_monitor_file (file, G_FILE_MONITOR_NONE, NULL, NULL);
-
- g_object_unref (file);
-
- if (!monitor)
- continue;
-
- g_signal_connect (monitor, "changed", G_CALLBACK (stuff_changed), data);
-
- g_ptr_array_add (monitors, monitor);
- }
-
- FcStrListDone (list);
-}
-
-
-struct _fontconfig_monitor_handle {
- GPtrArray *monitors;
-
- guint timeout;
-
- GFunc notify_callback;
- gpointer notify_data;
-};
-
-static GPtrArray *
-monitors_create (gpointer data)
-{
- GPtrArray *monitors = g_ptr_array_new ();
-
- monitor_files (monitors, FcConfigGetConfigFiles (NULL), data);
- monitor_files (monitors, FcConfigGetFontDirs (NULL) , data);
-
- return monitors;
-}
-
-static void
-monitors_free (GPtrArray *monitors)
-{
- if (!monitors)
- return;
-
- g_ptr_array_foreach (monitors, (GFunc) g_object_unref, NULL);
- g_ptr_array_free (monitors, TRUE);
-}
-
-static gboolean
-update (gpointer data)
-{
- fontconfig_monitor_handle_t *handle = data;
- gboolean notify = FALSE;
-
- handle->timeout = 0;
-
- if (!FcConfigUptoDate (NULL) && FcInitReinitialize ()) {
- notify = TRUE;
- monitors_free (handle->monitors);
- handle->monitors = monitors_create (data);
- }
-
- /* we finish modifying handle before calling the notify callback,
- * allowing the callback to free the monitor if it decides to. */
-
- if (notify && handle->notify_callback)
- handle->notify_callback (data, handle->notify_data);
-
- return FALSE;
-}
-
-static void
-stuff_changed (GFileMonitor *monitor G_GNUC_UNUSED,
- GFile *file G_GNUC_UNUSED,
- GFile *other_file G_GNUC_UNUSED,
- GFileMonitorEvent event_type G_GNUC_UNUSED,
- gpointer data)
-{
- fontconfig_monitor_handle_t *handle = data;
-
- /* wait for quiescence */
- if (handle->timeout)
- g_source_remove (handle->timeout);
-
- handle->timeout = g_timeout_add_seconds (TIMEOUT_SECONDS, update, data);
-}
-
-
-fontconfig_monitor_handle_t *
-fontconfig_monitor_start (GFunc notify_callback,
- gpointer notify_data)
-{
- fontconfig_monitor_handle_t *handle = g_slice_new0 (fontconfig_monitor_handle_t);
-
- handle->notify_callback = notify_callback;
- handle->notify_data = notify_data;
- handle->monitors = monitors_create (handle);
-
- return handle;
-}
-
-void
-fontconfig_monitor_stop (fontconfig_monitor_handle_t *handle)
-{
- if (handle->timeout)
- g_source_remove (handle->timeout);
- handle->timeout = 0;
-
- monitors_free (handle->monitors);
- handle->monitors = NULL;
-}
-
-#ifdef FONTCONFIG_MONITOR_TEST
-static void
-yay (void)
-{
- g_message ("yay");
-}
-
-int
-main (void)
-{
- GMainLoop *loop;
-
- g_type_init ();
-
- fontconfig_monitor_start ((GFunc) yay, NULL);
-
- loop = g_main_loop_new (NULL, TRUE);
- g_main_loop_run (loop);
-
- return 0;
-}
-#endif
diff --git a/plugins/xsettings/fontconfig-monitor.h b/plugins/xsettings/fontconfig-monitor.h
deleted file mode 100644
index b3df8cd8..00000000
--- a/plugins/xsettings/fontconfig-monitor.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- 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.
- *
- * Author: Behdad Esfahbod, Red Hat, Inc.
- */
-#ifndef __FONTCONFIG_MONITOR_H
-#define __FONTCONFIG_MONITOR_H
-
-#include <glib.h>
-
-G_BEGIN_DECLS
-
-typedef struct _fontconfig_monitor_handle fontconfig_monitor_handle_t;
-
-fontconfig_monitor_handle_t *
-fontconfig_monitor_start (GFunc notify_callback,
- gpointer notify_data);
-void fontconfig_monitor_stop (fontconfig_monitor_handle_t *handle);
-
-G_END_DECLS
-
-#endif /* __FONTCONFIG_MONITOR_H */
diff --git a/plugins/xsettings/gsd-xsettings-manager.c b/plugins/xsettings/gsd-xsettings-manager.c
index 88a4c416..a7f54abf 100644
--- a/plugins/xsettings/gsd-xsettings-manager.c
+++ b/plugins/xsettings/gsd-xsettings-manager.c
@@ -28,7 +28,6 @@
#include <unistd.h>
#include <string.h>
#include <errno.h>
-#include <time.h>
#include <glib.h>
#include <glib/gi18n.h>
@@ -41,9 +40,6 @@
#include "gnome-settings-profile.h"
#include "gsd-xsettings-manager.h"
#include "xsettings-manager.h"
-#ifdef HAVE_FONTCONFIG
-#include "fontconfig-monitor.h"
-#endif /* HAVE_FONTCONFIG */
#define GNOME_XSETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_XSETTINGS_MANAGER, GnomeXSettingsManagerPrivate))
@@ -51,7 +47,7 @@
#define GTK_SETTINGS_DIR "/desktop/gtk"
#define INTERFACE_SETTINGS_DIR "/desktop/gnome/interface"
-#ifdef HAVE_FONTCONFIG
+#ifdef HAVE_XFT2
#define FONT_RENDER_DIR "/desktop/gnome/font_rendering"
#define FONT_ANTIALIASING_KEY FONT_RENDER_DIR "/antialiasing"
#define FONT_HINTING_KEY FONT_RENDER_DIR "/hinting"
@@ -72,7 +68,7 @@
#define DPI_LOW_REASONABLE_VALUE 50
#define DPI_HIGH_REASONABLE_VALUE 500
-#endif /* HAVE_FONTCONFIG */
+#endif /* HAVE_XFT2 */
typedef struct _TranslationEntry TranslationEntry;
typedef void (* TranslationFunc) (GnomeXSettingsManager *manager,
@@ -91,9 +87,6 @@ struct GnomeXSettingsManagerPrivate
{
XSettingsManager **managers;
guint notify[4];
-#ifdef HAVE_FONTCONFIG
- fontconfig_monitor_handle_t *fontconfig_handle;
-#endif /* HAVE_FONTCONFIG */
};
#define GSD_XSETTINGS_ERROR gsd_xsettings_error_quark ()
@@ -214,7 +207,7 @@ static TranslationEntry translations [] = {
{ "/desktop/gnome/interface/show_unicode_menu", "Gtk/ShowUnicodeMenu", GCONF_VALUE_BOOL, translate_bool_int },
};
-#ifdef HAVE_FONTCONFIG
+#ifdef HAVE_XFT2
static double
dpi_from_pixels_and_mm (int pixels,
int mm)
@@ -543,22 +536,7 @@ xft_callback (GConfClient *client,
}
}
-static void
-fontconfig_callback (fontconfig_monitor_handle_t *handle,
- GnomeXSettingsManager *manager)
-{
- int i;
-
- gnome_settings_profile_start (NULL);
-
- for (i = 0; manager->priv->managers [i]; i++) {
- xsettings_manager_set_int (manager->priv->managers [i], "Fontconfig/Timestamp", time(NULL));
- xsettings_manager_notify (manager->priv->managers [i]);
- }
- gnome_settings_profile_end (NULL);
-}
-
-#endif /* HAVE_FONTCONFIG */
+#endif /* HAVE_XFT2 */
static const char *
type_to_string (GConfValueType type)
@@ -768,15 +746,13 @@ gnome_xsettings_manager_start (GnomeXSettingsManager *manager,
INTERFACE_SETTINGS_DIR,
(GConfClientNotifyFunc) xsettings_callback);
-#ifdef HAVE_FONTCONFIG
+#ifdef HAVE_XFT2
manager->priv->notify[3] =
register_config_callback (manager, client,
FONT_RENDER_DIR,
(GConfClientNotifyFunc) xft_callback);
update_xft_settings (manager, client);
-
- manager->priv->fontconfig_handle = fontconfig_monitor_start ((GFunc) fontconfig_callback, manager);
-#endif /* HAVE_FONTCONFIG */
+#endif /* HAVE_XFT */
g_object_unref (client);
@@ -817,12 +793,9 @@ gnome_xsettings_manager_stop (GnomeXSettingsManager *manager)
gconf_client_remove_dir (client, MOUSE_SETTINGS_DIR, NULL);
gconf_client_remove_dir (client, GTK_SETTINGS_DIR, NULL);
gconf_client_remove_dir (client, INTERFACE_SETTINGS_DIR, NULL);
-#ifdef HAVE_FONTCONFIG
+#ifdef HAVE_XFT2
gconf_client_remove_dir (client, FONT_RENDER_DIR, NULL);
-
- fontconfig_monitor_stop (manager->priv->fontconfig_handle);
- manager->priv->fontconfig_handle = NULL;
-#endif /* HAVE_FONTCONFIG */
+#endif
for (i = 0; i < G_N_ELEMENTS (p->notify); ++i) {
if (p->notify[i] != 0) {