Ejemplo n.º 1
0
//*****************************************************
void update(char *name,int idx)
{
    GtkWidget *menu1;
    // Print
    if(!name) return;
    menu1 = gtk_menu_new ();
    gtk_label_set_text(GTK_LABEL(WID(labelVobsub)),name);
    // Try to load it...
    vobSubLanguage *lang=NULL;

    lang=vobSubAllocateLanguage();

    if(vobSubGetLanguage(name,lang))
    {
        // add them
        for(int i=0; i<lang->nbLanguage; i++)
        {
            fq[i]=gtk_menu_item_new_with_mnemonic (lang->language[i].name);
            gtk_widget_show (fq[i]);
            gtk_container_add (GTK_CONTAINER (menu1), fq[i]);
            indeces[i]=lang->language[i].index;
            ADM_assert(i<MAX_INDECES);
        }
        gtk_option_menu_set_menu (GTK_OPTION_MENU (WID(optionmenu1)), menu1);
        gtk_option_menu_set_history(GTK_OPTION_MENU(WID(optionmenu1)), idx);
    }
    // Destroy
    vobSubDestroyLanguage(lang);
}
Ejemplo n.º 2
0
/**
 * 	\fn fillLanguage
 *  \brief Update the language combobox with what's in the idx file
 *  @param file : idx file (in)
 */
void  Ui_vobsubWindow::fillLanguage(const char *file)
{
    // Grab info also
    vobSubLanguage *lang=NULL;
    QComboBox *combo=(ui.comboBoxLanguage);

    combo->clear();
    lang=vobSubAllocateLanguage();

    if(vobSubGetLanguage(file,lang))
    {
        // add them
        for(int i=0; i<lang->nbLanguage; i++)
        {
            combo->addItem(lang->language[i].name);
        }
    }
    // Destroy
    vobSubDestroyLanguage(lang);
    // Reset index
    ui.comboBoxLanguage->setCurrentIndex(0);
}