Commit 90e6afcb authored by Behdad Esfahbod's avatar Behdad Esfahbod Committed by Behdad Esfahbod

Start manager in idle callback (bug #559166)

2008-11-03  Behdad Esfahbod  <behdad@gnome.org>

        * plugins/clipboard/gsd-clipboard-manager.c
        (start_clipboard_idle_cb), (gsd_clipboard_manager_start):
        Start manager in idle callback (bug #559166)

        * plugins/mouse/gsd-mouse-manager.c (gsd_mouse_manager_idle_cb),
        (gsd_mouse_manager_start):
        Start manager in idle callback (bug #559166)

        * plugins/xsettings/fontconfig-monitor.c (fontconfig_cache_update),
        (update):
        * plugins/xsettings/fontconfig-monitor.h:
        * plugins/xsettings/gsd-xsettings-manager.c
        (start_fontconfig_monitor_idle_cb), (start_fontconfig_monitor),
        (stop_fontconfig_monitor):
        Start fontconfig monitors in idle callback.  However, make sure
        fontconfig caches are up to date during initialization (bug #559166)

svn path=/trunk/; revision=580
parent 85b7422b
2008-11-03 Behdad Esfahbod <behdad@gnome.org>
* plugins/clipboard/gsd-clipboard-manager.c
(start_clipboard_idle_cb), (gsd_clipboard_manager_start):
Start manager in idle callback (bug #559166)
* plugins/mouse/gsd-mouse-manager.c (gsd_mouse_manager_idle_cb),
(gsd_mouse_manager_start):
Start manager in idle callback (bug #559166)
* plugins/xsettings/fontconfig-monitor.c (fontconfig_cache_update),
(update):
* plugins/xsettings/fontconfig-monitor.h:
* plugins/xsettings/gsd-xsettings-manager.c
(start_fontconfig_monitor_idle_cb), (start_fontconfig_monitor),
(stop_fontconfig_monitor):
Start fontconfig monitors in idle callback. However, make sure
fontconfig caches are up to date during initialization (bug #559166)
2008-11-03 Behdad Esfahbod <behdad@gnome.org>
* plugins/mouse/gsd-mouse-manager.c (set_mousetweaks_daemon):
......
......@@ -82,13 +82,6 @@ typedef struct
int offset;
} IncrConversion;
#define GSD_CLIPBOARD_ERROR gsd_clipboard_error_quark ()
enum {
GSD_CLIPBOARD_ERROR_RUNNING,
GSD_CLIPBOARD_ERROR_FAILED
};
static void gsd_clipboard_manager_class_init (GsdClipboardManagerClass *klass);
static void gsd_clipboard_manager_init (GsdClipboardManager *clipboard_manager);
static void gsd_clipboard_manager_finalize (GObject *object);
......@@ -103,12 +96,6 @@ G_DEFINE_TYPE (GsdClipboardManager, gsd_clipboard_manager, G_TYPE_OBJECT)
static gpointer manager_object = NULL;
static GQuark
gsd_clipboard_error_quark (void)
{
return g_quark_from_static_string ("gsd-clipboard-error-quark");
}
/* We need to use reference counting for the target data, since we may
* need to keep the data around after loosing the CLIPBOARD ownership
* to complete incremental transfers.
......@@ -858,22 +845,19 @@ clipboard_manager_watch_cb (GsdClipboardManager *manager,
}
}
gboolean
gsd_clipboard_manager_start (GsdClipboardManager *manager,
GError **error)
static gboolean
start_clipboard_idle_cb (GsdClipboardManager *manager)
{
XClientMessageEvent xev;
g_debug ("Starting clipboard manager");
gnome_settings_profile_start (NULL);
init_atoms (manager->priv->display);
/* check if there is a clipboard manager running */
if (XGetSelectionOwner (manager->priv->display, XA_CLIPBOARD_MANAGER)) {
g_set_error (error, GSD_CLIPBOARD_ERROR,
GSD_CLIPBOARD_ERROR_RUNNING,
"Clipboard manager is already running.");
g_warning ("Clipboard manager is already running.");
return FALSE;
}
......@@ -929,15 +913,23 @@ gsd_clipboard_manager_start (GsdClipboardManager *manager,
0,
NULL);
/* FIXME: manager->priv->terminate (manager->priv->cb_data); */
g_set_error (error, GSD_CLIPBOARD_ERROR,
GSD_CLIPBOARD_ERROR_FAILED,
"Failed to claim selection.");
return FALSE;
}
gnome_settings_profile_end (NULL);
return FALSE;
}
gboolean
gsd_clipboard_manager_start (GsdClipboardManager *manager,
GError **error)
{
gnome_settings_profile_start (NULL);
g_idle_add ((GSourceFunc) start_clipboard_idle_cb, manager);
gnome_settings_profile_end (NULL);
return TRUE;
}
......
......@@ -694,13 +694,11 @@ gsd_mouse_manager_init (GsdMouseManager *manager)
manager->priv = GSD_MOUSE_MANAGER_GET_PRIVATE (manager);
}
gboolean
gsd_mouse_manager_start (GsdMouseManager *manager,
GError **error)
static gboolean
gsd_mouse_manager_idle_cb (GsdMouseManager *manager)
{
GConfClient *client;
g_debug ("Starting mouse manager");
gnome_settings_profile_start (NULL);
client = gconf_client_get_default ();
......@@ -729,6 +727,19 @@ gsd_mouse_manager_start (GsdMouseManager *manager,
gnome_settings_profile_end (NULL);
return FALSE;
}
gboolean
gsd_mouse_manager_start (GsdMouseManager *manager,
GError **error)
{
gnome_settings_profile_start (NULL);
g_idle_add ((GSourceFunc) gsd_mouse_manager_idle_cb, manager);
gnome_settings_profile_end (NULL);
return TRUE;
}
......
......@@ -33,6 +33,12 @@ stuff_changed (GFileMonitor *monitor,
GFileMonitorEvent event_type,
gpointer handle);
gboolean
fontconfig_cache_update (void)
{
return !FcConfigUptoDate (NULL) && FcInitReinitialize ();
}
static void
monitor_files (GPtrArray *monitors,
FcStrList *list,
......@@ -100,7 +106,7 @@ update (gpointer data)
handle->timeout = 0;
if (!FcConfigUptoDate (NULL) && FcInitReinitialize ()) {
if (fontconfig_cache_update ()) {
notify = TRUE;
monitors_free (handle->monitors);
handle->monitors = monitors_create (data);
......
......@@ -25,6 +25,8 @@
G_BEGIN_DECLS
gboolean fontconfig_cache_update (void);
typedef struct _fontconfig_monitor_handle fontconfig_monitor_handle_t;
fontconfig_monitor_handle_t *
......
......@@ -566,12 +566,26 @@ fontconfig_callback (fontconfig_monitor_handle_t *handle,
gnome_settings_profile_end (NULL);
}
static gboolean
start_fontconfig_monitor_idle_cb (GnomeXSettingsManager *manager)
{
gnome_settings_profile_start (NULL);
manager->priv->fontconfig_handle = fontconfig_monitor_start ((GFunc) fontconfig_callback, manager);
gnome_settings_profile_end (NULL);
return FALSE;
}
static void
start_fontconfig_monitor (GnomeXSettingsManager *manager)
{
gnome_settings_profile_start (NULL);
manager->priv->fontconfig_handle = fontconfig_monitor_start ((GFunc) fontconfig_callback, manager);
fontconfig_cache_update ();
g_idle_add ((GSourceFunc) start_fontconfig_monitor_idle_cb, manager);
gnome_settings_profile_end (NULL);
}
......@@ -579,8 +593,10 @@ start_fontconfig_monitor (GnomeXSettingsManager *manager)
static void
stop_fontconfig_monitor (GnomeXSettingsManager *manager)
{
fontconfig_monitor_stop (manager->priv->fontconfig_handle);
manager->priv->fontconfig_handle = NULL;
if (manager->priv->fontconfig_handle) {
fontconfig_monitor_stop (manager->priv->fontconfig_handle);
manager->priv->fontconfig_handle = NULL;
}
}
#endif /* HAVE_FONTCONFIG */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment