nmtui: replace occurrences of master/slave with controller/port in internal code

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/1335
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1698
This commit is contained in:
Jan Vaclav 2023-07-19 12:29:32 +02:00 committed by Fernando Fernandez Mancera
parent 4f84ed9c10
commit bf4d0eba6e
83 changed files with 493 additions and 492 deletions

View file

@ -5294,8 +5294,8 @@ src_nmtui_nmtui_SOURCES = \
src/nmtui/nmt-route-entry.h \ src/nmtui/nmt-route-entry.h \
src/nmtui/nmt-route-table.c \ src/nmtui/nmt-route-table.c \
src/nmtui/nmt-route-table.h \ src/nmtui/nmt-route-table.h \
src/nmtui/nmt-slave-list.c \ src/nmtui/nmt-port-list.c \
src/nmtui/nmt-slave-list.h \ src/nmtui/nmt-port-list.h \
src/nmtui/nmt-utils.c \ src/nmtui/nmt-utils.c \
src/nmtui/nmt-utils.h \ src/nmtui/nmt-utils.h \
src/nmtui/nmt-widget-list.c \ src/nmtui/nmt-widget-list.c \

View file

@ -187,7 +187,7 @@ src/nmtui/nmt-password-dialog.c
src/nmtui/nmt-password-fields.c src/nmtui/nmt-password-fields.c
src/nmtui/nmt-route-editor.c src/nmtui/nmt-route-editor.c
src/nmtui/nmt-route-table.c src/nmtui/nmt-route-table.c
src/nmtui/nmt-slave-list.c src/nmtui/nmt-port-list.c
src/nmtui/nmt-widget-list.c src/nmtui/nmt-widget-list.c
src/nmtui/nmt-wireguard-peer-editor.c src/nmtui/nmt-wireguard-peer-editor.c
src/nmtui/nmt-wireguard-peer-list.c src/nmtui/nmt-wireguard-peer-list.c

View file

@ -13656,7 +13656,7 @@ msgstr "মেট্ৰিক"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "কোনো স্বনিৰ্বাচিত পথ নাই।" msgstr "কোনো স্বনিৰ্বাচিত পথ নাই।"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "আপুনি যোগ কৰিব বিচৰা স্লেইভ সংযোগৰ ধৰণ বাছক।" msgstr "আপুনি যোগ কৰিব বিচৰা স্লেইভ সংযোগৰ ধৰণ বাছক।"

View file

@ -12557,7 +12557,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12963,7 +12963,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13685,7 +13685,7 @@ msgstr "মেট্রিক"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "কোনো কাস্টম রাউট নির্দিষ্ট করা হয়নি।" msgstr "কোনো কাস্টম রাউট নির্দিষ্ট করা হয়নি।"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "অাপনি যে ধরনের স্লেভ সংযোগ যোগ করতে চান তা নির্বাচন করুন।" msgstr "অাপনি যে ধরনের স্লেভ সংযোগ যোগ করতে চান তা নির্বাচন করুন।"

View file

@ -12640,7 +12640,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -14429,7 +14429,7 @@ msgstr "Mètrica"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "No hi ha rutes personalitzades definides." msgstr "No hi ha rutes personalitzades definides."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Seleccioneu el tipus de connexió esclava que voleu afegir." msgstr "Seleccioneu el tipus de connexió esclava que voleu afegir."

View file

@ -13233,7 +13233,7 @@ msgstr "Metrika"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13692,7 +13692,7 @@ msgstr "Metrisk"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -15407,7 +15407,7 @@ msgstr "Metrik"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Es sind keine eigenen Routen festgelegt." msgstr "Es sind keine eigenen Routen festgelegt."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Wählen Sie die Art der Slave-Verbindung, die Sie hinzufügen möchten." msgstr "Wählen Sie die Art der Slave-Verbindung, die Sie hinzufügen möchten."

View file

@ -12709,7 +12709,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
#, fuzzy #, fuzzy
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "ཁྱོད་ཀྱིས་ཝི་པི་ཨེན་མཐེད་ལམ་ག་བཟུམ་གསར་བསྐྲུན་འབད་ནི་ཨིན་ན་གདམ་ཁ་བརྐྱབ།" msgstr "ཁྱོད་ཀྱིས་ཝི་པི་ཨེན་མཐེད་ལམ་ག་བཟུམ་གསར་བསྐྲུན་འབད་ནི་ཨིན་ན་གདམ་ཁ་བརྐྱབ།"

View file

@ -13790,7 +13790,7 @@ msgstr "Μετρικό"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Δεν ορίστηκαν προσαρμοσμένες διαδρομές." msgstr "Δεν ορίστηκαν προσαρμοσμένες διαδρομές."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Επιλέξτε τον τύπο της υποτελούς σύνδεσης που θέλετε να προσθέσετε." msgstr "Επιλέξτε τον τύπο της υποτελούς σύνδεσης που θέλετε να προσθέσετε."

View file

@ -12858,7 +12858,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
#, fuzzy #, fuzzy
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Choose the type of VPN connection you wish to create." msgstr "Choose the type of VPN connection you wish to create."

View file

@ -12961,7 +12961,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12752,7 +12752,7 @@ msgstr "Metriko"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -15300,7 +15300,7 @@ msgstr "Métrica"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "No hay rutas personalizadas definidas." msgstr "No hay rutas personalizadas definidas."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Seleccionar el tipo de conexión esclava que desee añadir." msgstr "Seleccionar el tipo de conexión esclava que desee añadir."

View file

@ -12615,7 +12615,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12874,7 +12874,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12831,7 +12831,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -15630,7 +15630,7 @@ msgstr "Métrique"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Aucune route personnalisée n'est définie." msgstr "Aucune route personnalisée n'est définie."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Sélectionnez le type de connexion esclave que vous souhaitez ajouter." msgstr "Sélectionnez le type de connexion esclave que vous souhaitez ajouter."

View file

@ -13009,7 +13009,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12959,7 +12959,7 @@ msgstr "Métrica"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Non se definiron rutas personalizadas." msgstr "Non se definiron rutas personalizadas."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Seleccoine o tipo de conexión escrava que quere engadir." msgstr "Seleccoine o tipo de conexión escrava que quere engadir."

View file

@ -13562,7 +13562,7 @@ msgstr "મેટ્રિક"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "કોઇ વૈવિધ્યપૂર્ણ માર્ગો વ્યાખ્યાયિત નથી." msgstr "કોઇ વૈવિધ્યપૂર્ણ માર્ગો વ્યાખ્યાયિત નથી."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "જે પ્રકારનું ગૌણ જોડાણ તમે ઉમેરવા ઇચ્છો છો તે પસંદ કરો." msgstr "જે પ્રકારનું ગૌણ જોડાણ તમે ઉમેરવા ઇચ્છો છો તે પસંદ કરો."

View file

@ -12551,7 +12551,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13629,7 +13629,7 @@ msgstr "मेट्रिक"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "कोई पसंदीदा रूट परिभाषित नहीं है." msgstr "कोई पसंदीदा रूट परिभाषित नहीं है."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "स्लेव कनेक्शन के प्रकार चुनें जिसे आप जोड़ना चाहते हैं." msgstr "स्लेव कनेक्शन के प्रकार चुनें जिसे आप जोड़ना चाहते हैं."

View file

@ -14755,7 +14755,7 @@ msgstr "Metrika"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Nema određenih prilagođenih ruta." msgstr "Nema određenih prilagođenih ruta."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Odaberi vrstu pričuvnog povezivanja kojeg želite dodati." msgstr "Odaberi vrstu pričuvnog povezivanja kojeg želite dodati."

View file

@ -14015,7 +14015,7 @@ msgstr "Metrika"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Nincsenek egyéni útvonalak meghatározva." msgstr "Nincsenek egyéni útvonalak meghatározva."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Válassza ki a hozzáadni kívánt szolgakapcsolat típusát." msgstr "Válassza ki a hozzáadni kívánt szolgakapcsolat típusát."

View file

@ -15163,7 +15163,7 @@ msgstr "Metrik"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Tidak ada rute ubahan yang didefinisikan." msgstr "Tidak ada rute ubahan yang didefinisikan."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Pilih tipe koneksi slave yang hendak Anda tambahkan." msgstr "Pilih tipe koneksi slave yang hendak Anda tambahkan."

View file

@ -15247,7 +15247,7 @@ msgstr "Metrica"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Nessun instradamento personalizzato definito." msgstr "Nessun instradamento personalizzato definito."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Selezionare il tipo di connessione slave da aggiungere." msgstr "Selezionare il tipo di connessione slave da aggiungere."

View file

@ -15170,7 +15170,7 @@ msgstr "メトリック"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "カスタムのルートが定義されていません。" msgstr "カスタムのルートが定義されていません。"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "追加したいスレーブ接続のタイプを選択してください。" msgstr "追加したいスレーブ接続のタイプを選択してください。"

View file

