connectionMgr/src/editScreenDialup.c File Reference

connectionMgr - "Dialup" screen More...

#include "config.h"
#include <string.h>
#include <gtk/gtk.h>
#include <libergtk/ergtk.h>
#include "connectionMgrLog.h"
#include "displayStatus.h"
#include "background.h"
#include "connectionMgr.h"
#include "gtkSettingItem.h"
#include "gtkInfoItem.h"
#include "widgetUtils.h"
#include "editScreen.h"
#include "editScreenDialup.h"
#include "editScreenOverview.h"
#include "connectScreenData.h"
#include "connectPing.h"
#include "erbusy.h"
#include "languages.h"

Go to the source code of this file.

Enumerations

enum  dialupStatus_t {
  inputPhone_e = 0, inputUser_e, inputPassword_e, dialupInputProfileName_e,
  dialupConnecting_e, dialupSucceeded_e, dialupFailed_e, dialupAborting_e,
  dialupAborted_e, undefStatus_e
}

Functions

static GtkWidget * create_settings (void)
static void edit_dialup_update_info_text (dialupStatus_t status)
static void edit_dialup_set_phone (const char *phone)
static void edit_dialup_set_user (const char *user)
static void edit_dialup_set_password (const char *password)
static const char * edit_dialup_get_password (void)
static const char * edit_dialup_get_user (void)
static const char * edit_dialup_get_phone (void)
static void edit_dialup_backup_network_settings (void)
static void on_changed (GtkEntry *widget, gpointer data)
static void on_next (GtkToggleButton *button, gpointer data)
static void on_buttons_update (GtkWidget *selection, gpointer button, gpointer data)
static gboolean delayed_deactive_button (gpointer data)
static void on_test (void)
static void on_save (void)
static void on_saveconnect (void)
static void edit_dialup_restore_ping_ctxt (void)
static void on_connected (int profileIndex)
static void on_failed (void)
static void ui_update_status (int profileIndex, pingStatus_t status)
static void ui_display_settings (int profileIndex, gboolean resetStatus)
static void ui_select_profile (int profileIndex)
static void ui_unselect_all_profile (void)
static void edit_dialup_freeze_ui (gboolean freeze)
GtkWidget * edit_dialup_create (void)
void edit_dialup_enable_save_button (gboolean enable)
void edit_dialup_set_text (void)
static dialupStatus_t edit_dialup_detect_status (void)
static void edit_dialup_determine_status (void)
void edit_dialup_set_network_settings (const regNetworkProfile_t *settings)
void edit_dialup_set_profilename (const char *profilename)
void edit_dialup_get_network_settings (regNetworkProfile_t *settings)
const char * edit_dialup_get_profilename (void)
gboolean edit_dialup_check_network_settings (void)
void edit_dialup_restore_network_settings (void)
static gboolean on_delayed_next (gpointer data)
static gboolean on_delayed_test (gpointer data)
static gboolean on_delayed_save (gpointer data)
gboolean on_edit_dialup_keypress (GdkEventKey *event)

Variables

GtkWidget * g_dialup = NULL
wdtLabelEntryg_phone = NULL
wdtLabelEntryg_user = NULL
wdtLabelEntryg_password = NULL
bkWdtLabelEntryg_profilename = NULL
bkWdtLabelButtong_buttons = NULL
GtkWidget * g_info = NULL
static regDialupSetting_tg_old_settings = NULL
static char * g_old_profilename = NULL


Detailed Description

connectionMgr - "Dialup" screen

Copyright (C) 2007 iRex Technologies BV.

Definition in file editScreenDialup.c.


Enumeration Type Documentation

Enumerator:
inputPhone_e 
inputUser_e 
inputPassword_e 
dialupInputProfileName_e 
dialupConnecting_e 
dialupSucceeded_e 
dialupFailed_e 
dialupAborting_e 
dialupAborted_e 
undefStatus_e 

Definition at line 45 of file editScreenDialup.c.


Function Documentation

static GtkWidget * create_settings ( void   )  [static]

Definition at line 196 of file editScreenDialup.c.

