#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <liberdm/display.h>
#include <libergtk/ergtk.h>
#include "connectionMgrLog.h"
#include "displayStatus.h"
#include "gtkSettingItem.h"
#include "gtkProfileEntry.h"
#include "gtkProfileGroup.h"
#include "background.h"
#include "erbusy.h"
Go to the source code of this file.
connectionMgr - the network-profile group containing a header label a information label a list of gtkProfileEntry
Copyright (C) 2007 iRex Technologies BV.
Definition in file gtkProfileGroup.c.
static GtkWidget * create_list | ( | GtkProfileGroup * | profileGroup | ) | [static] |
Definition at line 296 of file gtkProfileGroup.c.
00297 { 00298 GtkWidget *vbox; 00299 GtkWidget *profile; 00300 GtkWidget *selection; 00301 GtkWidget *nameButton, *editButton; 00302 GtkToggleButton **button_tbl; 00303 GtkProfileEntry **profileEntries; 00304 int i; 00305 00306 // malloc the memory 00307 CN_LOGPRINTF("profileGroup->nProfiles=%d", profileGroup->nProfiles); 00308 profileEntries = g_new0(GtkProfileEntry*, profileGroup->nProfiles); 00309 g_assert(profileEntries != NULL); 00310 button_tbl = g_new0(GtkToggleButton*, (profileGroup->nProfiles+1)); 00311 g_assert(button_tbl != NULL); 00312 00313 // vbox 00314 vbox = gtk_vbox_new(FALSE, PROFILE_GROUP_ENTRY_SPACING); 00315 00316 // profile1...N 00317 for (i = 0; i < profileGroup->nProfiles; i++) 00318 { 00319 profile = gtk_profile_entry_new (); 00320 gtk_box_pack_start (GTK_BOX (vbox), profile, FALSE, FALSE, 0); 00321 profileEntries[i] = GTK_PROFILE_ENTRY(profile); 00322 00323 editButton = gtk_profile_entry_get_editbutton(profileEntries[i]); 00324 nameButton = gtk_profile_entry_get_namebutton(profileEntries[i]); 00325 g_signal_connect(G_OBJECT(nameButton), "button-press-event", 00326 G_CALLBACK(on_profile_group_name_button_press), profileGroup); 00327 g_signal_connect(G_OBJECT(editButton), "button-press-event", 00328 G_CALLBACK(on_profile_group_edit_button_press), profileGroup); 00329 00330 // selection 00331 if (profileGroup->mode == editMode_e) 00332 { 00333 gtk_profile_entry_show_edit_button(profileEntries[i], TRUE); 00334 button_tbl[i] = GTK_TOGGLE_BUTTON (editButton); 00335 } 00336 else 00337 { 00338 gtk_profile_entry_show_edit_button(profileEntries[i], FALSE); 00339 button_tbl[i] = GTK_TOGGLE_BUTTON (nameButton); 00340 } 00341 } 00342 00343 // selection 00344 button_tbl[profileGroup->nProfiles] = NULL; 00345 selection = ergtk_selection_group_new (button_tbl); 00346 ergtk_selection_group_set_details(ERGTK_SELECTION_GROUP(selection), 00347 0, 1); 00348 00349 g_signal_connect (G_OBJECT (selection), "selection-update", 00350 G_CALLBACK (on_profile_group_selection_update), profileGroup); 00351 00352 // free the memory 00353 g_free(button_tbl); 00354 button_tbl = NULL; 00355 00356 // set the values of profileGroup 00357 profileGroup->profileEntries = profileEntries; 00358 profileGroup->selection = selection; 00359 profileGroup->nDisplayed = 0; 00360 00361 return vbox; 00362 }
static int get_button_index | ( | GtkProfileGroup * | profileGroup, | |
GtkWidget * | button, | |||
gboolean | edit | |||
) | [static] |
Definition at line 659 of file gtkProfileGroup.c.
00662 { 00663 GtkProfileEntry* profileEntry; 00664 GtkWidget* nameEditBtn; 00665 gint i, profileIndex = -1; 00666 00667 for (i = 0; i < profileGroup->nProfiles; i++) 00668 { 00669 profileEntry = profileGroup->profileEntries[i]; 00670 if (edit) 00671 { 00672 nameEditBtn = gtk_profile_entry_get_editbutton(profileEntry); 00673 } 00674 else 00675 { 00676 nameEditBtn = gtk_profile_entry_get_namebutton(profileEntry); 00677 } 00678 00679 if (nameEditBtn == button) 00680 { 00681 profileIndex = i; 00682 CN_LOGPRINTF("button press event: profileIndex=%d", 00683 profileIndex); 00684 break; 00685 } 00686 } 00687 00688 return profileIndex; 00689 }
void gtk_profile_group_callback_on_buttons_clicked | ( | GtkProfileGroup * | profileGroup, | |
on_profile_group_selection_update_t * | on_name, | |||
on_profile_group_selection_update_t * | on_edit | |||
) |
Definition at line 603 of file gtkProfileGroup.c.
00606 { 00607 CN_LOGPRINTF("entry"); 00608 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00609 00610 profileGroup->callback_on_name = on_name; 00611 profileGroup->callback_on_edit = on_edit; 00612 }
void gtk_profile_group_callback_on_buttons_press | ( | GtkProfileGroup * | profileGroup, | |
on_profile_group_button_press_t * | on_name_press, | |||
on_profile_group_button_press_t * | on_edit_press | |||
) |
Definition at line 614 of file gtkProfileGroup.c.
00617 { 00618 CN_LOGPRINTF("entry"); 00619 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00620 00621 profileGroup->callback_on_name_press = on_name_press; 00622 profileGroup->callback_on_edit_press = on_edit_press; 00623 }
static void gtk_profile_group_class_init | ( | GtkProfileGroupClass * | klass | ) | [static] |
static void gtk_profile_group_create | ( | GtkProfileGroup * | profileGroup, | |
int | nProfiles, | |||
profileGroupMode_t | mode | |||
) | [static] |
Definition at line 168 of file gtkProfileGroup.c.
00171 { 00172 CN_LOGPRINTF("entry"); 00173 00174 GtkWidget* item; 00175 GtkWidget* background; 00176 GtkWidget* alignment; 00177 GtkWidget* vbox; 00178 GtkWidget* dialup; 00179 GtkWidget* dialupLabel; 00180 GtkWidget* dialupSigHbox; 00181 GtkWidget* dialupSigImage; 00182 GtkWidget* label; 00183 GtkWidget* list; 00184 00185 CN_LOGPRINTF("nProfiles[%d] mode[%d]", nProfiles, mode); 00186 00187 g_return_if_fail((mode == editMode_e) || (mode == connectMode_e)); 00188 00189 // set the values of profileGroup 00190 profileGroup->nProfiles = nProfiles; 00191 profileGroup->mode = mode; 00192 00193 // item 00194 item = gtk_settingitem_new(""); 00195 gtk_container_add(GTK_CONTAINER(profileGroup), item); 00196 gtk_widget_show(item); 00197 00198 // background 00199 background = gtk_event_box_new(); 00200 gtk_widget_set_name(background, "profile_group_background"); 00201 gtk_widget_set_size_request(background, 00202 PROFILE_GROUP_WIDTH, 00203 PROFILE_GROUP_HEIGHT); 00204 gtk_settingitem_add_details(GTK_SETTINGITEM(item), background); 00205 gtk_widget_show(background); 00206 00207 // alignment 00208 alignment = gtk_alignment_new(0.0, 0.0, 0.0, 0.0); 00209 gtk_alignment_set_padding(GTK_ALIGNMENT(alignment), 00210 PROFILE_GROUP_PADDING_TOP, 00211 PROFILE_GROUP_PADDING_BOTTOM, 00212 PROFILE_GROUP_PADDING_LEFT, 00213 PROFILE_GROUP_PADDING_RIGHT); 00214 gtk_container_add(GTK_CONTAINER(background), alignment); 00215 gtk_widget_show(alignment); 00216 00217 // vbox 00218 vbox = gtk_vbox_new(FALSE, PROFILE_GROUP_SPACING); 00219 gtk_container_add(GTK_CONTAINER(alignment), vbox); 00220 gtk_widget_show(vbox); 00221 00222 // dialup 00223 dialup = gtk_vbox_new(FALSE, PROFILE_GROUP_DIALUP_SPACING); 00224 gtk_box_pack_start(GTK_BOX(vbox), dialup, FALSE, FALSE, 0); 00225 00226 // dialupLabel 00227 dialupLabel = gtk_label_new(""); 00228 gtk_widget_set_name (dialupLabel, "profile_group_info_text"); 00229 gtk_widget_set_size_request(dialupLabel, 00230 (-1), PROFILE_GROUP_DIALUP_LABEL_HEIGHT); 00231 gtk_label_set_justify (GTK_LABEL(dialupLabel), GTK_JUSTIFY_LEFT); 00232 gtk_misc_set_alignment(GTK_MISC(dialupLabel), 0.0, 0.0); 00233 gtk_box_pack_start (GTK_BOX (dialup), dialupLabel, FALSE, FALSE, 0); 00234 gtk_widget_show(dialupLabel); 00235 00236 // signal quality images. 00237 dialupSigHbox = gtk_hbox_new(FALSE, 0); 00238 gtk_widget_set_size_request(GTK_WIDGET(dialupSigHbox), 00239 PROFILE_GROUP_DIALUP_SIGIMG_WIDTH, 00240 PROFILE_GROUP_DIALUP_SIGIMG_HEIGHT); 00241 gtk_box_pack_start(GTK_BOX(dialup), dialupSigHbox, FALSE, FALSE, 0); 00242 gtk_widget_show(dialupSigHbox); 00243 00244 // signal images 00245 int i; 00246 char bgStyle[] = "profile_entry_signal0_background"; 00247 for (i = 0; i < 5; i++) 00248 { 00249 dialupSigImage = gtk_event_box_new(); 00250 gtk_widget_set_size_request(GTK_WIDGET(dialupSigImage), 00251 PROFILE_GROUP_DIALUP_SIGIMG_WIDTH, 00252 PROFILE_GROUP_DIALUP_SIGIMG_HEIGHT); 00253 snprintf(bgStyle, sizeof(bgStyle), 00254 "profile_entry_signal%d_background", i); 00255 gtk_widget_set_name(GTK_WIDGET(dialupSigImage), bgStyle); 00256 gtk_box_pack_start(GTK_BOX(dialupSigHbox), dialupSigImage, 00257 FALSE, FALSE, 0); 00258 profileGroup->dialupSigImage[i] = dialupSigImage; 00259 } 00260 00261 // label 00262 label = gtk_label_new(""); 00263 gtk_widget_set_name (label, "profile_group_info_text"); 00264 gtk_widget_set_size_request(GTK_WIDGET(label), 00265 PROFILE_GROUP_INFO_WIDTH, 00266 (-1) ); 00267 gtk_label_set_justify (GTK_LABEL(label), GTK_JUSTIFY_LEFT); 00268 gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.0); 00269 gtk_label_set_line_wrap(GTK_LABEL(label), TRUE); 00270 gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); 00271 gtk_widget_show(label); 00272 00273 // list 00274 list = create_list(profileGroup); 00275 gtk_box_pack_start(GTK_BOX(vbox), list, FALSE, FALSE, 0); 00276 gtk_widget_show(list); 00277 00278 // set the values of profileGroup 00279 profileGroup->item = item; 00280 profileGroup->background = background; 00281 profileGroup->infoLabel = label; 00282 00283 profileGroup->dialup = dialup; 00284 profileGroup->dialupLabel = dialupLabel; 00285 profileGroup->dialupSigHbox = dialupSigHbox; 00286 00287 // gtk_profile_group_set_height(profileGroup); 00288 00289 CN_LOGPRINTF("done"); 00290 }
void gtk_profile_group_display_settings | ( | GtkProfileGroup * | profileGroup, | |
int | profileIndex, | |||
const networkProfile_t * | settings, | |||
gboolean | resetStatus | |||
) |
Definition at line 492 of file gtkProfileGroup.c.
00496 { 00497 CN_LOGPRINTF("entry"); 00498 00499 GtkProfileEntry *profileEntry; 00500 00501 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00502 g_return_if_fail((profileIndex >= 0) && (profileIndex < profileGroup->nProfiles)); 00503 g_return_if_fail(settings != NULL ); 00504 00505 profileEntry = gtk_profile_group_get_profile_entry(profileGroup, 00506 profileIndex); 00507 g_return_if_fail(profileEntry != NULL); 00508 00509 if (resetStatus) 00510 { 00511 gtk_profile_entry_display_settings (profileEntry, settings, ""); 00512 } 00513 else 00514 { 00515 gtk_profile_entry_display_settings (profileEntry, settings, NULL); 00516 } 00517 gtk_profile_entry_set_buttons_active(profileEntry, FALSE, FALSE); 00518 }
profileGroupMode_t gtk_profile_group_get_mode | ( | GtkProfileGroup * | profileGroup | ) |
Definition at line 101 of file gtkProfileGroup.c.
00102 { 00103 CN_LOGPRINTF("entry"); 00104 00105 profileGroupMode_t mode = modeUndef_e; 00106 00107 g_return_val_if_fail(IS_GTK_PROFILE_GROUP(profileGroup), mode); 00108 00109 mode = profileGroup->mode; 00110 00111 return mode; 00112 }
static GtkProfileEntry* gtk_profile_group_get_profile_entry | ( | GtkProfileGroup * | profileGroup, | |
gint | profileIndex | |||
) | [static] |
Definition at line 449 of file gtkProfileGroup.c.
00451 { 00452 CN_LOGPRINTF("entry [%p] [%d]", profileGroup, profileIndex); 00453 00454 GtkProfileEntry *profileEntry = NULL; 00455 00456 g_return_val_if_fail(IS_GTK_PROFILE_GROUP(profileGroup), NULL); 00457 00458 CN_LOGPRINTF("entry profile[%d]", profileGroup->nProfiles); 00459 00460 if ((profileIndex >= 0) && (profileIndex < profileGroup->nProfiles)) 00461 { 00462 CN_LOGPRINTF("entry profileEntries[%p]", 00463 profileGroup->profileEntries); 00464 profileEntry = profileGroup->profileEntries[profileIndex]; 00465 } 00466 00467 CN_LOGPRINTF("ret[%p]", profileEntry); 00468 return profileEntry; 00469 }
gint gtk_profile_group_get_selected_profile_index | ( | GtkProfileGroup * | profileGroup | ) |
Definition at line 427 of file gtkProfileGroup.c.
00428 { 00429 guint profileIndex; 00430 erGtkSelectionGroup *selection; 00431 00432 g_return_val_if_fail(IS_GTK_PROFILE_GROUP(profileGroup), -1); 00433 g_return_val_if_fail(ERGTK_IS_SELECTION_GROUP(profileGroup->selection), -1); 00434 00435 selection = ERGTK_SELECTION_GROUP(profileGroup->selection); 00436 ergtk_selection_group_get_selected_buttons(selection, &profileIndex, 1); 00437 if ((profileIndex >= 0) && (profileIndex < profileGroup->nDisplayed)) 00438 { 00439 CN_LOGPRINTF("profileIndex=%d", profileIndex); 00440 return profileIndex; 00441 } 00442 else 00443 { 00444 return (-1); 00445 } 00446 }
GType gtk_profile_group_get_type | ( | void | ) |
Definition at line 115 of file gtkProfileGroup.c.
00116 { 00117 static GType profile_group_type = 0; 00118 00119 if (!profile_group_type) 00120 { 00121 static const GTypeInfo profile_group_info = { 00122 sizeof(GtkProfileGroupClass), /* class_size */ 00123 NULL, /* base_init */ 00124 NULL, /* base_finalize */ 00125 (GClassInitFunc) gtk_profile_group_class_init,/* class_init */ 00126 NULL, /* class_finalize */ 00127 NULL, /* class_data */ 00128 sizeof(GtkProfileGroup), /* instance_size */ 00129 0, /* n_preallocs */ 00130 (GInstanceInitFunc) gtk_profile_group_init, /* instance_init */ 00131 0 /* value_table */ 00132 }; 00133 00134 profile_group_type = g_type_register_static(GTK_TYPE_EVENT_BOX, 00135 "ProfileGroup", 00136 &profile_group_info, 00137 0); 00138 } 00139 00140 return profile_group_type; 00141 }
static void gtk_profile_group_init | ( | GtkProfileGroup * | profileGroup | ) | [static] |
GtkWidget* gtk_profile_group_new | ( | int | nProfiles, | |
profileGroupMode_t | mode | |||
) |
Definition at line 66 of file gtkProfileGroup.c.
00067 { 00068 GtkProfileGroup *profileGroup = NULL; 00069 00070 profileGroup = (GtkProfileGroup*)g_object_new(GTK_PROFILE_GROUP_TYPE, 00071 NULL); 00072 gtk_profile_group_create(profileGroup, nProfiles, mode); 00073 00074 return GTK_WIDGET(profileGroup); 00075 }
void gtk_profile_group_select_first_profile | ( | GtkProfileGroup * | profileGroup | ) |
Definition at line 879 of file gtkProfileGroup.c.
00880 { 00881 CN_LOGPRINTF ("entry"); 00882 00883 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00884 if (profileGroup->nDisplayed > 0) 00885 { 00886 gtk_profile_group_select_profile (profileGroup, 0); 00887 } 00888 }
void gtk_profile_group_select_last_profile | ( | GtkProfileGroup * | profileGroup | ) |
Definition at line 890 of file gtkProfileGroup.c.
00891 { 00892 CN_LOGPRINTF ("entry"); 00893 00894 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00895 if (profileGroup->nDisplayed > 0) 00896 { 00897 gtk_profile_group_select_profile (profileGroup, 00898 profileGroup->nDisplayed-1); 00899 } 00900 }
gboolean gtk_profile_group_select_next_profile | ( | GtkProfileGroup * | profileGroup | ) |
Definition at line 902 of file gtkProfileGroup.c.
00903 { 00904 CN_LOGPRINTF ("entry"); 00905 00906 erGtkSelectionGroup *selection; 00907 guint profileIndex; 00908 gboolean selected = FALSE; // no profile selected (yet) 00909 00910 g_return_val_if_fail(IS_GTK_PROFILE_GROUP(profileGroup), FALSE); 00911 00912 selection = ERGTK_SELECTION_GROUP(profileGroup->selection); 00913 ergtk_selection_group_get_selected_buttons(selection, 00914 &profileIndex, 1); 00915 if ((profileIndex >= 0) && (profileIndex < profileGroup->nDisplayed)) 00916 { 00917 // select next profile 00918 if ((profileIndex + 1) < profileGroup->nDisplayed) 00919 { 00920 gtk_profile_group_select_profile(profileGroup, 00921 profileIndex + 1); 00922 selected = TRUE; 00923 } 00924 } 00925 return selected; 00926 }
gboolean gtk_profile_group_select_previous_profile | ( | GtkProfileGroup * | profileGroup | ) |
Definition at line 928 of file gtkProfileGroup.c.
00929 { 00930 CN_LOGPRINTF ("entry"); 00931 00932 erGtkSelectionGroup *selection; 00933 guint profileIndex; 00934 gboolean selected = FALSE; // no profile selected (yet) 00935 00936 g_return_val_if_fail(IS_GTK_PROFILE_GROUP(profileGroup), FALSE); 00937 00938 selection = ERGTK_SELECTION_GROUP(profileGroup->selection); 00939 ergtk_selection_group_get_selected_buttons(selection, &profileIndex, 1); 00940 if ((profileIndex >= 0) && (profileIndex < profileGroup->nDisplayed)) 00941 { 00942 // select previous profile 00943 if ((profileIndex - 1) > 0) 00944 { 00945 gtk_profile_group_select_profile(profileGroup, profileIndex-1); 00946 selected = TRUE; 00947 } 00948 } 00949 return selected; 00950 }
void gtk_profile_group_select_profile | ( | GtkProfileGroup * | profileGroup, | |
guint | profileIndex | |||
) |
Definition at line 952 of file gtkProfileGroup.c.
00954 { 00955 CN_LOGPRINTF ("entry: profileIndex [%d]", profileIndex); 00956 00957 erGtkSelectionGroup *selection; 00958 guint selectedIndex; 00959 GtkProfileEntry *profileEntry; 00960 00961 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00962 00963 // specified profile must be valid range for current screen 00964 if ((profileIndex >= 0) && (profileIndex < profileGroup->nProfiles)) 00965 { 00966 profileEntry = profileGroup->profileEntries[profileIndex]; 00967 g_return_if_fail(profileEntry != NULL); 00968 00969 if (profileGroup->mode == deleteMode_e) 00970 { 00971 gtk_profile_entry_set_buttons_active(profileEntry, TRUE, FALSE); 00972 } 00973 else 00974 { 00975 // get the current selection 00976 selection = ERGTK_SELECTION_GROUP(profileGroup->selection); 00977 ergtk_selection_group_get_selected_buttons(selection, 00978 &selectedIndex, 1); 00979 if (profileIndex != selectedIndex) 00980 { 00981 if (profileGroup->mode == editMode_e) 00982 { 00983 gtk_profile_entry_set_buttons_active(profileEntry, 00984 FALSE, TRUE); 00985 } 00986 else 00987 { 00988 gtk_profile_entry_set_buttons_active(profileEntry, 00989 TRUE, FALSE); 00990 } 00991 } 00992 } 00993 } 00994 }
void gtk_profile_group_set_dialup_signal_image | ( | GtkProfileGroup * | profileGroup, | |
guint | quality | |||
) |
Definition at line 537 of file gtkProfileGroup.c.
00539 { 00540 CN_LOGPRINTF("entry profileGroup[%p] quality[%d]", 00541 profileGroup, quality); 00542 00543 int i; 00544 00545 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00546 g_return_if_fail((quality >= 0) && (quality <= 100)); 00547 00548 // hide all signal images firstly 00549 for (i = 0; i < 5; i++) 00550 { 00551 gtk_widget_hide(profileGroup->dialupSigImage[i]); 00552 } 00553 00554 // show one correct signal image secondly 00555 if (quality <= 0) 00556 { 00557 gtk_widget_show(profileGroup->dialupSigImage[0]); 00558 } 00559 else if (quality <= 25) 00560 { 00561 gtk_widget_show(profileGroup->dialupSigImage[1]); 00562 } 00563 else if (quality <= 50) 00564 { 00565 gtk_widget_show(profileGroup->dialupSigImage[2]); 00566 } 00567 else if (quality <= 75) 00568 { 00569 gtk_widget_show(profileGroup->dialupSigImage[3]); 00570 } 00571 else 00572 { 00573 gtk_widget_show(profileGroup->dialupSigImage[4]); 00574 } 00575 }
void gtk_profile_group_set_dialup_text | ( | GtkProfileGroup * | profileGroup, | |
gchar * | text | |||
) |
Definition at line 394 of file gtkProfileGroup.c.
00396 { 00397 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00398 00399 if (text) 00400 { 00401 CN_LOGPRINTF("text [%s]", text); 00402 gtk_label_set_text(GTK_LABEL(profileGroup->dialupLabel), text); 00403 } 00404 }
void gtk_profile_group_set_editbuttons_text | ( | GtkProfileGroup * | profileGroup, | |
gchar * | editText | |||
) |
Definition at line 406 of file gtkProfileGroup.c.
00408 { 00409 int i; 00410 GtkProfileEntry* profileEntry; 00411 00412 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00413 00414 if (editText) 00415 { 00416 CN_LOGPRINTF("editButton [%s]", editText); 00417 00418 for ( i= 0; i < profileGroup->nProfiles; i++) 00419 { 00420 profileEntry = profileGroup->profileEntries[i]; 00421 gtk_profile_entry_set_editbutton_text(profileEntry, editText); 00422 } 00423 } 00424 }
void gtk_profile_group_set_header_text | ( | GtkProfileGroup * | profileGroup, | |
gchar * | headerText | |||
) |
Definition at line 380 of file gtkProfileGroup.c.
00382 { 00383 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00384 00385 if (headerText) 00386 { 00387 CN_LOGPRINTF("headerLabel [%s]", headerText); 00388 00389 gtk_settingitem_set_header_text(GTK_SETTINGITEM(profileGroup->item), 00390 headerText); 00391 } 00392 }
void gtk_profile_group_set_info_text | ( | GtkProfileGroup * | profileGroup, | |
gchar * | infoText | |||
) |
Definition at line 365 of file gtkProfileGroup.c.
00367 { 00368 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00369 00370 if (infoText) 00371 { 00372 CN_LOGPRINTF("infoLabel [%s]", infoText); 00373 00374 gtk_label_set_text(GTK_LABEL(profileGroup->infoLabel), infoText); 00375 gtk_widget_show(profileGroup->infoLabel); 00376 } 00377 }
void gtk_profile_group_set_mode | ( | GtkProfileGroup * | profileGroup, | |
profileGroupMode_t | mode | |||
) |
Definition at line 77 of file gtkProfileGroup.c.
00079 { 00080 CN_LOGPRINTF("entry"); 00081 00082 profileGroupMode_t oldMode; 00083 00084 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00085 g_return_if_fail((mode >= 0) && (mode < modeUndef_e)); 00086 00087 if (mode == deleteMode_e) 00088 { 00089 oldMode = gtk_profile_group_get_mode(profileGroup); 00090 if (oldMode == editMode_e) 00091 { 00092 profileGroup->mode = mode; 00093 } 00094 } 00095 else 00096 { 00097 profileGroup->mode = mode; 00098 } 00099 }
void gtk_profile_group_set_status_text | ( | GtkProfileGroup * | profileGroup, | |
int | profileIndex, | |||
gchar * | text, | |||
gboolean | flashing | |||
) |
Definition at line 472 of file gtkProfileGroup.c.
00476 { 00477 GtkProfileEntry *profileEntry; 00478 00479 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00480 g_return_if_fail((profileIndex >= 0) && (profileIndex < profileGroup->nProfiles)); 00481 g_return_if_fail(text != NULL ); 00482 00483 profileEntry = gtk_profile_group_get_profile_entry(profileGroup, 00484 profileIndex); 00485 g_return_if_fail(profileEntry != NULL); 00486 00487 gtk_profile_entry_set_status (profileEntry, text); 00488 gtk_profile_entry_set_status_flashing (profileEntry, flashing); 00489 }
void gtk_profile_group_show_dialup | ( | GtkProfileGroup * | profileGroup, | |
gboolean | show | |||
) |
Definition at line 520 of file gtkProfileGroup.c.
00522 { 00523 CN_LOGPRINTF("entry profileGroup[%p] show[%d]", profileGroup, show); 00524 00525 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00526 00527 if (show) 00528 { 00529 gtk_widget_show(profileGroup->dialup); 00530 } 00531 else 00532 { 00533 gtk_widget_hide(profileGroup->dialup); 00534 } 00535 }
void gtk_profile_group_show_profile_entries | ( | GtkProfileGroup * | profileGroup, | |
guint | nDisplayed | |||
) |
Definition at line 578 of file gtkProfileGroup.c.
00580 { 00581 int i; 00582 CN_LOGPRINTF("entry nDisplayed[%d]", nDisplayed); 00583 g_return_if_fail(IS_GTK_PROFILE_GROUP(profileGroup)); 00584 00585 i = 0; 00586 while (i < nDisplayed && i < profileGroup->nProfiles) 00587 { 00588 gtk_widget_show(GTK_WIDGET(profileGroup->profileEntries[i])); 00589 i++; 00590 } 00591 while (i < profileGroup->nProfiles) 00592 { 00593 gtk_widget_hide(GTK_WIDGET(profileGroup->profileEntries[i])); 00594 i++; 00595 } 00596 00597 // set the values of profileGroup 00598 profileGroup->nDisplayed = nDisplayed; 00599 00600 // gtk_profile_group_set_height(profileGroup); 00601 }
void gtk_profile_group_unselect_profile | ( | GtkProfileGroup * | profileGroup, | |
guint | profileIndex | |||
) |
Definition at line 996 of file gtkProfileGroup.c.
00998 { 00999 CN_LOGPRINTF ("entry"); 01000 01001 GtkProfileEntry* profileEntry; 01002 01003 if ((profileIndex >= 0) && (profileIndex < profileGroup->nProfiles)) 01004 { 01005 profileEntry = profileGroup->profileEntries[profileIndex]; 01006 if (profileEntry) 01007 { 01008 gtk_profile_entry_set_buttons_active(profileEntry, 01009 FALSE, FALSE); 01010 } 01011 } 01012 }
static gboolean on_profile_group_edit_button_press | ( | GtkWidget * | button, | |
GdkEventButton * | event, | |||
gpointer | data | |||
) | [static] |
Definition at line 739 of file gtkProfileGroup.c.
00742 { 00743 CN_LOGPRINTF("entry"); 00744 00745 GtkProfileGroup* profileGroup; 00746 gint profileIndex = -1; 00747 gboolean active; 00748 gboolean ret = FALSE; 00749 00750 g_return_val_if_fail(GTK_IS_TOGGLE_BUTTON(button), FALSE); 00751 g_return_val_if_fail(IS_GTK_PROFILE_GROUP(data), FALSE); 00752 00753 profileGroup = GTK_PROFILE_GROUP(data); 00754 profileIndex = get_button_index(profileGroup, button, TRUE); 00755 g_return_val_if_fail(profileIndex != -1, FALSE); 00756 00757 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); 00758 switch (profileGroup->mode) 00759 { 00760 case editMode_e: 00761 ret = FALSE; 00762 break; 00763 case connectMode_e: 00764 ret = TRUE; 00765 break; 00766 case deleteMode_e: 00767 ret = TRUE; 00768 break; 00769 default: 00770 break; 00771 } 00772 00773 return ret; 00774 }
guint on_profile_group_keypress | ( | GtkProfileGroup * | profileGroup, | |
GdkEventKey * | event | |||
) |
Definition at line 823 of file gtkProfileGroup.c.
00825 { 00826 CN_LOGPRINTF ("entry"); 00827 00828 gboolean selected; 00829 gboolean displayUpdated = FALSE; 00830 guint returnValue = 0;// return FALSE => default gtk handling 00831 00832 switch (event->keyval) 00833 { 00834 case GDK_Down: 00835 // select next profile 00836 selected = gtk_profile_group_select_next_profile (profileGroup); 00837 if (!selected) 00838 { 00839 gtk_profile_group_select_first_profile (profileGroup); 00840 } 00841 displayUpdated = TRUE; 00842 // return TRUE => stop event handling 00843 returnValue = 1; 00844 break; 00845 00846 case GDK_Up: 00847 // select previous profile 00848 selected = gtk_profile_group_select_previous_profile(profileGroup); 00849 if (!selected) 00850 { 00851 gtk_profile_group_select_last_profile (profileGroup); 00852 } 00853 displayUpdated = TRUE; 00854 //return TRUE => stop event handling 00855 returnValue = 1; 00856 break; 00857 00858 case GDK_Return:// TODO 00859 default: 00860 CN_ERRORPRINTF ("-- case default"); 00861 erbusy_off (); 00862 } 00863 00864 // show the changes on screen 00865 if (displayUpdated) 00866 { 00867 display_update_request_screen_refresh (STATUS_ITEM_CHANGE, 00868 WAVEFORM_TYPING); 00869 } 00870 00871 return returnValue; 00872 }
static gboolean on_profile_group_name_button_press | ( | GtkWidget * | button, | |
GdkEventButton * | event, | |||
gpointer | data | |||
) | [static] |
Definition at line 691 of file gtkProfileGroup.c.
00694 { 00695 CN_LOGPRINTF("entry"); 00696 00697 GtkProfileGroup* profileGroup; 00698 gint profileIndex = -1; 00699 gboolean active; 00700 gboolean ret = FALSE; 00701 00702 g_return_val_if_fail(GTK_IS_TOGGLE_BUTTON(button), FALSE); 00703 g_return_val_if_fail(IS_GTK_PROFILE_GROUP(data), FALSE); 00704 00705 profileGroup = GTK_PROFILE_GROUP(data); 00706 profileIndex = get_button_index(profileGroup, button, FALSE); 00707 g_return_val_if_fail(profileIndex != -1, FALSE); 00708 00709 active = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(button)); 00710 switch (profileGroup->mode) 00711 { 00712 case editMode_e: 00713 // make the name buttons in edit mode un-clicked 00714 ret = TRUE; 00715 break; 00716 case connectMode_e: 00717 if (profileGroup->callback_on_name_press) 00718 { 00719 ret = profileGroup->callback_on_name_press(profileGroup, 00720 profileIndex, 00721 active); 00722 } 00723 break; 00724 case deleteMode_e: 00725 if (profileGroup->callback_on_name_press) 00726 { 00727 ret = profileGroup->callback_on_name_press(profileGroup, 00728 profileIndex, 00729 active); 00730 } 00731 break; 00732 default: 00733 break; 00734 } 00735 00736 return ret; 00737 }
static void on_profile_group_selection_update | ( | erGtkSelectionGroup * | selection, | |
gpointer | button, | |||
gpointer | data | |||
) | [static] |
Definition at line 776 of file gtkProfileGroup.c.
00779 { 00780 CN_LOGPRINTF("entry"); 00781 00782 GtkProfileGroup* profileGroup; 00783 guint profileIndex; 00784 GtkToggleButton* btn; 00785 gboolean active; 00786 00787 g_return_if_fail(ERGTK_IS_SELECTION_GROUP(selection)); 00788 g_return_if_fail(GTK_IS_TOGGLE_BUTTON(button)); 00789 g_return_if_fail(IS_GTK_PROFILE_GROUP(data)); 00790 00791 profileGroup = GTK_PROFILE_GROUP(data); 00792 if (profileGroup->mode == deleteMode_e) 00793 { 00794 CN_WARNPRINTF("in delete mode, ignore selection-update signal"); 00795 } 00796 00797 btn = GTK_TOGGLE_BUTTON(button); 00798 active = gtk_toggle_button_get_active(btn); 00799 if (active) 00800 { 00801 ergtk_selection_group_get_selected_buttons(selection, 00802 &profileIndex, 1); 00803 g_return_if_fail((profileIndex >= 0) && (profileIndex < profileGroup->nDisplayed)); 00804 00805 if (profileGroup->mode == editMode_e) 00806 { 00807 if (profileGroup->callback_on_edit) 00808 { 00809 profileGroup->callback_on_edit(profileGroup, profileIndex); 00810 } 00811 } 00812 else 00813 { 00814 if (profileGroup->callback_on_name) 00815 { 00816 profileGroup->callback_on_name(profileGroup, profileIndex); 00817 } 00818 } 00819 } 00820 }