void ipcam_action_handler_run(IpcamActionHandler *action_handler, IpcamMessage *message) { g_return_if_fail(IPCAM_IS_ACTION_HANDLER(action_handler)); if (IPCAM_ACTION_HANDLER_GET_CLASS(action_handler)->run != NULL) IPCAM_ACTION_HANDLER_GET_CLASS(action_handler)->run(action_handler, message); else g_warning ("Class '%s' does not override the mandatory " "IpcamActionHandler.run() virtual function.", G_OBJECT_TYPE_NAME(action_handler)); }
static void ipcam_base_app_action_handler(IpcamBaseApp *base_app, IpcamMessage *msg) { GType action_handler_class_type = G_TYPE_INVALID; gchar *strval; g_object_get(G_OBJECT(msg), "action", &strval, NULL); IpcamBaseAppPrivate *priv = ipcam_base_app_get_instance_private(base_app); g_mutex_lock(&priv->mutex); action_handler_class_type = (GType)g_hash_table_lookup(priv->req_handler_hash, (gpointer)strval); g_mutex_unlock(&priv->mutex); g_free(strval); if (G_TYPE_INVALID != action_handler_class_type) { IpcamActionHandler *handler = g_object_new(action_handler_class_type, "service", base_app, NULL); if (IPCAM_IS_ACTION_HANDLER(handler)) { ipcam_action_handler_run(handler, msg); } g_object_unref(handler); } }