00197 {
00198     GtkWidget *background = NULL;
00199     GtkWidget *alignment = NULL;
00200     GtkWidget *vbox = NULL;
00201     wdtLabelEntry *phone = NULL;
00202     wdtLabelEntry *user = NULL;
00203     wdtLabelEntry *password = NULL;
00204     GtkWidget *widget = NULL;
00205 
00206     CN_LOGPRINTF("entry");
00207 
00208     // background
00209     background = gtk_event_box_new();
00210     gtk_widget_set_name(background, "bk_grey_666_245");
00211     gtk_widget_set_size_request(background, 
00212             BK_666_245_WIDTH, BK_666_245_HEIGHT);
00213 
00214     // alignment
00215     alignment = gtk_alignment_new(0.0, 0.0, 0.0, 0.0);
00216     gtk_alignment_set_padding(GTK_ALIGNMENT(alignment),
00217             PADDING_TOP, PADDING_BOTTOM, PADDING_LEFT,PADDING_RIGHT);
00218     gtk_container_add(GTK_CONTAINER(background), alignment);
00219 
00220     // vbox
00221     vbox = gtk_vbox_new(FALSE, VBOX_SPACING);
00222     gtk_container_add(GTK_CONTAINER(alignment), vbox);
00223     
00224     // phone
00225     phone = wdt_label_entry_new(string_e);
00226     gtk_box_pack_start(GTK_BOX(vbox), phone->parent, FALSE, FALSE, 0); 
00227     
00228     // user
00229     user = wdt_label_entry_new(string_e);
00230     gtk_box_pack_start(GTK_BOX(vbox), user->parent, FALSE, FALSE, 0);
00231     
00232     // password
00233     password = wdt_label_entry_new(string_e);
00234     gtk_box_pack_start(GTK_BOX(vbox), password->parent, FALSE, FALSE, 0);
00235 
00236     // signal handlers
00237     widget = phone->entry;
00238     g_signal_connect_after(G_OBJECT(widget), "changed-stable", 
00239                            G_CALLBACK(on_changed), (gpointer)inputPhone_e);
00240     widget = user->entry;
00241     g_signal_connect_after(G_OBJECT(widget), "changed-stable", 
00242                            G_CALLBACK(on_changed), (gpointer)inputUser_e);
00243     widget = password->entry;
00244     g_signal_connect_after(G_OBJECT(widget), "changed-stable", 
00245                        G_CALLBACK(on_changed), (gpointer)inputPassword_e);
00246         
00247     // show widgets
00248     gtk_widget_show(alignment);
00249     gtk_widget_show(vbox);
00250     gtk_widget_show(phone->parent);
00251     gtk_widget_hide(phone->button);
00252     gtk_widget_show(user->parent);
00253     gtk_widget_hide(user->button);
00254     gtk_widget_show(password->parent);
00255     gtk_widget_hide(password->button);
00256 
00257     // global variables
00258     g_phone = phone;
00259     g_user = user;
00260     g_password = password;
00261 
00262     // return
00263     return background;
00264 }

Here is the call graph for this function:

static gboolean delayed_deactive_button ( gpointer  data  )  [static]

Definition at line 780 of file editScreenDialup.c.

00781 {
00782     GtkToggleButton *button = GTK_TOGGLE_BUTTON(data);
00783     
00784     if (button)
00785     {
00786         gtk_toggle_button_set_active(button, FALSE);
00787     }
00788 
00789     return FALSE;
00790 }

static void edit_dialup_backup_network_settings ( void   )  [static]

Definition at line 494 of file editScreenDialup.c.

00495 {
00496     const char *phone, *user, *password, *profilename;
00497 
00498     CN_LOGPRINTF("entry");
00499 
00500     phone = edit_dialup_get_phone();
00501     user = edit_dialup_get_user();
00502     password = edit_dialup_get_password();
00503     profilename = edit_dialup_get_profilename();
00504 
00505     if (g_old_settings)
00506     {
00507         g_free(g_old_settings->phone);
00508         g_free(g_old_settings->user);
00509         g_free(g_old_settings->password);
00510         g_free(g_old_settings);
00511     }
00512 
00513     g_old_settings = g_new0(regDialupSetting_t, 1);
00514     g_assert(g_old_settings != NULL);
00515     g_old_settings->phone = g_strdup(phone);
00516     g_old_settings->user = g_strdup(user);
00517     g_old_settings->password = g_strdup(password);
00518     
00519     g_free(g_old_profilename);
00520     g_old_profilename = g_strdup(profilename);
00521 }

Here is the call graph for this function:

gboolean edit_dialup_check_network_settings ( void   ) 

Definition at line 681 of file editScreenDialup.c.

00682 {
00683     dialupStatus_t status;
00684     gboolean valid = TRUE;
00685 
00686     CN_LOGPRINTF("entry");
00687 
00688     status = edit_dialup_detect_status();
00689     if ((status != inputUser_e)
00690         && (status != inputPassword_e)
00691         && (status != undefStatus_e))
00692     {
00693         valid = FALSE;
00694     }
00695 
00696     CN_LOGPRINTF("return valid=%d", valid);
00697     return valid;
00698 }

Here is the call graph for this function:

GtkWidget* edit_dialup_create ( void   ) 

Definition at line 120 of file editScreenDialup.c.