@ -13032,7 +13032,7 @@ msgstr "მეტრიკა"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "რაუტები ხელით მითითებული არაა." msgstr "რაუტები ხელით მითითებული არაა."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13554,7 +13554,7 @@ msgstr "ಮೆಟ್ರಿಕ್"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "ಯಾವುದೆ ಅಗತ್ಯಾನುಗುಣ ರೌಟ್‌ಗಳನ್ನು ವಿವರಿಸಲಾಗಿಲ್ಲ" msgstr "ಯಾವುದೆ ಅಗತ್ಯಾನುಗುಣ ರೌಟ್‌ಗಳನ್ನು ವಿವರಿಸಲಾಗಿಲ್ಲ"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "ನೀವು ಸೇರಿಸಲು ಬಯಸುವ ಸ್ಲೇವ ಸಂಪರ್ಕವನ್ನು ಆಯ್ಕೆ ಮಾಡಿ." msgstr "ನೀವು ಸೇರಿಸಲು ಬಯಸುವ ಸ್ಲೇವ ಸಂಪರ್ಕವನ್ನು ಆಯ್ಕೆ ಮಾಡಿ."

View file

@ -14935,7 +14935,7 @@ msgstr "메트릭"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "사용자 지정 라우팅이 정의되어 있지 않습니다." msgstr "사용자 지정 라우팅이 정의되어 있지 않습니다."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "추가하려는 슬레이브 연결 유형을 선택합니다." msgstr "추가하려는 슬레이브 연결 유형을 선택합니다."

View file

@ -12750,7 +12750,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13147,7 +13147,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12784,7 +12784,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
#, fuzzy #, fuzzy
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Izvēlieties kuru VPN savienojuma tipu jūs vēlaties radīt." msgstr "Izvēlieties kuru VPN savienojuma tipu jūs vēlaties radīt."

View file

@ -12560,7 +12560,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13419,7 +13419,7 @@ msgstr "മെട്രിക്ക്"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "യഥേഷ്ടമായൊരു റൂട്ടുകളും നിഷ്കര്‍ഷിച്ചിട്ടില്ല." msgstr "യഥേഷ്ടമായൊരു റൂട്ടുകളും നിഷ്കര്‍ഷിച്ചിട്ടില്ല."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "നിങ്ങള്‍ക്കു് ചേര്‍ക്കുവാനുള്ള സ്ലേവ് കണക്ഷന്‍ രീതി തെരഞ്ഞെടുക്കുക." msgstr "നിങ്ങള്‍ക്കു് ചേര്‍ക്കുവാനുള്ള സ്ലേവ് കണക്ഷന്‍ രീതി തെരഞ്ഞെടുക്കുക."

View file

@ -13486,7 +13486,7 @@ msgstr "मेट्रिक"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "पसंतीचे राउट्स ठरवले नाही." msgstr "पसंतीचे राउट्स ठरवले नाही."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "समावेशजोगी स्लेव्ह जोडणीचे प्रकार नीवडा." msgstr "समावेशजोगी स्लेव्ह जोडणीचे प्रकार नीवडा."

View file

@ -12580,7 +12580,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12662,7 +12662,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
#, fuzzy #, fuzzy
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "तपाईँ कस्तो प्रकारको भीपीएन जडान सिर्जना गर्न चाहनुहुन्छ रोज्नुहोस् ।" msgstr "तपाईँ कस्तो प्रकारको भीपीएन जडान सिर्जना गर्न चाहनुहुन्छ रोज्नुहोस् ।"

View file

@ -13195,7 +13195,7 @@ msgstr "Metrisch"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Er zijn geen aangepaste routes ingesteld." msgstr "Er zijn geen aangepaste routes ingesteld."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13053,7 +13053,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13403,7 +13403,7 @@ msgstr "ମେଟ୍ରିକ"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "କୌଣସି ଇଚ୍ଛାରୂପଣ ପଥ ବ୍ୟାଖା କରାଯାଇ ନାହିଁ।" msgstr "କୌଣସି ଇଚ୍ଛାରୂପଣ ପଥ ବ୍ୟାଖା କରାଯାଇ ନାହିଁ।"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "ଆପଣ ଯୋଗ କରିବାକୁ ଚାହୁଁଥିବା ସ୍ଲେଭ ସଂଯୋଗ ପ୍ରକାରକୁ ବାଛନ୍ତୁ।" msgstr "ଆପଣ ଯୋଗ କରିବାକୁ ଚାହୁଁଥିବା ସ୍ଲେଭ ସଂଯୋଗ ପ୍ରକାରକୁ ବାଛନ୍ତୁ।"

View file

@ -13232,7 +13232,7 @@ msgstr "ਮੀਟਰਿਕ"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "ਕੋਈ ਚੁਣਿੰਦਾ ਰੂਟ ਪਰਿਭਾਸ਼ਤ ਨਹੀਂ ਹਨ।" msgstr "ਕੋਈ ਚੁਣਿੰਦਾ ਰੂਟ ਪਰਿਭਾਸ਼ਤ ਨਹੀਂ ਹਨ।"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "ਜਿਹੜਾ ਸਲੇਵ ਕਨੈਕਸ਼ਨ ਤੁਸੀਂ ਜੋੜਨਾ ਚਾਹੁੰਦੇ ਹੋ, ਉਹ ਚੁਣੋ।" msgstr "ਜਿਹੜਾ ਸਲੇਵ ਕਨੈਕਸ਼ਨ ਤੁਸੀਂ ਜੋੜਨਾ ਚਾਹੁੰਦੇ ਹੋ, ਉਹ ਚੁਣੋ।"

View file

@ -13914,7 +13914,7 @@ msgstr "Parametry"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Nie określono żadnych tras użytkownika." msgstr "Nie określono żadnych tras użytkownika."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Proszę wybrać typ połączenia podrzędnego do dodania." msgstr "Proszę wybrać typ połączenia podrzędnego do dodania."

View file

@ -12706,7 +12706,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -15237,7 +15237,7 @@ msgstr "Métrica"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Nenhuma rota de cliente foi definida." msgstr "Nenhuma rota de cliente foi definida."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Selecionar o tipo de conexão escrava que você deseja adicionar." msgstr "Selecionar o tipo de conexão escrava que você deseja adicionar."

View file

@ -12815,7 +12815,7 @@ msgstr "Metrică"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Nu sunt definite rute personalizate." msgstr "Nu sunt definite rute personalizate."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Alegeți tipul conexiunii secundare pe care doriți s-o creați." msgstr "Alegeți tipul conexiunii secundare pe care doriți s-o creați."

View file

@ -15839,7 +15839,7 @@ msgstr "Метрика"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Нет дополнительных маршрутов." msgstr "Нет дополнительных маршрутов."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Выберите тип добавляемого подчинённого подключения." msgstr "Выберите тип добавляемого подчинённого подключения."

View file

@ -12760,7 +12760,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12804,7 +12804,7 @@ msgstr "Metrika"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Nie sú definované žiane vlastné smerovania." msgstr "Nie sú definované žiane vlastné smerovania."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Vyberte typ podriadeného spojenia, ktoré si želáte pridať." msgstr "Vyberte typ podriadeného spojenia, ktoré si želáte pridať."

View file

@ -12911,7 +12911,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12634,7 +12634,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12987,7 +12987,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12992,7 +12992,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -14887,7 +14887,7 @@ msgstr "Mätvärde"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Inga anpassade rutter är definierade." msgstr "Inga anpassade rutter är definierade."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Välj den typ av slavanslutning du vill lägga till." msgstr "Välj den typ av slavanslutning du vill lägga till."

View file

@ -13568,7 +13568,7 @@ msgstr "மெட்ரிக்"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "தனிப்பயன் தடங்கள் ஏதும் வரையறுக்கப்படவில்லை." msgstr "தனிப்பயன் தடங்கள் ஏதும் வரையறுக்கப்படவில்லை."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "நீங்கள் சேர்க்க விரும்பும் அடிமை இணைப்பு வகையைத் தேர்ந்தெடுக்கவும்." msgstr "நீங்கள் சேர்க்க விரும்பும் அடிமை இணைப்பு வகையைத் தேர்ந்தெடுக்கவும்."

View file

@ -13475,7 +13475,7 @@ msgstr "మెట్రిక్"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "ఏ మలచిన రౌట్లు నిర్వచించలేదు." msgstr "ఏ మలచిన రౌట్లు నిర్వచించలేదు."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "మీరు జతచేయాలని అనుకొంటున్న స్లేవ్ అనుసంధానం రకం ఎంపికచేయి." msgstr "మీరు జతచేయాలని అనుకొంటున్న స్లేవ్ అనుసంధానం రకం ఎంపికచేయి."

View file

@ -12786,7 +12786,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -13521,7 +13521,7 @@ msgstr "Ölçü"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Tanımlanmış bir özel yönlendirme yok." msgstr "Tanımlanmış bir özel yönlendirme yok."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Eklemek istediğiniz ikincil bağlantının türünü seçin." msgstr "Eklemek istediğiniz ikincil bağlantının türünü seçin."

View file

@ -16080,7 +16080,7 @@ msgstr "Метрика"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "Нетипових маршрутів не визначено." msgstr "Нетипових маршрутів не визначено."
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "Виберіть тип підлеглого з'єднання, яке ви хочете додати." msgstr "Виберіть тип підлеглого з'єднання, яке ви хочете додати."

View file

@ -12605,7 +12605,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -12715,7 +12715,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -14581,7 +14581,7 @@ msgstr "跃点数"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "未定义自定义陆游。" msgstr "未定义自定义陆游。"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "选择您要添加的从连接类型。" msgstr "选择您要添加的从连接类型。"

