Changeset 570:6a61c5ce242a in mediastreamer2


Ignore:
Timestamp:
Jul 30, 2009 5:19:23 PM (4 years ago)
Author:
smorlat <smorlat@…>
Branch:
default
Message:

add new tab with language setting.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@560 3f6dc0c8-ddfe-455d-9043-3cd528dc4637

Location:
linphone
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • linphone/configure.in

    r507 r570  
    6868ALL_LINGUAS="fr it de ja es pl cs nl sv pt_BR hu ru" 
    6969AC_SUBST(ALL_LINGUAS) 
     70AC_DEFINE_UNQUOTED(LINPHONE_ALL_LANGS, "$ALL_LINGUAS", [All supported languages]) 
    7071 
    7172if test "$mingw_found" != "yes" ; then 
  • linphone/coreapi/misc.c

    r493 r570  
    716716                                                } 
    717717#ifdef WIN32 
    718                                                 Sleep(10); 
     718                                                Sleep(100); 
    719719#else 
    720                                                 usleep(10000); 
     720                                                usleep(100000); 
    721721#endif 
    722722                                        } 
  • linphone/gtk-glade/linphone.h

    r505 r570  
    6060void linphone_gtk_check_for_new_version(void); 
    6161const char *linphone_gtk_get_lang(const char *config_file); 
     62void linphone_gtk_set_lang(const char *code); 
    6263SipSetupContext* linphone_gtk_get_default_sip_setup_context(void); 
    6364void linphone_gtk_show_buddy_lookup_window(SipSetupContext *ctx); 
  • linphone/gtk-glade/parameters.glade

    r493 r570  
    1717            <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
    1818            <child> 
    19               <widget class="GtkVBox" id="vbox2"> 
     19              <widget class="GtkVBox" id="network_tab"> 
    2020                <property name="visible">True</property> 
    2121                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
    2222                <child> 
    23                   <widget class="GtkFrame" id="frame1"> 
     23                  <widget class="GtkFrame" id="transport_frame"> 
    2424                    <property name="visible">True</property> 
    2525                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
     
    113113                </child> 
    114114                <child> 
    115                   <widget class="GtkFrame" id="frame2"> 
     115                  <widget class="GtkFrame" id="ports_frame"> 
    116116                    <property name="visible">True</property> 
    117117                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
     
    224224                </child> 
    225225                <child> 
    226                   <widget class="GtkFrame" id="frame6"> 
     226                  <widget class="GtkFrame" id="nat_frame"> 
    227227                    <property name="visible">True</property> 
    228228                    <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
     
    410410            </child> 
    411411            <child> 
    412               <widget class="GtkVBox" id="vbox10"> 
     412              <widget class="GtkVBox" id="multimedia_tab"> 
    413413                <property name="visible">True</property> 
    414414                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
     
    430430                            <property name="n_columns">2</property> 
    431431                            <child> 
    432                               <widget class="GtkHBox" id="hbox19"> 
     432                              <widget class="GtkHBox" id="ring_sound_box"> 
    433433                                <property name="visible">True</property> 
    434434                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
     
    467467                            </child> 
    468468                            <child> 
    469                               <widget class="GtkLabel" id="label37"> 
     469                              <widget class="GtkLabel" id="ring_sound_label"> 
    470470                                <property name="visible">True</property> 
    471471                                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
     
    664664                            </child> 
    665665                            <child> 
    666                               <widget class="GtkLabel" id="label8"> 
     666                              <widget class="GtkLabel" id="video_size_label"> 
    667667                                <property name="visible">True</property> 
    668668                                <property name="label" translatable="yes">Prefered video resolution:</property> 
     
    15091509              </packing> 
    15101510            </child> 
     1511            <child> 
     1512              <widget class="GtkVBox" id="vbox2"> 
     1513                <property name="visible">True</property> 
     1514                <property name="orientation">vertical</property> 
     1515                <child> 
     1516                  <widget class="GtkFrame" id="lang_frame"> 
     1517                    <property name="visible">True</property> 
     1518                    <property name="label_xalign">0</property> 
     1519                    <child> 
     1520                      <widget class="GtkAlignment" id="alignment3"> 
     1521                        <property name="visible">True</property> 
     1522                        <property name="left_padding">12</property> 
     1523                        <child> 
     1524                          <widget class="GtkComboBox" id="lang_combo"> 
     1525                            <property name="visible">True</property> 
     1526                            <property name="items" translatable="yes">C</property> 
     1527                            <signal name="changed" handler="linphone_gtk_lang_changed"/> 
     1528                          </widget> 
     1529                        </child> 
     1530                      </widget> 
     1531                    </child> 
     1532                    <child> 
     1533                      <widget class="GtkLabel" id="lang_label"> 
     1534                        <property name="visible">True</property> 
     1535                        <property name="label" translatable="yes">&lt;b&gt;Language&lt;/b&gt;</property> 
     1536                        <property name="use_markup">True</property> 
     1537                      </widget> 
     1538                      <packing> 
     1539                        <property name="type">label_item</property> 
     1540                      </packing> 
     1541                    </child> 
     1542                  </widget> 
     1543                  <packing> 
     1544                    <property name="expand">False</property> 
     1545                    <property name="position">0</property> 
     1546                  </packing> 
     1547                </child> 
     1548                <child> 
     1549                  <placeholder/> 
     1550                </child> 
     1551              </widget> 
     1552              <packing> 
     1553                <property name="position">4</property> 
     1554              </packing> 
     1555            </child> 
     1556            <child> 
     1557              <widget class="GtkHBox" id="hbox4"> 
     1558                <property name="visible">True</property> 
     1559                <child> 
     1560                  <widget class="GtkImage" id="image13"> 
     1561                    <property name="visible">True</property> 
     1562                    <property name="stock">gtk-properties</property> 
     1563                    <property name="icon-size">3</property> 
     1564                  </widget> 
     1565                  <packing> 
     1566                    <property name="position">0</property> 
     1567                  </packing> 
     1568                </child> 
     1569                <child> 
     1570                  <widget class="GtkLabel" id="label10"> 
     1571                    <property name="visible">True</property> 
     1572                    <property name="label" translatable="yes">User interface</property> 
     1573                  </widget> 
     1574                  <packing> 
     1575                    <property name="position">1</property> 
     1576                  </packing> 
     1577                </child> 
     1578              </widget> 
     1579              <packing> 
     1580                <property name="position">4</property> 
     1581                <property name="tab_fill">False</property> 
     1582                <property name="type">tab</property> 
     1583              </packing> 
     1584            </child> 
    15111585          </widget> 
    15121586          <packing> 
     
    15211595            <child> 
    15221596              <widget class="GtkButton" id="button5"> 
    1523                 <property name="label" translatable="yes">gtk-close</property> 
    15241597                <property name="visible">True</property> 
    15251598                <property name="can_focus">True</property> 
    15261599                <property name="receives_default">True</property> 
    15271600                <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property> 
    1528                 <property name="use_stock">True</property> 
    15291601                <signal name="clicked" handler="linphone_gtk_parameters_closed"/> 
     1602                <child> 
     1603                  <widget class="GtkHBox" id="hbox3"> 
     1604                    <property name="visible">True</property> 
     1605                    <child> 
     1606                      <widget class="GtkImage" id="image12"> 
     1607                        <property name="visible">True</property> 
     1608                        <property name="stock">gtk-apply</property> 
     1609                        <property name="icon-size">4</property> 
     1610                      </widget> 
     1611                      <packing> 
     1612                        <property name="position">0</property> 
     1613                      </packing> 
     1614                    </child> 
     1615                    <child> 
     1616                      <widget class="GtkLabel" id="label8"> 
     1617                        <property name="visible">True</property> 
     1618                        <property name="label" translatable="yes">Done</property> 
     1619                      </widget> 
     1620                      <packing> 
     1621                        <property name="position">1</property> 
     1622                      </packing> 
     1623                    </child> 
     1624                  </widget> 
     1625                </child> 
    15301626              </widget> 
    15311627              <packing> 
    15321628                <property name="expand">False</property> 
    15331629                <property name="fill">False</property> 
     1630                <property name="padding">10</property> 
    15341631                <property name="position">0</property> 
    15351632              </packing> 
     
    15371634          </widget> 
    15381635          <packing> 
     1636            <property name="padding">5</property> 
    15391637            <property name="position">1</property> 
    15401638          </packing> 
  • linphone/gtk-glade/propertybox.c

    r495 r570  
    612612} 
    613613 
     614typedef struct _LangCodes{ 
     615        const char *code; 
     616        const char *name; 
     617}LangCodes; 
     618 
     619static LangCodes supported_langs[]={ 
     620        {       "C"     ,       N_("English")   }, 
     621        {       "fr"    ,       N_("French")    }, 
     622        {       "sv"    ,       N_("Swedish")   }, 
     623        {       "it"    ,       N_("Italian")   }, 
     624        {       "es"    ,       N_("Spanish")   }, 
     625        {       "pt_BR" ,       N_("Bresilian") }, 
     626        {       "pl"    ,       N_("Polish")    }, 
     627        {       "de"    ,       N_("German")    }, 
     628        {       "ru"    ,       N_("Russian")   }, 
     629        {       "ja"    ,       N_("Japanese")  }, 
     630        {       "nl"    ,       N_("Dutch")     }, 
     631        {       "hu"    ,       N_("Hungarian") }, 
     632        {       "cs"    ,       N_("Czech")     }, 
     633        {       NULL    ,       NULL            } 
     634}; 
     635 
     636static const char *lang_get_name(const char *code){ 
     637        LangCodes *p=supported_langs; 
     638        while(p->code!=NULL){ 
     639                if (strcmp(p->code,code)==0) return p->name; 
     640                p++; 
     641        } 
     642        return NULL; 
     643} 
     644 
     645static gboolean lang_equals(const char *l1, const char *l2){ 
     646        return ((strncmp(l1,l2,5)==0 || strncmp(l1,l2,2)==0)); 
     647} 
     648 
     649static void linphone_gtk_fill_langs(GtkWidget *pb){ 
     650        GtkWidget *combo=linphone_gtk_get_widget(pb,"lang_combo"); 
     651        char code[10]; 
     652        const char *all_langs="C " LINPHONE_ALL_LANGS; 
     653        const char *name; 
     654        int i=0,index=0; 
     655        int adv; 
     656        const char *cur_lang=getenv("LANG"); 
     657        int cur_lang_index=-1; 
     658        char text[256]={0}; 
     659        if (cur_lang==NULL) cur_lang="C"; 
     660        /* glade creates a combo box without list model and text renderer, 
     661        unless we fill it with a dummy text. 
     662        This dummy text needs to be removed first*/ 
     663        gtk_combo_box_remove_text(GTK_COMBO_BOX(combo),0); 
     664        while(sscanf(all_langs+i,"%s %n",code,&adv)>=1){ 
     665                i+=adv; 
     666                name=lang_get_name(code); 
     667                snprintf(text,sizeof(text)-1,"%s : %s",code,name!=NULL ? _(name) : code); 
     668                gtk_combo_box_append_text(GTK_COMBO_BOX(combo),text); 
     669                if (cur_lang_index==-1 && lang_equals(cur_lang,code))  
     670                        cur_lang_index=index; 
     671                index++; 
     672        } 
     673        gtk_combo_box_set_active(GTK_COMBO_BOX(combo),cur_lang_index); 
     674} 
     675 
     676void linphone_gtk_lang_changed(GtkComboBox *combo){ 
     677        const char *selected=gtk_combo_box_get_active_text(combo); 
     678        char code[10]; 
     679        const char *cur_lang=getenv("LANG"); 
     680        if (selected!=NULL){ 
     681                sscanf(selected,"%s",code); 
     682                if (cur_lang==NULL) cur_lang="C"; 
     683                if (!lang_equals(cur_lang,code)){ 
     684                        GtkWidget *dialog = gtk_message_dialog_new (GTK_WINDOW(gtk_widget_get_toplevel(GTK_WIDGET(combo))), 
     685                                GTK_DIALOG_DESTROY_WITH_PARENT, 
     686                                GTK_MESSAGE_INFO, 
     687                                GTK_BUTTONS_CLOSE, 
     688                                "%s", 
     689                                (const gchar*)_("You need to restart linphone for the new language selection to take effect.")); 
     690                                /* Destroy the dialog when the user responds to it (e.g. clicks a button) */ 
     691                        g_signal_connect_swapped (G_OBJECT (dialog), "response", 
     692                                        G_CALLBACK (gtk_widget_destroy), 
     693                                        G_OBJECT (dialog)); 
     694                        gtk_widget_show(dialog); 
     695                        linphone_gtk_set_lang(code); 
     696                } 
     697        } 
     698} 
     699 
    614700void linphone_gtk_show_parameters(void){ 
    615701        GtkWidget *pb=linphone_gtk_create_window("parameters"); 
     
    689775        gtk_spin_button_set_value(GTK_SPIN_BUTTON(linphone_gtk_get_widget(pb,"upload_bw")), 
    690776                                linphone_core_get_upload_bandwidth(lc)); 
     777 
     778        linphone_gtk_fill_langs(pb); 
    691779        gtk_widget_show(pb); 
    692780} 
  • linphone/gtk-glade/support.c

    r342 r570  
    125125} 
    126126 
     127void linphone_gtk_set_lang(const char *code){ 
     128        LpConfig *cfg=linphone_core_get_config(linphone_gtk_get_core()); 
     129        lp_config_set_string(cfg,"GtkUi","lang",code); 
     130#ifdef WIN32 
     131        char tmp[128]; 
     132        snprintf(tmp,sizeof(tmp),"LANG=%s",code); 
     133        _putenv(tmp); 
     134#else 
     135        setenv("LANG",code,1); 
     136#endif 
     137} 
     138 
    127139const gchar *linphone_gtk_get_ui_config(const char *key, const char *def){ 
    128140        LinphoneCore *lc=linphone_gtk_get_core(); 
Note: See TracChangeset for help on using the changeset viewer.