00121 {
00122     GtkWidget *item = NULL;
00123     GtkWidget *vbox = NULL;
00124     GtkWidget *settings = NULL;
00125     bkWdtLabelEntry *profilename = NULL;
00126     bkWdtLabelButton *buttons = NULL;
00127     GtkWidget *info = NULL;
00128     GtkWidget *widget = NULL;
00129 
00130     CN_LOGPRINTF("entry");
00131 
00132     // item
00133     item = gtk_settingitem_new("");
00134  
00135     // vbox
00136     vbox = gtk_vbox_new(FALSE, VBOX_SPACING);
00137     gtk_settingitem_add_details(GTK_SETTINGITEM(item), vbox);
00138 
00139     // settings
00140     settings = create_settings();
00141     gtk_box_pack_start(GTK_BOX(vbox), settings, FALSE, FALSE, 0);
00142 
00143     // profilename
00144     profilename = bk_wdt_label_entry_new(string_e);
00145     gtk_box_pack_start(GTK_BOX(vbox), profilename->background, 
00146                        FALSE, FALSE, 0);
00147    
00148     // buttons
00149     buttons = bk_wdt_label_button_new(3, FALSE, 0, 1);
00150     gtk_box_pack_start(GTK_BOX(vbox), buttons->background, FALSE, FALSE, 0);
00151 
00152     // info
00153     info = gtk_infoitem_new(FALSE);
00154     gtk_box_pack_start(GTK_BOX(vbox), info, FALSE, FALSE, 0);
00155 
00156     // signal handlers
00157     widget = profilename->details->entry;
00158     g_signal_connect_after(G_OBJECT(widget), "changed-stable", 
00159                G_CALLBACK(on_changed), (gpointer)dialupInputProfileName_e);
00160     widget = profilename->details->button;
00161     g_signal_connect_after(G_OBJECT(widget), "toggled", 
00162                            G_CALLBACK(on_next), NULL);
00163    
00164     widget = buttons->details->selection;
00165     g_signal_connect(G_OBJECT(widget), "selection-update",
00166                      G_CALLBACK(on_buttons_update), NULL);
00167 
00168     // show widgets
00169     gtk_widget_show(vbox);
00170     gtk_widget_show(settings);
00171     gtk_widget_show(profilename->background);
00172     gtk_widget_show(buttons->background);
00173     gtk_widget_show(info);
00174     gtk_widget_show(item);
00175 
00176     // set global variables
00177     g_dialup = item;
00178     g_profilename = profilename;
00179     g_buttons = buttons;
00180     g_info = info;
00181 
00182     CN_LOGPRINTF("done");
00183 
00184     // return
00185     return item;
00186 }

Here is the call graph for this function:

static dialupStatus_t edit_dialup_detect_status ( void   )  [static]

Definition at line 393 of file editScreenDialup.c.

00394 {
00395     erGtkEntry *phone, *user, *password, *profilename;
00396     dialupStatus_t status = undefStatus_e;
00397 
00398     CN_LOGPRINTF("entry");
00399 
00400     phone = ERGTK_ENTRY(g_phone->entry);
00401     user = ERGTK_ENTRY(g_user->entry);
00402     password = ERGTK_ENTRY(g_password->entry);
00403     profilename = ERGTK_ENTRY(g_profilename->details->entry);
00404 
00405     if (!ergtk_entry_check_field(phone))
00406     {
00407         status = inputPhone_e;
00408     }
00409     else if (!ergtk_entry_check_field(user))
00410     {
00411         status = inputUser_e;
00412     }
00413     else if (!ergtk_entry_check_field(password))
00414     {
00415         status = inputPassword_e;
00416     }
00417     else if (!ergtk_entry_check_field(profilename))
00418     {
00419         status = inputProfileName_e;
00420     }
00421 
00422     CN_LOGPRINTF("return %d", status);
00423     return status;
00424 }

Here is the call graph for this function:

static void edit_dialup_determine_status ( void   )  [static]

Definition at line 426 of file editScreenDialup.c.

00427 {
00428     dialupStatus_t status;
00429     GtkWidget *widget = NULL;
00430 
00431     status = edit_dialup_detect_status();
00432     switch (status)
00433     {
00434         case inputPhone_e:
00435             widget = g_phone->entry;
00436             break;
00437         case inputUser_e:
00438             widget = g_user->entry;
00439             break;
00440         case inputPassword_e:
00441             widget = g_password->entry;
00442             break;
00443         case inputProfileName_e:
00444         case undefStatus_e:
00445             widget = g_profilename->details->entry;
00446             break;
00447         default:
00448             break;
00449     }
00450     
00451     if (widget)
00452     {
00453         gtk_widget_grab_focus(widget);
00454     }
00455 
00456     edit_dialup_update_info_text(status);
00457 }

Here is the call graph for this function:

void edit_dialup_enable_save_button ( gboolean  enable  ) 

Definition at line 266 of file editScreenDialup.c.

00267 {
00268     GtkWidget *widget;
00269 
00270     CN_LOGPRINTF("entry %d", enable);
00271     
00272     if (g_buttons)
00273     {
00274         widget = GTK_WIDGET(g_buttons->details->buttonList[1]);
00275         gtk_widget_set_sensitive(widget, enable);
00276     }
00277 }

static void edit_dialup_freeze_ui ( gboolean  freeze  )  [static]

Definition at line 1096 of file editScreenDialup.c.

