connectionMgr/inc/editScreenProfiles.h File Reference

connectionMgr - the first page of 'edit' screen the edit profiles screen containing a selection for network type and a new profile entry and a profile list(registry) More...

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

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

Go to the source code of this file.

Defines

#define ITEM_SELECT_TIMEOUT   6
#define ITEM_SELECT_TIMER_INTERVAL   500
#define ITEM_SELECT_TIMEOUT_TICKS   ((ITEM_SELECT_TIMEOUT * 1000) / ITEM_SELECT_TIMER_INTERVAL)

Functions

GtkWidget * edit_profiles_create (void)
void edit_profiles_set_text (void)
void edit_profiles_display (void)
char * edit_profiles_default_profilename (void)
void edit_profiles_create_profile (void)
int edit_profiles_get_edited_profile_index (void)
void on_edit_profiles_icon_clicked (int iconID, int iconState)
gboolean on_edit_profiles_keypress (GdkEventKey *event)


Detailed Description

connectionMgr - the first page of 'edit' screen the edit profiles screen containing a selection for network type and a new profile entry and a profile list(registry)

Copyright (C) 2007 iRex Technologies BV.

Definition in file editScreenProfiles.h.


Define Documentation

#define ITEM_SELECT_TIMEOUT   6

Definition at line 39 of file editScreenProfiles.h.

#define ITEM_SELECT_TIMEOUT_TICKS   ((ITEM_SELECT_TIMEOUT * 1000) / ITEM_SELECT_TIMER_INTERVAL)

Definition at line 41 of file editScreenProfiles.h.

#define ITEM_SELECT_TIMER_INTERVAL   500

Definition at line 40 of file editScreenProfiles.h.


Function Documentation

GtkWidget* edit_profiles_create ( void   ) 

Definition at line 127 of file editScreenProfiles.c.

00128 {
00129     CN_LOGPRINTF("entry");
00130 
00131     GtkWidget *vbox;
00132     GtkWidget *networkTypeItem;
00133     GtkWidget *newProfileItem;
00134     GtkWidget *knownProfilesItem;
00135 
00136     // vbox
00137     vbox = gtk_vbox_new(FALSE, VBOX_SPACING);
00138     gtk_widget_show(vbox);
00139     g_edit_profiles = vbox;
00140 
00141     // networkTypeItem
00142     networkTypeItem = create_network_type();
00143     gtk_box_pack_start(GTK_BOX(vbox), networkTypeItem, FALSE, FALSE, 0);
00144     gtk_widget_show(networkTypeItem);
00145 
00146     // newProfileItem
00147     newProfileItem = create_new_profile();
00148     gtk_box_pack_start(GTK_BOX(vbox), newProfileItem, FALSE, FALSE, 0);
00149     gtk_widget_show(newProfileItem);
00150 
00151     // knownProfilesItem
00152     knownProfilesItem = create_known_profiles();
00153     gtk_box_pack_start(GTK_BOX(vbox), knownProfilesItem, FALSE, FALSE, 0);
00154     gtk_widget_show(knownProfilesItem);
00155 
00156     return vbox;
00157 }

Here is the call graph for this function:

void edit_profiles_create_profile ( void   ) 

Definition at line 645 of file editScreenProfiles.c.

00646 {
00647     connection_t networkType;
00648     regNetworkProfile_t* settings;
00649 
00650     CN_LOGPRINTF("entry");
00651 
00652     networkType = edit_data_get_network_type();
00653     if ((networkType >= 0) && (networkType < connection_undefined_t))
00654     {
00655         edit_set_wizard_mode(TRUE);
00656         edit_set_back_overview(FALSE);
00657 
00658         // get network settings and show in screen objects
00659         settings = g_new0(regNetworkProfile_t, 1);
00660         g_assert(settings != NULL);
00661 
00662         settings->name = edit_profiles_default_profilename();
00663         settings->connection  = networkType;
00664         settings->proxy       = FALSE;
00665         settings->addressMode = dhcp_t;
00666         
00667         edit_set_network_settings(settings);
00668         
00669         erRegFreeNetworkProfile(settings);
00670 
00671         // show the correct screen
00672         switch (networkType)
00673         {
00674             case wired_t:
00675                 edit_goto_page(editScreenOverview_e);
00676                 break;
00677             case wireless_t:
00678                 edit_search_restore_screen();
00679                 edit_goto_page(editScreenSearch_e);
00680                 break;
00681             case dialup_t:
00682                 edit_goto_page(editScreenDialup_e);
00683                 break;
00684             default:
00685                 edit_goto_page(editScreenOverview_e);
00686                 break;
00687         }
00688     }
00689 }

Here is the call graph for this function:

char* edit_profiles_default_profilename ( void   ) 

Definition at line 616 of file editScreenProfiles.c.

