summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorfujiwarat <takao.fujiwara1@gmail.com>2015-09-08 13:01:37 +0900
committerfujiwarat <takao.fujiwara1@gmail.com>2015-09-08 13:01:37 +0900
commit1d678673e18e132ed53df32502b779b0a56314d5 (patch)
treed668865f5bea3bf7023f39b0f0036cd67b1bbf06
parentc0ced65ea1298e860c571cd9151d81e620834132 (diff)
downloadibus-1d678673e18e132ed53df32502b779b0a56314d5.tar.gz
ibus-daemon update user cache when user observed path is updated
After the system registry cache is generated by root, the cache remembers the observed path exists in /root == '~' but if a user updates the user observed path, the observed path exists in '~' and ibus-daemon cannot get the updated mtime because the cache refers the root directory but not the user directory. The patch tries to save '~' instead of the actual home dir in the cache. BUG=https://github.com/ibus/ibus/issues/1815 R=Shawn.P.Huang@gmail.com Review URL: https://codereview.appspot.com/261040043
-rw-r--r--configure.ac4
-rw-r--r--src/ibusobservedpath.c36
-rw-r--r--src/ibusregistry.c2
3 files changed, 24 insertions, 18 deletions
diff --git a/configure.ac b/configure.ac
index 4600dbae..ac8243d3 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,12 +51,12 @@ m4_define([ibus_binary_version],
[ibus_major_version.ibus_abi_current_minus_age.ibus_abi_age.ibus_abi_revision])
# Required versions of other packages.
-m4_define([glib_required_version], [2.32.0])
+m4_define([glib_required_version], [2.36.0])
# VALA_TARGET_GLIB_VERSION is used by valac --ccode --target-glib .
# VALA_TARGET_GLIB_VERSION and glib_required_version will be different
# in the future.
-VALA_TARGET_GLIB_VERSION=2.32
+VALA_TARGET_GLIB_VERSION=2.36
AC_SUBST(VALA_TARGET_GLIB_VERSION)
# Init automake.
diff --git a/src/ibusobservedpath.c b/src/ibusobservedpath.c
index 684cd77c..9d45d40f 100644
--- a/src/ibusobservedpath.c
+++ b/src/ibusobservedpath.c
@@ -1,8 +1,8 @@
/* -*- mode: C; c-basic-offset: 4; indent-tabs-mode: nil; -*- */
/* vim:set et sts=4: */
/* ibus - The Input IBus
- * Copyright (C) 2008-2010 Peng Huang <shawn.p.huang@gmail.com>
- * Copyright (C) 2008-2010 Red Hat, Inc.
+ * Copyright (C) 2008-2015 Peng Huang <shawn.p.huang@gmail.com>
+ * Copyright (C) 2008-2015 Red Hat, Inc.
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -88,7 +88,8 @@ ibus_observed_path_serialize (IBusObservedPath *path,
{
gboolean retval;
- retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->serialize ((IBusSerializable *)path, builder);
+ retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->
+ serialize ((IBusSerializable *)path, builder);
g_return_val_if_fail (retval, FALSE);
g_variant_builder_add (builder, "s", path->path);
@@ -103,7 +104,8 @@ ibus_observed_path_deserialize (IBusObservedPath *path,
{
gint retval;
- retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->deserialize ((IBusSerializable *)path, variant);
+ retval = IBUS_SERIALIZABLE_CLASS (ibus_observed_path_parent_class)->
+ deserialize ((IBusSerializable *)path, variant);
g_return_val_if_fail (retval, 0);
ibus_g_variant_get_child_string (variant, retval++, &path->path);
@@ -152,13 +154,25 @@ ibus_observed_path_output (IBusObservedPath *path,
gboolean
ibus_observed_path_check_modification (IBusObservedPath *path)
{
- g_assert (IBUS_IS_OBSERVED_PATH (path));
+ gchar *real_path = NULL;
struct stat buf;
- if (g_stat (path->path, &buf) != 0) {
+ g_assert (IBUS_IS_OBSERVED_PATH (path));
+
+ if (path->path[0] == '~') {
+ const gchar *homedir = g_get_home_dir ();
+ real_path = g_build_filename (homedir, path->path + 2, NULL);
+ }
+ else {
+ real_path = g_strdup (path->path);
+ }
+
+ if (g_stat (real_path, &buf) != 0) {
buf.st_mtime = 0;
}
+ g_free (real_path);
+
if (path->mtime == buf.st_mtime)
return FALSE;
return TRUE;
@@ -237,15 +251,7 @@ ibus_observed_path_parse_xml_node (IBusObservedPath *path,
return FALSE;
}
- if (node->text[0] == '~') {
- const gchar *homedir = g_getenv ("HOME");
- if (homedir == NULL)
- homedir = g_get_home_dir ();
- path->path = g_build_filename (homedir, node->text + 2, NULL);
- }
- else {
- path->path = g_strdup (node->text);
- }
+ path->path = g_strdup (node->text);
gchar **attr;
for (attr = node->attributes; attr[0]; attr += 2) {
diff --git a/src/ibusregistry.c b/src/ibusregistry.c
index 8e9ada94..dfda2af3 100644
--- a/src/ibusregistry.c
+++ b/src/ibusregistry.c
@@ -29,7 +29,7 @@
#include "ibusregistry.h"
#define IBUS_CACHE_MAGIC 0x49425553 /* "IBUS" */
-#define IBUS_CACHE_VERSION 0x00010502
+#define IBUS_CACHE_VERSION 0x00010512
enum {
CHANGED,