01097 {
01098     editMode_t mode;
01099     gboolean sensitive;
01100     GtkWidget *widget;
01101 
01102     CN_LOGPRINTF("entry[%d]", freeze);
01103 
01104     sensitive = !freeze;
01105 
01106     // the phone
01107     widget = g_phone->entry;
01108     gtk_widget_set_sensitive(widget, sensitive);
01109     // the user
01110     widget = g_user->entry;
01111     gtk_widget_set_sensitive(widget, sensitive);
01112     // the password
01113     widget = g_password->entry;
01114     gtk_widget_set_sensitive(widget, sensitive);
01115 
01116     // the profilename
01117     widget = g_profilename->details->entry;
01118     gtk_widget_set_sensitive(widget, sensitive);
01119 
01120     widget = g_profilename->details->button;
01121     gtk_widget_set_sensitive(widget, sensitive);
01122     
01123     // the buttons
01124     widget = GTK_WIDGET(g_buttons->details->buttonList[0]);
01125     gtk_widget_set_sensitive(widget, sensitive);
01126     
01127     widget = GTK_WIDGET(g_buttons->details->buttonList[1]);
01128     gtk_widget_set_sensitive(widget, sensitive);
01129 
01130     widget = GTK_WIDGET(g_buttons->details->buttonList[2]);
01131     gtk_widget_set_sensitive(widget, sensitive);
01132  
01133     if (sensitive)
01134     {
01135         // restore the previous in-sensitive widgets
01136         // save button
01137         mode = edit_get_mode();
01138         if ((mode == editModeConnectFillIn_e)
01139             || (mode == editModeConnectCreate_e)
01140             || (mode == editModeConnectNormal_e))
01141         {
01142             edit_dialup_enable_save_button(FALSE);
01143         }
01144     }
01145 }

Here is the call graph for this function:

void edit_dialup_get_network_settings ( regNetworkProfile_t settings  ) 

Definition at line 576 of file editScreenDialup.c.

00577 {
00578     regDialupSetting_t *dialupSettings;
00579     const gchar *phone, *user, *password, *profilename;
00580 
00581     CN_LOGPRINTF("entry [%p]", settings);
00582 
00583     g_return_if_fail(settings != NULL);
00584     g_return_if_fail(settings->connection == dialup_t);
00585 
00586     // free the old settings
00587     dialupSettings = settings->dialupSettings;
00588     if (dialupSettings)
00589     {
00590         g_free(dialupSettings->phone);
00591         g_free(dialupSettings->user);
00592         g_free(dialupSettings->password);
00593         g_free(dialupSettings);
00594         dialupSettings = NULL;
00595         settings->dialupSettings = NULL;
00596     }
00597    
00598     // store the new settings
00599     if (settings->connection == dialup_t)
00600     {
00601         profilename = edit_dialup_get_profilename();
00602         g_free(settings->name);
00603         settings->name = g_strdup(profilename);
00604 
00605         dialupSettings = g_new0(regDialupSetting_t, 1);
00606         if (dialupSettings)
00607         {
00608             phone = edit_dialup_get_phone();
00609             user = edit_dialup_get_user();
00610             password = edit_dialup_get_password();
00611 
00612             dialupSettings->phone = g_strdup(phone);
00613             dialupSettings->user = g_strdup(user);
00614             dialupSettings->password = g_strdup(password);
00615            
00616             settings->dialupSettings = dialupSettings;
00617         }
00618     }
00619 }

Here is the call graph for this function:

static const char * edit_dialup_get_password ( void   )  [static]

Definition at line 651 of file editScreenDialup.c.

00652 {
00653     GtkWidget *widget;
00654     const char *password = NULL;
00655 
00656     if (g_password)
00657     {
00658         widget = g_password->entry;
00659         password = gtk_entry_get_text(GTK_ENTRY(widget));
00660     }
00661 
00662     CN_LOGPRINTF("return password[%s]", password);
00663     return password;
00664 }

static const char * edit_dialup_get_phone ( void   )  [static]

Definition at line 621 of file editScreenDialup.c.

00622 {
00623     GtkWidget *widget;
00624     const char *phone = NULL;
00625 
00626     if (g_phone)
00627     {
00628         widget = g_phone->entry;
00629         phone = gtk_entry_get_text(GTK_ENTRY(widget));
00630     }
00631 
00632     CN_LOGPRINTF("return phone=%s", phone);
00633     return phone;
00634 }

const char* edit_dialup_get_profilename ( void   ) 

Definition at line 666 of file editScreenDialup.c.

00667 {
00668     GtkWidget *widget;
00669     const char *profilename = NULL;
00670 
00671     if (g_profilename)
00672     {
00673         widget = g_profilename->details->entry;
00674         profilename = gtk_entry_get_text(GTK_ENTRY(widget));
00675     }
00676 
00677     CN_LOGPRINTF("return profilename=%s", profilename);
00678     return profilename;
00679 }

static const char * edit_dialup_get_user ( void   )  [static]

Definition at line 636 of file editScreenDialup.c.

00637 {
00638     GtkWidget *widget;
00639     const char *user = NULL;
00640 
00641     if (g_user)
00642     {
00643         widget = g_user->entry;
00644         user = gtk_entry_get_text(GTK_ENTRY(widget));
00645     }
00646 
00647     CN_LOGPRINTF("return user=%s", user);
00648     return user;
00649 }

void edit_dialup_restore_network_settings ( void   ) 

Definition at line 700 of file editScreenDialup.c.

00701 {
00702     char *phone = NULL;
00703     char *user = NULL;
00704     char *password = NULL;
00705     char *profilename = NULL; 
00706     
00707     CN_LOGPRINTF("entry");
00708      
00709     if (g_old_settings)
00710     {
00711        phone = g_old_settings->phone;
00712        user = g_old_settings->user;
00713        password = g_old_settings->password;
00714     }
00715     if (g_old_profilename)
00716     {
00717         profilename = g_old_profilename;
00718     }
00719     
00720     edit_dialup_set_phone(phone);
00721     edit_dialup_set_user(user);
00722     edit_dialup_set_password(password);
00723     edit_dialup_set_profilename(profilename);
00724 
00725 }