00617 {
00618     connection_t networkType;
00619     int          nProfiles;
00620     char        *name = NULL;
00621 
00622     networkType = edit_data_get_network_type();
00623     nProfiles = edit_data_get_n_network_profiles();
00624    
00625     switch (networkType)
00626     {
00627         case wired_t:
00628             name = g_strdup_printf(_("Wired %d"), nProfiles+1);
00629             break;
00630         case wireless_t:
00631             name = g_strdup_printf(_("Wireless %d"), nProfiles+1);
00632             break;
00633         case dialup_t:
00634             name = g_strdup_printf(_("Dial-up %d"), nProfiles+1);
00635             break;
00636         default:
00637             name = g_strdup("");
00638             break;
00639     }
00640 
00641     CN_LOGPRINTF("return %s", name);
00642     return name;
00643 }

Here is the call graph for this function:

void edit_profiles_display ( void   ) 

Definition at line 305 of file editScreenProfiles.c.

00306 {
00307     CN_LOGPRINTF ("entry");
00308  
00309     GtkProfileGroup           *profileGroup;
00310     networkProfile_t          *settings;
00311     int                       i, profileIndex;
00312     int                       nProfiles, nDisplayed;
00313 
00314     GtkWidget*                widget;
00315     GtkToggleButton*          button;
00316 
00317     if (g_nwtype_labelbutton)
00318     {
00319         // display choice wired / wireless / dialup
00320         switch (edit_data_get_network_type())
00321         {
00322             case wired_t:
00323                 widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[0]);
00324                 break;
00325             case wireless_t:
00326                 widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[1]);
00327                 break;
00328             case dialup_t:
00329                 widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[2]);
00330                 break;
00331             default:
00332                 // nothing selected (yet), using the default setting: wired
00333                 widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[0]);
00334                 edit_data_set_network_type (wired_t);
00335                 break;
00336         }
00337 
00338         //   - and select this button
00339         //     Note: when the button is already selected, 
00340         //     we de-select then select again;
00341         //           this ensures the signal handlers are called 
00342         //           regardless the old button state.
00343         button = GTK_TOGGLE_BUTTON(widget);
00344         if (g_first_display && gtk_toggle_button_get_active(button))
00345         {
00346             // button is selected, so first deselect it 
00347             // to make sure signal handler is called
00348             gtk_toggle_button_set_active(button, FALSE);
00349         }
00350         gtk_toggle_button_set_active(button, TRUE);
00351         
00352         // Disable buttons for WiFi and/or Dialup based on hardware presence
00353         if (main_get_wifi_disabled())
00354         {
00355             // set wifi button insensitive when wifi is disabled
00356             widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[1]);
00357             gtk_widget_set_sensitive(widget, FALSE);
00358         }
00359 
00360         if (main_get_dialup_disabled())
00361         {
00362             // set dialup button insensitive when dialup is disabled
00363             widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[2]);
00364             gtk_widget_set_sensitive(widget, FALSE);
00365         }
00366     }
00367 
00368     if (g_newprofile_labelbutton)
00369     {
00370         button = g_newprofile_labelbutton->details->buttonList[0];
00371 
00372         // grey out the 'Create new profile' button if needed
00373         if (edit_data_reach_max_profiles())
00374         {
00375             gtk_widget_set_sensitive(GTK_WIDGET(button), FALSE);
00376         }
00377         else
00378         {
00379             gtk_widget_set_sensitive(GTK_WIDGET(button), TRUE);
00380         }
00381 
00382         // deselect the 'create new profile' button
00383         gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(button), FALSE);
00384     }
00385 
00386     // show the corresponding profile entries  
00387     profileGroup = GTK_PROFILE_GROUP(g_known_profiles);   
00388     nProfiles = edit_data_get_n_network_profiles();
00389     CN_LOGPRINTF("nProfiles[%d]", nProfiles);
00390 
00391     nDisplayed = ((nProfiles < MAX_PROFILES_PER_PAGE) ? nProfiles: MAX_PROFILES_PER_PAGE);
00392     if (nDisplayed > 0)
00393     {
00394         for (i = 0; i < nDisplayed; i++)
00395         {
00396             settings = (networkProfile_t*)edit_data_get_network_profile(i);
00397             gtk_profile_group_display_settings(profileGroup, i, 
00398                                                settings, TRUE);
00399         }
00400     }
00401     gtk_profile_group_show_profile_entries(profileGroup, nDisplayed);
00402 
00403     // deselect all profile index
00404     profileIndex = gtk_profile_group_get_selected_profile_index(profileGroup);
00405     if (profileIndex != -1)
00406     {
00407         gtk_profile_group_unselect_profile(profileGroup, profileIndex);
00408     }
00409 
00410     // update the trashcan icon as well
00411     edit_show_trashcan();
00412 
00413 
00414     g_first_display = FALSE;
00415 }

