Add Advanced option section to ui and add some options

freq
psk
no_virt
mac
hidden
This commit is contained in:
lakinduakash 2019-04-16 11:06:46 +05:30
parent b19924c6c9
commit 7d59dec228
2 changed files with 254 additions and 4 deletions

View File

@ -149,7 +149,236 @@
</packing>
</child>
<child>
<placeholder/>
<object class="GtkExpander">
<property name="visible">True</property>
<property name="can_focus">True</property>
<child>
<object class="GtkGrid">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="row_spacing">5</property>
<property name="row_homogeneous">True</property>
<property name="column_homogeneous">True</property>
<child>
<object class="GtkCheckButton" id="cb_hidden">
<property name="label" translatable="yes">Hidden</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">1</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cb_psk">
<property name="label" translatable="yes">Use psk</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">2</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cb_mac">
<property name="label" translatable="yes">Set MAC</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_mac">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">3</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cb_novirt">
<property name="label" translatable="yes">No Virt</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Do not create virtual interface</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">4</property>
</packing>
</child>
<child>
<object class="GtkCheckButton" id="cb_channel">
<property name="label" translatable="yes">Channel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="entry_channel">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="halign">start</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">5</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_freq_2">
<property name="label" translatable="yes">2.4Ghz</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">rb_freq_auto</property>
</object>
<packing>
<property name="left_attach">2</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_freq_auto">
<property name="label" translatable="yes">Auto</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
<property name="group">rb_freq_5</property>
</object>
<packing>
<property name="left_attach">1</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Frequency band</property>
</object>
<packing>
<property name="left_attach">0</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="rb_freq_5">
<property name="label" translatable="yes">5Ghz</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">True</property>
<property name="group">rb_freq_auto</property>
</object>
<packing>
<property name="left_attach">3</property>
<property name="top_attach">0</property>
</packing>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
<child>
<placeholder/>
</child>
</object>
</child>
<child type="label">
<object class="GtkLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Advance</property>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkBox">

View File

@ -13,19 +13,31 @@
#include "read_config.h"
#include "util.h"
#define BUFSIZE 1024
#define BUFSIZE 512
#define AP_ENABLED "AP-ENABLED"
GtkBuilder *builder;
GObject *window;
GtkButton *button_create_hp;
GtkButton *button_stop_hp;
GtkEntry *entry_ssd;
GtkEntry *entry_pass;
GtkEntry *entry_mac;
GtkEntry *entry_channel;
GtkComboBox *combo_wifi;
GtkComboBox *combo_internet;
GtkRadioButton *rb_freq_auto;
GtkRadioButton *rb_freq_2;
GtkRadioButton *rb_freq_5;
GtkCheckButton *cb_hidden;
GtkCheckButton *cb_psk;
GtkCheckButton *cb_mac;
GtkCheckButton *cb_novirt;
GtkProgressBar *progress_bar;
GtkLabel *label_status;
@ -46,6 +58,7 @@ void *stopHp();
void *stopHp() {
if(running_info[0]!=NULL){
gtk_label_set_label(label_status,"Stopping ...");
start_pb_pulse();
lock_all_views(TRUE);
startShell(build_kill_create_ap_command(running_info[0]));
@ -113,17 +126,23 @@ int initUi(int argc, char *argv[]){
entry_ssd = (GtkEntry *) gtk_builder_get_object(builder, "entry_ssid");
entry_pass = (GtkEntry *) gtk_builder_get_object(builder, "entry_pass");
entry_mac = (GtkEntry *) gtk_builder_get_object(builder, "entry_mac");
entry_channel = (GtkEntry *) gtk_builder_get_object(builder, "entry_channel");
combo_wifi = (GtkComboBox *) gtk_builder_get_object(builder, "combo_wifi");
combo_internet = (GtkComboBox *) gtk_builder_get_object(builder, "combo_internet");
cb_hidden = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_hidden");
cb_psk = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_psk");
cb_mac = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_mac");
cb_novirt = (GtkCheckButton *) gtk_builder_get_object(builder, "cb_novirt");
label_status = (GtkLabel *) gtk_builder_get_object(builder, "label_status");
progress_bar = (GtkProgressBar *) gtk_builder_get_object(builder, "progress_bar");
//gtk_entry_set_visibility(entry_pass,FALSE);
WIData wiData = {
.pass= entry_pass,
@ -268,6 +287,8 @@ void* init_running_info(){
clear_running_info();
lock_all_views(TRUE);
gtk_label_set_label(label_status,"Getting running info...");
get_running_info(running_info);
if(running_info[0]!=NULL){