Here is the call graph for this function:

static void edit_dialup_restore_ping_ctxt ( void   )  [static]

Definition at line 922 of file editScreenDialup.c.

00923 {
00924     pingContext_t *ctxt;
00925     cmgrConnectType_t connectType;
00926 
00927     CN_LOGPRINTF("entry");
00928     
00929     ctxt = cmgr_get_ping_ctxt();
00930     if (ctxt)
00931     {
00932         // set mode and connect type
00933         connect_ping_ctxt_set_mode(ctxt, editPing_e);
00934         connectType = connect_data_get_connect_type();
00935         connect_ping_ctxt_set_connect_type(ctxt, connectType);
00936         
00937         // ping done callbacks
00938         connect_ping_ctxt_set_done_callbacks(ctxt, on_connected, on_failed);
00939        
00940         // data access callbacks
00941         connect_ping_ctxt_set_get_initial_profile(ctxt, 
00942                         edit_get_initial_profile);
00943         connect_ping_ctxt_set_access_network_profiles_callbacks(ctxt,
00944                                         edit_get_n_network_profiles,
00945                                         edit_get_network_profile,
00946                                         edit_select_next_regprofile);
00947 
00948         // ui callbacks
00949         connect_ping_ctxt_set_ui_callbacks(ctxt, 
00950                                     ui_update_status, 
00951                                     ui_display_settings,
00952                                     ui_select_profile,
00953                                     ui_unselect_all_profile);
00954     }
00955 }

Here is the call graph for this function:

void edit_dialup_set_network_settings ( const regNetworkProfile_t settings  ) 

Definition at line 459 of file editScreenDialup.c.

00460 {
00461     regDialupSetting_t *dialupSettings = NULL;
00462     char *phone = "";
00463     char *user = "";
00464     char *password = "";
00465     char *profilename = "";
00466 
00467     CN_LOGPRINTF("entry [%p]", settings);
00468 
00469     g_return_if_fail(settings != NULL);
00470     g_return_if_fail(settings->connection == dialup_t);
00471 
00472     // get the values
00473     profilename = settings->name;
00474     dialupSettings = settings->dialupSettings;
00475     if (dialupSettings)
00476     {
00477         phone = dialupSettings->phone;
00478         user = dialupSettings->user;
00479         password = dialupSettings->password;
00480     }
00481 
00482     // set the text for screen objects
00483     edit_dialup_set_phone(phone);
00484     edit_dialup_set_user(user);
00485     edit_dialup_set_password(password);
00486     edit_dialup_set_profilename(profilename);
00487 
00488     edit_dialup_determine_status();
00489 
00490     // make a backup copy of the settings
00491     edit_dialup_backup_network_settings();
00492 }

Here is the call graph for this function:

static void edit_dialup_set_password ( const char *  password  )  [static]

Definition at line 549 of file editScreenDialup.c.

00550 {
00551     GtkWidget *widget;
00552 
00553     CN_LOGPRINTF("entry [%s]", password);
00554 
00555     if (g_password)
00556     {
00557         widget = g_password->entry;
00558         gtk_entry_set_text(GTK_ENTRY(widget), password ? password : "");
00559     }
00560 }

static void edit_dialup_set_phone ( const char *  phone  )  [static]

Definition at line 523 of file editScreenDialup.c.

00524 {
00525     GtkWidget *widget;
00526 
00527     CN_LOGPRINTF("entry [%s]", phone);
00528 
00529     if (g_phone)
00530     {
00531         widget = g_phone->entry;
00532         gtk_entry_set_text(GTK_ENTRY(widget), phone ? phone : ""); 
00533     }
00534 }

void edit_dialup_set_profilename ( const char *  profilename  ) 

Definition at line 562 of file editScreenDialup.c.

00563 {
00564     GtkWidget *widget;
00565 
00566     CN_LOGPRINTF("entry [%s]", profilename);
00567 
00568     if (g_profilename)
00569     {
00570         widget = g_profilename->details->entry;
00571         gtk_entry_set_text(GTK_ENTRY(widget), 
00572                            profilename ? profilename: "");
00573     }
00574 }

void edit_dialup_set_text ( void   ) 

Definition at line 279 of file editScreenDialup.c.

