summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSung-jae Park <nicesj.park@samsung.com>2013-05-20 20:30:34 +0900
committerSung-jae Park <nicesj.park@samsung.com>2013-05-20 20:30:34 +0900
commit013231a41fea414f7a66f55844a96db08a1b5ce0 (patch)
treeb2b7828a22c3b692c4b03172418c08ee54d704b8 /lib
parent73841e54e490d5b718922726fd1fa2c7f753dacc (diff)
downloadshortcut-013231a41fea414f7a66f55844a96db08a1b5ce0.tar.gz
shortcut-013231a41fea414f7a66f55844a96db08a1b5ce0.tar.bz2
shortcut-013231a41fea414f7a66f55844a96db08a1b5ce0.zip
Don't try to make a connection from discon cb.
Change-Id: I10ac77e38f01643ae63d3da5165e169808bd384f
Diffstat (limited to 'lib')
-rw-r--r--lib/src/icon.c2
-rw-r--r--lib/src/main.c35
2 files changed, 27 insertions, 10 deletions
diff --git a/lib/src/icon.c b/lib/src/icon.c
index c29445b..b4eddce 100644
--- a/lib/src/icon.c
+++ b/lib/src/icon.c
@@ -264,7 +264,7 @@ static inline struct block *find_block(struct shortcut_desc *handle, const char
struct dlist *l;
dlist_foreach(handle->block_list, l, block) {
- if (!strcmp(block->part, part) && !strcmp(block->id, id))
+ if (!strcmp(block->part, part) && (!id || !strcmp(block->id, id)))
return block;
}
diff --git a/lib/src/main.c b/lib/src/main.c
index 0a27aa3..bbba095 100644
--- a/lib/src/main.c
+++ b/lib/src/main.c
@@ -51,6 +51,7 @@ static struct info {
} server_cb;
int initialized;
int db_opened;
+ guint timer_id;
} s_info = {
.server_fd = -1,
.client_fd = -1,
@@ -59,6 +60,7 @@ static struct info {
.handle = NULL,
.initialized = 0,
.db_opened = 0,
+ .timer_id = 0,
};
@@ -203,6 +205,24 @@ static void master_started_cb(keynode_t *node, void *user_data)
+static gboolean timeout_cb(void *data)
+{
+ int ret;
+
+ ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
+ if (ret < 0)
+ ErrPrint("Failed to add vconf for service state [%d]\n", ret);
+ else
+ DbgPrint("vconf is registered\n");
+
+ master_started_cb(NULL, NULL);
+
+ s_info.timer_id = 0;
+ return FALSE;
+}
+
+
+
static int disconnected_cb(int handle, void *data)
{
if (s_info.client_fd == handle) {
@@ -211,15 +231,12 @@ static int disconnected_cb(int handle, void *data)
}
if (s_info.server_fd == handle) {
- int ret;
- s_info.server_fd = SHORTCUT_ERROR_INVALID;
- ret = vconf_notify_key_changed(VCONFKEY_MASTER_STARTED, master_started_cb, NULL);
- if (ret < 0)
- ErrPrint("Failed to add vconf for service state [%d]\n", ret);
- else
- DbgPrint("vconf is registered\n");
-
- master_started_cb(NULL, NULL);
+ if (!s_info.timer_id) {
+ s_info.server_fd = SHORTCUT_ERROR_INVALID;
+ s_info.timer_id = g_timeout_add(1000, timeout_cb, NULL);
+ if (!s_info.timer_id)
+ ErrPrint("Unable to add timer\n");
+ }
return 0;
}