#include <unistd.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <liberregxml/erregapi.h>
#include <libergtk/ergtk.h>
#include <liberipc/eripctoolbar.h>
#include "connectionMgrLog.h"
#include "connectionMgr.h"
#include "gtkSettingItem.h"
#include "gtkProfileEntry.h"
#include "gtkProfileGroup.h"
#include "widgetUtils.h"
#include "commonData.h"
#include "editScreenData.h"
#include "editScreen.h"
#include "editScreenProfiles.h"
#include "editScreenOverview.h"
#include "editScreenSearch.h"
#include "background.h"
#include "displayStatus.h"
#include "erbusy.h"
#include "pagebar.h"
#include "toolbar.h"
#include "languages.h"
Go to the source code of this file.
Typedefs | |
typedef void | on_item_selected_t (const int *index_tbl) |
Functions | |
static GtkWidget * | create_new_profile (void) |
static GtkWidget * | create_known_profiles (void) |
static GtkWidget * | create_network_type (void) |
static void | on_networktype_update (erGtkSelectionGroup *selection, gpointer button, gpointer data) |
static void | on_new_profile_toggled (GtkWidget *button, GdkEventButton *event, gpointer data) |
static void | on_profile_entry_selected (GtkProfileGroup *profileGroup, guint profileIndex) |
static void | edit_profile (guint profileIndex) |
static void | on_icon_clicked (int iconID, int iconState) |
static void | begin_select_delete_profiles (int iconID, gboolean confirm_with_icon, on_item_selected_t *callback_on_selected) |
static gboolean | on_end_select_delete_profiles_timer (gpointer data) |
static void | select_delete_profiles_stop (gboolean restore_toolbar) |
static void | unselect_delete_profiles (void) |
static gboolean | on_delete_profile_selected (GtkProfileGroup *profileGroup, guint index, gboolean active) |
static void | delete_profiles (const int *index_tbl) |
GtkWidget * | edit_profiles_create (void) |
void | edit_profiles_set_text (void) |
void | edit_profiles_display (void) |
static gboolean | delayed_on_new_profile_toggled (gpointer data) |
static gboolean | delayed_on_profile_entry_selected (gpointer data) |
gboolean | on_edit_profiles_keypress (GdkEventKey *event) |
void | on_edit_profiles_icon_clicked (int iconID, int iconState) |
char * | edit_profiles_default_profilename (void) |
void | edit_profiles_create_profile (void) |
int | edit_profiles_get_edited_profile_index (void) |
Variables | |
struct { | |
int iconID | |
gboolean confirm_with_icon | |
guint ticks | |
guint timerID | |
gboolean active | |
gboolean icon_clicked | |
gboolean item_selected [MAX_PROFILES_PER_PAGE] | |
on_item_selected_t * on_item_selected | |
} | g_select |
static GtkWidget * | g_edit_profiles = NULL |
static GtkWidget * | g_networktype = NULL |
static bkWdtLabelButton * | g_nwtype_labelbutton = NULL |
static GtkWidget * | g_new_profile = NULL |
static bkWdtLabelButton * | g_newprofile_labelbutton = NULL |
static GtkWidget * | g_known_profiles = NULL |
static gboolean | g_first_display = TRUE |
Copyright (C) 2007 iRex Technologies BV.
Definition in file editScreenProfiles.c.
typedef void on_item_selected_t(const int *index_tbl) |
Definition at line 60 of file editScreenProfiles.c.
static void begin_select_delete_profiles | ( | int | iconID, | |
gboolean | confirm_with_icon, | |||
on_item_selected_t * | callback_on_selected | |||
) | [static] |
Definition at line 759 of file editScreenProfiles.c.
00762 { 00763 GtkProfileGroup* profileGroup; 00764 00765 CN_LOGPRINTF("entry: iconID [%d]", iconID); 00766 00767 g_assert(callback_on_selected != NULL); 00768 00769 profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00770 00771 // set the delete mode 00772 gtk_profile_group_set_mode(profileGroup, deleteMode_e); 00773 00774 // remember the settings 00775 g_select.iconID = iconID; 00776 g_select.on_item_selected = callback_on_selected; 00777 g_select.confirm_with_icon = confirm_with_icon; 00778 00779 // update toolbar 00780 toolbar_disableUpdate(); 00781 toolbar_setIconState(iconID_trashcan, iconState_grey); 00782 toolbar_setIconState(iconID, iconState_selected); 00783 toolbar_enableUpdate(); 00784 00785 // de-select profiles 00786 unselect_delete_profiles(); 00787 00788 // start time-out 00789 g_select.ticks = ITEM_SELECT_TIMEOUT_TICKS; 00790 g_select.timerID = g_timeout_add(500, 00791 on_end_select_delete_profiles_timer, 00792 0); 00793 g_select.icon_clicked = FALSE; 00794 g_select.active = TRUE; 00795 00796 // update screen when toolbar icons ok 00797 toolbar_synchronise(); 00798 }
static GtkWidget * create_known_profiles | ( | void | ) | [static] |
Definition at line 225 of file editScreenProfiles.c.
00226 { 00227 GtkWidget* item; 00228 00229 // item 00230 item = gtk_profile_group_new(MAX_PROFILES_PER_PAGE, editMode_e); 00231 gtk_profile_group_show_dialup(GTK_PROFILE_GROUP(item), FALSE); 00232 00233 gtk_profile_group_callback_on_buttons_press(GTK_PROFILE_GROUP(item), 00234 on_delete_profile_selected, NULL); 00235 gtk_profile_group_callback_on_buttons_clicked(GTK_PROFILE_GROUP(item), 00236 NULL, on_profile_entry_selected); 00237 g_known_profiles = item; 00238 00239 return item; 00240 }
static GtkWidget * create_network_type | ( | void | ) | [static] |
Definition at line 193 of file editScreenProfiles.c.
00194 { 00195 GtkWidget *item = NULL; 00196 bkWdtLabelButton *widget; 00197 GtkWidget *selection; 00198 00199 // item 00200 item = gtk_settingitem_new(""); 00201 00202 // widget 00203 widget = bk_wdt_label_button_new(3, FALSE, 1, 1); 00204 gtk_settingitem_add_details(GTK_SETTINGITEM(item), widget->background); 00205 00206 // signal handlers 00207 selection = widget->details->selection; 00208 g_signal_connect (G_OBJECT (selection), "selection-update", 00209 G_CALLBACK (on_networktype_update), NULL); 00210 00211 // show widget 00212 gtk_widget_show(widget->background); 00213 00214 // global variables 00215 g_networktype = item; 00216 g_nwtype_labelbutton = widget; 00217 00218 // return 00219 return item; 00220 }
static GtkWidget * create_new_profile | ( | void | ) | [static] |
Definition at line 161 of file editScreenProfiles.c.
00162 { 00163 GtkWidget *item; 00164 bkWdtLabelButton *widget; 00165 GtkToggleButton *button; 00166 00167 // item 00168 item = gtk_settingitem_new(""); 00169 00170 // widget 00171 widget = bk_wdt_label_button_new(1, FALSE, 0, 1); 00172 gtk_settingitem_add_details(GTK_SETTINGITEM(item), widget->background); 00173 00174 // signal handlers 00175 button = widget->details->buttonList[0]; 00176 g_signal_connect(G_OBJECT(button), "toggled", 00177 G_CALLBACK(on_new_profile_toggled), 0); 00178 00179 // show widgets 00180 gtk_widget_show(widget->background); 00181 00182 // global variables 00183 g_new_profile = item; 00184 g_newprofile_labelbutton = widget; 00185 00186 // return value 00187 return item; 00188 }
static gboolean delayed_on_new_profile_toggled | ( | gpointer | data | ) | [static] |
Definition at line 465 of file editScreenProfiles.c.
00466 { 00467 GtkToggleButton *button; 00468 00469 erbusy_blink(); 00470 edit_profiles_create_profile(); 00471 00472 button = g_newprofile_labelbutton->details->buttonList[0]; 00473 gtk_toggle_button_set_active(button, FALSE); 00474 00475 return FALSE; 00476 }
static gboolean delayed_on_profile_entry_selected | ( | gpointer | data | ) | [static] |
Definition at line 498 of file editScreenProfiles.c.
00499 { 00500 int profileIndex = (int)data; 00501 00502 erbusy_blink(); 00503 edit_profile(profileIndex); 00504 return FALSE; 00505 }
static void delete_profiles | ( | const int * | index_tbl | ) | [static] |
Definition at line 932 of file editScreenProfiles.c.
00933 { 00934 int itemCount; 00935 int index; 00936 const int* indexPtr; 00937 gboolean deleted = FALSE; 00938 00939 CN_LOGPRINTF("entry: index [%d]", index_tbl[0]); 00940 00941 itemCount = edit_data_get_n_network_profiles(); 00942 for (indexPtr = index_tbl ; *indexPtr >= 0 ; indexPtr++) 00943 { 00944 index = *indexPtr; 00945 00946 if (index >= 0 && index < itemCount) 00947 { 00948 CN_LOGPRINTF("index [%d] itemCount [%d]", index, itemCount); 00949 00950 // Trashcan mode: delete the item 00951 erbusy_blink(); 00952 edit_data_remove_network_profile(index); 00953 deleted = TRUE; 00954 } 00955 } 00956 00957 if (deleted) 00958 { 00959 // save to registry 00960 edit_data_store_network_profiles(); 00961 00962 // update the the list network profiles in the meanwhile 00963 edit_data_init_network_profiles(); 00964 edit_profiles_display(); 00965 } 00966 }
static void edit_profile | ( | guint | profileIndex | ) | [static] |
Definition at line 569 of file editScreenProfiles.c.
00570 { 00571 const networkProfile_t *settings; 00572 regNetworkProfile_t* pRegSettings = NULL; 00573 00574 CN_LOGPRINTF("entry: profileIndex [%d]", profileIndex); 00575 00576 edit_set_wizard_mode(FALSE); 00577 edit_set_back_overview(FALSE); 00578 00579 // get network settings and show in screen objects 00580 settings = edit_data_get_network_profile(profileIndex); 00581 00582 if ((settings->nRegProfiles > 0) 00583 && settings->regSettingsList 00584 && ((settings->nActiveIndex >= 0) 00585 && (settings->nActiveIndex < settings->nRegProfiles))) 00586 { 00587 pRegSettings = settings->regSettingsList[settings->nActiveIndex]; 00588 } 00589 00590 if (pRegSettings) 00591 { 00592 edit_set_network_settings(pRegSettings); 00593 00594 switch (pRegSettings->connection) 00595 { 00596 case wired_t: 00597 edit_goto_page(editScreenOverview_e); 00598 break; 00599 case wireless_t: 00600 edit_goto_page(editScreenWireless_e); 00601 break; 00602 case dialup_t: 00603 edit_goto_page(editScreenDialup_e); 00604 break; 00605 default: 00606 break; 00607 } 00608 } 00609 else 00610 { 00611 // oops, no settings: create a new profile 00612 edit_profiles_create_profile(); 00613 } 00614 }
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 }
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 }
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 }
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 }
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 }
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 }
static gboolean on_delete_profile_selected | ( | GtkProfileGroup * | profileGroup, | |
guint | index, | |||
gboolean | active | |||
) | [static] |
Definition at line 899 of file editScreenProfiles.c.
00901 { 00902 CN_LOGPRINTF("Entry: index [%d]", index); 00903 00904 if (g_select.active) 00905 { 00906 // notes, active means current state is active, 00907 // it's going to be de-active. 00908 // select mode: blink or hide cursor for this item 00909 // if (g_select.item_selected[index]) 00910 if (active) 00911 { 00912 g_select.item_selected[index] = FALSE; 00913 gtk_profile_group_unselect_profile(profileGroup, index); 00914 } 00915 else 00916 { 00917 g_select.item_selected[index] = TRUE; 00918 gtk_profile_group_select_profile(profileGroup, index); 00919 if ( !g_select.confirm_with_icon ) 00920 { 00921 g_select.icon_clicked = TRUE; 00922 } 00923 } 00924 00925 // restart the select timeout 00926 g_select.ticks = ITEM_SELECT_TIMEOUT_TICKS; 00927 00928 } 00929 return TRUE; 00930 }
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 }
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 }
static gboolean on_end_select_delete_profiles_timer | ( | gpointer | data | ) | [static] |
Definition at line 800 of file editScreenProfiles.c.
00801 { 00802 int i; 00803 int item_idx[MAX_PROFILES_PER_PAGE + 1]; 00804 int* ip; 00805 gboolean call_me_again = FALSE; 00806 00807 CN_LOGPRINTF("entry"); 00808 00809 if (g_select.active) 00810 { 00811 if (g_select.icon_clicked) 00812 { 00813 // listitem select procedure ends 00814 if (g_select.on_item_selected != NULL) 00815 { 00816 // report the currently selected item(s) 00817 ip = item_idx; 00818 for (i = MAX_PROFILES_PER_PAGE - 1 ; i >= 0 ; i--) 00819 { 00820 if (g_select.item_selected[i]) 00821 { 00822 *ip = i; 00823 ip++; 00824 } 00825 } 00826 *ip = -1; 00827 g_select.on_item_selected(item_idx); 00828 select_delete_profiles_stop(g_select.confirm_with_icon); 00829 } 00830 else 00831 { 00832 select_delete_profiles_stop(TRUE); 00833 } 00834 } 00835 else if (g_select.ticks > 0) 00836 { 00837 // decrement time-out counter 00838 g_select.ticks--; 00839 call_me_again = TRUE; 00840 } 00841 else 00842 { 00843 // abort select mode 00844 select_delete_profiles_stop(TRUE); 00845 toolbar_synchronise(); 00846 } 00847 } 00848 00849 return call_me_again; 00850 }
static void on_icon_clicked | ( | int | iconID, | |
int | iconState | |||
) | [static] |
Definition at line 718 of file editScreenProfiles.c.
00719 { 00720 CN_LOGPRINTF("entry: iconID [%d] iconState [%d]", iconID, iconState); 00721 00722 if ( g_select.active 00723 && iconID == g_select.iconID 00724 && iconState == iconState_selected) 00725 { 00726 // icon clicked again -> listitem select procedure ends 00727 // Note: ipc messages like toolbar icon clicked are received 00728 // on a separate thread, therefore the current 00729 // function is NOT called on the GTK thread, 00730 // so the order of events cannot be guaranteed. 00731 // More precisely: pen-click listitem, 00732 // pen-click toolbar icon sometimes is received 00733 // in the inverse order. 00734 // To avoid these issues we set a flag, 00735 // which is checked by the timer function 00736 // who then ends the select. 00737 g_select.icon_clicked = TRUE; 00738 } 00739 else 00740 { 00741 // icon actions for icon state normal 00742 if (iconState == iconState_normal) 00743 { 00744 switch (iconID) 00745 { 00746 case iconID_trashcan: 00747 begin_select_delete_profiles(iconID_trashcan, 00748 TRUE, 00749 delete_profiles); 00750 break; 00751 default: 00752 break; // ignore 00753 } 00754 } 00755 } 00756 }
static void on_networktype_update | ( | erGtkSelectionGroup * | selection, | |
gpointer | button, | |||
gpointer | data | |||
) | [static] |
Definition at line 420 of file editScreenProfiles.c.
00422 { 00423 CN_LOGPRINTF("entry selection[%p], button[%p], data[%p]", 00424 selection, button, data); 00425 00426 GtkToggleButton* btn; 00427 gboolean active; 00428 int nsel; 00429 00430 btn = GTK_TOGGLE_BUTTON(button); 00431 active = gtk_toggle_button_get_active(btn); 00432 if (active) 00433 { 00434 00435 erbusy_blink(); 00436 00437 // stop the delete mode 00438 select_delete_profiles_stop(TRUE); 00439 00440 ergtk_selection_group_get_selected_buttons(selection, &nsel, 1); 00441 if (nsel == 0) 00442 { 00443 // wired selected 00444 edit_data_set_network_type(wired_t); 00445 } 00446 else if (nsel == 1) 00447 { 00448 // wireless selected 00449 edit_data_set_network_type (wireless_t); 00450 } 00451 else if (nsel == 2) 00452 { 00453 // dialup selected 00454 edit_data_set_network_type(dialup_t); 00455 } 00456 00457 // update the edit data 00458 edit_data_init_network_profiles(); 00459 00460 // update the GUI 00461 edit_profiles_display(); 00462 } 00463 }
static void on_new_profile_toggled | ( | GtkWidget * | button, | |
GdkEventButton * | event, | |||
gpointer | data | |||
) | [static] |
Definition at line 478 of file editScreenProfiles.c.
00481 { 00482 gboolean pressed; 00483 00484 CN_LOGPRINTF ("entry"); 00485 00486 // check if it is a "pressed event" 00487 pressed = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); 00488 if (pressed) 00489 { 00490 // stop the delete mode 00491 select_delete_profiles_stop(TRUE); 00492 00493 // wait for a while to show button selected 00494 g_timeout_add(500, delayed_on_new_profile_toggled, data); 00495 } 00496 }
static void on_profile_entry_selected | ( | GtkProfileGroup * | profileGroup, | |
guint | profileIndex | |||
) | [static] |
Definition at line 507 of file editScreenProfiles.c.
00509 { 00510 CN_LOGPRINTF ("entry"); 00511 00512 // wait for a while to show button selected 00513 g_timeout_add(500, 00514 delayed_on_profile_entry_selected, 00515 (gpointer)profileIndex); 00516 }
static void select_delete_profiles_stop | ( | gboolean | restore_toolbar | ) | [static] |
Definition at line 852 of file editScreenProfiles.c.
00853 { 00854 GtkProfileGroup* profileGroup; 00855 00856 CN_LOGPRINTF("entry"); 00857 00858 profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00859 00860 // set the delete mode 00861 gtk_profile_group_set_mode(profileGroup, editMode_e); 00862 00863 if (g_select.active) 00864 { 00865 // stop time-out 00866 gtk_timeout_remove(g_select.timerID); 00867 g_select.active = FALSE; 00868 00869 // unselect all profiles 00870 unselect_delete_profiles(); 00871 00872 if (restore_toolbar) 00873 { 00874 // update toolbar 00875 toolbar_disableUpdate(); 00876 edit_show_trashcan(); 00877 toolbar_enableUpdate(); 00878 toolbar_synchronise(); 00879 } 00880 } 00881 }
static void unselect_delete_profiles | ( | void | ) | [static] |
Definition at line 883 of file editScreenProfiles.c.
00884 { 00885 int i; 00886 00887 GtkProfileGroup* profileGroup = GTK_PROFILE_GROUP(g_known_profiles); 00888 00889 for (i = 0 ; i < MAX_PROFILES_PER_PAGE; i++) 00890 { 00891 if (g_select.item_selected[i]) 00892 { 00893 gtk_profile_group_unselect_profile(profileGroup, i); 00894 g_select.item_selected[i] = FALSE; 00895 } 00896 } 00897 }
gboolean active |
Definition at line 67 of file editScreenProfiles.c.
gboolean confirm_with_icon |
Definition at line 64 of file editScreenProfiles.c.
GtkWidget* g_edit_profiles = NULL [static] |
Definition at line 74 of file editScreenProfiles.c.
gboolean g_first_display = TRUE [static] |
Definition at line 87 of file editScreenProfiles.c.
GtkWidget* g_known_profiles = NULL [static] |
Definition at line 85 of file editScreenProfiles.c.
GtkWidget* g_networktype = NULL [static] |
Definition at line 77 of file editScreenProfiles.c.
GtkWidget* g_new_profile = NULL [static] |
Definition at line 81 of file editScreenProfiles.c.
bkWdtLabelButton* g_newprofile_labelbutton = NULL [static] |
Definition at line 82 of file editScreenProfiles.c.
bkWdtLabelButton* g_nwtype_labelbutton = NULL [static] |
Definition at line 78 of file editScreenProfiles.c.
struct { ... } g_select [static] |
gboolean icon_clicked |
Definition at line 68 of file editScreenProfiles.c.
int iconID |
Definition at line 63 of file editScreenProfiles.c.
gboolean item_selected[MAX_PROFILES_PER_PAGE] |
Definition at line 69 of file editScreenProfiles.c.
Definition at line 70 of file editScreenProfiles.c.
guint ticks |
Definition at line 65 of file editScreenProfiles.c.
guint timerID |
Definition at line 66 of file editScreenProfiles.c.