00280 {
00281     GtkWidget *widget = NULL;
00282 
00283     CN_LOGPRINTF("entry");
00284 
00285     if (g_dialup)
00286     {
00287         gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_dialup),
00288                                         _("Network profile"));
00289     }
00290 
00291     if (g_phone)
00292     {
00293         widget = g_phone->label;
00294         gtk_label_set_text(GTK_LABEL(widget), 
00295                 _("Type the phone number which you get from your ISP:"));
00296     }
00297    
00298     if (g_user)
00299     {
00300         widget = g_user->label;
00301         gtk_label_set_text(GTK_LABEL(widget), _("Type your username:"));
00302     }
00303     
00304     if (g_password)
00305     {
00306         widget = g_password->label;
00307         gtk_label_set_text(GTK_LABEL(widget), _("Type your password:"));
00308     }
00309     
00310     if (g_profilename)
00311     {
00312         widget = g_profilename->details->label;
00313         gtk_label_set_text(GTK_LABEL(widget), 
00314                            _("You can personalize the profile name."));
00315         widget = g_profilename->details->button;
00316         gtk_button_set_label(GTK_BUTTON(widget), _("Next"));
00317     }
00318 
00319     if (g_buttons)
00320     {
00321         widget = g_buttons->details->label;
00322         gtk_label_set_text(GTK_LABEL(widget),
00323             _("Select an action for this profile."));
00324 
00325        widget = GTK_WIDGET(g_buttons->details->buttonList[0]);
00326        gtk_button_set_label(GTK_BUTTON(widget), _("Test"));
00327        widget = GTK_WIDGET(g_buttons->details->buttonList[1]);
00328        gtk_button_set_label(GTK_BUTTON(widget), _("Save"));
00329        widget = GTK_WIDGET(g_buttons->details->buttonList[2]);
00330        gtk_button_set_label(GTK_BUTTON(widget), _("Save & Connect"));
00331     }
00332 }

Here is the call graph for this function:

static void edit_dialup_set_user ( const char *  user  )  [static]

Definition at line 536 of file editScreenDialup.c.

00537 {
00538     GtkWidget *widget;
00539 
00540     CN_LOGPRINTF("entry [%s]", user);
00541 
00542     if (g_user)
00543     {
00544         widget = g_user->entry;
00545         gtk_entry_set_text(GTK_ENTRY(widget), user ? user : "");
00546     }
00547 } 

static void edit_dialup_update_info_text ( dialupStatus_t  status  )  [static]

Definition at line 334 of file editScreenDialup.c.

00335 {
00336     CN_LOGPRINTF("entry");
00337 
00338     g_return_if_fail(g_info != NULL);
00339 
00340     switch (status)
00341     {
00342         case inputPhone_e:
00343         case inputUser_e:
00344         case inputPassword_e:
00345             gtk_infoitem_set_icon(GTK_INFOITEM(g_info), iconInfo_e); 
00346             gtk_infoitem_set_text(GTK_INFOITEM(g_info),
00347                     _("If you do not know the settings for this network, "
00348                       "please ask your Internet Service Provider "
00349                       "for detailed information."));
00350             break;
00351         case dialupInputProfileName_e:
00352         case undefStatus_e:
00353             gtk_infoitem_set_icon(GTK_INFOITEM(g_info), iconInfo_e); 
00354             gtk_infoitem_set_text(GTK_INFOITEM(g_info),
00355                 _("If you personalize the profile name, "
00356                   "it will be easy to recognize "
00357                   "in the iLiad's network profile list.\n"
00358                   "Click 'Next' for more advanced settings."));
00359             break;
00360         case dialupConnecting_e:
00361             gtk_infoitem_set_icon(GTK_INFOITEM(g_info), iconInfo_e); 
00362             gtk_infoitem_set_text(GTK_INFOITEM(g_info),
00363                 _("The iLiad is trying to connect to the server."));
00364             break;
00365         case dialupSucceeded_e:
00366             gtk_infoitem_set_icon(GTK_INFOITEM(g_info), iconOk_e); 
00367             gtk_infoitem_set_text(GTK_INFOITEM(g_info),
00368                     _("Connection to the server established."));
00369              break;
00370         case dialupFailed_e:
00371             gtk_infoitem_set_icon(GTK_INFOITEM(g_info), iconFailed_e); 
00372             gtk_infoitem_set_text(GTK_INFOITEM(g_info),
00373                     _("Connection to server "
00374                       "can not been established correctly."));
00375            break;
00376         case dialupAborting_e:
00377             gtk_infoitem_set_icon(GTK_INFOITEM(g_info), iconInfo_e); 
00378             gtk_infoitem_set_text(GTK_INFOITEM(g_info), 
00379                 _("The iLiad is aborting the connection."));
00380             break;
00381         case dialupAborted_e:
00382             gtk_infoitem_set_icon(GTK_INFOITEM(g_info), iconInfo_e);
00383             gtk_infoitem_set_text(GTK_INFOITEM(g_info), 
00384                 _("The connection has been aborted."));
00385             break;
00386  
00387         default:
00388             break;
00389     }
00390 }

Here is the call graph for this function:

static void on_buttons_update ( GtkWidget *  selection,
gpointer  button,
gpointer  data 
) [static]

Definition at line 792 of file editScreenDialup.c.

