Add app list version number to the AppStateChanged signal and check it
This commit is contained in:
parent
6dbf026ba2
commit
7a5ba755e9
|
@ -157,12 +157,15 @@ void emit_app_state_changed(struct ladish_app_supervisor * supervisor_ptr, struc
|
||||||
running = app_ptr->pid != 0;
|
running = app_ptr->pid != 0;
|
||||||
terminal = app_ptr->terminal;
|
terminal = app_ptr->terminal;
|
||||||
|
|
||||||
|
supervisor_ptr->version++;
|
||||||
|
|
||||||
dbus_signal_emit(
|
dbus_signal_emit(
|
||||||
g_dbus_connection,
|
g_dbus_connection,
|
||||||
supervisor_ptr->opath,
|
supervisor_ptr->opath,
|
||||||
IFACE_APP_SUPERVISOR,
|
IFACE_APP_SUPERVISOR,
|
||||||
"AppStateChanged",
|
"AppStateChanged",
|
||||||
"tsbby",
|
"ttsbby",
|
||||||
|
&supervisor_ptr->version,
|
||||||
&app_ptr->id,
|
&app_ptr->id,
|
||||||
&app_ptr->name,
|
&app_ptr->name,
|
||||||
&running,
|
&running,
|
||||||
|
@ -1078,6 +1081,7 @@ SIGNAL_ARGS_BEGIN(AppRemoved, "")
|
||||||
SIGNAL_ARGS_END
|
SIGNAL_ARGS_END
|
||||||
|
|
||||||
SIGNAL_ARGS_BEGIN(AppStateChanged, "")
|
SIGNAL_ARGS_BEGIN(AppStateChanged, "")
|
||||||
|
SIGNAL_ARG_DESCRIBE("new_list_version", DBUS_TYPE_UINT64_AS_STRING, "")
|
||||||
SIGNAL_ARG_DESCRIBE("id", DBUS_TYPE_UINT64_AS_STRING, "")
|
SIGNAL_ARG_DESCRIBE("id", DBUS_TYPE_UINT64_AS_STRING, "")
|
||||||
SIGNAL_ARG_DESCRIBE("name", DBUS_TYPE_STRING_AS_STRING, "")
|
SIGNAL_ARG_DESCRIBE("name", DBUS_TYPE_STRING_AS_STRING, "")
|
||||||
SIGNAL_ARG_DESCRIBE("running", DBUS_TYPE_BOOLEAN_AS_STRING, "")
|
SIGNAL_ARG_DESCRIBE("running", DBUS_TYPE_BOOLEAN_AS_STRING, "")
|
||||||
|
|
|
@ -108,6 +108,7 @@ static void on_app_removed(void * context, DBusMessage * message_ptr)
|
||||||
|
|
||||||
static void on_app_state_changed(void * context, DBusMessage * message_ptr)
|
static void on_app_state_changed(void * context, DBusMessage * message_ptr)
|
||||||
{
|
{
|
||||||
|
uint64_t new_list_version;
|
||||||
uint64_t id;
|
uint64_t id;
|
||||||
const char * name;
|
const char * name;
|
||||||
dbus_bool_t running;
|
dbus_bool_t running;
|
||||||
|
@ -117,6 +118,7 @@ static void on_app_state_changed(void * context, DBusMessage * message_ptr)
|
||||||
if (!dbus_message_get_args(
|
if (!dbus_message_get_args(
|
||||||
message_ptr,
|
message_ptr,
|
||||||
&g_dbus_error,
|
&g_dbus_error,
|
||||||
|
DBUS_TYPE_UINT64, &new_list_version,
|
||||||
DBUS_TYPE_UINT64, &id,
|
DBUS_TYPE_UINT64, &id,
|
||||||
DBUS_TYPE_STRING, &name,
|
DBUS_TYPE_STRING, &name,
|
||||||
DBUS_TYPE_BOOLEAN, &running,
|
DBUS_TYPE_BOOLEAN, &running,
|
||||||
|
@ -130,7 +132,15 @@ static void on_app_state_changed(void * context, DBusMessage * message_ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
//log_info("AppStateChanged signal received");
|
//log_info("AppStateChanged signal received");
|
||||||
proxy_ptr->app_state_changed(proxy_ptr->context, id, name, running, terminal, level);
|
//log_info("AppRemoved signal received, id=%"PRIu64, id);
|
||||||
|
if (new_list_version <= proxy_ptr->version)
|
||||||
|
{
|
||||||
|
log_info("Ignoring signal for older version of the app list");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
proxy_ptr->app_state_changed(proxy_ptr->context, id, name, running, terminal, level);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef proxy_ptr
|
#undef proxy_ptr
|
||||||
|
|
Loading…
Reference in New Issue