Created
December 25, 2014 08:57
-
-
Save xuhdev/cc840c8dd6229cfe0d25 to your computer and use it in GitHub Desktop.
Enable and disable wireless via libnm-glib
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* Compile with | |
| * gcc nm-test.c `pkg-config --cflags libnm-glib` `pkg-config --libs libnm-glib` `pkg-config --cflags glib-2.0` */ | |
| #include <string.h> | |
| #include <nm-client.h> | |
| #include <glib.h> | |
| int main(int argc, const char * argv[]) | |
| { | |
| NMClient * nm = nm_client_new(); | |
| if (argc >= 2 && !strcmp(argv[1], "disable")) | |
| { | |
| nm_client_wireless_set_enabled(nm, FALSE); | |
| puts("Wireless disabled."); | |
| } | |
| else | |
| { | |
| nm_client_wireless_set_enabled(nm, TRUE); | |
| puts("Wireless enabled."); | |
| } | |
| g_object_unref(nm); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment