xed-message-bus: Clean up code styling
This commit is contained in:
parent
909ea55a7c
commit
2bf076e7c5
|
@ -152,7 +152,9 @@ static void
|
|||
listener_free (Listener *listener)
|
||||
{
|
||||
if (listener->destroy_data)
|
||||
{
|
||||
listener->destroy_data (listener->userdata);
|
||||
}
|
||||
|
||||
g_free (listener);
|
||||
}
|
||||
|
@ -182,7 +184,9 @@ xed_message_bus_finalize (GObject *object)
|
|||
XedMessageBus *bus = XED_MESSAGE_BUS (object);
|
||||
|
||||
if (bus->priv->idle_id != 0)
|
||||
{
|
||||
g_source_remove (bus->priv->idle_id);
|
||||
}
|
||||
|
||||
message_queue_free (bus->priv->message_queue);
|
||||
|
||||
|
@ -278,9 +282,7 @@ message_new (XedMessageBus *bus,
|
|||
message->method = g_strdup (method);
|
||||
message->listeners = NULL;
|
||||
|
||||
g_hash_table_insert (bus->priv->messages,
|
||||
xed_message_type_identifier (object_path, method),
|
||||
message);
|
||||
g_hash_table_insert (bus->priv->messages, xed_message_type_identifier (object_path, method), message);
|
||||
return message;
|
||||
}
|
||||
|
||||
|
@ -298,10 +300,14 @@ lookup_message (XedMessageBus *bus,
|
|||
g_free (identifier);
|
||||
|
||||
if (!message && !create)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (!message)
|
||||
{
|
||||
message = message_new (bus, object_path, method);
|
||||
}
|
||||
|
||||
return message;
|
||||
}
|
||||
|
@ -390,9 +396,11 @@ dispatch_message_real (XedMessageBus *bus,
|
|||
Listener *listener = (Listener *)item->data;
|
||||
|
||||
if (!listener->blocked)
|
||||
{
|
||||
listener->callback (bus, message, listener->userdata);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
xed_message_bus_dispatch_real (XedMessageBus *bus,
|
||||
|
@ -408,8 +416,10 @@ xed_message_bus_dispatch_real (XedMessageBus *bus,
|
|||
msg = lookup_message (bus, object_path, method, FALSE);
|
||||
|
||||
if (msg)
|
||||
{
|
||||
dispatch_message_real (bus, msg, message);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
dispatch_message (XedMessageBus *bus,
|
||||
|
@ -486,8 +496,7 @@ process_by_match (XedMessageBus *bus,
|
|||
{
|
||||
Listener *listener = (Listener *)item->data;
|
||||
|
||||
if (listener->callback == callback &&
|
||||
listener->userdata == userdata)
|
||||
if (listener->callback == callback && listener->userdata == userdata)
|
||||
{
|
||||
processor (bus, message, item);
|
||||
return;
|
||||
|
@ -534,8 +543,7 @@ xed_message_bus_get_default (void)
|
|||
if (G_UNLIKELY (default_bus == NULL))
|
||||
{
|
||||
default_bus = g_object_new (XED_TYPE_MESSAGE_BUS, NULL);
|
||||
g_object_add_weak_pointer (G_OBJECT (default_bus),
|
||||
(gpointer) &default_bus);
|
||||
g_object_add_weak_pointer (G_OBJECT (default_bus), (gpointer) &default_bus);
|
||||
}
|
||||
|
||||
return default_bus;
|
||||
|
@ -636,10 +644,7 @@ xed_message_bus_register (XedMessageBus *bus,
|
|||
data = g_hash_table_lookup (bus->priv->types, identifier);
|
||||
|
||||
va_start (var_args, num_optional);
|
||||
message_type = xed_message_type_new_valist (object_path,
|
||||
method,
|
||||
num_optional,
|
||||
var_args);
|
||||
message_type = xed_message_type_new_valist (object_path, method, num_optional, var_args);
|
||||
va_end (var_args);
|
||||
|
||||
if (message_type)
|
||||
|
@ -671,7 +676,9 @@ xed_message_bus_unregister_real (XedMessageBus *bus,
|
|||
xed_message_type_ref (message_type);
|
||||
|
||||
if (!remove_from_store || g_hash_table_remove (bus->priv->types, identifier))
|
||||
{
|
||||
g_signal_emit (bus, message_bus_signals[UNREGISTERED], 0, message_type);
|
||||
}
|
||||
|
||||
xed_message_type_unref (message_type);
|
||||
g_free (identifier);
|
||||
|
@ -738,9 +745,7 @@ xed_message_bus_unregister_all (XedMessageBus *bus,
|
|||
g_return_if_fail (XED_IS_MESSAGE_BUS (bus));
|
||||
g_return_if_fail (object_path != NULL);
|
||||
|
||||
g_hash_table_foreach_remove (bus->priv->types,
|
||||
(GHRFunc)unregister_each,
|
||||
&info);
|
||||
g_hash_table_foreach_remove (bus->priv->types, (GHRFunc)unregister_each, &info);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -996,15 +1001,16 @@ send_message_real (XedMessageBus *bus,
|
|||
return;
|
||||
}
|
||||
|
||||
bus->priv->message_queue = g_list_prepend (bus->priv->message_queue,
|
||||
g_object_ref (message));
|
||||
bus->priv->message_queue = g_list_prepend (bus->priv->message_queue, g_object_ref (message));
|
||||
|
||||
if (bus->priv->idle_id == 0)
|
||||
{
|
||||
bus->priv->idle_id = g_idle_add_full (G_PRIORITY_HIGH,
|
||||
(GSourceFunc)idle_dispatch,
|
||||
bus,
|
||||
NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* xed_message_bus_send_message:
|
||||
|
@ -1076,8 +1082,7 @@ create_message (XedMessageBus *bus,
|
|||
return NULL;
|
||||
}
|
||||
|
||||
return xed_message_type_instantiate_valist (message_type,
|
||||
var_args);
|
||||
return xed_message_type_instantiate_valist (message_type, var_args);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue