コード例 #1
0
ファイル: wrapper.c プロジェクト: community-ssu/mafw
/**
 * wrapper_init:
 *
 * Acquires connection to the session bus and initializes source and renderer
 * wrappers.
 */
void wrapper_init(void)
{
	DBusError err;

	dbus_error_init(&err);
	Session_bus = dbus_bus_get(DBUS_BUS_SESSION, &err);
	if (dbus_error_is_set(&err)) {
		g_critical("wrapper_init(): %s",
                           dbus_error_is_set(&err) ? err.message : "error");
		dbus_error_free(&err);
                exit(2);
	}
	dbus_connection_setup_with_g_main(Session_bus, NULL);

	g_signal_connect(mafw_registry_get_instance(), "source-added",
			 G_CALLBACK(registry_action),
			 GUINT_TO_POINTER(EXTENSION_ADDED));
	g_signal_connect(mafw_registry_get_instance(), "source-removed",
			 G_CALLBACK(registry_action),
			 GUINT_TO_POINTER(EXTENSION_REMOVED));
	g_signal_connect(mafw_registry_get_instance(), "renderer-added",
			 G_CALLBACK(registry_action),
			 GUINT_TO_POINTER(EXTENSION_ADDED));
	g_signal_connect(mafw_registry_get_instance(), "renderer-removed",
			 G_CALLBACK(registry_action),
			 GUINT_TO_POINTER(EXTENSION_REMOVED));
	
	extension_init(Session_bus);
}
コード例 #2
0
/********************
 * console_init
 ********************/
static int
console_init(char *address)
{
    char *signature;
    
#define IMPORT(name, ptr) ({                                            \
            signature = (char *)ptr##_SIGNATURE;                        \
            ohm_module_find_method((name), &signature, (void *)&(ptr)); \
        })

    extension_init();
    
    if (!strcmp(address, "disabled")) {
        OHM_INFO("resolver: console disabled");
        return 0;
    }
    
    if (!IMPORT("console.open", console_open)) {
        OHM_INFO("resolver: no console methods available, console disabled");
        return 0;
    }
    
    IMPORT("console.close" , console_close);
    IMPORT("console.printf", console_printf);
    IMPORT("console.grab"  , console_grab);
    IMPORT("console.ungrab", console_ungrab);

    if (console_close == NULL || console_printf == NULL ||
        console_grab == NULL || console_ungrab == NULL) {
        OHM_WARNING("resolver: missing console methods, console disabled");
        return 0;
    }
    
    
    OHM_INFO("resolver: using console %s", address);
    
    console = console_open(address,
                           console_opened, console_closed, console_input,
                           NULL, FALSE);
    
    return console < 0 ? EINVAL : 0;
#undef IMPORT    
}