connectionMgr/inc/editScreenDialup.h File Reference

connectionMgr - "Dialup" screen More...

#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
#include <liberregxml/erregapi.h>

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

GtkWidget * edit_dialup_create (void)
void edit_dialup_enable_save_button (gboolean enable)
void edit_dialup_set_text (void)
void edit_dialup_set_network_settings (const regNetworkProfile_t *settings)
void edit_dialup_get_network_settings (regNetworkProfile_t *settings)
gboolean edit_dialup_check_network_settings (void)
void edit_dialup_restore_network_settings (void)
void edit_dialup_set_profilename (const char *profilename)
const char * edit_dialup_get_profilename (void)
gboolean on_edit_dialup_keypress (GdkEventKey *event)


Detailed Description

connectionMgr - "Dialup" screen

Copyright (C) 2007 iRex Technologies BV.

Definition in file editScreenDialup.h.


Function Documentation

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:

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 }

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:

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 }

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:

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:

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:

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:


Generated on Sun Dec 14 17:15:38 2008 by  doxygen 1.5.6