Populate a combo box with known network interfaces
Read Use /proc/net/dev
getifaddrs()
on Linux/OpenBSD/NetBSD/FreeBSD to enumerate the list of available network interfaces, and use a GtkComboBoxText
to list them in the options dialog. If /proc
getifaddrs()
is not available (strict permissions, running on something other than Linux), an interface name can still be manually typed in.
Warts:
- Hitting enter (or selecting an interface from the list) doesn't automatically update the plugin's UI anymore (until you close the settings dialog). Unfortunately the combo box's
changed
signal gets fired for each character typed into the entry field, and there's no way to get a pointer to the underlyingGtkEntry
in order to listen foractivate
or handle key presses. - On
non-Linux systems, or systems wheresystems without/proc/net/dev
is locked down (if that's a thing)getifaddrs()
, we still display a combo box, even though it will be empty. It's of course still possible to manually type in an interface name, as before.
Edited by Brian Tarricone