00795 {
00796     gboolean   active;
00797     gboolean   valid;
00798     int        nsel;
00799     GtkWidget  *widget;
00800     erGtkSelectionGroup *sel;
00801     gboolean toDeactive = TRUE;
00802 
00803     CN_LOGPRINTF("entry");
00804 
00805     active = gtk_toggle_button_get_active(button);
00806     valid = edit_dialup_check_network_settings();
00807     if (!valid)
00808     {
00809         edit_dialup_determine_status();
00810     }
00811 
00812     if (active && valid)
00813     {
00814         widget = g_buttons->details->selection;
00815         sel = ERGTK_SELECTION_GROUP(widget);
00816         ergtk_selection_group_get_selected_buttons(sel, &nsel, 1);
00817 
00818         switch (nsel)
00819         {
00820             case 0:
00821                 // test button is selected
00822                 on_test();
00823                 toDeactive = FALSE;
00824                 break;
00825             case 1:
00826                 // save button is selected
00827                 on_save();
00828                 toDeactive = FALSE;
00829                 break;
00830             case 2:
00831                 // save&connect button is selected
00832                 on_saveconnect();
00833                 toDeactive = FALSE;
00834                 break;
00835             default:
00836                 break;
00837         }
00838     }
00839 
00840     if (active && toDeactive)
00841     {
00842         g_timeout_add(500, delayed_deactive_button, button);
00843     }
00844 }

Here is the call graph for this function:

static void on_changed ( GtkEntry *  widget,
gpointer  data 
) [static]

Definition at line 728 of file editScreenDialup.c.

00729 {
00730     CN_LOGPRINTF("entry");
00731 
00732     dialupStatus_t status = (dialupStatus_t)data;
00733     edit_dialup_update_info_text(status);
00734     if (status == inputProfileName_e)
00735     {
00736         edit_overview_update_profile();
00737     }
00738 }

Here is the call graph for this function:

static void on_connected ( int  profileIndex  )  [static]

Definition at line 957 of file editScreenDialup.c.

00958 {
00959     GtkToggleButton *button;
00960 
00961     CN_LOGPRINTF("entry");
00962   
00963     edit_dialup_freeze_ui(FALSE);
00964 
00965     if (g_buttons)
00966     {
00967         button = g_buttons->details->buttonList[2];
00968         g_timeout_add(500, delayed_deactive_button, button);
00969     }
00970 
00971     edit_save_profile();
00972 
00973     edit_on_connected();    
00974 }

Here is the call graph for this function:

static gboolean on_delayed_next ( gpointer  data  )  [static]

Definition at line 740 of file editScreenDialup.c.

00741 {
00742     CN_LOGPRINTF("entry");
00743     
00744     erbusy_blink();
00745 
00746     edit_dialup_backup_network_settings();
00747 
00748     edit_goto_page(editScreenOverview_e);
00749     edit_overview_update_info_text(inputProxy_e);
00750     edit_overview_update_profile();
00751 
00752     return FALSE;
00753 }

Here is the call graph for this function:

static gboolean on_delayed_save ( gpointer  data  )  [static]

Definition at line 877 of file editScreenDialup.c.

00878 {
00879     GtkToggleButton *button;
00880 
00881     CN_LOGPRINTF("entry");
00882 
00883     erbusy_blink();
00884 
00885     edit_save_profile();
00886     edit_goto_page(editScreenProfiles_e);
00887 
00888     if (g_buttons)
00889     {
00890         button = g_buttons->details->buttonList[1];
00891         gtk_toggle_button_set_active(button, FALSE);
00892     }
00893 
00894     return FALSE;
00895 }

Here is the call graph for this function:

static gboolean on_delayed_test ( gpointer  data  )  [static]

Definition at line 846 of file editScreenDialup.c.

00847 {
00848     GtkToggleButton *button;
00849 
00850     CN_LOGPRINTF("entry");
00851 
00852     erbusy_blink();
00853 
00854     edit_dialup_backup_network_settings();
00855 
00856     edit_overview_update_profile();
00857     edit_goto_page(editScreenOverview_e);
00858     // similuate clicking the 'Test' button
00859     edit_overview_click_test();
00860    
00861     if (g_buttons)
00862     {
00863         button = g_buttons->details->buttonList[0];
00864         gtk_toggle_button_set_active(button, FALSE);
00865     }
00866 
00867     return FALSE;
00868 }

Here is the call graph for this function:

gboolean on_edit_dialup_keypress ( GdkEventKey *  event  ) 

Definition at line 1046 of file editScreenDialup.c.

01047 {
01048     pingContext_t *ctxt;
01049     GtkToggleButton *button;
01050     gboolean ret = FALSE;
01051 
01052     CN_LOGPRINTF("entry");
01053     
01054     ctxt = cmgr_get_ping_ctxt();
01055     switch (event->keyval)
01056     {
01057         case GDK_Return:
01058             // 'Enter' key is pressed
01059             if (!connect_ping_in_pinging(ctxt))
01060             {
01061                 // simulate clicking the 'Save & Connect' button
01062                 if (g_buttons)
01063                 {
01064                     button = GTK_TOGGLE_BUTTON(g_buttons->details->buttonList[2]);
01065                     gtk_toggle_button_set_active(button, TRUE);
01066                 }
01067                 ret = TRUE;
01068             }
01069             break;
01070 
01071         case GDK_F5:
01072             // 'UP' key is pressed
01073             // goto the one top level page
01074             connect_ping_abort(ctxt);
01075             cmgr_up_page();
01076             ret = TRUE;
01077             break;
01078         case GDK_Down:
01079         case GDK_Up:
01080             // avoid the standard GTK behaviour for GtkEntries
01081             erbusy_off();
01082             ret = TRUE;
01083             break;
01084         default:
01085             erbusy_off();
01086             break;
01087     }
01088 
01089     return ret;
01090 }