View file

@ -12812,7 +12812,7 @@ msgstr ""
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "" msgstr ""
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "" msgstr ""

View file

@ -14298,7 +14298,7 @@ msgstr "公制"
msgid "No custom routes are defined." msgid "No custom routes are defined."
msgstr "沒有已定義的自訂路線。" msgstr "沒有已定義的自訂路線。"
#: src/nmtui/nmt-slave-list.c:126 #: src/nmtui/nmt-port-list.c:126
msgid "Select the type of slave connection you wish to add." msgid "Select the type of slave connection you wish to add."
msgstr "選擇您想要新增的 slave 連線類型。" msgstr "選擇您想要新增的 slave 連線類型。"

View file

@ -40,7 +40,7 @@ executable(
'nmt-route-editor.c', 'nmt-route-editor.c',
'nmt-route-entry.c', 'nmt-route-entry.c',
'nmt-route-table.c', 'nmt-route-table.c',
'nmt-slave-list.c', 'nmt-port-list.c',
'nmt-wireguard-peer-list.c', 'nmt-wireguard-peer-list.c',
'nmt-wireguard-peer-editor.c', 'nmt-wireguard-peer-editor.c',
'nmtui.c', 'nmtui.c',

View file

@ -204,7 +204,7 @@ nm_editor_utils_get_connection_type_list(void)
item = g_new0(NMEditorConnectionTypeDataReal, 1); item = g_new0(NMEditorConnectionTypeDataReal, 1);
item->data.name = _("Bridge"); item->data.name = _("Bridge");
item->data.setting_type = NM_TYPE_SETTING_BRIDGE; item->data.setting_type = NM_TYPE_SETTING_BRIDGE;
item->data.slave_setting_type = NM_TYPE_SETTING_BRIDGE_PORT; item->data.port_setting_type = NM_TYPE_SETTING_BRIDGE_PORT;
item->data.device_type = NM_TYPE_DEVICE_BRIDGE; item->data.device_type = NM_TYPE_DEVICE_BRIDGE;
item->data.virtual = TRUE; item->data.virtual = TRUE;
item->id_format = _("Bridge connection %d"); item->id_format = _("Bridge connection %d");
@ -213,7 +213,7 @@ nm_editor_utils_get_connection_type_list(void)
item = g_new0(NMEditorConnectionTypeDataReal, 1); item = g_new0(NMEditorConnectionTypeDataReal, 1);
item->data.name = _("Team"); item->data.name = _("Team");
item->data.setting_type = NM_TYPE_SETTING_TEAM; item->data.setting_type = NM_TYPE_SETTING_TEAM;
item->data.slave_setting_type = NM_TYPE_SETTING_TEAM_PORT; item->data.port_setting_type = NM_TYPE_SETTING_TEAM_PORT;
item->data.device_type = NM_TYPE_DEVICE_TEAM; item->data.device_type = NM_TYPE_DEVICE_TEAM;
item->data.virtual = TRUE; item->data.virtual = TRUE;
item->id_format = _("Team connection %d"); item->id_format = _("Team connection %d");
@ -367,46 +367,46 @@ get_available_iface_name(const char *try_name, NMClient *client)
/** /**
* nm_editor_utils_create_connection: * nm_editor_utils_create_connection:
* @type: the type of the connection's primary #NMSetting * @type: the type of the connection's primary #NMSetting
* @master: (nullable): the connection's master, if any * @controller: (nullable): the connection's controller, if any
* @client: an #NMClient * @client: an #NMClient
* *
* Creates a new #NMConnection of the given type, automatically * Creates a new #NMConnection of the given type, automatically
* creating a UUID and an appropriate not-currently-in-use connection * creating a UUID and an appropriate not-currently-in-use connection
* name, setting #NMSettingConnection:autoconnect appropriately for * name, setting #NMSettingConnection:autoconnect appropriately for
* the connection type, filling in slave-related information if * the connection type, filling in port-related information if
* @master is not %NULL, and initializing any other mandatory-to-set * @controller is not %NULL, and initializing any other mandatory-to-set
* properties to reasonable initial values. * properties to reasonable initial values.
* *
* Returns: a new #NMConnection * Returns: a new #NMConnection
*/ */
NMConnection * NMConnection *
nm_editor_utils_create_connection(GType type, NMConnection *master, NMClient *client) nm_editor_utils_create_connection(GType type, NMConnection *controller, NMClient *client)
{ {
NMEditorConnectionTypeData **types; NMEditorConnectionTypeData **types;
NMEditorConnectionTypeDataReal *type_data = NULL; NMEditorConnectionTypeDataReal *type_data = NULL;
const char *master_setting_type = NULL, *master_uuid = NULL; const char *controller_setting_type = NULL, *controller_uuid = NULL;
GType master_type = G_TYPE_INVALID, slave_setting_type = G_TYPE_INVALID; GType controller_type = G_TYPE_INVALID, port_setting_type = G_TYPE_INVALID;
NMConnection *connection; NMConnection *connection;
NMSettingConnection *s_con; NMSettingConnection *s_con;
NMSetting *s_hw, *s_slave; NMSetting *s_hw, *s_port;
char *uuid, *id, *ifname; char *uuid, *id, *ifname;
int i; int i;
if (master) { if (controller) {
NMSettingConnection *master_s_con; NMSettingConnection *controller_s_con;
master_s_con = nm_connection_get_setting_connection(master); controller_s_con = nm_connection_get_setting_connection(controller);
master_setting_type = nm_setting_connection_get_connection_type(master_s_con); controller_setting_type = nm_setting_connection_get_connection_type(controller_s_con);
master_uuid = nm_setting_connection_get_uuid(master_s_con); controller_uuid = nm_setting_connection_get_uuid(controller_s_con);
master_type = nm_setting_lookup_type(master_setting_type); controller_type = nm_setting_lookup_type(controller_setting_type);
} }
types = nm_editor_utils_get_connection_type_list(); types = nm_editor_utils_get_connection_type_list();
for (i = 0; types[i]; i++) { for (i = 0; types[i]; i++) {
if (types[i]->setting_type == type) if (types[i]->setting_type == type)
type_data = (NMEditorConnectionTypeDataReal *) types[i]; type_data = (NMEditorConnectionTypeDataReal *) types[i];
if (types[i]->setting_type == master_type) if (types[i]->setting_type == controller_type)
slave_setting_type = types[i]->slave_setting_type; port_setting_type = types[i]->port_setting_type;
} }
if (!type_data) { if (!type_data) {
g_return_val_if_reached(NULL); g_return_val_if_reached(NULL);
@ -430,9 +430,9 @@ nm_editor_utils_create_connection(GType type, NMConnection *master, NMClient *cl
else else
ifname = NULL; ifname = NULL;
if (slave_setting_type != G_TYPE_INVALID) { if (port_setting_type != G_TYPE_INVALID) {
s_slave = g_object_new(slave_setting_type, NULL); s_port = g_object_new(port_setting_type, NULL);
nm_connection_add_setting(connection, s_slave); nm_connection_add_setting(connection, s_port);
} }
uuid = nm_utils_uuid_generate(); uuid = nm_utils_uuid_generate();
@ -448,9 +448,9 @@ nm_editor_utils_create_connection(GType type, NMConnection *master, NMClient *cl
NM_SETTING_CONNECTION_AUTOCONNECT, NM_SETTING_CONNECTION_AUTOCONNECT,
!type_data->no_autoconnect, !type_data->no_autoconnect,
NM_SETTING_CONNECTION_MASTER, NM_SETTING_CONNECTION_MASTER,
master_uuid, controller_uuid,
NM_SETTING_CONNECTION_SLAVE_TYPE, NM_SETTING_CONNECTION_SLAVE_TYPE,
master_setting_type, controller_setting_type,
NM_SETTING_CONNECTION_INTERFACE_NAME, NM_SETTING_CONNECTION_INTERFACE_NAME,
ifname, ifname,
NULL); NULL);

View file

@ -9,7 +9,7 @@
typedef struct { typedef struct {
const char *name; const char *name;
GType setting_type; GType setting_type;
GType slave_setting_type; GType port_setting_type;
GType device_type; GType device_type;
gboolean virtual; gboolean virtual;
} NMEditorConnectionTypeData; } NMEditorConnectionTypeData;
@ -17,6 +17,7 @@ typedef struct {
NMEditorConnectionTypeData **nm_editor_utils_get_connection_type_list(void); NMEditorConnectionTypeData **nm_editor_utils_get_connection_type_list(void);
NMEditorConnectionTypeData *nm_editor_utils_get_connection_type_data(NMConnection *conn); NMEditorConnectionTypeData *nm_editor_utils_get_connection_type_data(NMConnection *conn);
NMConnection *nm_editor_utils_create_connection(GType type, NMConnection *master, NMClient *client); NMConnection *
nm_editor_utils_create_connection(GType type, NMConnection *controller, NMClient *client);
#endif /* NM_EDITOR_UTILS_H */ #endif /* NM_EDITOR_UTILS_H */

View file

@ -490,7 +490,7 @@ nmt_edit_connection_list_class_init(NmtEditConnectionListClass *list_class)
* *
* If %TRUE, connections should be grouped by type, with headers * If %TRUE, connections should be grouped by type, with headers
* indicating the types (as in the main connection list). If %FALSE, * indicating the types (as in the main connection list). If %FALSE,
* they will not be grouped (as in slave connection lists). * they will not be grouped (as in port connection lists).
*/ */
g_object_class_install_property( g_object_class_install_property(
object_class, object_class,

View file

@ -104,7 +104,7 @@ nmt_editor_page_add_section(NmtEditorPage *page, NmtEditorSection *section)
* *
* This method is called when the user saves the connection. It gives * This method is called when the user saves the connection. It gives
* the page a chance to do save its data outside the connections (such as * the page a chance to do save its data outside the connections (such as
* recommit the slave connections). * recommit the port connections).
*/ */
void void
nmt_editor_page_saved(NmtEditorPage *page) nmt_editor_page_saved(NmtEditorPage *page)

View file

@ -306,7 +306,7 @@ nmt_editor_constructed(GObject *object)
const char *deventry_label; const char *deventry_label;
NmtDeviceEntry *deventry; NmtDeviceEntry *deventry;
GType hardware_type; GType hardware_type;
const char *slave_type; const char *port_type;
NmtEditorPage *page; NmtEditorPage *page;
if (G_OBJECT_CLASS(nmt_editor_parent_class)->constructed) if (G_OBJECT_CLASS(nmt_editor_parent_class)->constructed)
@ -385,13 +385,13 @@ nmt_editor_constructed(GObject *object)
add_sections_for_page(editor, grid, page); add_sections_for_page(editor, grid, page);
nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL); nmt_editor_grid_append(grid, NULL, nmt_newt_separator_new(), NULL);
slave_type = nm_setting_connection_get_slave_type(s_con); port_type = nm_setting_connection_get_slave_type(s_con);
if (slave_type) { if (port_type) {
if (!strcmp(slave_type, NM_SETTING_BRIDGE_SETTING_NAME)) if (!strcmp(port_type, NM_SETTING_BRIDGE_SETTING_NAME))
add_sections_for_page(editor, grid, nmt_page_bridge_port_new(priv->edit_connection)); add_sections_for_page(editor, grid, nmt_page_bridge_port_new(priv->edit_connection));
else if (!strcmp(slave_type, NM_SETTING_TEAM_SETTING_NAME)) else if (!strcmp(port_type, NM_SETTING_TEAM_SETTING_NAME))
add_sections_for_page(editor, grid, nmt_page_team_port_new(priv->edit_connection)); add_sections_for_page(editor, grid, nmt_page_team_port_new(priv->edit_connection));
else if (nm_streq(slave_type, NM_SETTING_BOND_SETTING_NAME)) else if (nm_streq(port_type, NM_SETTING_BOND_SETTING_NAME))
add_sections_for_page(editor, grid, nmt_page_bond_port_new(priv->edit_connection)); add_sections_for_page(editor, grid, nmt_page_bond_port_new(priv->edit_connection));
} else { } else {
NmtNewtWidget *section; NmtNewtWidget *section;

View file

@ -22,7 +22,7 @@
#include "libnm-core-aux-intern/nm-libnm-core-utils.h" #include "libnm-core-aux-intern/nm-libnm-core-utils.h"
#include "nmt-mac-entry.h" #include "nmt-mac-entry.h"
#include "nmt-address-list.h" #include "nmt-address-list.h"
#include "nmt-slave-list.h" #include "nmt-port-list.h"
G_DEFINE_TYPE(NmtPageBond, nmt_page_bond, NMT_TYPE_EDITOR_PAGE_DEVICE) G_DEFINE_TYPE(NmtPageBond, nmt_page_bond, NMT_TYPE_EDITOR_PAGE_DEVICE)
@ -36,7 +36,7 @@ typedef enum {
} NmtPageBondMonitoringMode; } NmtPageBondMonitoringMode;
typedef struct { typedef struct {
NmtSlaveList *slaves; NmtPortList *ports;
/* Note: when adding new options to the UI also ensure they are /* Note: when adding new options to the UI also ensure they are
* initialized in bond_connection_setup_func() * initialized in bond_connection_setup_func()
@ -53,7 +53,7 @@ typedef struct {
NmtPageBondMonitoringMode monitoring_mode; NmtPageBondMonitoringMode monitoring_mode;
NMSettingBond *s_bond; NMSettingBond *s_bond;
GType slave_type; GType port_type;
gboolean updating; gboolean updating;
} NmtPageBondPrivate; } NmtPageBondPrivate;
@ -75,7 +75,7 @@ nmt_page_bond_init(NmtPageBond *bond)
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(bond); NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(bond);
priv->monitoring_mode = NMT_PAGE_BOND_MONITORING_UNKNOWN; priv->monitoring_mode = NMT_PAGE_BOND_MONITORING_UNKNOWN;
priv->slave_type = G_TYPE_NONE; priv->port_type = G_TYPE_NONE;
} }
static NmtNewtPopupEntry bond_mode[] = { static NmtNewtPopupEntry bond_mode[] = {
@ -159,30 +159,30 @@ bond_options_changed(GObject *object, GParamSpec *pspec, gpointer user_data)
} }
static void static void
slaves_changed(GObject *object, GParamSpec *pspec, gpointer user_data) ports_changed(GObject *object, GParamSpec *pspec, gpointer user_data)
{ {
NmtPageBond *bond = NMT_PAGE_BOND(user_data); NmtPageBond *bond = NMT_PAGE_BOND(user_data);
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(bond); NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(bond);
GPtrArray *slaves; GPtrArray *ports;
g_object_get(object, "connections", &slaves, NULL); g_object_get(object, "connections", &ports, NULL);
if (slaves->len == 0) { if (ports->len == 0) {
if (priv->slave_type == G_TYPE_NONE) if (priv->port_type == G_TYPE_NONE)
return; return;
priv->slave_type = G_TYPE_NONE; priv->port_type = G_TYPE_NONE;
} else { } else {
NMConnection *slave = slaves->pdata[0]; NMConnection *port = ports->pdata[0];
if (priv->slave_type != G_TYPE_NONE) if (priv->port_type != G_TYPE_NONE)
return; return;
if (nm_connection_is_type(slave, NM_SETTING_INFINIBAND_SETTING_NAME)) if (nm_connection_is_type(port, NM_SETTING_INFINIBAND_SETTING_NAME))
priv->slave_type = NM_TYPE_SETTING_INFINIBAND; priv->port_type = NM_TYPE_SETTING_INFINIBAND;
else else
priv->slave_type = NM_TYPE_SETTING_WIRED; priv->port_type = NM_TYPE_SETTING_WIRED;
} }
if (priv->slave_type == NM_TYPE_SETTING_INFINIBAND) { if (priv->port_type == NM_TYPE_SETTING_INFINIBAND) {
nmt_newt_popup_set_active_id(priv->mode, "active-backup"); nmt_newt_popup_set_active_id(priv->mode, "active-backup");
nmt_newt_component_set_sensitive(NMT_NEWT_COMPONENT(priv->mode), FALSE); nmt_newt_component_set_sensitive(NMT_NEWT_COMPONENT(priv->mode), FALSE);
} else } else
@ -314,9 +314,9 @@ bond_connection_type_filter(GType connection_type, gpointer user_data)
NmtPageBond *bond = user_data; NmtPageBond *bond = user_data;
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(bond); NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(bond);
if (priv->slave_type != NM_TYPE_SETTING_WIRED && connection_type == NM_TYPE_SETTING_INFINIBAND) if (priv->port_type != NM_TYPE_SETTING_WIRED && connection_type == NM_TYPE_SETTING_INFINIBAND)
return TRUE; return TRUE;
if (priv->slave_type != NM_TYPE_SETTING_INFINIBAND && connection_type == NM_TYPE_SETTING_WIRED) if (priv->port_type != NM_TYPE_SETTING_INFINIBAND && connection_type == NM_TYPE_SETTING_WIRED)
return TRUE; return TRUE;
return FALSE; return FALSE;
@ -346,10 +346,10 @@ nmt_page_bond_constructed(GObject *object)
nmt_editor_grid_append(grid, _("Slaves"), widget, NULL); nmt_editor_grid_append(grid, _("Slaves"), widget, NULL);
nmt_editor_grid_set_row_flags(grid, widget, NMT_EDITOR_GRID_ROW_LABEL_ALIGN_LEFT); nmt_editor_grid_set_row_flags(grid, widget, NMT_EDITOR_GRID_ROW_LABEL_ALIGN_LEFT);
widget = nmt_slave_list_new(conn, bond_connection_type_filter, bond); widget = nmt_port_list_new(conn, bond_connection_type_filter, bond);
g_signal_connect(widget, "notify::connections", G_CALLBACK(slaves_changed), bond); g_signal_connect(widget, "notify::connections", G_CALLBACK(ports_changed), bond);
nmt_editor_grid_append(grid, NULL, widget, NULL); nmt_editor_grid_append(grid, NULL, widget, NULL);
priv->slaves = NMT_SLAVE_LIST(widget); priv->ports = NMT_PORT_LIST(widget);
widget = nmt_newt_popup_new(bond_mode); widget = nmt_newt_popup_new(bond_mode);
g_signal_connect(widget, "notify::active-id", G_CALLBACK(mode_widget_changed), bond); g_signal_connect(widget, "notify::active-id", G_CALLBACK(mode_widget_changed), bond);
@ -408,7 +408,7 @@ nmt_page_bond_constructed(GObject *object)
G_CALLBACK(bond_options_changed), G_CALLBACK(bond_options_changed),
bond); bond);
bond_options_changed(G_OBJECT(s_bond), NULL, bond); bond_options_changed(G_OBJECT(s_bond), NULL, bond);
slaves_changed(G_OBJECT(priv->slaves), NULL, bond); ports_changed(G_OBJECT(priv->ports), NULL, bond);
nmt_editor_page_add_section(NMT_EDITOR_PAGE(bond), section); nmt_editor_page_add_section(NMT_EDITOR_PAGE(bond), section);
@ -420,7 +420,7 @@ nmt_page_bond_saved(NmtEditorPage *editor_page)
{ {
NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(editor_page); NmtPageBondPrivate *priv = NMT_PAGE_BOND_GET_PRIVATE(editor_page);
nmt_edit_connection_list_recommit(NMT_EDIT_CONNECTION_LIST(priv->slaves)); nmt_edit_connection_list_recommit(NMT_EDIT_CONNECTION_LIST(priv->ports));
} }
static void static void

View file

@ -14,7 +14,7 @@
#include "libnm-core-aux-intern/nm-libnm-core-utils.h" #include "libnm-core-aux-intern/nm-libnm-core-utils.h"
#include "nmt-address-list.h" #include "nmt-address-list.h"
#include "nmt-slave-list.h" #include "nmt-port-list.h"
G_DEFINE_TYPE(NmtPageBridge, nmt_page_bridge, NMT_TYPE_EDITOR_PAGE_DEVICE) G_DEFINE_TYPE(NmtPageBridge, nmt_page_bridge, NMT_TYPE_EDITOR_PAGE_DEVICE)
@ -22,7 +22,7 @@ G_DEFINE_TYPE(NmtPageBridge, nmt_page_bridge, NMT_TYPE_EDITOR_PAGE_DEVICE)
(G_TYPE_INSTANCE_GET_PRIVATE((o), NMT_TYPE_PAGE_BRIDGE, NmtPageBridgePrivate)) (G_TYPE_INSTANCE_GET_PRIVATE((o), NMT_TYPE_PAGE_BRIDGE, NmtPageBridgePrivate))
typedef struct { typedef struct {
NmtSlaveList *slaves; NmtPortList *ports;
} NmtPageBridgePrivate; } NmtPageBridgePrivate;
NmtEditorPage * NmtEditorPage *
@ -63,9 +63,9 @@ nmt_page_bridge_constructed(GObject *object)
nmt_editor_grid_append(grid, _("Slaves"), widget, NULL); nmt_editor_grid_append(grid, _("Slaves"), widget, NULL);
nmt_editor_grid_set_row_flags(grid, widget, NMT_EDITOR_GRID_ROW_LABEL_ALIGN_LEFT); nmt_editor_grid_set_row_flags(grid, widget, NMT_EDITOR_GRID_ROW_LABEL_ALIGN_LEFT);
widget = nmt_slave_list_new(conn, bridge_connection_type_filter, bridge); widget = nmt_port_list_new(conn, bridge_connection_type_filter, bridge);
nmt_editor_grid_append(grid, NULL, widget, NULL); nmt_editor_grid_append(grid, NULL, widget, NULL);
priv->slaves = NMT_SLAVE_LIST(widget); priv->ports = NMT_PORT_LIST(widget);
widget = nmt_newt_entry_numeric_new(10, 0, 1000000); widget = nmt_newt_entry_numeric_new(10, 0, 1000000);
g_object_bind_property(s_bridge, g_object_bind_property(s_bridge,
@ -165,7 +165,7 @@ nmt_page_bridge_saved(NmtEditorPage *editor_page)
{ {
NmtPageBridgePrivate *priv = NMT_PAGE_BRIDGE_GET_PRIVATE(editor_page); NmtPageBridgePrivate *priv = NMT_PAGE_BRIDGE_GET_PRIVATE(editor_page);
nmt_edit_connection_list_recommit(NMT_EDIT_CONNECTION_LIST(priv->slaves)); nmt_edit_connection_list_recommit(NMT_EDIT_CONNECTION_LIST(priv->ports));
} }
static void static void

View file

@ -13,7 +13,7 @@
#include "nmt-page-team.h" #include "nmt-page-team.h"
#include "libnm-core-aux-intern/nm-libnm-core-utils.h" #include "libnm-core-aux-intern/nm-libnm-core-utils.h"
#include "nmt-slave-list.h" #include "nmt-port-list.h"
G_DEFINE_TYPE(NmtPageTeam, nmt_page_team, NMT_TYPE_EDITOR_PAGE_DEVICE) G_DEFINE_TYPE(NmtPageTeam, nmt_page_team, NMT_TYPE_EDITOR_PAGE_DEVICE)
@ -21,10 +21,10 @@ G_DEFINE_TYPE(NmtPageTeam, nmt_page_team, NMT_TYPE_EDITOR_PAGE_DEVICE)
(G_TYPE_INSTANCE_GET_PRIVATE((o), NMT_TYPE_PAGE_TEAM, NmtPageTeamPrivate)) (G_TYPE_INSTANCE_GET_PRIVATE((o), NMT_TYPE_PAGE_TEAM, NmtPageTeamPrivate))
typedef struct { typedef struct {
NmtSlaveList *slaves; NmtPortList *ports;
NMSettingTeam *s_team; NMSettingTeam *s_team;
GType slave_type; GType port_type;
} NmtPageTeamPrivate; } NmtPageTeamPrivate;
@ -39,26 +39,26 @@ nmt_page_team_init(NmtPageTeam *team)
{ {
NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(team); NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(team);
priv->slave_type = G_TYPE_NONE; priv->port_type = G_TYPE_NONE;
} }
static void static void
slaves_changed(GObject *object, GParamSpec *pspec, gpointer user_data) ports_changed(GObject *object, GParamSpec *pspec, gpointer user_data)
{ {
NmtPageTeam *team = NMT_PAGE_TEAM(user_data); NmtPageTeam *team = NMT_PAGE_TEAM(user_data);
NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(team); NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(team);
GPtrArray *slaves; GPtrArray *ports;
g_object_get(object, "connections", &slaves, NULL); g_object_get(object, "connections", &ports, NULL);
if (slaves->len == 0) { if (ports->len == 0) {
priv->slave_type = G_TYPE_NONE; priv->port_type = G_TYPE_NONE;
} else if (priv->slave_type == G_TYPE_NONE) { } else if (priv->port_type == G_TYPE_NONE) {
NMConnection *slave = slaves->pdata[0]; NMConnection *port = ports->pdata[0];
if (nm_connection_is_type(slave, NM_SETTING_INFINIBAND_SETTING_NAME)) if (nm_connection_is_type(port, NM_SETTING_INFINIBAND_SETTING_NAME))
priv->slave_type = NM_TYPE_SETTING_INFINIBAND; priv->port_type = NM_TYPE_SETTING_INFINIBAND;
else else
priv->slave_type = NM_TYPE_SETTING_WIRED; priv->port_type = NM_TYPE_SETTING_WIRED;
} }
} }
@ -68,11 +68,11 @@ team_connection_type_filter(GType connection_type, gpointer user_data)
NmtPageTeam *team = user_data; NmtPageTeam *team = user_data;
NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(team); NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(team);
if (priv->slave_type != NM_TYPE_SETTING_WIRED) { if (priv->port_type != NM_TYPE_SETTING_WIRED) {
if (connection_type == NM_TYPE_SETTING_INFINIBAND) if (connection_type == NM_TYPE_SETTING_INFINIBAND)
return TRUE; return TRUE;
} }
if (priv->slave_type != NM_TYPE_SETTING_INFINIBAND) { if (priv->port_type != NM_TYPE_SETTING_INFINIBAND) {
if (connection_type == NM_TYPE_SETTING_WIRED || connection_type == NM_TYPE_SETTING_WIRELESS if (connection_type == NM_TYPE_SETTING_WIRED || connection_type == NM_TYPE_SETTING_WIRELESS
|| connection_type == NM_TYPE_SETTING_VLAN) || connection_type == NM_TYPE_SETTING_VLAN)
return TRUE; return TRUE;
@ -126,12 +126,12 @@ nmt_page_team_constructed(GObject *object)
widget = nmt_newt_label_new(_("Slaves")); widget = nmt_newt_label_new(_("Slaves"));
nmt_newt_grid_add(grid, widget, 0, 0); nmt_newt_grid_add(grid, widget, 0, 0);
widget = nmt_slave_list_new(conn, team_connection_type_filter, team); widget = nmt_port_list_new(conn, team_connection_type_filter, team);
g_signal_connect(widget, "notify::connections", G_CALLBACK(slaves_changed), team); g_signal_connect(widget, "notify::connections", G_CALLBACK(ports_changed), team);
nmt_newt_grid_add(grid, widget, 0, 1); nmt_newt_grid_add(grid, widget, 0, 1);
nmt_newt_widget_set_padding(widget, 0, 0, 0, 1); nmt_newt_widget_set_padding(widget, 0, 0, 0, 1);
priv->slaves = NMT_SLAVE_LIST(widget); priv->ports = NMT_PORT_LIST(widget);
slaves_changed(G_OBJECT(priv->slaves), NULL, team); ports_changed(G_OBJECT(priv->ports), NULL, team);
widget = nmt_newt_label_new(_("JSON configuration")); widget = nmt_newt_label_new(_("JSON configuration"));
nmt_newt_grid_add(grid, widget, 0, 2); nmt_newt_grid_add(grid, widget, 0, 2);
@ -156,7 +156,7 @@ nmt_page_team_saved(NmtEditorPage *editor_page)
{ {
NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(editor_page); NmtPageTeamPrivate *priv = NMT_PAGE_TEAM_GET_PRIVATE(editor_page);
nmt_edit_connection_list_recommit(NMT_EDIT_CONNECTION_LIST(priv->slaves)); nmt_edit_connection_list_recommit(NMT_EDIT_CONNECTION_LIST(priv->ports));
} }
static void static void

254
src/nmtui/nmt-port-list.c Normal file
View file

@ -0,0 +1,254 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2013 Red Hat, Inc.
*/
/**
* SECTION:nmt-port-list:
* @short_description: An editable list of a connection's ports
*
* #NmtPortList implements an #NmtEditConnectionList for the
* ports of a connection.
*/
#include "libnm-client-aux-extern/nm-default-client.h"
#include "nmt-port-list.h"
G_DEFINE_TYPE(NmtPortList, nmt_port_list, NMT_TYPE_EDIT_CONNECTION_LIST)
#define NMT_PORT_LIST_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), NMT_TYPE_PORT_LIST, NmtPortListPrivate))
typedef struct {
NMConnection *controller;
const char *controller_type, *controller_uuid;
NmtAddConnectionTypeFilter type_filter;
gpointer type_filter_data;
} NmtPortListPrivate;
enum {
PROP_0,
PROP_CONTROLLER,
PROP_TYPE_FILTER,
PROP_TYPE_FILTER_DATA,
LAST_PROP
};
static gboolean nmt_port_list_connection_filter(NmtEditConnectionList *list,
NMConnection *connection,
gpointer user_data);
/**
* nmt_port_list_new:
* @controller: the controller #NMConnection whose ports are being listed
* @type_filter: (nullable): a function to limit the available port types
* @type_filter_data: (nullable): data for @type_filter.
*
* Creates a new #NmtPortList.
*
* If @type_filter is non-%NULL, it will be used to limit the connection
* types that are available when the user clicks on the "Add" button to add
* a new port. If the @type_filter filters the list down to only a single
* connection type, then the user will not be presented with a connection-type
* dialog, and will instead be immediately taken to an editor window for the
* new port after clicking "Add".
*
* Returns: a new #NmtPortList.
*/
NmtNewtWidget *
nmt_port_list_new(NMConnection *controller,
NmtAddConnectionTypeFilter type_filter,
gpointer type_filter_data)
{
return g_object_new(NMT_TYPE_PORT_LIST,
"controller",
controller,
"type-filter",
type_filter,
"type-filter-data",
type_filter_data,
"grouped",
FALSE,
"connection-filter",
nmt_port_list_connection_filter,
NULL);
}
static void
nmt_port_list_init(NmtPortList *list)
{}
static void
nmt_port_list_finalize(GObject *object)
{
NmtPortListPrivate *priv = NMT_PORT_LIST_GET_PRIVATE(object);
g_object_unref(priv->controller);
G_OBJECT_CLASS(nmt_port_list_parent_class)->finalize(object);
}
static gboolean
nmt_port_list_connection_filter(NmtEditConnectionList *list,
NMConnection *connection,
gpointer user_data)
{
NmtPortListPrivate *priv = NMT_PORT_LIST_GET_PRIVATE(list);
NMSettingConnection *s_con;
const char *controller, *controller_ifname, *port_type;
s_con = nm_connection_get_setting_connection(connection);
g_return_val_if_fail(s_con != NULL, FALSE);
port_type = nm_setting_connection_get_slave_type(s_con);
if (g_strcmp0(port_type, priv->controller_type) != 0)
return FALSE;
controller = nm_setting_connection_get_master(s_con);
if (!controller)
return FALSE;
controller_ifname = nm_connection_get_interface_name(priv->controller);
if (g_strcmp0(controller, controller_ifname) != 0
&& g_strcmp0(controller, priv->controller_uuid) != 0)
return FALSE;
return TRUE;
}
static void
nmt_port_list_add_connection(NmtEditConnectionList *list)
{
NmtPortListPrivate *priv = NMT_PORT_LIST_GET_PRIVATE(list);
nmt_add_connection_full(_("Select the type of slave connection you wish to add."),
NULL,
priv->controller,
priv->type_filter,
priv->type_filter_data);
}
static void
nmt_port_list_edit_connection(NmtEditConnectionList *list, NMConnection *connection)
{
nmt_edit_connection(connection);
}
static void
nmt_port_list_remove_connection(NmtEditConnectionList *list, NMRemoteConnection *connection)
{
nmt_remove_connection(connection);
}
static void
nmt_port_list_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
NmtPortListPrivate *priv = NMT_PORT_LIST_GET_PRIVATE(object);
switch (prop_id) {
case PROP_CONTROLLER:
priv->controller = g_value_dup_object(value);
if (priv->controller) {
NMSettingConnection *s_con = nm_connection_get_setting_connection(priv->controller);
priv->controller_type = nm_setting_connection_get_connection_type(s_con);
priv->controller_uuid = nm_setting_connection_get_uuid(s_con);
}
break;
case PROP_TYPE_FILTER:
priv->type_filter = g_value_get_pointer(value);
break;
case PROP_TYPE_FILTER_DATA:
priv->type_filter_data = g_value_get_pointer(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void
nmt_port_list_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
NmtPortListPrivate *priv = NMT_PORT_LIST_GET_PRIVATE(object);
switch (prop_id) {
case PROP_CONTROLLER:
g_value_set_object(value, priv->controller);
break;
case PROP_TYPE_FILTER:
g_value_set_pointer(value, priv->type_filter);
break;
case PROP_TYPE_FILTER_DATA:
g_value_set_pointer(value, priv->type_filter_data);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void
nmt_port_list_class_init(NmtPortListClass *list_class)
{
GObjectClass *object_class = G_OBJECT_CLASS(list_class);
NmtEditConnectionListClass *connection_list_class = NMT_EDIT_CONNECTION_LIST_CLASS(list_class);
g_type_class_add_private(list_class, sizeof(NmtPortListPrivate));
/* virtual methods */
object_class->set_property = nmt_port_list_set_property;
object_class->get_property = nmt_port_list_get_property;
object_class->finalize = nmt_port_list_finalize;
connection_list_class->add_connection = nmt_port_list_add_connection;
connection_list_class->edit_connection = nmt_port_list_edit_connection;
connection_list_class->remove_connection = nmt_port_list_remove_connection;
/**
* NmtPortList:controller:
*
* The controller #NMConnection whose ports are being displayed.
*/
g_object_class_install_property(
object_class,
PROP_CONTROLLER,
g_param_spec_object("controller",
"",
"",
NM_TYPE_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* NmtPortList:type-filter:
*
* If non-%NULL, this will be used to limit the connection types
* that are available when the user clicks on the "Add" button to
* add a new port. If the filter filters the list down to only a
* single connection type, then the user will not be presented
* with a connection-type dialog, and will instead be immediately
* taken to an editor window for the new port after clicking
* "Add".
*/
g_object_class_install_property(
object_class,
PROP_TYPE_FILTER,
g_param_spec_pointer("type-filter",
"",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* NmtPortList:type-filter-data:
*
* User data passed to #NmtPortList:type-filter
*/
g_object_class_install_property(
object_class,
PROP_TYPE_FILTER_DATA,
g_param_spec_pointer("type-filter-data",
"",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}

37
src/nmtui/nmt-port-list.h Normal file
View file

@ -0,0 +1,37 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2013 Red Hat, Inc.
*/
#ifndef NMT_PORT_LIST_H
#define NMT_PORT_LIST_H
#include "nmt-edit-connection-list.h"
#include "nmtui-edit.h"
#define NMT_TYPE_PORT_LIST (nmt_port_list_get_type())
#define NMT_PORT_LIST(obj) (_NM_G_TYPE_CHECK_INSTANCE_CAST((obj), NMT_TYPE_PORT_LIST, NmtPortList))
#define NMT_PORT_LIST_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), NMT_TYPE_PORT_LIST, NmtPortListClass))
#define NMT_IS_PORT_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NMT_TYPE_PORT_LIST))
#define NMT_IS_PORT_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NMT_TYPE_PORT_LIST))
#define NMT_PORT_LIST_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), NMT_TYPE_PORT_LIST, NmtPortListClass))
typedef struct {
NmtEditConnectionList parent;
} NmtPortList;
typedef struct {
NmtEditConnectionListClass parent;
} NmtPortListClass;
GType nmt_port_list_get_type(void);
NmtNewtWidget *nmt_port_list_new(NMConnection *controller,
NmtAddConnectionTypeFilter type_filter,
gpointer type_filter_data);
#endif /* NMT_PORT_LIST_H */

View file

@ -1,253 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2013 Red Hat, Inc.
*/
/**
* SECTION:nmt-slave-list:
* @short_description: An editable list of a connection's slaves
*
* #NmtSlaveList implements an #NmtEditConnectionList for the
* slaves of a connection.
*/
#include "libnm-client-aux-extern/nm-default-client.h"
#include "nmt-slave-list.h"
G_DEFINE_TYPE(NmtSlaveList, nmt_slave_list, NMT_TYPE_EDIT_CONNECTION_LIST)
#define NMT_SLAVE_LIST_GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE((o), NMT_TYPE_SLAVE_LIST, NmtSlaveListPrivate))
typedef struct {
NMConnection *master;
const char *master_type, *master_uuid;
NmtAddConnectionTypeFilter type_filter;
gpointer type_filter_data;
} NmtSlaveListPrivate;
enum {
PROP_0,
PROP_MASTER,
PROP_TYPE_FILTER,
PROP_TYPE_FILTER_DATA,
LAST_PROP
};
static gboolean nmt_slave_list_connection_filter(NmtEditConnectionList *list,
NMConnection *connection,
gpointer user_data);
/**
* nmt_slave_list_new:
* @master: the master #NMConnection whose slaves are being listed
* @type_filter: (nullable): a function to limit the available slave types
* @type_filter_data: (nullable): data for @type_filter.
*
* Creates a new #NmtSlaveList.
*
* If @type_filter is non-%NULL, it will be used to limit the connection
* types that are available when the user clicks on the "Add" button to add
* a new slave. If the @type_filter filters the list down to only a single
* connection type, then the user will not be presented with a connection-type
* dialog, and will instead be immediately taken to an editor window for the
* new slave after clicking "Add".
*
* Returns: a new #NmtSlaveList.
*/
NmtNewtWidget *
nmt_slave_list_new(NMConnection *master,
NmtAddConnectionTypeFilter type_filter,
gpointer type_filter_data)
{
return g_object_new(NMT_TYPE_SLAVE_LIST,
"master",
master,
"type-filter",
type_filter,
"type-filter-data",
type_filter_data,
"grouped",
FALSE,
"connection-filter",
nmt_slave_list_connection_filter,
NULL);
}
static void
nmt_slave_list_init(NmtSlaveList *list)
{}
static void
nmt_slave_list_finalize(GObject *object)
{
NmtSlaveListPrivate *priv = NMT_SLAVE_LIST_GET_PRIVATE(object);
g_object_unref(priv->master);
G_OBJECT_CLASS(nmt_slave_list_parent_class)->finalize(object);
}
static gboolean
nmt_slave_list_connection_filter(NmtEditConnectionList *list,
NMConnection *connection,
gpointer user_data)
{
NmtSlaveListPrivate *priv = NMT_SLAVE_LIST_GET_PRIVATE(list);
NMSettingConnection *s_con;
const char *master, *master_ifname, *slave_type;
s_con = nm_connection_get_setting_connection(connection);
g_return_val_if_fail(s_con != NULL, FALSE);
slave_type = nm_setting_connection_get_slave_type(s_con);
if (g_strcmp0(slave_type, priv->master_type) != 0)
return FALSE;
master = nm_setting_connection_get_master(s_con);
if (!master)
return FALSE;
master_ifname = nm_connection_get_interface_name(priv->master);
if (g_strcmp0(master, master_ifname) != 0 && g_strcmp0(master, priv->master_uuid) != 0)
return FALSE;
return TRUE;
}
static void
nmt_slave_list_add_connection(NmtEditConnectionList *list)
{
NmtSlaveListPrivate *priv = NMT_SLAVE_LIST_GET_PRIVATE(list);
nmt_add_connection_full(_("Select the type of slave connection you wish to add."),
NULL,
priv->master,
priv->type_filter,
priv->type_filter_data);
}
static void
nmt_slave_list_edit_connection(NmtEditConnectionList *list, NMConnection *connection)
{
nmt_edit_connection(connection);
}
static void
nmt_slave_list_remove_connection(NmtEditConnectionList *list, NMRemoteConnection *connection)
{
nmt_remove_connection(connection);
}
static void
nmt_slave_list_set_property(GObject *object, guint prop_id, const GValue *value, GParamSpec *pspec)
{
NmtSlaveListPrivate *priv = NMT_SLAVE_LIST_GET_PRIVATE(object);
switch (prop_id) {
case PROP_MASTER:
priv->master = g_value_dup_object(value);
if (priv->master) {
NMSettingConnection *s_con = nm_connection_get_setting_connection(priv->master);
priv->master_type = nm_setting_connection_get_connection_type(s_con);
priv->master_uuid = nm_setting_connection_get_uuid(s_con);
}
break;
case PROP_TYPE_FILTER:
priv->type_filter = g_value_get_pointer(value);
break;
case PROP_TYPE_FILTER_DATA:
priv->type_filter_data = g_value_get_pointer(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void
nmt_slave_list_get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec)
{
NmtSlaveListPrivate *priv = NMT_SLAVE_LIST_GET_PRIVATE(object);
switch (prop_id) {
case PROP_MASTER:
g_value_set_object(value, priv->master);
break;
case PROP_TYPE_FILTER:
g_value_set_pointer(value, priv->type_filter);
break;
case PROP_TYPE_FILTER_DATA:
g_value_set_pointer(value, priv->type_filter_data);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec);
break;
}
}
static void
nmt_slave_list_class_init(NmtSlaveListClass *list_class)
{
GObjectClass *object_class = G_OBJECT_CLASS(list_class);
NmtEditConnectionListClass *connection_list_class = NMT_EDIT_CONNECTION_LIST_CLASS(list_class);
g_type_class_add_private(list_class, sizeof(NmtSlaveListPrivate));
/* virtual methods */
object_class->set_property = nmt_slave_list_set_property;
object_class->get_property = nmt_slave_list_get_property;
object_class->finalize = nmt_slave_list_finalize;
connection_list_class->add_connection = nmt_slave_list_add_connection;
connection_list_class->edit_connection = nmt_slave_list_edit_connection;
connection_list_class->remove_connection = nmt_slave_list_remove_connection;
/**
* NmtSlaveList:master:
*
* The master #NMConnection whose slaves are being displayed.
*/
g_object_class_install_property(
object_class,
PROP_MASTER,
g_param_spec_object("master",
"",
"",
NM_TYPE_CONNECTION,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* NmtSlaveList:type-filter:
*
* If non-%NULL, this will be used to limit the connection types
* that are available when the user clicks on the "Add" button to
* add a new slave. If the filter filters the list down to only a
* single connection type, then the user will not be presented
* with a connection-type dialog, and will instead be immediately
* taken to an editor window for the new slave after clicking
* "Add".
*/
g_object_class_install_property(
object_class,
PROP_TYPE_FILTER,
g_param_spec_pointer("type-filter",
"",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
/**
* NmtSlaveList:type-filter-data:
*
* User data passed to #NmtSlaveList:type-filter
*/
g_object_class_install_property(
object_class,
PROP_TYPE_FILTER_DATA,
g_param_spec_pointer("type-filter-data",
"",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
}

View file

@ -1,38 +0,0 @@
/* SPDX-License-Identifier: GPL-2.0-or-later */
/*
* Copyright (C) 2013 Red Hat, Inc.
*/
#ifndef NMT_SLAVE_LIST_H
#define NMT_SLAVE_LIST_H
#include "nmt-edit-connection-list.h"
#include "nmtui-edit.h"
#define NMT_TYPE_SLAVE_LIST (nmt_slave_list_get_type())
#define NMT_SLAVE_LIST(obj) \
(_NM_G_TYPE_CHECK_INSTANCE_CAST((obj), NMT_TYPE_SLAVE_LIST, NmtSlaveList))
#define NMT_SLAVE_LIST_CLASS(klass) \
(G_TYPE_CHECK_CLASS_CAST((klass), NMT_TYPE_SLAVE_LIST, NmtSlaveListClass))
#define NMT_IS_SLAVE_LIST(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), NMT_TYPE_SLAVE_LIST))
#define NMT_IS_SLAVE_LIST_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), NMT_TYPE_SLAVE_LIST))
#define NMT_SLAVE_LIST_GET_CLASS(obj) \
(G_TYPE_INSTANCE_GET_CLASS((obj), NMT_TYPE_SLAVE_LIST, NmtSlaveListClass))
typedef struct {
NmtEditConnectionList parent;
} NmtSlaveList;
typedef struct {
NmtEditConnectionListClass parent;
} NmtSlaveListClass;
GType nmt_slave_list_get_type(void);
NmtNewtWidget *nmt_slave_list_new(NMConnection *master,
NmtAddConnectionTypeFilter type_filter,
gpointer type_filter_data);
#endif /* NMT_SLAVE_LIST_H */

View file

@ -49,22 +49,22 @@ edit_connection_list_filter(NmtEditConnectionList *list,
gpointer user_data) gpointer user_data)
{ {
NMSettingConnection *s_con; NMSettingConnection *s_con;
const char *master, *slave_type; const char *controller, *port_type;
const char *uuid, *ifname; const char *uuid, *ifname;
const GPtrArray *conns; const GPtrArray *conns;
int i; int i;
gboolean found_master = FALSE; gboolean found_controller = FALSE;
s_con = nm_connection_get_setting_connection(connection); s_con = nm_connection_get_setting_connection(connection);
g_return_val_if_fail(s_con != NULL, FALSE); g_return_val_if_fail(s_con != NULL, FALSE);
master = nm_setting_connection_get_master(s_con); controller = nm_setting_connection_get_master(s_con);
if (!master) if (!controller)
return TRUE; return TRUE;
slave_type = nm_setting_connection_get_slave_type(s_con); port_type = nm_setting_connection_get_slave_type(s_con);
if (g_strcmp0(slave_type, NM_SETTING_BOND_SETTING_NAME) != 0 if (g_strcmp0(port_type, NM_SETTING_BOND_SETTING_NAME) != 0
&& g_strcmp0(slave_type, NM_SETTING_TEAM_SETTING_NAME) != 0 && g_strcmp0(port_type, NM_SETTING_TEAM_SETTING_NAME) != 0
&& g_strcmp0(slave_type, NM_SETTING_BRIDGE_SETTING_NAME) != 0) && g_strcmp0(port_type, NM_SETTING_BRIDGE_SETTING_NAME) != 0)
return TRUE; return TRUE;
conns = nm_client_get_connections(nm_client); conns = nm_client_get_connections(nm_client);
@ -73,13 +73,13 @@ edit_connection_list_filter(NmtEditConnectionList *list,
uuid = nm_connection_get_uuid(candidate); uuid = nm_connection_get_uuid(candidate);
ifname = nm_connection_get_interface_name(candidate); ifname = nm_connection_get_interface_name(candidate);
if (!g_strcmp0(master, uuid) || !g_strcmp0(master, ifname)) { if (!g_strcmp0(controller, uuid) || !g_strcmp0(controller, ifname)) {
found_master = TRUE; found_controller = TRUE;
break; break;
} }
} }
return !found_master; return !found_controller;
} }
static NmtNewtForm * static NmtNewtForm *
@ -132,7 +132,7 @@ typedef struct {
char *primary_text; char *primary_text;
char *secondary_text; char *secondary_text;
NMConnection *master; NMConnection *controller;
NmtAddConnectionTypeFilter type_filter; NmtAddConnectionTypeFilter type_filter;
gpointer type_filter_data; gpointer type_filter_data;
@ -144,7 +144,7 @@ enum {
PROP_PRIMARY_TEXT, PROP_PRIMARY_TEXT,
PROP_SECONDARY_TEXT, PROP_SECONDARY_TEXT,
PROP_MASTER, PROP_CONTROLLER,
PROP_TYPE_FILTER, PROP_TYPE_FILTER,
PROP_TYPE_FILTER_DATA, PROP_TYPE_FILTER_DATA,
@ -158,7 +158,7 @@ create_connection(NmtNewtWidget *widget, gpointer list)
GType type = (GType) GPOINTER_TO_SIZE(nmt_newt_listbox_get_active_key(priv->listbox)); GType type = (GType) GPOINTER_TO_SIZE(nmt_newt_listbox_get_active_key(priv->listbox));
NMConnection *connection; NMConnection *connection;
connection = nm_editor_utils_create_connection(type, priv->master, nm_client); connection = nm_editor_utils_create_connection(type, priv->controller, nm_client);
nmt_edit_connection(connection); nmt_edit_connection(connection);
g_object_unref(connection); g_object_unref(connection);
} }
@ -262,7 +262,7 @@ nmt_add_connection_finalize(GObject *object)
g_free(priv->primary_text); g_free(priv->primary_text);
g_free(priv->secondary_text); g_free(priv->secondary_text);
g_clear_object(&priv->master); g_clear_object(&priv->controller);
G_OBJECT_CLASS(nmt_add_connection_parent_class)->finalize(object); G_OBJECT_CLASS(nmt_add_connection_parent_class)->finalize(object);
} }
@ -282,8 +282,8 @@ nmt_add_connection_set_property(GObject *object,
case PROP_SECONDARY_TEXT: case PROP_SECONDARY_TEXT:
priv->secondary_text = g_value_dup_string(value); priv->secondary_text = g_value_dup_string(value);
break; break;
case PROP_MASTER: case PROP_CONTROLLER:
priv->master = g_value_dup_object(value); priv->controller = g_value_dup_object(value);
break; break;
case PROP_TYPE_FILTER: case PROP_TYPE_FILTER:
priv->type_filter = g_value_get_pointer(value); priv->type_filter = g_value_get_pointer(value);
@ -309,8 +309,8 @@ nmt_add_connection_get_property(GObject *object, guint prop_id, GValue *value, G
case PROP_SECONDARY_TEXT: case PROP_SECONDARY_TEXT:
g_value_set_string(value, priv->secondary_text); g_value_set_string(value, priv->secondary_text);
break; break;
case PROP_MASTER: case PROP_CONTROLLER:
g_value_set_object(value, priv->master); g_value_set_object(value, priv->controller);
break; break;
case PROP_TYPE_FILTER: case PROP_TYPE_FILTER:
g_value_set_pointer(value, priv->type_filter); g_value_set_pointer(value, priv->type_filter);
@ -364,8 +364,8 @@ nmt_add_connection_class_init(NmtAddConnectionClass *add_class)
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS)); G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY | G_PARAM_STATIC_STRINGS));
g_object_class_install_property( g_object_class_install_property(
object_class, object_class,
PROP_MASTER, PROP_CONTROLLER,
g_param_spec_object("master", g_param_spec_object("controller",
"", "",
"", "",
NM_TYPE_CONNECTION, NM_TYPE_CONNECTION,
@ -399,7 +399,7 @@ nmt_add_connection(void)
void void
nmt_add_connection_full(const char *primary_text, nmt_add_connection_full(const char *primary_text,
const char *secondary_text, const char *secondary_text,
NMConnection *master, NMConnection *controller,
NmtAddConnectionTypeFilter type_filter, NmtAddConnectionTypeFilter type_filter,
gpointer type_filter_data) gpointer type_filter_data)
{ {
@ -412,8 +412,8 @@ nmt_add_connection_full(const char *primary_text,
primary_text, primary_text,
"secondary-text", "secondary-text",
secondary_text, secondary_text,
"master", "controller",
master, controller,
"type-filter", "type-filter",
type_filter, type_filter,
"type-filter-data", "type-filter-data",
@ -500,11 +500,11 @@ void
nmt_remove_connection(NMRemoteConnection *connection) nmt_remove_connection(NMRemoteConnection *connection)
{ {
const GPtrArray *all_conns; const GPtrArray *all_conns;
GSList *slaves, *iter; GSList *ports, *iter;
int i; int i;
NMRemoteConnection *slave; NMRemoteConnection *port;
NMSettingConnection *s_con; NMSettingConnection *s_con;
const char *uuid, *iface, *master; const char *uuid, *iface, *controller;
int choice; int choice;
choice = nmt_newt_choice_dialog(_("Cancel"), choice = nmt_newt_choice_dialog(_("Cancel"),
@ -521,20 +521,20 @@ nmt_remove_connection(NMRemoteConnection *connection)
iface = nm_connection_get_interface_name(NM_CONNECTION(connection)); iface = nm_connection_get_interface_name(NM_CONNECTION(connection));
all_conns = nm_client_get_connections(nm_client); all_conns = nm_client_get_connections(nm_client);
slaves = NULL; ports = NULL;
for (i = 0; i < all_conns->len; i++) { for (i = 0; i < all_conns->len; i++) {
slave = all_conns->pdata[i]; port = all_conns->pdata[i];
s_con = nm_connection_get_setting_connection(NM_CONNECTION(slave)); s_con = nm_connection_get_setting_connection(NM_CONNECTION(port));
master = nm_setting_connection_get_master(s_con); controller = nm_setting_connection_get_master(s_con);
if (master) { if (controller) {
if (!g_strcmp0(master, uuid) || !g_strcmp0(master, iface)) if (!g_strcmp0(controller, uuid) || !g_strcmp0(controller, iface))
slaves = g_slist_prepend(slaves, g_object_ref(slave)); ports = g_slist_prepend(ports, g_object_ref(port));
} }
} }
for (iter = slaves; iter; iter = iter->next) for (iter = ports; iter; iter = iter->next)
remove_one_connection(iter->data); remove_one_connection(iter->data);
g_slist_free_full(slaves, g_object_unref); g_slist_free_full(ports, g_object_unref);
g_object_unref(connection); g_object_unref(connection);
} }

View file

@ -15,7 +15,7 @@ NmtNewtForm *nmtui_edit(gboolean is_top, int argc, char **argv);
void nmt_add_connection(void); void nmt_add_connection(void);
void nmt_add_connection_full(const char *primary_text, void nmt_add_connection_full(const char *primary_text,
const char *secondary_text, const char *secondary_text,
NMConnection *master, NMConnection *controller,
NmtAddConnectionTypeFilter type_filter, NmtAddConnectionTypeFilter type_filter,
gpointer type_filter_data); gpointer type_filter_data);