#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
#include "connectPing.h"
Go to the source code of this file.
Functions | |
GtkWidget * | connect_profiles_create (void) |
void | connect_profiles_set_text (void) |
void | connect_profiles_display (void) |
gboolean | on_connect_profiles_keypress (GdkEventKey *event) |
void | on_connect_profiles_icon_clicked (int iconID, int iconState) |
void | connect_profiles_restore_ping_ctxt (void) |
Copyright (C) 2007 iRex Technologies BV.
Definition in file connectScreenProfiles.h.
GtkWidget* connect_profiles_create | ( | void | ) |
Definition at line 107 of file connectScreenProfiles.c.
00108 { 00109 CN_LOGPRINTF ("entry"); 00110 00111 GtkWidget* vbox; 00112 GtkWidget* itemNetworks; 00113 GtkWidget* itemNewProfile; 00114 GtkWidget* itemInfo; 00115 00116 // vbox 00117 vbox = gtk_vbox_new(FALSE, VBOX_SPACING); 00118 gtk_widget_show(vbox); 00119 g_connect_profiles = vbox; 00120 00121 // itemNetworks 00122 itemNetworks = create_known_profiles(); 00123 gtk_box_pack_start(GTK_BOX(vbox), itemNetworks, FALSE, FALSE, 0); 00124 gtk_widget_show(itemNetworks); 00125 00126 // itemNewProfile 00127 itemNewProfile = create_profile_editor(); 00128 gtk_box_pack_start(GTK_BOX(vbox), itemNewProfile, FALSE, FALSE, 0); 00129 gtk_widget_show(itemNewProfile); 00130 00131 // itemInfo 00132 itemInfo = create_info(); 00133 gtk_box_pack_start(GTK_BOX(vbox), itemInfo, FALSE, FALSE, 0); 00134 gtk_widget_show(itemInfo); 00135 00136 return g_connect_profiles; 00137 }
void connect_profiles_display | ( | void | ) |
Definition at line 311 of file connectScreenProfiles.c.
00312 { 00313 CN_LOGPRINTF ("entry"); 00314 00315 GtkProfileGroup *profileGroup; 00316 const networkProfile_t *settings; 00317 int i, profileIndex; 00318 int nProfiles, nDisplayed; 00319 int quality; 00320 GtkToggleButton *button; 00321 00322 connect_profiles_update_info(); 00323 00324 // show the accurate profile entries 00325 profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00326 00327 // show dialup signal widgets or not 00328 switch (connect_data_get_network_type()) 00329 { 00330 case wired_t: 00331 case wireless_t: 00332 gtk_profile_group_show_dialup(profileGroup, FALSE); 00333 break; 00334 case dialup_t: 00335 quality = get_modem_signal_strength() * 100 / 32; 00336 gtk_profile_group_set_dialup_signal_image(profileGroup, quality); 00337 gtk_profile_group_show_dialup(profileGroup, TRUE); 00338 break; 00339 default: 00340 break; 00341 } 00342 00343 // display the profile list 00344 nProfiles = connect_data_get_n_network_profiles(); 00345 nDisplayed = ((nProfiles < MAX_PROFILES_PER_PAGE) ? nProfiles: MAX_PROFILES_PER_PAGE); 00346 00347 if (nDisplayed > 0) 00348 { 00349 for (i = 0; i < nDisplayed; i++) 00350 { 00351 settings = connect_data_get_network_profile(i); 00352 gtk_profile_group_display_settings(profileGroup, i, 00353 settings, TRUE); 00354 } 00355 } 00356 gtk_profile_group_show_profile_entries(profileGroup, nDisplayed); 00357 00358 // deselect all profile index 00359 profileIndex = gtk_profile_group_get_selected_profile_index(profileGroup); 00360 if (profileIndex != -1) 00361 { 00362 gtk_profile_group_unselect_profile(profileGroup, profileIndex); 00363 } 00364 00365 // deselect the 'profile editor' button 00366 if (g_label_button) 00367 { 00368 button = g_label_button->details->buttonList[0]; 00369 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE); 00370 } 00371 }
void connect_profiles_restore_ping_ctxt | ( | void | ) |
Definition at line 912 of file connectScreenProfiles.c.
00913 { 00914 pingContext_t *ctxt; 00915 cmgrConnectType_t connectType; 00916 00917 CN_LOGPRINTF("entry"); 00918 00919 ctxt = cmgr_get_ping_ctxt(); 00920 if (ctxt) 00921 { 00922 connect_ping_ctxt_set_mode(ctxt, connectPing_e); 00923 00924 connectType = connect_data_get_connect_type(); 00925 connect_ping_ctxt_set_connect_type(ctxt, connectType); 00926 00927 connect_ping_ctxt_set_done_callbacks(ctxt, 00928 connect_background_on_connected, 00929 connect_profiles_on_failed_all); 00930 00931 connect_ping_ctxt_set_get_initial_profile(ctxt, 00932 connect_background_get_initial_profile); 00933 00934 connect_ping_ctxt_set_access_network_profiles_callbacks(ctxt, 00935 connect_data_get_n_network_profiles, 00936 connect_data_get_network_profile, 00937 connect_data_select_next_regprofile); 00938 00939 connect_ping_ctxt_set_ui_callbacks(ctxt, 00940 connect_profiles_update_status, 00941 connect_profiles_display_settings, 00942 connect_profiles_select_profile, 00943 connect_profiles_unselect_profile); 00944 } 00945 }
void connect_profiles_set_text | ( | void | ) |
Definition at line 203 of file connectScreenProfiles.c.
00204 { 00205 GtkProfileGroup *profileGroup; 00206 GtkWidget *widget; 00207 00208 CN_LOGPRINTF ("entry"); 00209 00210 if (g_known_profiles) 00211 { 00212 profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00213 gtk_profile_group_set_dialup_text(profileGroup, 00214 _("Signal strength of network:")); 00215 } 00216 00217 if (g_profile_editor) 00218 { 00219 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_profile_editor), 00220 _("Setup a network profile")); 00221 } 00222 00223 if (g_label_button) 00224 { 00225 widget = g_label_button->details->label; 00226 gtk_label_set_text (GTK_LABEL(widget), 00227 _("You can create or edit a network profile " 00228 "by clicking the button below.")); 00229 00230 widget = GTK_WIDGET(g_label_button->details->buttonList[0]); 00231 gtk_button_set_label (GTK_BUTTON(widget), _("Profile editor")); 00232 } 00233 }
void on_connect_profiles_icon_clicked | ( | int | iconID, | |
int | iconState | |||
) |
Definition at line 879 of file connectScreenProfiles.c.
00880 { 00881 pingContext_t *ctxt; 00882 00883 CN_LOGPRINTF("entry iconID[%d] iconState[%d]", iconID, iconState); 00884 00885 switch (iconID) 00886 { 00887 case iconID_back: 00888 if (iconState == iconState_normal) 00889 { 00890 ctxt = cmgr_get_ping_ctxt(); 00891 if (connect_ping_freeze_ui(ctxt)) 00892 { 00893 CN_WARNPRINTF("Please wait when freezing UI..."); 00894 return; 00895 } 00896 00897 // aborting pinging firstly 00898 connect_ping_abort(ctxt); 00899 00900 // wait for ping aborting doen, then back one page 00901 g_timeout_add(200, on_delay_back_page, NULL); 00902 } 00903 break; 00904 default: 00905 break; 00906 } 00907 }
gboolean on_connect_profiles_keypress | ( | GdkEventKey * | event | ) |
Definition at line 822 of file connectScreenProfiles.c.
00823 { 00824 pingContext_t *ctxt; 00825 gboolean ret = FALSE; 00826 00827 CN_LOGPRINTF ("entry"); 00828 00829 switch (event->keyval) 00830 { 00831 case GDK_Return: 00832 // 'Enter' key is pressed 00833 ret = TRUE; 00834 break; 00835 00836 case GDK_F5: 00837 // 'UP' key is pressed 00838 // goto the one top level page 00839 ctxt = cmgr_get_ping_ctxt(); 00840 connect_ping_abort(ctxt); 00841 cmgr_up_page(); 00842 ret = TRUE; 00843 break; 00844 00845 case GDK_Down: 00846 case GDK_Up: 00847 case GDK_Page_Down: 00848 case GDK_Page_Up: 00849 default: 00850 erbusy_off(); 00851 } 00852 00853 return ret; 00854 }