#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include <glib.h>
#include "gtkProfileEntry.h"
Go to the source code of this file.
#define GTK_PROFILE_GROUP | ( | obj | ) |
Value:
(G_TYPE_CHECK_INSTANCE_CAST ((obj), \ GTK_PROFILE_GROUP_TYPE, GtkProfileGroup))
Definition at line 61 of file gtkProfileGroup.h.
#define GTK_PROFILE_GROUP_CLASS | ( | klass | ) |
Value:
(G_TYPE_CHECK_CLASS_CAST ((klass), \ GTK_PROFILE_GROUP_TYPE, \ GtkProfileGroupClass))
Definition at line 63 of file gtkProfileGroup.h.
#define GTK_PROFILE_GROUP_TYPE (gtk_profile_group_get_type ()) |
Definition at line 60 of file gtkProfileGroup.h.
#define IS_GTK_PROFILE_GROUP | ( | obj | ) |
Value:
(G_TYPE_CHECK_INSTANCE_TYPE ((obj), \ GTK_PROFILE_GROUP_TYPE))
Definition at line 66 of file gtkProfileGroup.h.
#define IS_GTK_PROFILE_GROUP_CLASS | ( | klass | ) |
Value:
(G_TYPE_CHECK_CLASS_TYPE ((klass), \ GTK_PROFILE_GROUP_TYPE))
Definition at line 68 of file gtkProfileGroup.h.
#define PROFILE_GROUP_DIALUP_LABEL_HEIGHT 27 |
Definition at line 49 of file gtkProfileGroup.h.
#define PROFILE_GROUP_DIALUP_LABEL_WIDTH 666 |
Definition at line 48 of file gtkProfileGroup.h.
#define PROFILE_GROUP_DIALUP_SIGIMG_HEIGHT 27 |
Definition at line 53 of file gtkProfileGroup.h.
#define PROFILE_GROUP_DIALUP_SIGIMG_WIDTH 37 |
Definition at line 52 of file gtkProfileGroup.h.
#define PROFILE_GROUP_DIALUP_SPACING 12 |
Definition at line 51 of file gtkProfileGroup.h.
#define PROFILE_GROUP_ENTRY_SPACING 12 |
Definition at line 58 of file gtkProfileGroup.h.
#define PROFILE_GROUP_HEIGHT 547 |
Definition at line 39 of file gtkProfileGroup.h.
#define PROFILE_GROUP_INFO_HEIGHT 27 |
Definition at line 56 of file gtkProfileGroup.h.
#define PROFILE_GROUP_INFO_WIDTH 640 |
Definition at line 55 of file gtkProfileGroup.h.
#define PROFILE_GROUP_PADDING_BOTTOM 10 |
Definition at line 44 of file gtkProfileGroup.h.
#define PROFILE_GROUP_PADDING_LEFT 13 |
Definition at line 45 of file gtkProfileGroup.h.
#define PROFILE_GROUP_PADDING_RIGHT 13 |
Definition at line 46 of file gtkProfileGroup.h.
#define PROFILE_GROUP_PADDING_TOP 10 |
Definition at line 43 of file gtkProfileGroup.h.
#define PROFILE_GROUP_SPACING 27 |
Definition at line 41 of file gtkProfileGroup.h.
#define PROFILE_GROUP_WIDTH 666 |
Definition at line 38 of file gtkProfileGroup.h.
typedef struct _GtkProfileGroup GtkProfileGroup |
Definition at line 79 of file gtkProfileGroup.h.
typedef struct _GtkProfileGroupClass GtkProfileGroupClass |
Definition at line 80 of file gtkProfileGroup.h.
typedef gboolean on_profile_group_button_press_t(GtkProfileGroup *profileGroup, guint profileIndex, gboolean active) |
Definition at line 84 of file gtkProfileGroup.h.
typedef void on_profile_group_selection_update_t(GtkProfileGroup *profileGroup, guint profileIndex) |
Definition at line 82 of file gtkProfileGroup.h.
enum profileGroupMode_t |
Definition at line 71 of file gtkProfileGroup.h.
00072 { 00073 editMode_e = 0, 00074 connectMode_e, 00075 deleteMode_e, 00076 modeUndef_e 00077 }profileGroupMode_t;
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 }
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 }
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 }
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 }
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 }