Commit cad79a48 authored by Daniel Abrecht's avatar Daniel Abrecht Committed by Julian Sparber
Browse files

Reintroduce GParamSpec props arrays & replace g_object_notify with g_object_notify_by_pspec

parent 40555033
......@@ -58,6 +58,7 @@ enum {
PROP_LAST_PROP
};
static GParamSpec *props[PROP_LAST_PROP];
static void
change_state (CallsCall *call,
......@@ -72,7 +73,7 @@ change_state (CallsCall *call,
}
self->state = state;
g_object_notify (G_OBJECT (call), "state");
g_object_notify_by_pspec (G_OBJECT (call), props[PROP_CALL_STATE]);
g_signal_emit_by_name (call,
"state-changed",
state,
......@@ -250,28 +251,32 @@ calls_dummy_call_class_init (CallsDummyCallClass *klass)
object_class->constructed = constructed;
object_class->finalize = finalize;
g_object_class_install_property (
object_class,
PROP_NUMBER_CONSTRUCTOR,
props[PROP_NUMBER_CONSTRUCTOR] =
g_param_spec_string ("number-constructor",
_("Number (constructor)"),
_("The dialed number (dummy class constructor)"),
"+441234567890",
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_NUMBER_CONSTRUCTOR, props[PROP_NUMBER_CONSTRUCTOR]);
g_object_class_install_property (
object_class,
PROP_INBOUND_CONSTRUCTOR,
props[PROP_INBOUND_CONSTRUCTOR] =
g_param_spec_boolean ("inbound-constructor",
_("Inbound (constructor)"),
_("Whether the calls is inbound (dummy class constructor)"),
FALSE,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_INBOUND_CONSTRUCTOR, props[PROP_INBOUND_CONSTRUCTOR]);
g_object_class_override_property (object_class, PROP_CALL_NUMBER, "number");
g_object_class_override_property (object_class, PROP_CALL_INBOUND, "inbound");
g_object_class_override_property (object_class, PROP_CALL_STATE, "state");
g_object_class_override_property (object_class, PROP_CALL_NAME, "name");
#define IMPLEMENTS(ID, NAME) \
g_object_class_override_property (object_class, ID, NAME); \
props[ID] = g_object_class_find_property(object_class, NAME);
IMPLEMENTS(PROP_CALL_NUMBER, "number");
IMPLEMENTS(PROP_CALL_INBOUND, "inbound");
IMPLEMENTS(PROP_CALL_STATE, "state");
IMPLEMENTS(PROP_CALL_NAME, "name");
#undef IMPLEMENTS
}
......
......@@ -60,7 +60,7 @@ enum {
PROP_LAST_PROP,
};
static GParamSpec *props[PROP_LAST_PROP];
static void
change_state (CallsMMCall *self,
......@@ -74,7 +74,7 @@ change_state (CallsMMCall *self,
}
self->state = state;
g_object_notify (G_OBJECT (self), "state");
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CALL_STATE]);
g_signal_emit_by_name (CALLS_CALL (self),
"state-changed",
state,
......@@ -87,7 +87,7 @@ notify_number_cb (CallsMMCall *self,
const gchar *number)
{
g_string_assign (self->number, number);
g_object_notify (G_OBJECT (self), "number");
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CALL_NUMBER]);
}
......@@ -390,20 +390,23 @@ calls_mm_call_class_init (CallsMMCallClass *klass)
object_class->dispose = dispose;
object_class->finalize = finalize;
g_object_class_install_property (
object_class,
PROP_MM_CALL,
g_param_spec_object ("mm-call",
_("MM call"),
_("A libmm-glib proxy object for the underlying call object"),
MM_TYPE_CALL,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
props[PROP_MM_CALL] = g_param_spec_object ("mm-call",
_("MM call"),
_("A libmm-glib proxy object for the underlying call object"),
MM_TYPE_CALL,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_MM_CALL, props[PROP_MM_CALL]);
#define IMPLEMENTS(ID, NAME) \
g_object_class_override_property (object_class, ID, NAME); \
props[ID] = g_object_class_find_property(object_class, NAME);
g_object_class_override_property (object_class, PROP_CALL_NUMBER, "number");
g_object_class_override_property (object_class, PROP_CALL_INBOUND, "inbound");
g_object_class_override_property (object_class, PROP_CALL_STATE, "state");
g_object_class_override_property (object_class, PROP_CALL_NAME, "name");
IMPLEMENTS(PROP_CALL_NUMBER, "number");
IMPLEMENTS(PROP_CALL_INBOUND, "inbound");
IMPLEMENTS(PROP_CALL_STATE, "state");
IMPLEMENTS(PROP_CALL_NAME, "name");
#undef IMPLEMENTS
}
......
......@@ -65,6 +65,7 @@ enum {
PROP_LAST_PROP,
};
static GParamSpec *props[PROP_LAST_PROP];
enum {
SIGNAL_TONE,
......@@ -84,7 +85,7 @@ change_state (CallsOfonoCall *self,
}
self->state = state;
g_object_notify (G_OBJECT (self), "state");
g_object_notify_by_pspec (G_OBJECT (self), props[PROP_CALL_STATE]);
g_signal_emit_by_name (CALLS_CALL (self),
"state-changed",
state,
......@@ -354,29 +355,33 @@ calls_ofono_call_class_init (CallsOfonoCallClass *klass)
object_class->dispose = dispose;
object_class->finalize = finalize;
g_object_class_install_property (
object_class,
PROP_VOICE_CALL,
props[PROP_VOICE_CALL] =
g_param_spec_object ("voice-call",
_("Voice call"),
_("A GDBO proxy object for the underlying call object"),
GDBO_TYPE_VOICE_CALL,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_VOICE_CALL, props[PROP_VOICE_CALL]);
g_object_class_install_property (
object_class,
PROP_PROPERTIES,
props[PROP_PROPERTIES] =
g_param_spec_variant ("properties",
_("Properties"),
_("The a{sv} dictionary of properties for the voice call object"),
G_VARIANT_TYPE_ARRAY,
NULL,
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY));
G_PARAM_WRITABLE | G_PARAM_CONSTRUCT_ONLY);
g_object_class_install_property (object_class, PROP_PROPERTIES, props[PROP_PROPERTIES]);
g_object_class_override_property (object_class, PROP_CALL_NUMBER, "number");
g_object_class_override_property (object_class, PROP_CALL_INBOUND, "inbound");
g_object_class_override_property (object_class, PROP_CALL_STATE, "state");
g_object_class_override_property (object_class, PROP_CALL_NAME, "name");
#define IMPLEMENTS(ID, NAME) \
g_object_class_override_property (object_class, ID, NAME); \
props[ID] = g_object_class_find_property(object_class, NAME);
IMPLEMENTS(PROP_CALL_NUMBER, "number");
IMPLEMENTS(PROP_CALL_INBOUND, "inbound");
IMPLEMENTS(PROP_CALL_STATE, "state");
IMPLEMENTS(PROP_CALL_NAME, "name");
#undef IMPLEMENTS
signals[SIGNAL_TONE] =
g_signal_newv ("tone",
......
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