Example #1
0
void preferences_show_pref_window(int plugin_id)
{
    GtkTreeIter iter;
    if (xml_preferences_window == NULL)
        create_preferences_window();
    if (plugin_store)
    {
        if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(plugin_store), &iter))
        {
            do
            {
                int pos;
                gtk_tree_model_get(GTK_TREE_MODEL(plugin_store), &iter, 0, &pos, -1);
                if (pos == plugin_get_pos(plugin_id))
                {
                    GtkTreeSelection *sel =
                        gtk_tree_view_get_selection(GTK_TREE_VIEW
                        (gtk_builder_get_object(xml_preferences_window, "plugin_tree")));
                    gtk_tree_selection_select_iter(sel, &iter);
                    return;
                }
            } while (gtk_tree_model_iter_next(GTK_TREE_MODEL(plugin_store), &iter));
        }
    }

}
Example #2
0
void
on_menu_options_preferences_activate   (GtkMenuItem    *menuitem,
                                        gpointer        user_data)
{
    GtkToggleButton *button;
    GtkCombo        *combo;
    GtkRange        *range;
    GtkSpinButton   *spinner;
    GList           *items;
    int i;
    vo_driver_t const *drivers;
    
    items = NULL;

    if( !preferences_window ) {
        preferences_window = create_preferences_window();
    }

        /* set the combo box up with the correct values. */
        combo = GTK_COMBO(lookup_widget(GTK_WIDGET(preferences_window), "video_output_driver_combo" ));
        gchar * vidpref = NULL;
        drivers = vo_drivers();
        for( i = 0; drivers[i].name; i++ ) {
            items = g_list_append(items, drivers[i].name);

            // while looking through the list of available video drivers,
            // the prefered driver is xv2, followed by xv, and finally x11.
            // If the user hasn't selected one, this one will be used.
            if ( !strcmp(drivers[i].name,"xv2") ||
                 (!vidpref && !strcmp(drivers[i].name,"xv"))) {
                if (vidpref) free(vidpref);
                vidpref=g_strdup(drivers[i].name);
            }
        }
        if (!vidpref) vidpref=g_strdup("x11");

        gtk_combo_set_popdown_strings(combo, items);

        if( !options.video_driver_ptr ) options.video_driver_ptr = vidpref;
        else                            if (vidpref) free(vidpref);

        gtk_entry_set_text(GTK_ENTRY(combo->entry),
                           (const gchar*)options.video_driver_ptr);

    handle_simple_preferences(true);

    gtk_widget_show(preferences_window);
}