static GtkWidget* get_entry_box (TTXWindow *self) { GtkWidget *entry_box, *entry_main, *entry_sub; entry_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); entry_main = gtk_entry_new (); gtk_entry_set_max_length (GTK_ENTRY(entry_main), 3); gtk_entry_set_width_chars (GTK_ENTRY(entry_main), 3); entry_sub = gtk_entry_new (); gtk_entry_set_max_length (GTK_ENTRY(entry_sub), 2); gtk_entry_set_width_chars (GTK_ENTRY(entry_sub), 2); gtk_box_pack_start (GTK_BOX(entry_box), entry_main, FALSE, FALSE, 2); gtk_box_pack_start (GTK_BOX(entry_box), entry_sub, FALSE, FALSE, 2); self->priv->page_entry = entry_main; self->priv->subpage_entry = entry_sub; g_signal_connect (entry_main, "activate", G_CALLBACK(on_entry_activate), self); g_signal_connect (entry_sub, "activate", G_CALLBACK(on_entry_activate), self); update_entry (self); return entry_box; }
static gint construct_units(RawXYZControls *controls, GtkTable *table, gint row) { RawXYZArgs *args = controls->args; GtkWidget *label; label = gtk_label_new_with_mnemonic(_("_Lateral units:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_table_attach(table, label, 0, 1, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); controls->xy_units = gtk_entry_new(); gtk_label_set_mnemonic_widget(GTK_LABEL(label), controls->xy_units); gtk_entry_set_text(GTK_ENTRY(controls->xy_units), args->xy_units); gtk_entry_set_width_chars(GTK_ENTRY(controls->xy_units), 6); gtk_table_attach(table, controls->xy_units, 1, 4, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); row++; label = gtk_label_new_with_mnemonic(_("_Value units:")); gtk_misc_set_alignment(GTK_MISC(label), 0.0, 0.5); gtk_table_attach(table, label, 0, 1, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); controls->z_units = gtk_entry_new(); gtk_label_set_mnemonic_widget(GTK_LABEL(label), controls->z_units); gtk_entry_set_text(GTK_ENTRY(controls->z_units), args->z_units); gtk_entry_set_width_chars(GTK_ENTRY(controls->z_units), 6); gtk_table_attach(table, controls->z_units, 1, 4, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); row++; return row; }
static void yui_resolution_init(YuiResolution * yr) { GtkWidget * label_w; GtkWidget * label_h; gtk_container_set_border_width (GTK_CONTAINER (yr), 10); label_w = gtk_label_new ("Width"); gtk_box_pack_start(GTK_BOX(yr), label_w, TRUE, TRUE, 0); yr->entry_w = gtk_entry_new (); gtk_entry_set_width_chars(GTK_ENTRY(yr->entry_w), 8); gtk_box_pack_start(GTK_BOX(yr), yr->entry_w, TRUE, TRUE, 0); label_h = gtk_label_new ("Height"); gtk_box_pack_start(GTK_BOX(yr), label_h, TRUE, TRUE, 0); yr->entry_h = gtk_entry_new (); gtk_entry_set_width_chars(GTK_ENTRY(yr->entry_h), 8); gtk_box_pack_start(GTK_BOX(yr), yr->entry_h, TRUE, TRUE, 0); yr->options = gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX(yr->options), "Window"); gtk_combo_box_append_text(GTK_COMBO_BOX(yr->options), "Fullscreen"); gtk_combo_box_append_text(GTK_COMBO_BOX(yr->options), "Keep ratio"); gtk_box_pack_start(GTK_BOX(yr), yr->options, TRUE, TRUE, 0); g_signal_connect(yr->entry_w, "changed", G_CALLBACK(yui_resolution_width_changed), yr); g_signal_connect(yr->entry_h, "changed", G_CALLBACK(yui_resolution_height_changed), yr); g_signal_connect(yr->options, "changed", G_CALLBACK(yui_resolution_options_changed), yr); }
static GtkWidget* ComPage(ArComPduType* Pdu) { GtkWidget* pGrid; pGrid = gtk_grid_new(); { GtkWidget* pEntry = gtk_entry_new(); gtk_grid_attach(GTK_GRID(pGrid),gtk_label_new("Period"),0,0,1,1); gtk_grid_attach(GTK_GRID(pGrid),pEntry,1,0,1,1); gtk_entry_set_width_chars(GTK_ENTRY(pEntry),32); gchar value[32]; sprintf(value,"%d",Pdu->Period); gtk_entry_set_text(GTK_ENTRY(pEntry),value); gtk_widget_set_sensitive(GTK_WIDGET(pEntry),Pdu->IsTxEnabled); if(Pdu->IsTxEnabled) { g_signal_connect(G_OBJECT (pEntry), "activate", G_CALLBACK(on_entry_period_activate) , (gpointer)(Pdu)); GtkWidget* pButton = gtk_button_new_with_label("Trigger Transmit"); g_signal_connect(G_OBJECT (pButton), "clicked", G_CALLBACK(on_button_trigger_transmit_clicked) , (gpointer)(Pdu)); gtk_grid_attach(GTK_GRID(pGrid),pButton,2,0,1,1); } } for (int j = 0; j<Pdu->SignalNbr ; j++) { ArComSignalType * Signal = &(Pdu->Signals[j]); ArComPduType* Pdu = (ArComPduType*)Signal->Pdu; GtkWidget* pEntry = gtk_entry_new(); Signal->Entry = pEntry; int J = j+2; gtk_grid_attach(GTK_GRID(pGrid),gtk_label_new(Signal->Name),(J%2)*2,J/2,1,1); gtk_grid_attach(GTK_GRID(pGrid),pEntry,(J%2)*2+1,J/2,1,1); gtk_entry_set_width_chars(GTK_ENTRY(pEntry),32); gchar value[32]; if(TRUE) { // TODO: support array types sprintf(value,"%d",Read(Signal)); } else { sprintf(value,"un-support type"); } gtk_entry_set_text(GTK_ENTRY(pEntry),value); gtk_widget_set_sensitive(GTK_WIDGET(pEntry),Pdu->IsTxEnabled); if(Pdu->IsTxEnabled) { g_signal_connect(G_OBJECT (pEntry), "activate", G_CALLBACK(on_entry_signal_activate) , (gpointer)(Signal)); } } return pGrid; }
static void gimp_rotate_tool_dialog (GimpTransformTool *tr_tool) { GimpRotateTool *rotate = GIMP_ROTATE_TOOL (tr_tool); GtkWidget *table; GtkWidget *button; GtkWidget *scale; GtkAdjustment *adj; table = gtk_table_new (4, 2, FALSE); gtk_table_set_row_spacings (GTK_TABLE (table), 2); gtk_table_set_col_spacings (GTK_TABLE (table), 6); gtk_table_set_row_spacing (GTK_TABLE (table), 1, 6); gtk_box_pack_start (GTK_BOX (gimp_tool_gui_get_vbox (tr_tool->gui)), table, FALSE, FALSE, 0); gtk_widget_show (table); rotate->angle_adj = (GtkAdjustment *) gtk_adjustment_new (0, -180, 180, 0.1, 15, 0); button = gtk_spin_button_new (rotate->angle_adj, 1.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (button), TRUE); gtk_spin_button_set_wrap (GTK_SPIN_BUTTON (button), TRUE); gtk_entry_set_width_chars (GTK_ENTRY (button), SB_WIDTH); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("_Angle:"), 0.0, 0.5, button, 1, TRUE); rotate->angle_spin_button = button; g_signal_connect (rotate->angle_adj, "value-changed", G_CALLBACK (rotate_angle_changed), tr_tool); scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, rotate->angle_adj); gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE); gtk_table_attach (GTK_TABLE (table), scale, 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 0, 0); gtk_widget_show (scale); adj = (GtkAdjustment *) gtk_adjustment_new (0, -1, 1, 1, 10, 0); button = gtk_spin_button_new (adj, 1.0, 2); gtk_spin_button_set_numeric (GTK_SPIN_BUTTON (button), TRUE); gtk_entry_set_width_chars (GTK_ENTRY (button), SB_WIDTH); gimp_table_attach_aligned (GTK_TABLE (table), 0, 2, _("Center _X:"), 0.0, 0.5, button, 1, TRUE); rotate->sizeentry = gimp_size_entry_new (1, GIMP_UNIT_PIXEL, "%a", TRUE, TRUE, FALSE, SB_WIDTH, GIMP_SIZE_ENTRY_UPDATE_SIZE); gimp_size_entry_add_field (GIMP_SIZE_ENTRY (rotate->sizeentry), GTK_SPIN_BUTTON (button), NULL); gimp_size_entry_set_pixel_digits (GIMP_SIZE_ENTRY (rotate->sizeentry), 2); gimp_table_attach_aligned (GTK_TABLE (table), 0, 3, _("Center _Y:"), 0.0, 0.5, rotate->sizeentry, 1, TRUE); g_signal_connect (rotate->sizeentry, "value-changed", G_CALLBACK (rotate_center_changed), tr_tool); }
void dv_view_set_entry_remark_text(dv_view_t * V, char * str) { if (GTK_IS_WIDGET(V->T->entry_remark)) { gtk_entry_set_width_chars(GTK_ENTRY(V->T->entry_remark), strlen(str)); gtk_entry_set_text(GTK_ENTRY(V->T->entry_remark), str); } }
void gtk_utils_convert_to_time_spin_button (GtkSpinButton *spin_button) { GtkAdjustment *adjustment = gtk_spin_button_get_adjustment (spin_button); gdouble upper_limit; gint max_width; g_return_if_fail (adjustment); g_signal_connect (spin_button, "output", G_CALLBACK (time_spin_button_output), NULL); g_signal_connect (spin_button, "input", G_CALLBACK (time_spin_button_input), NULL); if (adjustment->upper > 60.0 * 60.0) { /* One less, since two colons would normally take space of only * one "common" char. Anyway Quarry time upper bounds are not * something one would use. */ for (max_width = 6, upper_limit = adjustment->upper / (60.0 * 60.0); upper_limit >= 10.0; upper_limit /= 10.0) max_width++; } else max_width = 5; gtk_entry_set_width_chars (GTK_ENTRY (spin_button), max_width); }
bool wxSpinButton::Create(wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name) { if (!PreCreation(parent, pos, size) || !CreateBase(parent, id, pos, size, style, wxDefaultValidator, name)) { wxFAIL_MSG( wxT("wxSpinButton creation failed") ); return false; } m_pos = 0; m_widget = gtk_spin_button_new_with_range(0, 100, 1); g_object_ref(m_widget); gtk_entry_set_width_chars(GTK_ENTRY(m_widget), 0); gtk_spin_button_set_wrap( GTK_SPIN_BUTTON(m_widget), (int)(m_windowStyle & wxSP_WRAP) ); g_signal_connect_after( m_widget, "value_changed", G_CALLBACK(gtk_value_changed), this); m_parent->DoAddChild( this ); PostCreation(size); return true; }
static void remmina_main_create_quick_search(RemminaMain *remminamain) { GtkWidget *widget; GValue val = { 0 }; remminamain->priv->quick_search_separator = gtk_separator_tool_item_new(); gtk_toolbar_insert(GTK_TOOLBAR(remminamain->priv->toolbar), remminamain->priv->quick_search_separator, -1); remminamain->priv->quick_search_item = gtk_tool_item_new(); gtk_toolbar_insert(GTK_TOOLBAR(remminamain->priv->toolbar), remminamain->priv->quick_search_item, -1); widget = gtk_entry_new(); gtk_widget_show(widget); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget), GTK_ENTRY_ICON_PRIMARY, GTK_STOCK_FIND); gtk_entry_set_icon_from_stock(GTK_ENTRY(widget), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_CLEAR); gtk_entry_set_width_chars(GTK_ENTRY(widget), 25); gtk_container_add(GTK_CONTAINER(remminamain->priv->quick_search_item), widget); g_value_init(&val, G_TYPE_BOOLEAN); g_value_set_boolean(&val, FALSE); g_object_set_property(G_OBJECT(widget), "primary-icon-activatable", &val); g_value_unset(&val); g_signal_connect(G_OBJECT(widget), "icon-press", G_CALLBACK(remmina_main_quick_search_on_icon_press), remminamain); g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(remmina_main_quick_search_on_changed), remminamain); remminamain->priv->quick_search_entry = widget; }
/*---------------------------------------------------------------------*/ void make_hop_restart() { PangoFontDescription *font_desc; GtkWidget *port_lbl; GtkWidget *hbox, *hboxbut; GtkWidget *but; font_desc = pango_font_description_from_string( HOP_MONOSPACE_FONT ); port_lbl = gtk_label_new( "Port: " ); port_entry = gtk_entry_new(); gtk_entry_set_width_chars( GTK_ENTRY( port_entry ), 4 ); hbox = gtk_hbox_new( FALSE, 0 ); gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( port_lbl ) ); gtk_container_add( GTK_CONTAINER( hbox ), GTK_WIDGET( port_entry ) ); gtk_entry_set_text( GTK_ENTRY( port_entry ), (const gchar *)hop_port ); gtk_widget_modify_font( port_lbl, font_desc ); gtk_widget_modify_font( port_entry, font_desc ); pango_font_description_free( font_desc ); but = make_button( "Restart Hop" ); g_signal_connect( G_OBJECT( but ), "clicked", G_CALLBACK( run_hop_with_port ), win ); hboxbut = gtk_hbutton_box_new(); gtk_box_pack_start( GTK_BOX( hboxbut ), but, FALSE, FALSE, 2 ); gtk_box_pack_start( GTK_BOX( left_vbox ), hboxbut, FALSE, FALSE, 10 ); gtk_box_pack_start( GTK_BOX( left_vbox ), hbox, FALSE, FALSE, 2 ); }
static GtkWidget *toolbar_add_zoom(GtkWidget *box) // Add zoom combo box { int i; static char *txt[] = { "10%", "20%", "25%", "33%", "50%", "100%", "200%", "300%", "400%", "800%", "1200%", "1600%", "2000%", NULL }; GtkWidget *combo, *combo_entry; GList *combo_list = NULL; combo = gtk_combo_new(); gtk_combo_set_value_in_list (GTK_COMBO (combo), FALSE, FALSE); gtk_widget_show (combo); combo_entry = GTK_COMBO (combo)->entry; GTK_WIDGET_UNSET_FLAGS (combo_entry, GTK_CAN_FOCUS); gtk_widget_set_usize(GTK_COMBO(combo)->button, 18, -1); #if GTK_MAJOR_VERSION == 1 gtk_widget_set_usize(combo, 75, -1); #else /* #if GTK_MAJOR_VERSION == 2 */ gtk_entry_set_width_chars(GTK_ENTRY(combo_entry), 6); #endif gtk_entry_set_editable( GTK_ENTRY(combo_entry), FALSE ); for ( i=0; txt[i]; i++ ) combo_list = g_list_append( combo_list, txt[i] ); gtk_combo_set_popdown_strings( GTK_COMBO(combo), combo_list ); g_list_free( combo_list ); gtk_entry_set_text( GTK_ENTRY(combo_entry), "100%" ); pack(box, combo); return (combo); }
gboolean a_dialog_goto_utm ( GtkWindow *parent, struct UTM *utm, const struct UTM *old ) { GtkWidget *dialog = gtk_dialog_new_with_buttons (_("Go to UTM"), parent, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); GtkWidget *norlabel, *easlabel, *nor, *eas; GtkWidget *zonehbox, *zonespin, *letterentry; gchar tmp_letter[2]; norlabel = gtk_label_new (_("Northing:")); nor = ui_spin_button_new ( (GtkAdjustment*)gtk_adjustment_new(old->northing,0,9999999,1,250,0), 1, 0 ); easlabel = gtk_label_new (_("Easting:")); eas = ui_spin_button_new ( (GtkAdjustment*)gtk_adjustment_new(old->easting,0,9999999,1,250,0), 1, 0 ); zonehbox = gtk_hbox_new ( FALSE, 0 ); gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( _("Zone:") ), FALSE, FALSE, 5 ); zonespin = gtk_spin_button_new ( (GtkAdjustment *) gtk_adjustment_new ( old->zone, 1, 60, 1, 5, 0 ), 1, 0 ); gtk_box_pack_start ( GTK_BOX(zonehbox), zonespin, TRUE, TRUE, 5 ); gtk_box_pack_start ( GTK_BOX(zonehbox), gtk_label_new ( _("Letter:") ), FALSE, FALSE, 5 ); letterentry = gtk_entry_new (); gtk_entry_set_max_length ( GTK_ENTRY(letterentry), 1 ); gtk_entry_set_width_chars ( GTK_ENTRY(letterentry), 2 ); tmp_letter[0] = old->letter; tmp_letter[1] = '\0'; gtk_entry_set_text ( GTK_ENTRY(letterentry), tmp_letter ); gtk_box_pack_start ( GTK_BOX(zonehbox), letterentry, FALSE, FALSE, 5 ); gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), norlabel, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), nor, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), easlabel, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), eas, FALSE, FALSE, 0); gtk_box_pack_start (GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), zonehbox, FALSE, FALSE, 2); gtk_dialog_set_default_response ( GTK_DIALOG(dialog), GTK_RESPONSE_ACCEPT ); gtk_widget_show_all ( dialog ); if ( gtk_dialog_run ( GTK_DIALOG(dialog) ) == GTK_RESPONSE_ACCEPT ) { const gchar *letter; utm->northing = atof ( gtk_entry_get_text ( GTK_ENTRY(nor) ) ); utm->easting = atof ( gtk_entry_get_text ( GTK_ENTRY(eas) ) ); utm->zone = gtk_spin_button_get_value_as_int ( GTK_SPIN_BUTTON(zonespin) ); letter = gtk_entry_get_text ( GTK_ENTRY(letterentry) ); if (*letter) utm->letter = toupper(*letter); gtk_widget_destroy ( dialog ); return TRUE; } gtk_widget_destroy ( dialog ); return FALSE; }
void owperGUI::loadGUI() { winMain = gtk_window_new(GTK_WINDOW_TOPLEVEL); gtk_container_set_border_width(GTK_CONTAINER(winMain), 5); gtk_window_set_default_size(GTK_WINDOW(winMain), 600, 400); g_signal_connect (G_OBJECT(winMain), "delete_event", G_CALLBACK(delete_event), NULL); g_signal_connect (G_OBJECT (winMain), "destroy", G_CALLBACK (destroy), NULL); vboxMain = gtk_vbox_new(false, 5); //section for setting the directory from which to retrieve registry files frameSamFile = gtk_frame_new("Select Sam Registry File"); gtk_box_pack_start(GTK_BOX(vboxMain), frameSamFile, false, false, 0); hboxSamFile = gtk_hbox_new(false, 0); gtk_container_set_border_width(GTK_CONTAINER(hboxSamFile), 5); gtk_container_add(GTK_CONTAINER(frameSamFile), hboxSamFile); entrySamFile = gtk_entry_new(); gtk_entry_set_width_chars(GTK_ENTRY(entrySamFile), 30); gtk_entry_set_editable(GTK_ENTRY(entrySamFile), false); gtk_box_pack_start(GTK_BOX(hboxSamFile), entrySamFile, true, true, 5); buttonBrowseSamFile = gtk_button_new_with_mnemonic("_Browse"); g_signal_connect (G_OBJECT(buttonBrowseSamFile), "clicked", G_CALLBACK(sam_file_browse_event), (gpointer)this); gtk_box_pack_start(GTK_BOX(hboxSamFile), buttonBrowseSamFile, false, false, 5); //section for list of users scrollwinUsers = gtk_scrolled_window_new(NULL, NULL); gtk_box_pack_start(GTK_BOX(vboxMain), scrollwinUsers, true, true, 5); vboxUsers = gtk_vbox_new(false, 0); gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scrollwinUsers), vboxUsers); //commands across the bottom hboxCommands = gtk_hbox_new(false, 0); gtk_box_pack_start(GTK_BOX(vboxMain), hboxCommands, false, false, 0); buttonClearPasswords = gtk_button_new_with_mnemonic("_Clear Passwords"); g_signal_connect (G_OBJECT (buttonClearPasswords), "clicked", G_CALLBACK(clearPasswords), (gpointer)this); gtk_box_pack_end(GTK_BOX(hboxCommands), buttonClearPasswords, false, false, 0); buttonEnableAccounts = gtk_button_new_with_mnemonic("_Enable Accounts"); g_signal_connect (G_OBJECT (buttonEnableAccounts), "clicked", G_CALLBACK(enableAccounts), (gpointer)this); gtk_box_pack_end(GTK_BOX(hboxCommands), buttonEnableAccounts, false, false, 0); buttonDisableAccounts = gtk_button_new_with_mnemonic("_Disable Accounts"); g_signal_connect (G_OBJECT (buttonDisableAccounts), "clicked", G_CALLBACK(disableAccounts), (gpointer)this); gtk_box_pack_end(GTK_BOX(hboxCommands), buttonDisableAccounts, false, false, 0); gtk_container_add(GTK_CONTAINER (winMain), vboxMain); gtk_widget_show_all(winMain); }
static void polltextdlg_init(PollTextDlg *ptdlg, GtkWindow *parent) { GtkWidget *mainbox, *vbox; GtkWidget *label, *view; ptdlg->dlg = gtk_dialog_new_with_buttons(_("Text Poll Question"), parent, GTK_DIALOG_MODAL, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); mainbox = gtk_vbox_new(FALSE, 12); vbox = gtk_vbox_new(FALSE, 6); label = gtk_label_new_with_mnemonic(_("_Question:")); gtk_misc_set_alignment(GTK_MISC(label), 0, 0.5); gtk_box_pack_start(GTK_BOX(vbox), label, FALSE, FALSE, 0); ptdlg->question = view = gtk_text_view_new(); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(view), GTK_WRAP_WORD); gtk_label_set_mnemonic_widget(GTK_LABEL(label), view); gtk_box_pack_start(GTK_BOX(vbox), scroll_wrap(view), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(mainbox), vbox, TRUE, TRUE, 0); vbox = gtk_vbox_new(FALSE, 6); ptdlg->size = gtk_entry_new(); gtk_entry_set_width_chars(GTK_ENTRY(ptdlg->size), 4); ptdlg->width = gtk_entry_new(); gtk_entry_set_width_chars(GTK_ENTRY(ptdlg->width), 4); gtk_box_pack_start(GTK_BOX(vbox), labelled_box_new(_("_Text field size (optional): "), ptdlg->size), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(vbox), labelled_box_new(_("_Maximum text length (optional): "), ptdlg->width), FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(mainbox), vbox, FALSE, FALSE, 0); jam_dialog_set_contents(GTK_DIALOG(ptdlg->dlg), mainbox); }
static void set_text(RyostklconfigProDimnessSelector *dimness_selector, gchar const *text) { GtkEntry *entry; entry = GTK_ENTRY(gtk_bin_get_child(GTK_BIN(dimness_selector))); gtk_combo_box_set_active_iter(GTK_COMBO_BOX(dimness_selector), NULL); gtk_entry_set_text(entry, text); gtk_entry_set_width_chars(entry, g_utf8_strlen(text, -1)); }
static GtkWidget* new_entry(const char *text, int width, gfloat align){ GtkWidget *prog=monitor_new_entry_progress(); if(!text) text="Not Available"; gtk_entry_set_text(GTK_ENTRY(prog),text); gtk_entry_set_width_chars(GTK_ENTRY(prog),width); gtk_entry_set_alignment(GTK_ENTRY(prog),align); return prog; }
void ugtk_bandwidth_form_init (struct UgtkBandwidthForm* bwform) { GtkWidget* widget; GtkBox* box; GtkBox* vbox; GtkBox* hbox; box = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); bwform->self = (GtkWidget*) box; widget = gtk_label_new (_("These will affect all plug-ins.")); gtk_box_pack_start (box, widget, FALSE, FALSE, 2); widget = gtk_label_new (""); gtk_box_pack_start (box, widget, FALSE, FALSE, 2); // Global speed limit widget = gtk_frame_new (_("Global speed limit")); vbox = (GtkBox*) gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_container_add (GTK_CONTAINER (widget), (GtkWidget*) vbox); gtk_container_set_border_width (GTK_CONTAINER (vbox), 2); gtk_box_pack_start (box, widget, FALSE, FALSE, 2); // Max upload speed hbox = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (vbox, (GtkWidget*) hbox, FALSE, FALSE, 2); widget = gtk_label_new (_("Max upload speed")); gtk_box_pack_start (hbox, widget, FALSE, FALSE, 2); widget = gtk_label_new (_("KiB/s")); gtk_box_pack_end (hbox, widget, FALSE, FALSE, 2); widget = gtk_spin_button_new_with_range (0.0, 4000000000.0, 5.0); gtk_entry_set_width_chars (GTK_ENTRY (widget), 15); gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE); gtk_box_pack_end (hbox, widget, FALSE, FALSE, 2); bwform->upload = (GtkSpinButton*) widget; // Max download speed hbox = (GtkBox*) gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); gtk_box_pack_start (vbox, (GtkWidget*) hbox, FALSE, FALSE, 2); widget = gtk_label_new (_("Max download speed")); gtk_box_pack_start (hbox, widget, FALSE, FALSE, 2); widget = gtk_label_new (_("KiB/s")); gtk_box_pack_end (hbox, widget, FALSE, FALSE, 2); widget = gtk_spin_button_new_with_range (0.0, 4000000000.0, 5.0); gtk_entry_set_width_chars (GTK_ENTRY (widget), 15); gtk_entry_set_activates_default (GTK_ENTRY (widget), TRUE); gtk_box_pack_end (hbox, widget, FALSE, FALSE, 2); bwform->download = (GtkSpinButton*) widget; }
void gui_init(dt_lib_module_t *self) { /* initialize ui widgets */ dt_lib_tool_lighttable_t *d = (dt_lib_tool_lighttable_t *)g_malloc0(sizeof(dt_lib_tool_lighttable_t)); self->data = (void *)d; self->widget = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 2); d->layout = dt_conf_get_int("plugins/lighttable/layout"); d->previous_layout = d->layout == DT_LIGHTTABLE_LAYOUT_EXPOSE ? DT_LIGHTTABLE_LAYOUT_FILEMANAGER : DT_LIGHTTABLE_LAYOUT_EXPOSE; d->current_zoom = dt_conf_get_int("plugins/lighttable/images_in_row"); /* create layout selection combobox */ d->layout_combo = gtk_combo_box_text_new(); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(d->layout_combo), _("zoomable light table")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(d->layout_combo), _("file manager")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(d->layout_combo), _("expose")); gtk_combo_box_set_active(GTK_COMBO_BOX(d->layout_combo), d->layout); g_signal_connect(G_OBJECT(d->layout_combo), "changed", G_CALLBACK(_lib_lighttable_layout_changed), (gpointer)self); gtk_box_pack_start(GTK_BOX(self->widget), d->layout_combo, TRUE, TRUE, 0); /* create horizontal zoom slider */ d->zoom = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, 1, 21, 1); gtk_widget_set_size_request(GTK_WIDGET(d->zoom), DT_PIXEL_APPLY_DPI(140), -1); gtk_scale_set_draw_value(GTK_SCALE(d->zoom), FALSE); gtk_range_set_increments(GTK_RANGE(d->zoom), 1, 1); gtk_box_pack_start(GTK_BOX(self->widget), d->zoom, TRUE, TRUE, 0); /* manual entry of the zoom level */ d->zoom_entry = gtk_entry_new(); gtk_entry_set_alignment(GTK_ENTRY(d->zoom_entry), 1.0); gtk_entry_set_max_length(GTK_ENTRY(d->zoom_entry), 2); gtk_entry_set_width_chars(GTK_ENTRY(d->zoom_entry), 3); gtk_entry_set_max_width_chars(GTK_ENTRY(d->zoom_entry), 3); dt_gui_key_accel_block_on_focus_connect(d->zoom_entry); gtk_box_pack_start(GTK_BOX(self->widget), d->zoom_entry, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(d->zoom), "value-changed", G_CALLBACK(_lib_lighttable_zoom_slider_changed), (gpointer)self); g_signal_connect(d->zoom_entry, "key-press-event", G_CALLBACK(_lib_lighttable_zoom_entry_changed), self); gtk_range_set_value(GTK_RANGE(d->zoom), d->current_zoom); _lib_lighttable_zoom_slider_changed(GTK_RANGE(d->zoom), self); // the slider defaults to 1 and GTK doesn't // fire a value-changed signal when setting // it to 1 => empty text box gtk_widget_set_no_show_all(d->zoom, TRUE); gtk_widget_set_no_show_all(d->zoom_entry, TRUE); _lib_lighttable_layout_changed(GTK_COMBO_BOX(d->layout_combo), self); darktable.view_manager->proxy.lighttable.module = self; darktable.view_manager->proxy.lighttable.set_zoom = _lib_lighttable_set_zoom; darktable.view_manager->proxy.lighttable.get_zoom = _lib_lighttable_get_zoom; darktable.view_manager->proxy.lighttable.get_layout = _lib_lighttable_get_layout; darktable.view_manager->proxy.lighttable.set_layout = _lib_lighttable_set_layout; }
static void create_password_dialog(GtkWidget **dialog, GtkWidget *pass_entry, GtkWidget *pin_entry) { GtkWidget *table, *widget; int row = 0; *dialog = gtk_dialog_new_with_buttons(WINDOW_TITLE, NULL, 0, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, GTK_STOCK_QUIT, GTK_RESPONSE_REJECT, NULL); table = gtk_table_new(!!pin_entry + !!pass_entry, 2, FALSE); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(*dialog)->vbox), table); if (pass_entry) { widget = gtk_label_new("Password:"******"PIN:"); gtk_table_attach_defaults(GTK_TABLE(table), widget, 0, 1, row, row + 1); gtk_entry_set_max_length(GTK_ENTRY(pin_entry), MAX_PIN); gtk_entry_set_width_chars(GTK_ENTRY(pin_entry), MAX_PIN); gtk_entry_set_visibility(GTK_ENTRY(pin_entry), FALSE); gtk_table_attach_defaults(GTK_TABLE(table), pin_entry, 1, 2, row, row + 1); row++; } gtk_widget_show_all(*dialog); }
void dv_view_set_entry_radix_text(dv_view_t * V) { char str[DV_ENTRY_RADIX_MAX_LENGTH]; double radix = dv_view_get_radix(V); sprintf(str, "%lf", radix); if (GTK_IS_WIDGET(V->T->entry_radix)) { gtk_entry_set_width_chars(GTK_ENTRY(V->T->entry_radix), strlen(str)); gtk_entry_set_text(GTK_ENTRY(V->T->entry_radix), str); } }
void run_dialog_jump_to(GtkWidget *textview) { GtkWidget *dialog; GtkWidget *button; GtkWidget *table; GtkWidget *label; GtkWidget *spinner; GtkAdjustment *spinner_adj; GtkTextIter iter; gint num, max_num; GtkTextBuffer *textbuffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(textview)); gtk_text_buffer_get_iter_at_mark(textbuffer, &iter, gtk_text_buffer_get_insert(textbuffer)); num = gtk_text_iter_get_line(&iter) + 1; gtk_text_buffer_get_end_iter(textbuffer, &iter); max_num = gtk_text_iter_get_line(&iter) + 1; dialog = gtk_dialog_new_with_buttons(_("Jump To"), GTK_WINDOW(gtk_widget_get_toplevel(textview)), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); button = create_button_with_stock_image(_("_Jump"), GTK_STOCK_JUMP_TO); GTK_WIDGET_SET_FLAGS(button, GTK_CAN_DEFAULT); gtk_dialog_add_action_widget(GTK_DIALOG(dialog), button, GTK_RESPONSE_OK); table = gtk_table_new(1, 2, FALSE); gtk_table_set_col_spacings(GTK_TABLE(table), 8); gtk_container_set_border_width (GTK_CONTAINER(table), 8); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), table, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic(_("_Line number:")); spinner_adj = (GtkAdjustment *) gtk_adjustment_new(num, 1, max_num, 1, 1, 0); spinner = gtk_spin_button_new(spinner_adj, 1, 0); gtk_entry_set_width_chars(GTK_ENTRY(spinner), 8); gtk_label_set_mnemonic_widget(GTK_LABEL(label), spinner); gtk_entry_set_activates_default(GTK_ENTRY(spinner), TRUE); gtk_table_attach_defaults(GTK_TABLE(table), label, 0, 1, 0, 1); gtk_table_attach_defaults(GTK_TABLE(table), spinner, 1, 2, 0, 1); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_widget_show_all(dialog); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) { gtk_text_buffer_get_iter_at_line(textbuffer, &iter, gtk_spin_button_get_value_as_int(GTK_SPIN_BUTTON(spinner)) - 1); gtk_text_buffer_place_cursor(textbuffer, &iter); // gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(textview), &iter, 0.1, FALSE, 0.5, 0.5); scroll_to_cursor(textbuffer, 0.25); } gtk_widget_destroy (dialog); }
void ygtk_field_entry_setup_field (YGtkFieldEntry *fields, guint index, gint max_length, const gchar *valid_chars) { GtkEntry *entry = ygtk_field_entry_get_field_widget (fields, index); gboolean disable_len = (max_length <= 0); gtk_entry_set_max_length (entry, disable_len ? 0 : max_length); gtk_entry_set_width_chars (entry, disable_len ? -1 : max_length); gtk_box_set_child_packing (GTK_BOX (fields), GTK_WIDGET (entry), disable_len, TRUE, 0, GTK_PACK_START); ygutils_setFilter (entry, valid_chars); }
WirelessSecurityWPAPSK * ws_wpa_psk_new (NMConnection *connection, gboolean secrets_only) { WirelessSecurity *parent; WirelessSecurityWPAPSK *sec; GtkWidget *widget; parent = wireless_security_init (sizeof (WirelessSecurityWPAPSK), validate, add_to_size_group, fill_connection, update_secrets, NULL, "/org/gnome/control-center/network/ws-wpa-psk.ui", "wpa_psk_notebook", "wpa_psk_entry"); if (!parent) return NULL; parent->adhoc_compatible = FALSE; sec = (WirelessSecurityWPAPSK *) parent; widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_entry")); g_assert (widget); g_signal_connect (G_OBJECT (widget), "changed", (GCallback) wireless_security_changed_cb, sec); gtk_entry_set_width_chars (GTK_ENTRY (widget), 28); /* Fill secrets, if any */ if (connection) update_secrets (WIRELESS_SECURITY (sec), connection); widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "show_checkbutton_wpa")); g_assert (widget); g_signal_connect (G_OBJECT (widget), "toggled", (GCallback) show_toggled_cb, sec); /* Hide WPA/RSN for now since this can be autodetected by NM and the * supplicant when connecting to the AP. */ widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_type_combo")); g_assert (widget); gtk_widget_hide (widget); widget = GTK_WIDGET (gtk_builder_get_object (parent->builder, "wpa_psk_type_label")); g_assert (widget); gtk_widget_hide (widget); return sec; }
void gui_init(dt_lib_module_t *self) { dt_lib_geotagging_t *d = (dt_lib_geotagging_t *)malloc(sizeof(dt_lib_geotagging_t)); self->data = (void *)d; d->timezones = _lib_geotagging_get_timezones(); self->widget = gtk_box_new(GTK_ORIENTATION_VERTICAL, 5); GtkBox *hbox; GtkWidget *button, *label; /* the offset line */ hbox = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5)); label = GTK_WIDGET(gtk_label_new(_("time offset"))); gtk_widget_set_halign(label, GTK_ALIGN_START); gtk_box_pack_start(hbox, label, TRUE, TRUE, 0); d->offset_entry = gtk_entry_new(); dt_gui_key_accel_block_on_focus_connect(d->offset_entry); gtk_entry_set_max_length(GTK_ENTRY(d->offset_entry), 9); gtk_entry_set_width_chars(GTK_ENTRY(d->offset_entry), 0); gtk_box_pack_start(hbox, d->offset_entry, TRUE, TRUE, 0); g_signal_connect(d->offset_entry, "key-press-event", G_CALLBACK(_lib_geotagging_offset_key_press), self); g_signal_connect(d->offset_entry, "focus-out-event", G_CALLBACK(_lib_geotagging_offset_focus_out), self); g_object_set(G_OBJECT(d->offset_entry), "tooltip-text", _("time offset\nformat: [+-]?[[hh:]mm:]ss"), (char *)NULL); gchar *str = dt_conf_get_string("plugins/lighttable/geotagging/offset"); if(_lib_geotagging_parse_offset(str, NULL)) gtk_entry_set_text(GTK_ENTRY(d->offset_entry), str); else gtk_entry_set_text(GTK_ENTRY(d->offset_entry), "+00:00:00"); g_free(str); GtkBox *button_box = GTK_BOX(gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 5)); button = dtgtk_button_new(dtgtk_cairo_paint_zoom, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER); g_object_set(G_OBJECT(button), "tooltip-text", _("calculate the time offset from an image"), (char *)NULL); gtk_box_pack_start(button_box, button, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_lib_geotagging_show_offset_window), self); button = dtgtk_button_new(dtgtk_cairo_paint_check_mark, CPF_STYLE_FLAT | CPF_DO_NOT_USE_BORDER); g_object_set(G_OBJECT(button), "tooltip-text", _("apply time offset to selected images"), (char *)NULL); gtk_box_pack_start(button_box, button, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_lib_geotagging_apply_offset_callback), self); gtk_box_pack_start(hbox, GTK_WIDGET(button_box), TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(self->widget), GTK_WIDGET(hbox), TRUE, TRUE, 0); /* gpx */ button = gtk_button_new_with_label(_("apply GPX track file")); g_object_set(G_OBJECT(button), "tooltip-text", _("parses a GPX file and updates location of selected images"), (char *)NULL); gtk_box_pack_start(GTK_BOX(self->widget), button, TRUE, TRUE, 0); g_signal_connect(G_OBJECT(button), "clicked", G_CALLBACK(_lib_geotagging_gpx_callback), self); }
static void presence_chooser_dialog_show (void) { GladeXML *glade; gchar *filename; if (message_dialog) { gtk_window_present (GTK_WINDOW (message_dialog->dialog)); return; } message_dialog = g_new0 (CustomMessageDialog, 1); filename = empathy_file_lookup ("empathy-presence-chooser.glade", "libempathy-gtk"); glade = empathy_glade_get_file (filename, "custom_message_dialog", NULL, "custom_message_dialog", &message_dialog->dialog, "checkbutton_save", &message_dialog->checkbutton_save, "comboboxentry_message", &message_dialog->comboboxentry_message, "combobox_status", &message_dialog->combobox_status, NULL); g_free (filename); empathy_glade_connect (glade, message_dialog, "custom_message_dialog", "destroy", presence_chooser_dialog_destroy_cb, "custom_message_dialog", "response", presence_chooser_dialog_response_cb, "combobox_status", "changed", presence_chooser_dialog_status_changed_cb, "checkbutton_save", "toggled", presence_chooser_dialog_save_toggled_cb, NULL); g_object_unref (glade); /* Setup the message combobox */ message_dialog->entry_message = GTK_BIN (message_dialog->comboboxentry_message)->child; gtk_entry_set_activates_default (GTK_ENTRY (message_dialog->entry_message), TRUE); gtk_entry_set_width_chars (GTK_ENTRY (message_dialog->entry_message), 25); g_signal_connect (message_dialog->entry_message, "changed", G_CALLBACK (presence_chooser_dialog_message_changed_cb), message_dialog); presence_chooser_dialog_setup (message_dialog); gtk_combo_box_entry_set_text_column (GTK_COMBO_BOX_ENTRY (message_dialog->comboboxentry_message), 0); /* FIXME: Set transian for a window ? */ gtk_widget_show_all (message_dialog->dialog); }
/* * Create the dialog of 'Search' */ void av_dialog_search_new(const av_doc *doc) { GtkWidget *entry = NULL; const char *entry_text = NULL; gint result = 0; /* * Create dialog */ main_widget.dialog_search = gtk_dialog_new(); gtk_window_set_decorated(GTK_WINDOW(main_widget.dialog_search), FALSE); gtk_window_set_resizable(GTK_WINDOW(main_widget.dialog_search), FALSE); gtk_window_set_opacity(GTK_WINDOW(main_widget.dialog_search), AV_WIDGET_SEARCH_DIALOG_OPACITY); gtk_window_set_position(GTK_WINDOW(main_widget.dialog_search), GTK_WIN_POS_CENTER_ALWAYS); /* * Create entry in dialog */ entry = gtk_entry_new(); gtk_widget_show(entry); gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_GO_FORWARD); gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE); gtk_entry_set_width_chars(GTK_ENTRY(entry), AV_WIDGET_SEARCH_DIALOG_ENTRY_WIDTH); gtk_dialog_add_action_widget(GTK_DIALOG(main_widget.dialog_search), entry, GTK_RESPONSE_OK); /* Create completion in entry */ dialog_entry_completion_new(GTK_WIDGET(entry), dialog_search_entry_completion_cb, (gpointer)doc); result = gtk_dialog_run(GTK_DIALOG(main_widget.dialog_search)); switch (result) { case GTK_RESPONSE_CANCEL: AV_DBG("%s: canceled\n", __func__); break; case GTK_RESPONSE_OK: entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); AV_DBG("%s: search text: %s\n", __func__, entry_text); av_editor_search(&doc->editor, entry_text); break; default: break; } gtk_widget_destroy(entry); gtk_widget_destroy(main_widget.dialog_search); }
/* * Create the dialog of 'Go To Line' */ void av_dialog_goto_line_new(const av_doc *doc) { GtkWidget *entry = NULL; const char *entry_text = NULL; guint line = 0; gboolean status = FALSE; gint result = 0; /* * Create dialog */ main_widget.dialog_goto_line = gtk_dialog_new(); gtk_window_set_decorated(GTK_WINDOW(main_widget.dialog_goto_line), FALSE); gtk_window_set_resizable(GTK_WINDOW(main_widget.dialog_goto_line), FALSE); gtk_window_set_opacity(GTK_WINDOW(main_widget.dialog_goto_line), AV_WIDGET_GOTO_LINE_DIALOG_OPACITY); gtk_window_set_position(GTK_WINDOW(main_widget.dialog_goto_line), GTK_WIN_POS_CENTER); /* * Create entry in dialog */ entry = gtk_entry_new(); gtk_widget_show(entry); gtk_entry_set_icon_from_stock(GTK_ENTRY(entry), GTK_ENTRY_ICON_SECONDARY, GTK_STOCK_GO_FORWARD); gtk_entry_set_has_frame(GTK_ENTRY(entry), FALSE); gtk_entry_set_width_chars(GTK_ENTRY(entry), AV_WIDGET_GOTO_LINE_DIALOG_ENTRY_WIDTH); gtk_dialog_add_action_widget(GTK_DIALOG(main_widget.dialog_goto_line), entry, GTK_RESPONSE_OK); result = gtk_dialog_run(GTK_DIALOG(main_widget.dialog_goto_line)); switch (result) { case GTK_RESPONSE_CANCEL: AV_DBG("%s: canceled\n", __func__); break; case GTK_RESPONSE_OK: entry_text = gtk_entry_get_text(GTK_ENTRY(entry)); AV_DBG("%s: goto line: %s\n", __func__, entry_text); status = dialog_entry_text_to_digit(entry_text, &line); if (status == TRUE) av_editor_goto_line(&doc->editor, line); break; default: break; } gtk_widget_destroy(entry); gtk_widget_destroy(main_widget.dialog_goto_line); }
static GtkToolItem * create_entry_item (const char *text) { GtkToolItem *item; GtkWidget *entry; entry = gtk_entry_new (); gtk_entry_set_text (GTK_ENTRY (entry), text); gtk_entry_set_width_chars (GTK_ENTRY (entry), 5); item = gtk_tool_item_new (); gtk_container_add (GTK_CONTAINER (item), entry); return item; }
/* Create the command_combo_box. Called once, either by | ghid_command_window_show() or ghid_command_entry_get(). Then as long as | ghidgui->use_command_window is TRUE, the command_combo_box will live | in a command window vbox or float if the command window is not up. | But if ghidgui->use_command_window is FALSE, the command_combo_box | will live in the status_line_hbox either shown or hidden. | Since it's never destroyed, the combo history strings never need | rebuilding and history is maintained if the combo box location is moved. */ static void command_combo_box_entry_create (void) { ghidgui->command_combo_box = gtk_combo_box_entry_new_text (); ghidgui->command_entry = GTK_ENTRY (gtk_bin_get_child (GTK_BIN (ghidgui->command_combo_box))); gtk_entry_set_width_chars (ghidgui->command_entry, 40); gtk_entry_set_activates_default (ghidgui->command_entry, TRUE); g_signal_connect (G_OBJECT (ghidgui->command_entry), "activate", G_CALLBACK (command_entry_activate_cb), NULL); g_object_ref (G_OBJECT (ghidgui->command_combo_box)); /* so can move it */ }
static GtkWidget *ccma_confirm_dialog_new(CCManagerApplet * applet) { g_message(" ccma_confirm_dialog_new().."); GtkWidget *dialog, *label, *entry, *box, *bt_ok, *bt_cancel; if (CC_MANAGERAPPLET(applet)->is_confirm_showed == TRUE) return NULL; CC_MANAGERAPPLET(applet)->confirm_dialog = gtk_dialog_new(); dialog = CC_MANAGERAPPLET(applet)->confirm_dialog; CC_MANAGERAPPLET(applet)->is_confirm_showed = TRUE; gtk_window_set_title(GTK_WINDOW(dialog), "管理认证"); gtk_window_set_modal(GTK_WINDOW(dialog), TRUE); bt_ok = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_OK, GTK_RESPONSE_OK); bt_cancel = gtk_dialog_add_button(GTK_DIALOG(dialog), GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL); label = gtk_label_new("口令 :"); entry = gtk_entry_new(); gtk_entry_set_width_chars(GTK_ENTRY(entry), 20); gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); box=gtk_box_new(GTK_ORIENTATION_HORIZONTAL,5); gtk_box_pack_start(GTK_BOX(box),label, FALSE, FALSE, 5); gtk_box_pack_end(GTK_BOX(box),entry, TRUE, TRUE, 10); gtk_container_add(GTK_CONTAINER(gtk_dialog_get_content_area(GTK_DIALOG(dialog))),box); // gtk_window_set_has_resize_grip(GTK_WINDOW(dialog),TRUE); gtk_window_set_resizable(GTK_WINDOW(dialog), FALSE); gtk_widget_grab_focus(entry); g_signal_connect(dialog, "delete-event", G_CALLBACK(ccma_confirm_dialog_leave_cb), applet); g_signal_connect(entry, "activate", G_CALLBACK(ccma_dialog_entry_enter_cb), applet); g_signal_connect(dialog, "response", G_CALLBACK(ccma_dialog_response_cb), applet); gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER_ALWAYS); gtk_window_set_keep_above(GTK_WINDOW(dialog), TRUE); g_message("ccma_confirm_dialog_new().."); gtk_widget_show_all(dialog); return dialog; }