#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
#include <liberregxml/erregapi.h>
Go to the source code of this file.
Functions | |
GtkWidget * | edit_proxy_create (void) |
void | edit_proxy_set_text (void) |
void | edit_proxy_screen_leave (void) |
void | edit_proxy_set_network_settings (const regNetworkProfile_t *settings) |
void | edit_proxy_get_network_settings (regNetworkProfile_t *settings) |
gboolean | edit_proxy_check_network_settings (void) |
void | edit_proxy_restore_network_settings (void) |
void | edit_proxy_set_title (const char *profilename) |
gboolean | on_edit_proxy_keypress (GdkEventKey *event) |
Copyright (C) 2007 iRex Technologies BV.
Definition in file editScreenProxy.h.
gboolean edit_proxy_check_network_settings | ( | void | ) |
Definition at line 404 of file editScreenProxy.c.
00405 { 00406 proxyStatus_t status; 00407 gboolean valid = TRUE; 00408 00409 CN_LOGPRINTF("entry"); 00410 00411 status = edit_proxy_detect_status(); 00412 if (status != undefStatus_e) 00413 { 00414 valid = FALSE; 00415 } 00416 00417 CN_LOGPRINTF("return valid=%d", valid); 00418 return valid; 00419 }
GtkWidget* edit_proxy_create | ( | void | ) |
Definition at line 81 of file editScreenProxy.c.
00082 { 00083 CN_LOGPRINTF("entry"); 00084 00085 GtkWidget *item = NULL; 00086 GtkWidget *topVbox = NULL; 00087 GtkWidget *background = NULL; 00088 GtkWidget *alignment = NULL; 00089 GtkWidget *vbox = NULL; 00090 wdtLabelEntry *host = NULL; 00091 wdtLabelEntry *port = NULL; 00092 GtkWidget *info = NULL; 00093 GtkWidget *widget = NULL; 00094 00095 CN_LOGPRINTF("entry"); 00096 00097 // item 00098 item = gtk_settingitem_new(""); 00099 00100 // topVbox 00101 topVbox = gtk_vbox_new(FALSE, VBOX_SPACING); 00102 gtk_settingitem_add_details(GTK_SETTINGITEM(item), topVbox); 00103 00104 // background 00105 background = gtk_event_box_new(); 00106 gtk_widget_set_name(background, "bk_grey_666_140"); 00107 gtk_widget_set_size_request(background, 00108 BK_666_140_WIDTH, BK_666_140_HEIGHT); 00109 gtk_box_pack_start(GTK_BOX(topVbox), background, FALSE, FALSE, 0); 00110 00111 // alignment 00112 alignment = gtk_alignment_new(0.0, 0.0, 0, 0); 00113 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 00114 PADDING_TOP, PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT); 00115 gtk_container_add(GTK_CONTAINER(background), alignment); 00116 00117 // vbox 00118 vbox = gtk_vbox_new(FALSE, VBOX_SPACING); 00119 gtk_container_add(GTK_CONTAINER(alignment), vbox); 00120 00121 // host 00122 host = wdt_label_entry_new(string_e); 00123 gtk_box_pack_start(GTK_BOX(vbox), host->parent, FALSE, FALSE, 0); 00124 00125 // port 00126 port = wdt_label_entry_new(integer_e); 00127 gtk_box_pack_start(GTK_BOX(vbox), port->parent, FALSE, FALSE, 0); 00128 00129 // info item 00130 info = gtk_infoitem_new(FALSE); 00131 gtk_box_pack_start(GTK_BOX(topVbox), info, FALSE, FALSE, 0); 00132 00133 // signal handlers 00134 widget = port->button; 00135 g_signal_connect_after(G_OBJECT(widget), "toggled", 00136 G_CALLBACK(on_next), NULL); 00137 00138 // show the widgets 00139 gtk_widget_show(item); 00140 gtk_widget_show(topVbox); 00141 gtk_widget_show(background); 00142 gtk_widget_show(alignment); 00143 gtk_widget_show(vbox); 00144 gtk_widget_show(host->parent); 00145 gtk_widget_hide(host->button); 00146 gtk_widget_show(port->parent); 00147 gtk_widget_show(info); 00148 00149 // global variables 00150 g_proxy = item; 00151 g_host = host; 00152 g_port = port; 00153 g_info = info; 00154 00155 CN_LOGPRINTF("done"); 00156 00157 // return 00158 return item; 00159 }
void edit_proxy_get_network_settings | ( | regNetworkProfile_t * | settings | ) |
Definition at line 334 of file editScreenProxy.c.
00335 { 00336 const gchar *proxyhost = NULL; 00337 const gchar *proxyport = NULL; 00338 regProxySetting_t *proxySettings = NULL; 00339 00340 CN_LOGPRINTF("entry [%p]", settings); 00341 00342 g_return_if_fail(settings != NULL); 00343 g_return_if_fail(settings->proxy == TRUE); 00344 00345 // clear proxy settings 00346 proxySettings = settings->proxySettings; 00347 if (proxySettings) 00348 { 00349 g_free(proxySettings->address); 00350 g_free(proxySettings->port); 00351 g_free(proxySettings); 00352 proxySettings = NULL; 00353 settings->proxySettings = NULL; 00354 } 00355 00356 // get current value from screen objects 00357 proxyhost = edit_proxy_get_host(); 00358 proxyport = edit_proxy_get_port(); 00359 00360 // store new settings, if proxy selected 00361 if (settings->proxy == TRUE) 00362 { 00363 proxySettings = g_new0(regProxySetting_t, 1); 00364 if (proxySettings) 00365 { 00366 proxySettings->address = g_strdup(proxyhost); 00367 proxySettings->port = g_strdup(proxyport); 00368 } 00369 settings->proxySettings = proxySettings; 00370 } 00371 }
void edit_proxy_restore_network_settings | ( | void | ) |
Definition at line 443 of file editScreenProxy.c.
00444 { 00445 char *host = NULL; 00446 char *port = NULL; 00447 00448 CN_LOGPRINTF("entry"); 00449 00450 if (g_old_settings) 00451 { 00452 host = g_old_settings->address; 00453 port = g_old_settings->port; 00454 } 00455 00456 edit_proxy_set_host(host); 00457 edit_proxy_set_port(port); 00458 }
void edit_proxy_screen_leave | ( | void | ) |
Definition at line 460 of file editScreenProxy.c.
00461 { 00462 gboolean valid = TRUE; 00463 00464 CN_LOGPRINTF("entry"); 00465 00466 valid = edit_proxy_check_network_settings(); 00467 // force overview screen to no-proxy when proxy settings are empty 00468 if (!valid) 00469 { 00470 edit_overview_set_proxy(FALSE); 00471 } 00472 }
void edit_proxy_set_network_settings | ( | const regNetworkProfile_t * | settings | ) |
Definition at line 254 of file editScreenProxy.c.
00255 { 00256 char *profilename = NULL; 00257 char *proxyhost = NULL; 00258 char *proxyport = NULL; 00259 regProxySetting_t *proxySettings; 00260 00261 CN_LOGPRINTF("entry"); 00262 00263 g_return_if_fail(settings != NULL); 00264 // g_return_if_fail(settings->proxy == TRUE); 00265 00266 profilename = settings->name; 00267 00268 proxySettings = settings->proxySettings; 00269 if (proxySettings) 00270 { 00271 proxyhost = proxySettings->address; 00272 proxyport = proxySettings->port; 00273 } 00274 00275 edit_proxy_set_title(profilename); 00276 edit_proxy_set_host(proxyhost); 00277 edit_proxy_set_port(proxyport); 00278 00279 edit_proxy_determine_status(); 00280 00281 // a backup copy of settings 00282 edit_proxy_backup_network_settings(); 00283 }
void edit_proxy_set_text | ( | void | ) |
Definition at line 161 of file editScreenProxy.c.
00162 { 00163 GtkWidget *widget = NULL; 00164 00165 CN_LOGPRINTF("entry"); 00166 00167 if (g_proxy) 00168 { 00169 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_proxy), 00170 _("Network profile")); 00171 } 00172 00173 if (g_host) 00174 { 00175 widget = g_host->label; 00176 gtk_label_set_text(GTK_LABEL(widget), 00177 _("Enter the name or address of the HTTP proxy server:")); 00178 00179 } 00180 00181 if (g_port) 00182 { 00183 widget = g_port->label; 00184 gtk_label_set_text(GTK_LABEL(widget), 00185 _("Enter the port number of the HTTP proxy server:")); 00186 widget = g_port->button; 00187 gtk_button_set_label(GTK_BUTTON(widget), _("Next")); 00188 } 00189 00190 if (g_info) 00191 { 00192 gtk_infoitem_set_text( GTK_INFOITEM(g_info), 00193 _("Do not include the protocol (e.g. http://) " 00194 "and proxy number (e.g. 8080) " 00195 "in the name or address of the HTTP proxy server.\n" 00196 "Hint: If you do not know the proxy settings " 00197 "for this network, " 00198 "please ask your network administrator.")); 00199 } 00200 }
void edit_proxy_set_title | ( | const char * | profilename | ) |
Definition at line 285 of file editScreenProxy.c.
00286 { 00287 char *title = NULL; 00288 00289 CN_LOGPRINTF("entry[%s]", profilename); 00290 00291 if (g_proxy) 00292 { 00293 if (profilename) 00294 { 00295 title = g_strdup_printf(_("Network profile: %s/proxy"), 00296 profilename); 00297 } 00298 else 00299 { 00300 title = g_strdup(_("Network profile: proxy")); 00301 } 00302 00303 gtk_settingitem_set_header_text(GTK_SETTINGITEM(g_proxy), title); 00304 00305 g_free(title); 00306 } 00307 }
gboolean on_edit_proxy_keypress | ( | GdkEventKey * | event | ) |
Definition at line 513 of file editScreenProxy.c.
00514 { 00515 GtkToggleButton *button; 00516 gboolean ret = FALSE; 00517 00518 CN_LOGPRINTF("entry"); 00519 00520 switch (event->keyval) 00521 { 00522 case GDK_Return: 00523 // 'Enter' key is pressed 00524 // simulate clicking the 'Next' button 00525 if (g_port) 00526 { 00527 button = GTK_TOGGLE_BUTTON(g_port->button); 00528 gtk_toggle_button_set_active(button, TRUE); 00529 } 00530 ret = TRUE; 00531 break; 00532 00533 case GDK_F5: 00534 // 'UP' key is pressed 00535 // goto the one top level page 00536 cmgr_up_page(); 00537 ret = TRUE; 00538 break; 00539 00540 case GDK_Down: 00541 case GDK_Up: 00542 // avoid the standard GTK behaviour for GtkEntries 00543 erbusy_off(); 00544 ret = TRUE; 00545 00546 default: 00547 erbusy_off(); 00548 break; 00549 } 00550 00551 return ret; 00552 }