void calendar_set_signal_strings( char *sig_str, CalendarData *data) { gchar *prev_sig; gtk_label_get (GTK_LABEL (data->prev_sig), &prev_sig); gtk_label_set (GTK_LABEL (data->prev2_sig), prev_sig); gtk_label_get (GTK_LABEL (data->last_sig), &prev_sig); gtk_label_set (GTK_LABEL (data->prev_sig), prev_sig); gtk_label_set (GTK_LABEL (data->last_sig), sig_str); }
static void add_menuitem_to_source (GtkWidget * widget, GbWriteMenuItemSourceData * write_data) { gchar *label_text; GtkWidget *menuitem, *child = GTK_BIN (widget)->child; menuitem = GTK_OPTION_MENU (write_data->option_menu)->menu_item; if (child == NULL && menuitem == widget) { child = GTK_BUTTON (write_data->option_menu)->child; write_data->selected_index = write_data->index; } if (child && GTK_IS_LABEL (child)) { gtk_label_get (GTK_LABEL (child), &label_text); source_add (write_data->data, " glade_menuitem = gtk_menu_item_new_with_label (%s);\n" " gtk_widget_show (glade_menuitem);\n" " gtk_menu_append (GTK_MENU (%s_menu), glade_menuitem);\n", source_make_string (label_text, write_data->data->use_gettext), write_data->data->real_wname); } write_data->index++; }
gboolean gw_categories_edit_box_get_isupdate_state ( GtkWindow *w) { GtkButton *bt = NULL; gchar *label = NULL; gchar *text_utf8 = NULL; gboolean result = FALSE; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif if ( w != NULL ) { bt = gtk_object_get_data ( GTK_OBJECT ( w), GW_REF_CATEGORIES_EDIT_BOX_ADD_UPDATE_BUTTON); if ( bt != NULL ) { gtk_label_get ( GTK_LABEL ( GTK_BIN ( bt)->child), &label); g_strdup_to_gtk_text ( _( "Update"), text_utf8); if ( strcmp ( label, text_utf8) == 0 ) { result = TRUE; } g_free ( text_utf8); } } return result; }
void set_display_scale_from_label(GtkWidget *wdg, gpointer data) { // Sets the display scale variable from the label of a radio button // Scales on the buttons are in % // Internally, they are a binary shift (>>) gchar *txt; //GtkAdjustment *vadj,*hadj; //GtkRequisition rq; scale_buttons_struct *sbs; sbs = (scale_buttons_struct *) data; if (!gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(wdg))) return; // printf("HF_SET_DISPLAY_SCALE\n"); gtk_label_get(GTK_LABEL(GTK_BIN(wdg)->child), &txt); if (!strcmp(SCALE_100, txt)) sbs->current = 0; else if (!strcmp(SCALE_50, txt)) sbs->current = 1; else if (!strcmp(SCALE_25, txt)) sbs->current = 2; else if (!strcmp(SCALE_12_5, txt)) sbs->current = 3; else if (!strcmp(SCALE_200, txt)) sbs->current = -1; else if (!strcmp(SCALE_400, txt)) sbs->current = -2; else if (!strcmp(SCALE_800, txt)) sbs->current = -3; }
/* * Gets the properties of the widget. This is used for both displaying the * properties in the property editor, and also for saving the properties. */ static void gb_gnome_message_box_get_properties (GtkWidget *widget, GbWidgetGetArgData * data) { GtkWidget *pixmap, *label; gchar *label_text; gint type_index; get_message_box_widgets (widget, &pixmap, &label); g_return_if_fail (pixmap != NULL); g_return_if_fail (label != NULL); type_index = GPOINTER_TO_INT (gtk_object_get_data (GTK_OBJECT (widget), MessageBoxType)); gb_widget_output_choice (data, MessageBoxType, type_index, GbMessageBoxTypeSymbols[type_index]); gtk_label_get (GTK_LABEL (label), &label_text); gb_widget_output_translatable_text (data, Message, label_text); gb_window_get_standard_properties (widget, data, Title, NULL, Position, Modal, DefaultWidth, DefaultHeight, Shrink, Grow, AutoShrink, WMName, WMClass); gb_widget_output_bool (data, AutoClose, GNOME_DIALOG (widget)->click_closes); gb_widget_output_bool (data, HideOnClose, GNOME_DIALOG (widget)->just_hide); }
char * GetProperty(int NumParam) { static char ValTxtParameter[61]; gchar * TxtParameter; /* Convert to a number if it is a base */ gtk_label_get(GTK_LABEL(PropLabelParam[NumParam]),&TxtParameter); if (strcmp(TxtParameter,"Base")==0) { strcpy( ValTxtParameter , (char *)gtk_entry_get_text((GtkEntry *)((GtkCombo *)PropEntryBaseParam[NumParam])->entry) ); } else { if (strcmp(TxtParameter,"TimerMode")==0) { strcpy( ValTxtParameter , (char *)gtk_entry_get_text((GtkEntry *)((GtkCombo *)PropEntryTimerModeParam[NumParam])->entry) ); } else { // others standard parameters strncpy( ValTxtParameter , (char *)gtk_entry_get_text((GtkEntry *)PropEntryParam[NumParam]), 60 ); ValTxtParameter[ 60 ] = '\0'; } } return ValTxtParameter; }
const char * gtk_label_get_text(GtkLabel *label) { const char *text = NULL; g_return_val_if_fail(label, NULL); gtk_label_get(GTK_LABEL(label), (char **) &text); return text; }
/* Adds combo label text to buffer, or sets first char to -1 if it won't fit. */ static void add_label (GtkWidget * widget, GString *items) { gchar *label_text; gtk_label_get (GTK_LABEL (GTK_BIN (widget)->child), &label_text); g_string_append (items, label_text); g_string_append_c (items, '\n'); }
static void write_items_source_callback (GtkWidget * item, GbWidgetWriteSourceData * data) { gchar *label_text; gtk_label_get (GTK_LABEL (GTK_BIN (item)->child), &label_text); /* The (gpointer) cast is just to keep g++ happy. */ source_add (data, " %s_items = g_list_append (%s_items, (gpointer) %s);\n", data->real_wname, data->real_wname, source_make_string (label_text, data->use_gettext)); }
void gcb_enc_put(GtkWidget *w, struct encdata *enc) { GtkWidget *child; gchar *text; child = GTK_BIN(w)->child; gtk_label_get(GTK_LABEL(child), &text); prof2enc(text, enc); }
gboolean dialogGameFinderJoinByAddress(GtkWidget *widget, GdkEventButton *event, gpointer user_data) { char address[FILENAME_MAX]; /* Address of the machine to join */ char playerName[PLAYER_NAME_LEN]; /* Player Name */ unsigned short port; /* Port of the machine to join */ gchar *str; if (strlen(str) > 0 ) { gtk_label_get(GTK_LABEL(idc_gamefindport), &str); port = atoi(str); gtk_label_get(GTK_LABEL(idc_address), &str); strcpy(address, str); gameFrontGetPlayerName(playerName); gameFrontSetUdpOptions(playerName, address, port, 0); } if (useTracker == TRUE) { gameFrontSetDlgState(dialogGameFindUs, openInternetManual); } else { gameFrontSetDlgState(dialogGameFindUs, openLanManual); } return FALSE; }
/*---------------------------------------------------------------------*/ static char * bglk_gtk_glist_item_get_string( GtkListItem * li ) { GtkWidget *label; char *ltext = NULL; label = GTK_BIN( li )->child; if( !label || !GTK_IS_LABEL( label ) ) return NULL; gtk_label_get( GTK_LABEL( label ), <ext ); return ltext; }
/********************************************************* *NAME: dialogGameFinderJoinTest *AUTHOR: John Morrison *Creation Date: 18/1/00 *Last Modified: 2/6/00 *PURPOSE: * Called on attampt to join the currently selected game. * Returns whether we can join the game or not. ie version * numbers the same * *ARGUMENTS: * *********************************************************/ bool dialogGameFinderJoinTest() { bool returnValue; /* Value to return */ char address[FILENAME_MAX]; /* Address of the machine to join */ char playerName[PLAYER_NAME_LEN]; /* Player Name */ unsigned short port; /* Port of the machine to join */ gchar *str; returnValue = TRUE; gtk_label_get(GTK_LABEL(idc_gamefindversion), &str); if (strncmp(str, STRVER,4) != 0) { MessageBox(langGetText(STR_DLGGAMEFINDER_WRONGVERSION),DIALOG_BOX_TITLE); returnValue = FALSE; } else { gtk_label_get(GTK_LABEL(idc_gamefindport), &str); port = atoi(str); gtk_label_get(GTK_LABEL(idc_address), &str); strcpy(address, str); gameFrontGetPlayerName(playerName); gameFrontSetUdpOptions(playerName, address, port, 0); } return returnValue; }
/* Gets the current string of text within the GtkLabel */ int clip_GTK_LABELGET(ClipMachine * cm) { C_widget *clbl = _fetch_cw_arg(cm); gchar *text; CHECKCWID(clbl,GTK_IS_LABEL); gtk_label_get(GTK_LABEL(clbl->widget), &text); LOCALE_FROM_UTF(text); _clip_retc(cm,text); FREE_TEXT(text); return 0; err: return 1; }
static void set_freq_global(GtkWidget *button, gpointer data) { gint i, value; gchar *txt; hf_wrapper_struct *hfw; hfw = (hf_wrapper_struct *) * (hf_wrapper_struct **) data; gtk_label_get(GTK_LABEL(GTK_BIN(button)->child), &txt); value = atoi(txt); for (i=0; i<12; i++) { hfw->hf_options->surfadd_options->frq_percent[i] = value; gtk_adjustment_set_value( GTK_ADJUSTMENT(hfw->hf_options->freq_control_adj[i]), value); } gener_hf(hfw); }
void change_key_program_user ( GtkWidget *widget, char *label_string, KEY_SETTINGS_LIST *key_settings_list, char *program_user ) /* input: widget - This widget must be in the same tree a the widget from which the name is equal to label_string label_string - This is the name of a label (widget) which contains the name of the key to change the program_user element from key_settings_list - A list containing all keys, of the current keyboard, with their settings program_user - The program_user element of the specified key will be changed to this string output: key_settings - A list containing all keys, of the current keyboard, with their settings. returns: - description: This function changes the program_user (not the input variable) element of a key, in the key_settings list, to program_user (the input_variable). label_string is the name of a label (widget) which contains the name of the key to change. widget must be in the same tree as this label. */ { char *key_name; KEY_SETTINGS *selected_key; GtkWidget *key_name_label; key_name_label = lookup_widget(GTK_WIDGET(widget), label_string); if (key_name_label) { /* Get the name of the selected key */ gtk_label_get (GTK_LABEL(key_name_label), &key_name); if (*key_name) /* If a listitem was selected */ { /* Select the key in the linked list */ selected_key = ksl_find_key( key_settings_list, key_name ); if (selected_key) /* If the selected key exists */ { /* Update the key settings */ ks_set_program_user (selected_key, program_user); } } } }
static gchar * gtk_combo_func (GtkListItem * li) { GtkWidget *label; gchar *ltext = NULL; ltext = (gchar *) gtk_object_get_data (GTK_OBJECT (li), gtk_combo_string_key); if (!ltext) { label = GTK_BIN (li)->child; if (!label || !GTK_IS_LABEL (label)) return NULL; gtk_label_get (GTK_LABEL (label), <ext); } return ltext; }
static int _combo_simple_list_select(GtkList * list, GtkWidget * widget, gpointer data) { GtkWidget *child = NULL; GtkCombo *cb = GTK_COMBO(data); char *text; child = GTK_BIN(&(GTK_ITEM(widget)->bin))->child; if (GTK_IS_LABEL(child)) { gtk_label_get(GTK_LABEL(child), &text); gtk_entry_set_text(GTK_ENTRY(cb->entry), text); } return 0; }
int clip_GTK_BUTTONGETText(ClipMachine * ClipMachineMemory) { C_widget *cbtn = _fetch_cw_arg(ClipMachineMemory); gchar *text; CHECKCWID(cbtn, GTK_IS_BUTTON); gtk_label_get(GTK_LABEL(GTK_BIN(&(GTK_BUTTON(cbtn->widget)->bin))->child), &text); LOCALE_FROM_UTF(text); _clip_retc(ClipMachineMemory, text); FREE_TEXT(text); return 0; err: return 1; }
static void replace_word(GtkWidget *w, gpointer d) { int start, end; char *newword; char buf[BUFSIZE]; /* we don't save their position, * because the cursor is moved by the click. */ gtk_text_freeze(GTK_TEXT(d)); gtk_label_get(GTK_LABEL(GTK_BIN(w)->child), &newword); get_curword(GTK_TEXT(d), buf, &start, &end); gtk_text_set_point(GTK_TEXT(d), end); gtk_text_backward_delete(GTK_TEXT(d), end-start); gtk_text_insert(GTK_TEXT(d), NULL, NULL, NULL, newword, strlen(newword)); gtk_text_thaw(GTK_TEXT(d)); }
/* Returns text in item */ int clip_GTK_LISTITEMGETTEXT(ClipMachine *cm) { C_widget *clitm = _fetch_cw_arg(cm); GtkWidget *child = NULL; char *text; CHECKCWID(clitm,GTK_IS_LIST_ITEM); child = GTK_BIN(&(GTK_ITEM(clitm->widget)->bin))->child; if (GTK_IS_LABEL(child)) { gtk_label_get(GTK_LABEL(child), &text); LOCALE_TO_UTF(text); _clip_retc(cm,text); FREE_TEXT(text); } return 0; err: return 1; }
static void okButton_clicked( GtkWidget *widget, void *data ) { gtk_widget_hide( microcodeWindow ); if (GTK_LIST(microcodeList)->selection != 0) { char *text = 0; GtkListItem *item = GTK_LIST_ITEM(GTK_LIST(microcodeList)->selection->data); GtkLabel *label = GTK_LABEL(GTK_BIN(item)->child); gtk_label_get( label, &text ); if (text != 0) for (int i = 0; i < numMicrocodeTypes; i++) if (!strcmp( text, MicrocodeTypes[i] )) { selectedMicrocode = i; return; } } selectedMicrocode = NONE; }
void toggle_scale_button (scale_buttons_struct *sbs) { // Toggle the appropriate radio button from the current display scale gchar *lbl, *txt; GSList *node; if (!sbs) return; // Find label from scale: switch (sbs->current) { case 0: lbl = SCALE_100; break; case 1: lbl = SCALE_50; break; case 2: lbl = SCALE_25; break; case 3: lbl = SCALE_12_5; break; case -1: lbl = SCALE_200; break; case -2: lbl = SCALE_400; break; case -3: lbl = SCALE_800; } if (!sbs->group) return; for (node = sbs->group; node; node = node->next) { gtk_label_get(GTK_LABEL(GTK_BIN(node->data)->child), &txt); if (!strcmp(txt,lbl)) break; } if (node) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON(node->data), TRUE); } }
void walk_up_tree( GtkWidget* item ) { gchar* current_path = context.current_path; gchar* text; GtkWidget* widget = item; GtkTree* next_tree = GTK_TREE( widget->parent ); if( next_tree->level > 1 ) { walk_up_tree( next_tree->tree_owner ); } GtkLabel* label = GTK_LABEL( GTK_BIN( widget )->child ); gtk_label_get( label, &text ); strncat( current_path, text, PAKFileEntry::MAX_FILENAMESIZE - 1 ); // No "/" on front of path. if( next_tree->level >= 1 ) { strcat( current_path, "/" ); } }
gchar * gw_progress_bar_box_get_text ( GtkWindow *w) { GtkLabel *label = NULL; gchar *text = NULL; gchar *text_utf8 = NULL; #ifdef GW_DEBUG_GUI_COMPONENT g_print ( "*** GW - %s (%d) :: %s()\n", __FILE__, __LINE__, __PRETTY_FUNCTION__); #endif if ( w != NULL ) { if ( (label = GTK_LABEL ( gtk_object_get_data ( GTK_OBJECT ( w), GW_REF_PROGRESS_BAR_BOX_TEXT_INFO_LABEL))) != NULL ) { gtk_label_get ( label, &text); g_strdup_from_gtk_text ( text, text_utf8); } } return text_utf8; }
static gboolean out_map (GtkWidget *w, GdkEventCrossing *event, gpointer data) { ETzMap *tzmap; char *old_zone; tzmap = (ETzMap *) data; if (event->mode != GDK_CROSSING_NORMAL) return FALSE; if (tzmap->point_hover && tzmap->point_hover != tzmap->point_selected) e_map_point_set_color_rgba (tzmap->map, tzmap->point_hover, TZ_MAP_POINT_NORMAL_RGBA); tzmap->point_hover = NULL; gtk_label_get (GTK_LABEL (((GstTimeTool *) tzmap->tool)->map_hover_label), &old_zone); if (strcmp (old_zone, "")) gtk_label_set_text (GTK_LABEL (((GstTimeTool *) tzmap->tool)->map_hover_label), ""); return TRUE; }
static void xv_sync_to_display_changed(GtkWidget *widget, gpointer user_data) { CtkXVideo *ctk_xvideo = CTK_XVIDEO(user_data); gboolean enabled; gint value; gchar *label; enabled = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget)); if (enabled) { user_data = g_object_get_data(G_OBJECT(widget), "xv_sync_to_display"); value = GPOINTER_TO_INT(user_data); NvCtrlSetAttribute(ctk_xvideo->handle, NV_CTRL_XV_SYNC_TO_DISPLAY, value); gtk_label_get(GTK_LABEL(GTK_BIN(widget)->child), &label); post_xv_sync_to_display_changed(ctk_xvideo, enabled, label); } }/* xv_sync_to_display_changed() */
static int _combo_simple_find_in_list(GtkCombo * cb, char *ftext) { GList *list = GTK_LIST(cb->list)->children; GtkWidget *child = NULL; int i; char *text; LOCALE_TO_UTF(ftext); for (i = 0; list; i++, list = list->next) { child = GTK_BIN(&(GTK_ITEM(list->data)->bin))->child; if (GTK_IS_LABEL(child)) { gtk_label_get(GTK_LABEL(child), &text); if (cb->case_sensitive) { if (strcmp(ftext, text) == 0) return i; } else { if (strcasecmp(ftext, text) == 0) return i; } } } FREE_TEXT(ftext); return -1; }
static void add_label (GtkWidget * widget, GbAddLabelData * add_label_data) { gchar *label_text; GtkWidget *menuitem, *child = GTK_BIN (widget)->child; /* Return if list has already been marked invalid (i.e. not all items are labels or the list is too big. */ if (add_label_data->buffer_overflow) return; /* The currently selected menuitem's child is held in the option menu's child rather than the menuitem. */ menuitem = GTK_OPTION_MENU (add_label_data->option_menu)->menu_item; if (child == NULL && menuitem == widget) { child = GTK_BUTTON (add_label_data->option_menu)->child; add_label_data->selected_index = add_label_data->index; } add_label_data->index++; if (child && GTK_IS_LABEL (child)) { gtk_label_get (GTK_LABEL (child), &label_text); if (strlen (add_label_data->items) + strlen (label_text) + 2 < ITEMS_BUFFER_SIZE) { strcat (add_label_data->items, label_text); strcat (add_label_data->items, "\n"); return; } } /* If we reach here, the list item is not a label or the list is too big */ add_label_data->buffer_overflow = TRUE; }
static void sfe_ui_TreeSelectionChanged( GtkWidget *tree ) { GList *itemlist; gchar *name; GtkBox *hbox; GtkLabel *label; GtkWidget *item; pStructInf infptr, subinf; gchar* annotation; int i; gchar* rowtext[2]; gchar intbuf[32]; char* strval; int intval; /** Get the hidden label which contains the pointer to the inf **/ if (!tree) return; itemlist = GTK_TREE_SELECTION(tree); if (!itemlist) return; item = GTK_WIDGET (itemlist->data); if (!item) return; hbox = GTK_BOX (GTK_BIN (item)->child); label = GTK_LABEL (((GtkBoxChild*)(hbox->children->next->next->data))->widget); gtk_label_get (label, &name); infptr = (pStructInf)(strtol(name, NULL, 16)); if (!infptr) return; /** Show the info on the right side of the window **/ gtk_entry_set_text(GTK_ENTRY(SFE_Globals.NameEdit), infptr->Name); gtk_entry_set_text(GTK_ENTRY(GTK_COMBO(SFE_Globals.TypeCombo)->entry), infptr->UsrType); gtk_text_set_point(GTK_TEXT(SFE_Globals.AnnotText), 0); gtk_text_forward_delete(GTK_TEXT(SFE_Globals.AnnotText), gtk_text_get_length(GTK_TEXT(SFE_Globals.AnnotText))); annotation=""; stAttrValue(stLookup(infptr,"annotation"), NULL, &annotation, 0); gtk_text_insert(GTK_TEXT(SFE_Globals.AnnotText), NULL, NULL, NULL, annotation, strlen(annotation)); /** Build the attributes listing **/ gtk_clist_clear(GTK_CLIST(SFE_Globals.AttrsCList)); for(i=0;i<infptr->nSubInf;i++) { subinf = infptr->SubInf[i]; if (stStructType(subinf) == ST_T_ATTRIB) { strval = NULL; stAttrValue(subinf, &intval, &strval, 0); rowtext[0] = subinf->Name; if (strval) { rowtext[1] = strval; } else { snprintf(intbuf, 32, "%d", intval); rowtext[1] = intbuf; } gtk_clist_append(GTK_CLIST(SFE_Globals.AttrsCList), rowtext); } } return; }