#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include <libergtk/ergtk.h>
#include "connectionMgrLog.h"
#include "displayStatus.h"
#include "erbusy.h"
#include "background.h"
#include "gtkSettingItem.h"
#include "gtkInfoItem.h"
#include "gtkProfileGroup.h"
#include "connectScreenData.h"
#include "editScreen.h"
#include "widgetUtils.h"
#include "editScreenProfiles.h"
#include "editScreenWireless.h"
#include "editScreenSearch.h"
#include "connectScan.h"
#include "connectionMgr.h"
#include "languages.h"
Go to the source code of this file.
Functions | |
static GtkWidget * | create_known_profiles (void) |
static void | on_options_update (GtkWidget *selection, gpointer button, gpointer data) |
static void | on_profile_entry_selected (GtkProfileGroup *profileGroup, guint profileIndex) |
static int | edit_search_get_n_network_profiles (void) |
static const networkProfile_t * | edit_search_get_network_profile (int profileIndex) |
static void | edit_search_destroy_network_profiles (void) |
static void | edit_search_init_network_profiles (connection_t networkType, network_spec_t *pScanNetworks, int nScanNetworks) |
static void | edit_search_scan_networks_done (void) |
static void | edit_search_restore_scan_ctxt (void) |
GtkWidget * | edit_search_create (void) |
void | edit_search_set_text (void) |
static void | edit_search_update_profilelist_info (scanStatus_t status) |
static void | edit_search_display_profilelist (void) |
void | edit_search_restore_screen (void) |
static gboolean | on_delayed_search (gpointer data) |
static gboolean | on_delayed_manually (gpointer data) |
static gboolean | on_delayed_profile_entry_selected (gpointer data) |
gboolean | on_edit_search_keypress (GdkEventKey *event) |
Variables | |
static GtkWidget * | g_search = NULL |
static bkWdtLabelButton * | g_options = NULL |
static GtkWidget * | g_known_profiles = NULL |
static GtkWidget * | g_info = NULL |
static networkProfile_t * | g_network_profiles = NULL |
static int | g_n_network_profiles = 0 |
Copyright (C) 2007 iRex Technologies BV.
Definition in file editScreenSearch.c.
static GtkWidget * create_known_profiles | ( | void | ) | [static] |
Definition at line 139 of file editScreenSearch.c.
00140 { 00141 GtkWidget* item; 00142 00143 CN_LOGPRINTF("entry"); 00144 00145 // item 00146 item = gtk_profile_group_new(MAX_PROFILES_PER_PAGE, connectMode_e); 00147 gtk_profile_group_show_dialup(GTK_PROFILE_GROUP(item), FALSE); 00148 gtk_profile_group_callback_on_buttons_clicked(GTK_PROFILE_GROUP(item), 00149 on_profile_entry_selected, NULL); 00150 g_known_profiles = item; 00151 00152 return item; 00153 }
GtkWidget* edit_search_create | ( | void | ) |
Definition at line 83 of file editScreenSearch.c.
00084 { 00085 GtkWidget *item; 00086 GtkWidget *vbox; 00087 bkWdtLabelButton *options; 00088 GtkWidget *profilelist; 00089 GtkWidget *info; 00090 GtkWidget *widget; 00091 00092 CN_LOGPRINTF("entry"); 00093 00094 // item 00095 item = gtk_settingitem_new(""); 00096 00097 // vbox 00098 vbox = gtk_vbox_new(FALSE, VBOX_SPACING); 00099 gtk_settingitem_add_details(GTK_SETTINGITEM(item), vbox); 00100 00101 // options 00102 options = bk_wdt_label_button_new(2, FALSE, 0, 1); 00103 gtk_box_pack_start(GTK_BOX(vbox), options->background, FALSE, FALSE, 0); 00104 00105 // profilelist 00106 profilelist = create_known_profiles(); 00107 gtk_box_pack_start(GTK_BOX(vbox), profilelist, FALSE, FALSE, 0); 00108 00109 // info 00110 info = gtk_infoitem_new(FALSE); 00111 gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0); 00112 00113 // signal handlers 00114 widget = options->details->selection; 00115 g_signal_connect (G_OBJECT (widget), "selection-update", 00116 G_CALLBACK (on_options_update), NULL); 00117 00118 // show widgets 00119 gtk_widget_show(item); 00120 gtk_widget_show(vbox); 00121 gtk_widget_show(options->background); 00122 gtk_widget_show(profilelist); 00123 gtk_widget_show(info); 00124 00125 // global variables 00126 g_search = item; 00127 g_options = options; 00128 g_info = info; 00129 00130 CN_LOGPRINTF("done"); 00131 00132 // return 00133 return item; 00134 }
static void edit_search_destroy_network_profiles | ( | void | ) | [static] |
Definition at line 453 of file editScreenSearch.c.
00454 { 00455 CN_LOGPRINTF("entry"); 00456 00457 common_data_destroy_network_profiles(g_network_profiles, 00458 g_n_network_profiles); 00459 g_network_profiles = NULL; 00460 g_n_network_profiles = 0; 00461 }
static void edit_search_display_profilelist | ( | void | ) | [static] |
Definition at line 230 of file editScreenSearch.c.
00231 { 00232 int i, nProfiles, nDisplayed, max; 00233 GtkProfileGroup *profileGroup; 00234 const networkProfile_t *settings; 00235 00236 g_return_if_fail(g_known_profiles != NULL); 00237 00238 nProfiles = edit_search_get_n_network_profiles(); 00239 max = MAX_PROFILES_PER_PAGE; 00240 nDisplayed = ((nProfiles < max) ? nProfiles: max); 00241 00242 profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00243 00244 // display the profile list 00245 if (nDisplayed > 0) 00246 { 00247 for (i = 0; i < nDisplayed; i++) 00248 { 00249 settings = edit_search_get_network_profile(i); 00250 gtk_profile_group_display_settings(profileGroup, i, 00251 settings, TRUE); 00252 } 00253 } 00254 gtk_profile_group_show_profile_entries(profileGroup, nDisplayed); 00255 }
static int edit_search_get_n_network_profiles | ( | void | ) | [static] |
Definition at line 463 of file editScreenSearch.c.
00464 { 00465 CN_LOGPRINTF("entry [%d]", g_n_network_profiles); 00466 00467 return g_n_network_profiles; 00468 }
static const networkProfile_t * edit_search_get_network_profile | ( | int | profileIndex | ) | [static] |
Definition at line 470 of file editScreenSearch.c.
00471 { 00472 CN_LOGPRINTF("entry profileIndex[%d]", profileIndex); 00473 00474 networkProfile_t *ret = NULL; 00475 00476 g_return_val_if_fail(g_network_profiles != NULL, NULL); 00477 g_return_val_if_fail(profileIndex < g_n_network_profiles, NULL); 00478 00479 ret = &g_network_profiles[profileIndex]; 00480 00481 CN_LOGPRINTF("ret=%p", ret); 00482 00483 return ret; 00484 }
static void edit_search_init_network_profiles | ( | connection_t | networkType, | |
network_spec_t * | pScanNetworks, | |||
int | nScanNetworks | |||
) | [static] |
Definition at line 422 of file editScreenSearch.c.
00425 { 00426 int i; 00427 networkProfile_t *pNetwork; 00428 00429 CN_LOGPRINTF("entry"); 00430 00431 // empty the old results 00432 edit_search_destroy_network_profiles(); 00433 00434 // calculate the network profiles 00435 if (pScanNetworks && (nScanNetworks != 0)) 00436 { 00437 g_n_network_profiles = nScanNetworks; 00438 g_network_profiles = g_new0(networkProfile_t, nScanNetworks); 00439 g_return_if_fail(g_network_profiles != NULL); 00440 00441 for (i = 0; i < nScanNetworks; i++) 00442 { 00443 pNetwork = &g_network_profiles[i]; 00444 pNetwork->scanSettings = dup_network_spec(&pScanNetworks[i]); 00445 pNetwork->regSettingsList = NULL; 00446 pNetwork->regIndexList = NULL; 00447 pNetwork->nRegProfiles = 0; 00448 pNetwork->nActiveIndex = -1; 00449 } 00450 } 00451 }
static void edit_search_restore_scan_ctxt | ( | void | ) | [static] |
Definition at line 400 of file editScreenSearch.c.
00401 { 00402 scanContext_t *ctxt; 00403 char *ssidList; 00404 00405 CN_LOGPRINTF("entry"); 00406 00407 ctxt = cmgr_get_scan_ctxt(); 00408 if (ctxt) 00409 { 00410 connect_scan_ctxt_set_mode(ctxt, editScan_e); 00411 connect_scan_ctxt_set_network_type(ctxt, wireless_t); 00412 connect_scan_ctxt_set_done_callbacks(ctxt, 00413 edit_search_init_network_profiles, 00414 edit_search_scan_networks_done); 00415 00416 ssidList = connect_data_get_hidden_ssid_list(); 00417 connect_scan_ctxt_set_ssidlist(ctxt, ssidList); 00418 g_free(ssidList); 00419 } 00420 }
void edit_search_restore_screen | ( | void | ) |
Definition at line 257 of file editScreenSearch.c.
00258 { 00259 GtkToggleButton *button; 00260 00261 // Search and Manually buttons 00262 button = g_options->details->buttonList[0]; 00263 gtk_toggle_button_set_active(button, FALSE); 00264 00265 button = g_options->details->buttonList[0]; 00266 gtk_toggle_button_set_active(button, FALSE); 00267 00268 // the profilelist 00269 edit_search_destroy_network_profiles(); 00270 edit_search_display_profilelist(); 00271 edit_search_update_profilelist_info(undefScanStatus_e); 00272 }
static void edit_search_scan_networks_done | ( | void | ) | [static] |
Definition at line 486 of file editScreenSearch.c.
00487 { 00488 int nProfiles; 00489 GtkToggleButton *button; 00490 00491 CN_LOGPRINTF("entry"); 00492 00493 edit_search_display_profilelist(); 00494 00495 nProfiles = edit_search_get_n_network_profiles(); 00496 if (nProfiles > 0) 00497 { 00498 // update the information text 00499 edit_search_update_profilelist_info(scanOk_e); 00500 } 00501 else 00502 { 00503 edit_search_update_profilelist_info(rescanNeed_e); 00504 } 00505 00506 // de-active the 'Search' button when scan done 00507 if (g_options) 00508 { 00509 button = g_options->details->buttonList[0]; 00510 gtk_toggle_button_set_active(button, FALSE); 00511 } 00512 00513 display_update_request_screen_refresh(STATUS_ITEM_CHANGE, 00514 WAVEFORM_TYPING); 00515 }
void edit_search_set_text | ( | void | ) |
Definition at line 155 of file editScreenSearch.c.
00156 { 00157 GtkProfileGroup *profileGroup; 00158 GtkWidget *widget = NULL; 00159 00160 CN_LOGPRINTF("entry"); 00161 00162 if (g_search) 00163 { 00164 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_search), 00165 _("Create new wireless network")); 00166 } 00167 00168 if (g_options) 00169 { 00170 widget = g_options->details->label; 00171 gtk_label_set_text(GTK_LABEL(widget), 00172 _("Select a way to create the network.")); 00173 00174 widget = GTK_WIDGET(g_options->details->buttonList[0]); 00175 gtk_button_set_label(GTK_BUTTON(widget), _("Search")); 00176 00177 widget = GTK_WIDGET(g_options->details->buttonList[1]); 00178 gtk_button_set_label(GTK_BUTTON(widget), _("Manually")); 00179 } 00180 00181 if (g_known_profiles) 00182 { 00183 profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00184 gtk_profile_group_set_header_text(profileGroup, 00185 _("Network profiles")); 00186 } 00187 00188 if (g_info) 00189 { 00190 gtk_infoitem_set_text(GTK_INFOITEM(g_info), 00191 _("When you click on 'Search' the device will scan for networks.\n" 00192 "Clicking 'Manually' requires all the settings.")); 00193 } 00194 }
static void edit_search_update_profilelist_info | ( | scanStatus_t | status | ) | [static] |
Definition at line 196 of file editScreenSearch.c.
00197 { 00198 GtkProfileGroup *item; 00199 char *info; 00200 00201 CN_LOGPRINTF("entry"); 00202 00203 if (g_known_profiles) 00204 { 00205 item = GTK_PROFILE_GROUP(g_known_profiles); 00206 switch (status) 00207 { 00208 case scanRunning_e: 00209 info = _("Please wait while the iLiad scans " 00210 "for wireless networks ...."); 00211 break; 00212 case scanAborting_e: 00213 info = _("Aborting scan ..."); 00214 break; 00215 case rescanNeed_e: 00216 info = _("No wireless networks detected."); 00217 break; 00218 case scanOk_e: 00219 info = _("Please select the network you wish to create."); 00220 break; 00221 default: 00222 info = ""; 00223 break; 00224 } 00225 00226 gtk_profile_group_set_info_text(item, info); 00227 } 00228 }
static gboolean on_delayed_manually | ( | gpointer | data | ) | [static] |
Definition at line 287 of file editScreenSearch.c.
00288 { 00289 char *profilename; 00290 GtkToggleButton *button; 00291 00292 erbusy_blink(); 00293 00294 edit_wireless_set_ssid(""); 00295 edit_wireless_set_encrtype(encr_undefined_t); 00296 00297 profilename = edit_profiles_default_profilename(); 00298 edit_wireless_set_profilename(profilename); 00299 g_free(profilename); 00300 00301 // backup the wireless settings 00302 edit_wireless_backup_network_settings(); 00303 00304 delay_edit_wireless_determine_status(); 00305 00306 edit_goto_page(editScreenWireless_e); 00307 00308 // de-active the button 00309 button = g_options->details->buttonList[1]; 00310 gtk_toggle_button_set_active(button, FALSE); 00311 00312 return FALSE; 00313 }
static gboolean on_delayed_profile_entry_selected | ( | gpointer | data | ) | [static] |
Definition at line 344 of file editScreenSearch.c.
00345 { 00346 int profileIndex = (int)data; 00347 00348 const networkProfile_t *pNetwork = NULL; 00349 network_spec_t *pScan = NULL; 00350 00351 const gchar *ssid = ""; 00352 wireless_encr_type_t encrtype = encr_undefined_t; 00353 00354 GtkProfileGroup *profileGroup; 00355 00356 CN_LOGPRINTF("entry"); 00357 00358 erbusy_blink(); 00359 00360 if ((profileIndex >= 0) && (profileIndex < g_n_network_profiles)) 00361 { 00362 pNetwork = edit_search_get_network_profile(profileIndex); 00363 pScan = pNetwork->scanSettings; 00364 00365 // ssid 00366 ssid = pScan->ssid; 00367 edit_wireless_set_ssid(ssid); 00368 00369 encrtype = pScan->encryption; 00370 edit_wireless_set_encrtype(encrtype); 00371 00372 // profilename 00373 edit_wireless_set_profilename(ssid); 00374 00375 // backup the wireless settings 00376 edit_wireless_backup_network_settings(); 00377 00378 delay_edit_wireless_determine_status(); 00379 00380 edit_goto_page(editScreenWireless_e); 00381 00382 profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00383 gtk_profile_group_unselect_profile(profileGroup, profileIndex); 00384 } 00385 00386 return FALSE; 00387 }
static gboolean on_delayed_search | ( | gpointer | data | ) | [static] |
Definition at line 274 of file editScreenSearch.c.
00275 { 00276 scanContext_t *ctxt; 00277 00278 erbusy_blink(); 00279 00280 edit_search_restore_scan_ctxt(); 00281 ctxt = cmgr_get_scan_ctxt(); 00282 connect_scan(ctxt, FALSE); 00283 00284 return FALSE; 00285 }
gboolean on_edit_search_keypress | ( | GdkEventKey * | event | ) |
Definition at line 517 of file editScreenSearch.c.
00518 { 00519 GtkToggleButton *button; 00520 gboolean ret = FALSE; 00521 00522 CN_LOGPRINTF("entry"); 00523 00524 switch (event->keyval) 00525 { 00526 case GDK_Return: 00527 // 'Enter' key is pressed 00528 // simulate clicking the 'Manually' button 00529 if (g_options) 00530 { 00531 button = g_options->details->buttonList[1]; 00532 gtk_toggle_button_set_active(button, TRUE); 00533 } 00534 ret = TRUE; 00535 break; 00536 00537 case GDK_F5: 00538 // 'UP' key is pressed 00539 // goto the one top level page 00540 cmgr_up_page(); 00541 ret = TRUE; 00542 break; 00543 00544 case GDK_Down: 00545 case GDK_Up: 00546 case GDK_Page_Down: 00547 case GDK_Page_Up: 00548 default: 00549 erbusy_off(); 00550 break; 00551 } 00552 00553 return ret; 00554 }
static void on_options_update | ( | GtkWidget * | selection, | |
gpointer | button, | |||
gpointer | data | |||
) | [static] |
Definition at line 315 of file editScreenSearch.c.
00318 { 00319 erGtkSelectionGroup *item; 00320 int nsel; 00321 00322 CN_LOGPRINTF("entry"); 00323 00324 item = ERGTK_SELECTION_GROUP(selection); 00325 ergtk_selection_group_get_selected_buttons(item, &nsel, 1); 00326 switch (nsel) 00327 { 00328 case 0: // 'Search' button is selected 00329 // empty the old stuff before searching again 00330 edit_search_destroy_network_profiles(); 00331 edit_search_display_profilelist(); 00332 edit_search_update_profilelist_info(scanRunning_e); 00333 g_timeout_add(500, on_delayed_search, NULL); 00334 break; 00335 case 1: 00336 // 'Manually' button is selected 00337 g_timeout_add(500, on_delayed_manually, NULL); 00338 break; 00339 default: 00340 break; 00341 } 00342 }
static void on_profile_entry_selected | ( | GtkProfileGroup * | profileGroup, | |
guint | profileIndex | |||
) | [static] |
Definition at line 389 of file editScreenSearch.c.
00391 { 00392 CN_LOGPRINTF ("entry"); 00393 00394 // wait for a while to show button selected 00395 g_timeout_add(500, 00396 on_delayed_profile_entry_selected, 00397 (gpointer)profileIndex); 00398 }
GtkWidget* g_info = NULL [static] |
Definition at line 51 of file editScreenSearch.c.
GtkWidget* g_known_profiles = NULL [static] |
Definition at line 50 of file editScreenSearch.c.
int g_n_network_profiles = 0 [static] |
Definition at line 55 of file editScreenSearch.c.
networkProfile_t* g_network_profiles = NULL [static] |
Definition at line 54 of file editScreenSearch.c.
bkWdtLabelButton* g_options = NULL [static] |
Definition at line 49 of file editScreenSearch.c.
GtkWidget* g_search = NULL [static] |
Definition at line 48 of file editScreenSearch.c.