Here is the call graph for this function:

static void on_failed ( void   )  [static]

Definition at line 976 of file editScreenDialup.c.

00977 {
00978     GtkToggleButton *button;
00979 
00980     CN_LOGPRINTF("entry");
00981 
00982     edit_dialup_freeze_ui(FALSE);
00983 
00984     if (g_buttons)
00985     {
00986         button = g_buttons->details->buttonList[2];
00987         g_timeout_add(500, delayed_deactive_button, button);
00988     }
00989 }

Here is the call graph for this function:

static void on_next ( GtkToggleButton *  button,
gpointer  data 
) [static]

Definition at line 755 of file editScreenDialup.c.

00756 {
00757     gboolean active;
00758     gboolean valid;
00759 
00760     CN_LOGPRINTF("entry");
00761 
00762     active = gtk_toggle_button_get_active(button);
00763     if (active)
00764     {
00765         valid = edit_dialup_check_network_settings();
00766         if (valid)
00767         {
00768             g_timeout_add(500, on_delayed_next, NULL);
00769         }
00770         else
00771         {
00772             edit_dialup_determine_status();
00773         }
00774 
00775         // wait for a while to deactive the button 
00776         g_timeout_add(500, delayed_deactive_button, button);
00777     }
00778 }

Here is the call graph for this function:

static void on_save ( void   )  [static]

Definition at line 897 of file editScreenDialup.c.

00898 {
00899     CN_LOGPRINTF("entry");
00900 
00901     g_timeout_add(500, on_delayed_save, NULL);
00902 }

Here is the call graph for this function:

static void on_saveconnect ( void   )  [static]

Definition at line 904 of file editScreenDialup.c.

00905 {
00906     pingContext_t *ctxt;
00907 
00908     CN_LOGPRINTF("entry");
00909 
00910     edit_dialup_freeze_ui(TRUE);
00911 
00912     edit_dialup_restore_ping_ctxt();
00913 
00914     ctxt = cmgr_get_ping_ctxt();
00915     if (ctxt)
00916     {
00917         connect_ping_select_initial_profile(ctxt);
00918         connect_ping(ctxt, TRUE);
00919     }
00920 }

Here is the call graph for this function:

static void on_test ( void   )  [static]

Definition at line 870 of file editScreenDialup.c.

00871 {
00872     CN_LOGPRINTF("entry");
00873 
00874     g_timeout_add(500, on_delayed_test, NULL);
00875 }

Here is the call graph for this function:

static void ui_display_settings ( int  profileIndex,
gboolean  resetStatus 
) [static]

Definition at line 1028 of file editScreenDialup.c.

01029 {
01030     CN_LOGPRINTF("entry");
01031     // nothing to do
01032 }

static void ui_select_profile ( int  profileIndex  )  [static]

Definition at line 1034 of file editScreenDialup.c.

01035 {
01036     CN_LOGPRINTF("entry");
01037     // nothing to do
01038 }

static void ui_unselect_all_profile ( void   )  [static]

Definition at line 1040 of file editScreenDialup.c.

01041 {
01042     CN_LOGPRINTF("entry");
01043     // nothing to do
01044 }

static void ui_update_status ( int  profileIndex,
pingStatus_t  status 
) [static]

Definition at line 991 of file editScreenDialup.c.

00992 {
00993     dialupStatus_t state;
00994 
00995     CN_LOGPRINTF("entry");
00996 
00997     switch (status)
00998     {
00999         case pingSucceeded_e:
01000             state = dialupSucceeded_e;
01001             break;
01002         case pingFailed_e:
01003         case pingFailedPCShare_e:
01004         case pingFailedNetwork_e:
01005             state = dialupFailed_e;
01006             break;
01007         case pingConnecting_e:
01008             state = dialupConnecting_e;
01009             break;
01010         case pingAborting_e:
01011             state = dialupAborting_e;
01012             break;
01013         case pingAborted_e:
01014             state = dialupAborted_e;
01015             on_failed();
01016             break;
01017         default:
01018             state = undefStatus_e;
01019             break;
01020     }
01021 
01022     edit_dialup_update_info_text(state);
01023 
01024     display_update_request_screen_refresh(STATUS_ITEM_CHANGE, 
01025                                           WAVEFORM_TYPING);
01026 }

Here is the call graph for this function:


Variable Documentation

Definition at line 66 of file editScreenDialup.c.

GtkWidget* g_dialup = NULL

Definition at line 59 of file editScreenDialup.c.

GtkWidget* g_info = NULL

Definition at line 68 of file editScreenDialup.c.

char* g_old_profilename = NULL [static]

Definition at line 72 of file editScreenDialup.c.

Definition at line 71 of file editScreenDialup.c.

Definition at line 63 of file editScreenDialup.c.

Definition at line 61 of file editScreenDialup.c.

Definition at line 65 of file editScreenDialup.c.

Definition at line 62 of file editScreenDialup.c.


Generated on Sun Dec 14 17:16:17 2008 by  doxygen 1.5.6