示例#1
0
static gboolean add_item_cb (PluginHandle * plugin, IfaceMenuAddState * state)
{
    GtkWidget * item = gtk_radio_menu_item_new_with_label (state->group,
     aud_plugin_get_name (plugin));
    state->group = gtk_radio_menu_item_get_group ((GtkRadioMenuItem *) item);
    if (aud_plugin_get_enabled (plugin))
        gtk_check_menu_item_set_active ((GtkCheckMenuItem *) item, TRUE);
    gtk_menu_shell_append ((GtkMenuShell *) state->menu, item);
    g_signal_connect (item, "activate", (GCallback) switch_cb, plugin);
    gtk_widget_show (item);
    return TRUE;
}
示例#2
0
static bool_t add_item_cb (PluginHandle * plugin, GtkWidget * menu)
{
    GtkWidget * item = gtk_check_menu_item_new_with_label (aud_plugin_get_name
     (plugin));
    gtk_check_menu_item_set_active ((GtkCheckMenuItem *) item,
     aud_plugin_get_enabled (plugin));
    gtk_menu_shell_append ((GtkMenuShell *) menu, item);
    aud_plugin_add_watch (plugin, (PluginForEachFunc) watch_cb, item);
    g_signal_connect (item, "toggled", (GCallback) enable_cb, plugin);
    g_signal_connect (item, "destroy", (GCallback) destroy_cb, plugin);
    gtk_widget_show (item);

    if (aud_plugin_has_configure (plugin))
    {
        GtkWidget * settings = gtk_menu_item_new_with_label (_("settings ..."));
        gtk_widget_set_sensitive (settings, aud_plugin_get_enabled (plugin));
        g_object_set_data ((GObject *) item, "settings", settings);
        gtk_menu_shell_append ((GtkMenuShell *) menu, settings);
        g_signal_connect (settings, "activate", (GCallback) settings_cb, plugin);
        gtk_widget_show (settings);
    }

    return TRUE;
}