Here is the call graph for this function:

int edit_profiles_get_edited_profile_index ( void   ) 

Definition at line 691 of file editScreenProfiles.c.

00692 {
00693     CN_LOGPRINTF("entry");
00694 
00695     int              profileIndex;
00696     GtkProfileGroup* profileGroup; 
00697     
00698     if (edit_get_wizard_mode())
00699     {
00700         profileIndex = -1;
00701     }
00702     else
00703     {
00704         profileGroup = GTK_PROFILE_GROUP(g_known_profiles);
00705         profileIndex = gtk_profile_group_get_selected_profile_index(profileGroup);
00706     }
00707 
00708     CN_LOGPRINTF("profileIndex[%d]", profileIndex);
00709 
00710     return profileIndex;
00711 }

Here is the call graph for this function:

void edit_profiles_set_text ( void   ) 

Definition at line 245 of file editScreenProfiles.c.

00246 {
00247     GtkWidget *widget;
00248     GtkProfileGroup *profileGroup;
00249 
00250     CN_LOGPRINTF ("entry");
00251 
00252     if (g_networktype)
00253     {
00254         gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_networktype), 
00255                                         _("Show network profiles for"));
00256     }
00257     
00258     if (g_nwtype_labelbutton)
00259     {
00260         widget = g_nwtype_labelbutton->details->label;
00261         gtk_label_set_text (GTK_LABEL(widget), 
00262                 _("Select the type of network profiles to list below."));
00263 
00264         widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[0]);
00265         gtk_button_set_label (GTK_BUTTON (widget), _("Wired"));
00266 
00267         widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[1]);
00268         gtk_button_set_label (GTK_BUTTON (widget), _("Wireless"));
00269 
00270         widget = GTK_WIDGET(g_nwtype_labelbutton->details->buttonList[2]);
00271         gtk_button_set_label (GTK_BUTTON (widget), _("Dial-up"));
00272     }
00273 
00274     if (g_new_profile)
00275     {
00276         gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_new_profile), 
00277                                         _("Network profiles"));
00278     }
00279 
00280     if (g_newprofile_labelbutton)
00281     {
00282         widget = g_newprofile_labelbutton->details->label;
00283         gtk_label_set_text (GTK_LABEL (widget), 
00284                 _("Create a new network profile:"));
00285 
00286         widget = GTK_WIDGET(g_newprofile_labelbutton->details->buttonList[0]);
00287         gtk_button_set_label (GTK_BUTTON (widget), _("Create new profile"));
00288     }
00289 
00290     if (g_known_profiles)
00291     {
00292         profileGroup = GTK_PROFILE_GROUP(g_known_profiles);
00293         gtk_profile_group_set_header_text(profileGroup,
00294                                          _("Network profiles"));
00295         gtk_profile_group_set_info_text (profileGroup,
00296                             _("Stored network profiles on your iLiad: "));
00297         gtk_profile_group_set_editbuttons_text(profileGroup,
00298                                                _("Edit"));
00299     }
00300 }

Here is the call graph for this function:

void on_edit_profiles_icon_clicked ( int  iconID,
int  iconState 
)

Definition at line 561 of file editScreenProfiles.c.

00562 {
00563     CN_LOGPRINTF("entry iconID[%d] iconState[%d]", iconID, iconState);
00564 
00565     on_icon_clicked(iconID, iconState);
00566 }

Here is the call graph for this function:

gboolean on_edit_profiles_keypress ( GdkEventKey *  event  ) 

Definition at line 518 of file editScreenProfiles.c.

00519 {
00520     CN_LOGPRINTF("entry");
00521 
00522     GtkToggleButton *button;
00523     gboolean ret = FALSE;
00524      
00525     switch (event->keyval)
00526     {
00527         case GDK_Return:
00528             // 'Enter' key is pressed
00529             // simulate clicking the 'Create new profile' button
00530             if (!edit_data_reach_max_profiles() && g_newprofile_labelbutton)
00531             {
00532                 button = g_newprofile_labelbutton->details->buttonList[0];
00533                 gtk_toggle_button_set_active(button, TRUE);
00534             }
00535             else
00536             {
00537                 erbusy_off();
00538             }
00539             ret = TRUE;
00540             break;
00541 
00542         case GDK_F5:
00543             // 'UP' key is pressed
00544             // goto the one top level page
00545             cmgr_up_page();
00546             ret = TRUE;
00547             break;
00548 
00549         case GDK_Down:
00550         case GDK_Up:
00551         case GDK_Page_Down:
00552         case GDK_Page_Up:
00553         default:
00554             erbusy_off();
00555             break;
00556     }
00557     
00558     return ret;
00559 }

Here is the call graph for this function:


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