GtkWidget * athena_entry_new_with_max_length (guint16 max) { GtkWidget *widget; widget = gtk_widget_new (ATHENA_TYPE_ENTRY, NULL); gtk_entry_set_max_length (GTK_ENTRY (widget), max); return widget; }
GtkWidget * nemo_entry_new_with_max_length (guint16 max) { GtkWidget *widget; widget = gtk_widget_new (NEMO_TYPE_ENTRY, NULL); gtk_entry_set_max_length (GTK_ENTRY (widget), max); return widget; }
GtkWidget * nautilus_entry_new_with_max_length (guint16 max) { GtkWidget *widget; widget = gtk_widget_new (NAUTILUS_TYPE_ENTRY, NULL); gtk_entry_set_max_length (GTK_ENTRY (widget), max); return widget; }
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); }
void aifp_rename_item_cb (GtkButton *button, gpointer user_data) { GtkWidget *name_entry; gchar temp[MAXLEN]; gint response; const gchar * text; if (strncmp(remote_item, PARENTDIR, 2)) { rename_dialog = gtk_message_dialog_new (GTK_WINDOW(aifp_window), GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_OK_CANCEL, _("Please enter a new name.")); gtk_window_set_title(GTK_WINDOW(rename_dialog), _("Rename")); name_entry = gtk_entry_new(); g_signal_connect (G_OBJECT(name_entry), "key_press_event", G_CALLBACK(rename_key_press), NULL); gtk_entry_set_max_length(GTK_ENTRY(name_entry), 64); gtk_widget_set_size_request(GTK_WIDGET(name_entry), 300, -1); gtk_entry_set_text(GTK_ENTRY(name_entry), remote_item); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(rename_dialog))), name_entry, FALSE, FALSE, 6); gtk_widget_show_all (rename_dialog); response = aqualung_dialog_run(GTK_DIALOG(rename_dialog)); if (response == GTK_RESPONSE_OK) { text = gtk_entry_get_text(GTK_ENTRY(name_entry)); strncpy(temp, remote_path, MAXLEN-1); if (strlen(remote_path) != 1) { strncat(temp, "\\", MAXLEN-1); } strncat(temp, text, MAXLEN-1); if (strlen(text)) { strncpy(dest_file, remote_path, MAXLEN-1); if (strlen(remote_path) != 1) { strncat(dest_file, "\\", MAXLEN-1); } strncat(dest_file, remote_item, MAXLEN-1); ifp_rename(&ifpdev, dest_file, temp); aifp_update_info(); aifp_directory_listing (NULL); } } gtk_widget_destroy(rename_dialog); } }
static void file_entry_build_children (GladeXML *xml, GtkWidget *w, GladeWidgetInfo *info, const char *longname) { GList *tmp; GladeWidgetInfo *cinfo = NULL; GtkEntry *entry; for (tmp = info->children; tmp; tmp = tmp->next) { GList *tmp2; gchar *child_name = NULL; cinfo = tmp->data; for (tmp2 = cinfo->attributes; tmp2; tmp2 = tmp2->next) { GladeAttribute *attr = tmp2->data; if (!strcmp(attr->name, "child_name")) { child_name = attr->value; break; } } if (child_name && !strcmp(child_name, "GnomeEntry:entry")) break; } if (!tmp) return; entry = GTK_ENTRY(GTK_PANDA_FILE_ENTRY(w)->entry); for (tmp = cinfo->attributes; tmp; tmp = tmp->next) { GladeAttribute *attr = tmp->data; if (!strcmp(attr->name, "editable")) gtk_entry_set_editable(entry, attr->value[0] == 'T'); else if (!strcmp(attr->name, "text_visible")) gtk_entry_set_visibility(entry, attr->value[0] == 'T'); else if (!strcmp(attr->name, "text_max_length")) gtk_entry_set_max_length(entry, strtol(attr->value,NULL, 0)); else if (!strcmp(attr->name, "max_length")) gtk_entry_set_max_length(entry, strtol(attr->value,NULL, 0)); else if (!strcmp(attr->name, "text")) gtk_entry_set_text(entry, attr->value); } glade_xml_set_common_params(xml, GTK_WIDGET(entry), cinfo, longname); }
void mc_create_command_entry (MCData *mc) { mc->applet_box = icon_entry_new (); mc->entry= ICON_ENTRY(mc->applet_box)->entry; g_object_set_data (G_OBJECT (mc->applet_box), "mcdata", mc); gtk_entry_set_max_length (GTK_ENTRY (mc->entry), MC_MAX_COMMAND_LENGTH); mc->history_button = gtk_event_box_new (); gtk_event_box_set_visible_window (GTK_EVENT_BOX (mc->history_button), FALSE); mc->history_image = gtk_image_new_from_stock ("gtk-go-down", GTK_ICON_SIZE_MENU); gtk_widget_show (mc->history_image); gtk_container_add (GTK_CONTAINER (mc->history_button), mc->history_image); icon_entry_pack_widget (ICON_ENTRY(mc->applet_box), mc->history_button, FALSE); mc->file_select_button = gtk_event_box_new (); gtk_event_box_set_visible_window (GTK_EVENT_BOX (mc->file_select_button), FALSE); mc->file_select_image = gtk_image_new_from_stock ("gtk-open", GTK_ICON_SIZE_MENU); gtk_widget_show (mc->file_select_image); gtk_container_add (GTK_CONTAINER (mc->file_select_button), mc->file_select_image); icon_entry_pack_widget (ICON_ENTRY(mc->applet_box), mc->file_select_button, FALSE); g_signal_connect (mc->entry, "key_press_event", G_CALLBACK (command_key_event), mc); g_signal_connect (mc->entry, "button_press_event", G_CALLBACK (button_press_cb), mc); g_signal_connect (mc->file_select_button, "button_press_event", G_CALLBACK (button_press_hack), mc); g_signal_connect (mc->history_button, "button_press_event", G_CALLBACK (button_press_hack), mc); if (!mc->preferences.show_default_theme) { gtk_widget_set_name (mc->entry, "minicommander-applet-entry"); mc_command_update_entry_color (mc); } else gtk_widget_set_name (mc->entry, "minicommander-applet-entry-default"); mc_command_update_entry_size (mc); set_atk_name_description (mc->entry, _("Command line"), _("Type a command here and Gnome will execute it for you")); }
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 GtkWidget * request_dialog (const gchar * request, const gchar * default_text, const guint16 max_length, MateStringCallback callback, gpointer data, gboolean password, GtkWindow * parent) { GtkWidget * mbox; callback_info * info; GtkWidget * entry; mbox = mate_message_box_new ( request, MATE_MESSAGE_BOX_QUESTION, MATE_STOCK_BUTTON_CANCEL, MATE_STOCK_BUTTON_OK, NULL ); mate_dialog_set_default ( MATE_DIALOG(mbox), 1 ); /* set up text entry widget */ entry = gtk_entry_new(); if (password) gtk_entry_set_visibility (GTK_ENTRY(entry), FALSE); if ((default_text != NULL) && (*default_text)) gtk_entry_set_text(GTK_ENTRY(entry), default_text); if (max_length > 0) gtk_entry_set_max_length(GTK_ENTRY(entry), max_length); gtk_box_pack_end ( GTK_BOX(MATE_DIALOG(mbox)->vbox), entry, FALSE, FALSE, MATE_PAD_SMALL ); /* If Return is pressed in the text entry, propagate to the buttons */ mate_dialog_editable_enters(MATE_DIALOG(mbox), GTK_EDITABLE(entry)); info = g_new(callback_info, 1); info->function = callback; info->data = data; info->entry = GTK_ENTRY(entry); g_signal_connect_data (mbox, "clicked", G_CALLBACK (dialog_string_callback), info, (GClosureNotify) g_free, 0); if (parent != NULL) { mate_dialog_set_parent(MATE_DIALOG(mbox),parent); } gtk_widget_grab_focus (entry); gtk_widget_show (entry); gtk_widget_show (mbox); return mbox; }
// initialise a new object static void gtk_pincode_entry_init(GtkPincodeEntry* pincode_entry) { g_return_if_fail(pincode_entry != NULL); GtkWidget* widget = (GtkWidget*)pincode_entry; GtkEntry* entry = (GtkEntry* )pincode_entry; gtk_widget_set_size_request(widget, PINCODE_INPUT_ENTRY_WIDTH, PINCODE_INPUT_ENTRY_HEIGHT); gtk_entry_set_max_length(entry, PINCODE_UI_MAX_LENGTH); gtk_entry_set_visibility(entry, FALSE); gtk_signal_connect(GTK_OBJECT(entry), "insert_text", GTK_SIGNAL_FUNC(on_gtk_pincode_entry_insert_text), NULL); }
int make_entry() { if(entry) return 1; entry =(GtkWidget *)gtk_entry_new(); gtk_widget_set_size_request(entry, 450, 24); gtk_entry_set_max_length((GtkEntry *)entry, 128); g_signal_connect(entry, "activate", G_CALLBACK(on_entry1_activate), NULL); debug("make entry"); return 0; }
char * show_username_dialog(GtkWindow * window) { GtkWidget *dialog, *label, *content_area,*entry,*button; entry = gtk_entry_new(); /* Create the widgets */ dialog = gtk_dialog_new_with_buttons("Username setup", window, GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_APPLY, GTK_RESPONSE_ACCEPT, NULL); content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); label = gtk_label_new("Please enter your youtube username\n"); button = gtk_dialog_get_widget_for_response(GTK_DIALOG(dialog),GTK_RESPONSE_ACCEPT); gtk_widget_set_sensitive(button,gtk_false()); g_signal_connect(G_OBJECT(entry), "insert_text", G_CALLBACK(insert_text_handler), button); g_signal_connect(G_OBJECT(entry), "delete-text", G_CALLBACK(delete_text_handler), button); /* Ensure that the dialog box is destroyed when the user responds. */ g_signal_connect_swapped(dialog,"response",G_CALLBACK(gtk_widget_destroy),dialog); /* Add the label, and show everything we've added to the dialog. */ gtk_container_add(GTK_CONTAINER (content_area), label); gtk_container_add(GTK_CONTAINER (content_area), entry); gtk_entry_set_max_length(GTK_ENTRY(entry),30); gtk_widget_show_all(dialog); gint result = gtk_dialog_run(GTK_DIALOG (dialog)); switch (result) { case GTK_RESPONSE_ACCEPT: printf("hello this %s",gtk_entry_get_text(GTK_ENTRY(entry))); put_username(entry); break; default: printf("hello"); gtk_main_quit(); break; } gtk_widget_destroy(dialog); fetch_new_videos(GTK_WINDOW(window)); }
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); GtkWidget *widget; /* create layout selection combobox */ widget = gtk_combo_box_text_new(); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("zoomable light table")); gtk_combo_box_text_append_text(GTK_COMBO_BOX_TEXT(widget), _("file manager")); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), dt_conf_get_int("plugins/lighttable/layout")); g_signal_connect(G_OBJECT(widget), "changed", G_CALLBACK(_lib_lighttable_layout_changed), (gpointer)self); gtk_box_pack_start(GTK_BOX(self->widget), widget, 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); #if GTK_CHECK_VERSION(3, 12, 0) gtk_entry_set_max_width_chars(GTK_ENTRY(d->zoom_entry), 3); #endif 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), dt_conf_get_int("plugins/lighttable/images_in_row")); _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 darktable.view_manager->proxy.lighttable.module = self; darktable.view_manager->proxy.lighttable.set_zoom = _lib_lighttable_set_zoom; }
static void finish_setup (CEPageMobile *self, gpointer unused, GError *error, gpointer user_data) { CEPage *parent = CE_PAGE (self); CEPageMobilePrivate *priv = CE_PAGE_MOBILE_GET_PRIVATE (self); if (error) return; if (NM_IS_SETTING_GSM (priv->setting)) populate_gsm_ui (self, parent->connection); else if (NM_IS_SETTING_CDMA (priv->setting)) populate_cdma_ui (self, parent->connection); else g_assert_not_reached (); g_signal_connect (priv->number, "changed", G_CALLBACK (stuff_changed), self); g_signal_connect (priv->username, "changed", G_CALLBACK (stuff_changed), self); g_signal_connect (priv->password, "changed", G_CALLBACK (stuff_changed), self); g_signal_connect (priv->apn, "changed", G_CALLBACK (stuff_changed), self); gtk_entry_set_max_length (priv->apn, 64); /* APNs are max 64 chars */ g_signal_connect (priv->apn, "insert-text", G_CALLBACK (apn_filter_cb), self); g_signal_connect (priv->apn_button, "clicked", G_CALLBACK (apn_button_clicked), self); g_signal_connect (priv->network_id, "changed", G_CALLBACK (stuff_changed), self); gtk_entry_set_max_length (priv->network_id, 6); /* MCC/MNCs are max 6 chars */ g_signal_connect (priv->network_id, "insert-text", G_CALLBACK (network_id_filter_cb), self); g_signal_connect (priv->network_type, "changed", G_CALLBACK (stuff_changed), self); g_signal_connect (priv->pin, "changed", G_CALLBACK (stuff_changed), self); g_signal_connect (priv->roaming_allowed, "toggled", G_CALLBACK (stuff_changed), self); g_signal_connect (GTK_WIDGET (gtk_builder_get_object (parent->builder, "mobile_show_passwords")), "toggled", G_CALLBACK (show_passwords), self); }
/**************************************************************** * gnc_ui_qif_account_picker_new_cb * * This handler is invoked when the user wishes to create a new * account. ****************************************************************/ void gnc_ui_qif_account_picker_new_cb(GtkButton * w, gpointer user_data) { QIFAccountPickerDialog * wind = user_data; SCM name_setter = scm_c_eval_string("qif-map-entry:set-gnc-name!"); const gchar *name; int response; gchar *fullname; GtkWidget *dlg, *entry; /* Create a dialog to get the new account name. */ dlg = gtk_message_dialog_new(GTK_WINDOW(wind->dialog), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_MESSAGE_QUESTION, GTK_BUTTONS_OK_CANCEL, "%s", _("Enter a name for the account")); gtk_dialog_set_default_response(GTK_DIALOG(dlg), GTK_RESPONSE_OK); entry = gtk_entry_new(); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); gtk_entry_set_max_length(GTK_ENTRY(entry), 250); gtk_widget_show(entry); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dlg)->vbox), entry); /* Run the dialog to get the new account name. */ response = gtk_dialog_run(GTK_DIALOG(dlg)); name = gtk_entry_get_text(GTK_ENTRY(entry)); /* Did the user enter a name and click OK? */ if (response == GTK_RESPONSE_OK && name && *name) { /* If an account is selected, this will be a new subaccount. */ if (wind->selected_name && *(wind->selected_name)) /* We have the short name; determine the full name. */ fullname = g_strjoin(gnc_get_account_separator_string(), wind->selected_name, name, (char *)NULL); else fullname = g_strdup(name); /* Save the full name and update the map entry. */ g_free(wind->selected_name); wind->selected_name = fullname; scm_call_2(name_setter, wind->map_entry, scm_from_utf8_string(fullname)); } gtk_widget_destroy(dlg); /* Refresh the tree display and give it the focus. */ build_acct_tree(wind, wind->qif_wind); gtk_widget_grab_focus(GTK_WIDGET(wind->treeview)); }
void gui_init(dt_lib_module_t *self) { /* initialize ui widgets */ dt_lib_tool_lighttable_t *d = (dt_lib_tool_lighttable_t *)g_malloc(sizeof(dt_lib_tool_lighttable_t)); self->data = (void *)d; memset(d,0,sizeof(dt_lib_tool_lighttable_t)); self->widget = gtk_hbox_new(FALSE,2); GtkWidget* widget; /* create layout selection combobox */ widget = gtk_combo_box_new_text(); gtk_combo_box_append_text(GTK_COMBO_BOX(widget), _("zoomable light table")); gtk_combo_box_append_text(GTK_COMBO_BOX(widget), _("file manager")); gtk_combo_box_set_active(GTK_COMBO_BOX(widget), dt_conf_get_int("plugins/lighttable/layout")); g_signal_connect (G_OBJECT (widget), "changed", G_CALLBACK (_lib_lighttable_layout_changed), (gpointer)self); gtk_box_pack_start(GTK_BOX(self->widget), widget, TRUE, TRUE, 0); /* create horizontal zoom slider */ d->zoom = gtk_hscale_new_with_range(1, 26, 1); gtk_widget_set_size_request (GTK_WIDGET(d->zoom), 160, -1); gtk_scale_set_draw_value(GTK_SCALE(d->zoom), FALSE); 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); g_object_set(G_OBJECT(d->zoom_entry), "width-chars", 3, (char *)NULL); 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), dt_conf_get_int("plugins/lighttable/images_in_row")); darktable.view_manager->proxy.lighttable.module = self; darktable.view_manager->proxy.lighttable.set_zoom = _lib_lighttable_set_zoom; }
/*! \brief Add new attribute dialog. * * This asks for the name of the attrib column to insert * and then inserts the column. */ void x_dialog_newattrib() { GtkWidget *dialog; GtkWidget *label; GtkWidget *attrib_entry; gchar *entry_text; /* Create the dialog */ dialog = gtk_dialog_new_with_buttons(_("Add new attribute"), NULL, GTK_DIALOG_MODAL, GTK_STOCK_OK, GTK_RESPONSE_OK, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); /* Create a text label for the dialog window */ label = gtk_label_new (_("Enter new attribute name")); gtk_box_pack_start (GTK_BOX(GTK_DIALOG(dialog)->vbox), label, FALSE, FALSE, 0); /* Create the "attrib" text entry area */ attrib_entry = gtk_entry_new (); gtk_entry_set_max_length (GTK_ENTRY (attrib_entry), 1024); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dialog)->vbox), attrib_entry, TRUE, TRUE, 5); gtk_widget_set_size_request (dialog, 260, 140); gtk_widget_show_all(dialog); switch(gtk_dialog_run(GTK_DIALOG(dialog))) { case GTK_RESPONSE_OK: entry_text = g_strdup( gtk_entry_get_text(GTK_ENTRY(attrib_entry)) ); /* Perhaps do some other checks . . . . */ if (entry_text != NULL) { s_toplevel_add_new_attrib(entry_text); g_free(entry_text); } break; case GTK_RESPONSE_CANCEL: default: /* do nothing */ break; } gtk_widget_destroy(dialog); }
/* options dialog */ static void wavelan_create_options (Control *ctrl, GtkContainer *con, GtkWidget *done) { t_wavelan *wavelan = (t_wavelan *)ctrl->data; GtkWidget *hbox, *label, *interface, *vbox, *autohide; GtkWidget *combo; GList *interfaces, *lp; vbox = gtk_vbox_new(FALSE, 2); gtk_widget_show(vbox); gtk_container_add(GTK_CONTAINER(con), vbox); hbox = gtk_hbox_new(FALSE, 2); gtk_widget_show(hbox); label = gtk_label_new(_("Interface")); gtk_widget_show(label); interfaces = wavelan_query_interfaces (); combo = gtk_combo_new (); gtk_combo_set_popdown_strings (GTK_COMBO (combo), interfaces); gtk_widget_show (combo); interface = GTK_COMBO (combo)->entry; gtk_entry_set_max_length(GTK_ENTRY(interface), 10); if (wavelan->interface != NULL) gtk_entry_set_text(GTK_ENTRY(interface), wavelan->interface); g_signal_connect(interface, "changed", G_CALLBACK(wavelan_interface_changed), wavelan); gtk_widget_show(interface); gtk_box_pack_start(GTK_BOX(hbox), label, TRUE, FALSE, 1); gtk_box_pack_start(GTK_BOX(hbox), combo, TRUE, FALSE, 1); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 1); hbox = gtk_hbox_new(FALSE, 2); gtk_widget_show(hbox); autohide = gtk_check_button_new_with_mnemonic(_("_Autohide when offline")); gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autohide), wavelan->autohide); g_signal_connect(autohide, "toggled", G_CALLBACK(wavelan_autohide_changed), wavelan); gtk_widget_show(autohide); gtk_box_pack_start(GTK_BOX(hbox), autohide, TRUE, TRUE, 1); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 1); for (lp = interfaces; lp != NULL; lp = lp ->next) g_free (lp->data); g_list_free (interfaces); }
static void on_break_ignore_editing_started(G_GNUC_UNUSED GtkCellRenderer *cell, GtkCellEditable *editable, const gchar *path_str, G_GNUC_UNUSED gpointer gdata) { GtkTreeIter iter; const gchar *ignore; if (GTK_IS_EDITABLE(editable)) validator_attach(GTK_EDITABLE(editable), VALIDATOR_NUMERIC); if (GTK_IS_ENTRY(editable)) gtk_entry_set_max_length(GTK_ENTRY(editable), 10); scp_tree_store_get_iter_from_string(store, &iter, path_str); scp_tree_store_get(store, &iter, BREAK_IGNORE, &ignore, -1); g_signal_connect(editable, "map", G_CALLBACK(on_view_editable_map), g_strdup(ignore)); }
static int gtkListSetNCAttrib(Ihandle* ih, const char* value) { if (!ih->data->has_editbox) return 0; if (!iupStrToInt(value, &ih->data->nc)) ih->data->nc = INT_MAX; if (ih->handle) { GtkEntry* entry = (GtkEntry*)iupAttribGet(ih, "_IUPGTK_ENTRY"); gtk_entry_set_max_length(entry, ih->data->nc); } return 0; }
static void gm_pw_init_general_page (GtkWidget *prefs_window, GtkWidget *container) { GtkWidget *subsection = NULL; GtkWidget *entry = NULL; /* Personal Information */ subsection = gnome_prefs_subsection_new (prefs_window, container, _("Personal Information"), 2, 2); entry = gnome_prefs_entry_new (subsection, _("_Full name:"), PERSONAL_DATA_KEY "full_name", _("Enter your full name"), 0, 2, false); gtk_widget_set_size_request (GTK_WIDGET (entry), 250, -1); gtk_entry_set_max_length (GTK_ENTRY (entry), 65); }
GtkWidget *createDialog(GtkWidget *window, GtkWidget *entry, const char *name, const char *message) { GtkWidget *dialog = gtk_dialog_new_with_buttons(l10n("Signing"), GTK_WINDOW(window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); setDialogProperties(dialog, window); GtkWidget* vbox = gtk_vbox_new(FALSE, 12); if (message && message[0]) { GtkWidget *messageLabel = gtk_label_new(NULL); char *markup = g_markup_printf_escaped("<span color='red'>%s</span>", message); gtk_label_set_markup(GTK_LABEL(messageLabel), markup); free(markup); gtk_container_add(GTK_CONTAINER(vbox), messageLabel); } GtkWidget *nameLabel = gtk_label_new(name); gtk_container_add(GTK_CONTAINER(vbox), nameLabel); gtk_misc_set_alignment(GTK_MISC(nameLabel), 0.0, 0.0); GtkWidget* hbox = gtk_hbox_new(FALSE, 12); gtk_entry_set_visibility(GTK_ENTRY(entry), FALSE); gtk_entry_set_max_length(GTK_ENTRY(entry), 12); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); GtkWidget *label = gtk_label_new(l10n("Please enter PIN2:")); gtk_label_set_use_underline(GTK_LABEL(label), TRUE); gtk_label_set_mnemonic_widget(GTK_LABEL(label), entry); gtk_container_add(GTK_CONTAINER(hbox), label); gtk_container_add(GTK_CONTAINER(hbox), entry); gtk_container_add(GTK_CONTAINER(vbox), hbox); gtk_container_set_border_width(GTK_CONTAINER(vbox), 5); gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)->vbox), vbox); gtk_dialog_set_has_separator(GTK_DIALOG(dialog), FALSE); gtk_container_set_border_width(GTK_CONTAINER(dialog), 5); gtk_widget_show_all(dialog); return dialog; }
static GtkWidget * ask_for_pin (GtkEntry **out_secret_entry) { GtkDialog *dialog; GtkWidget *w = NULL, *ok_button = NULL; GtkBox *box = NULL, *vbox = NULL; dialog = GTK_DIALOG (gtk_dialog_new ()); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_window_set_title (GTK_WINDOW (dialog), _("PIN code required")); ok_button = gtk_dialog_add_button (dialog, GTK_STOCK_CANCEL, GTK_RESPONSE_REJECT); ok_button = gtk_dialog_add_button (dialog, GTK_STOCK_OK, GTK_RESPONSE_OK); gtk_window_set_default (GTK_WINDOW (dialog), ok_button); vbox = GTK_BOX (gtk_dialog_get_content_area (dialog)); w = gtk_label_new (_("PIN code is needed for the mobile broadband device")); gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); w = gtk_alignment_new (0.5, 0.5, 0, 1.0); gtk_box_pack_start (vbox, w, TRUE, TRUE, 0); #if GTK_CHECK_VERSION(3,1,6) box = GTK_BOX (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6)); #else box = GTK_BOX (gtk_hbox_new (FALSE, 6)); #endif gtk_container_set_border_width (GTK_CONTAINER (box), 6); gtk_container_add (GTK_CONTAINER (w), GTK_WIDGET (box)); gtk_box_pack_start (box, gtk_label_new ("PIN:"), FALSE, FALSE, 0); w = gtk_entry_new (); *out_secret_entry = GTK_ENTRY (w); gtk_entry_set_max_length (GTK_ENTRY (w), 8); gtk_entry_set_width_chars (GTK_ENTRY (w), 8); gtk_entry_set_activates_default (GTK_ENTRY (w), TRUE); gtk_entry_set_visibility (GTK_ENTRY (w), FALSE); gtk_box_pack_start (box, w, FALSE, FALSE, 0); g_signal_connect (w, "changed", G_CALLBACK (pin_entry_changed), ok_button); pin_entry_changed (GTK_EDITABLE (w), ok_button); gtk_widget_show_all (GTK_WIDGET (vbox)); return GTK_WIDGET (dialog); }
LatexGlade::LatexGlade(GladeSearchpath* gladeSearchPath) : GladeGui(gladeSearchPath, "texdialog.glade", "texDialog") { XOJ_INIT_TYPE(LatexGlade); this->theLatex = NULL; this->theLatexLength = 0; //GtkWidget * vbox = get("texVBox"); //g_return_if_fail(vbox != NULL); this->texBox = get("texEntry"); //gtk_entry_set_max_length(GTK_ENTRY(this->texBox),50); //increase the maximum length to something reasonable. gtk_entry_set_max_length(GTK_ENTRY(this->texBox), 500); gtk_widget_show(this->texBox); }
static void change_title_menu_cb(void) { GtkWidget *dialog, *vbox, *hbox, *label, *entry; dialog = gtk_dialog_new_with_buttons( /* Dialog caption */ _("Change Title"), GTK_WINDOW(toplevel), GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_OK); g_signal_connect(G_OBJECT(dialog), "destroy", G_CALLBACK(gtk_widget_destroyed), &dialog); gtk_widget_realize(dialog); gdk_window_set_functions(dialog->window, GDK_FUNC_MOVE | GDK_FUNC_CLOSE); vbox = GTK_DIALOG(dialog)->vbox; hbox = gtk_hbox_new(FALSE, 5); gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, TRUE, 0); gtk_container_set_border_width(GTK_CONTAINER(hbox), 5); /* Label */ label = gtk_label_new(_("New title:")); gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, TRUE, 0); gtk_misc_set_alignment(GTK_MISC(label), 1, 0.5); entry = gtk_entry_new(); gtk_entry_set_max_length(GTK_ENTRY(entry), 60); gtk_box_pack_start(GTK_BOX(hbox), entry, TRUE, TRUE, 0); if (window_title != NULL) gtk_entry_set_text(GTK_ENTRY(entry), window_title); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); gtk_widget_show_all(dialog); if (gtk_dialog_run(GTK_DIALOG(dialog)) == GTK_RESPONSE_OK) set_window_title(gtk_entry_get_text(GTK_ENTRY(entry))); gtk_widget_destroy(dialog); }
/* --------------------------------------------------------------------- * Create the dialog, return the entry * --------------------------------------------------------------------- */ static GtkWidget* create_dialog(GtkWidget **dialog, GtkTreeModel *completion_model) { GtkWidget *entry; GtkWidget *label; GtkWidget *vbox; GtkEntryCompletion *completion; *dialog = gtk_dialog_new_with_buttons("Go to File...", GTK_WINDOW(geany->main_widgets->window), GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, GTK_STOCK_OK, GTK_RESPONSE_ACCEPT, NULL); gtk_dialog_set_default_response(GTK_DIALOG(*dialog), GTK_RESPONSE_ACCEPT); gtk_widget_set_name(*dialog, "GotoFile"); vbox = ui_dialog_vbox_new(GTK_DIALOG(*dialog)); label = gtk_label_new(_("Enter the file you want to open:")); gtk_container_add(GTK_CONTAINER(vbox), label); /* Entry definition */ entry = gtk_entry_new(); gtk_container_add(GTK_CONTAINER(vbox), entry); gtk_entry_set_text(GTK_ENTRY(entry), ""); gtk_entry_set_max_length(GTK_ENTRY(entry), MAX_FILENAME_LENGTH); gtk_entry_set_width_chars(GTK_ENTRY(entry), 40); gtk_entry_set_activates_default(GTK_ENTRY(entry), TRUE); /* 'enter' key */ /* Completion definition */ completion = gtk_entry_completion_new(); gtk_entry_set_completion(GTK_ENTRY(entry), completion); gtk_entry_completion_set_model (completion, completion_model); /* Completion options */ gtk_entry_completion_set_inline_completion(completion, 1); gtk_entry_completion_set_text_column (completion, 0); /* Signals */ g_signal_connect_after(GTK_ENTRY(entry), "changed", G_CALLBACK(directory_check), completion); gtk_widget_show_all(*dialog); return entry; }
static void mpd_set_entry (GtkWidget *dialog, const char *entry_name, const char *label_name, const char *label, guint32 minlen, guint32 maxlen) { GladeXML *xml; GtkWidget *widget; gboolean entry2_active = FALSE; gboolean entry3_active = FALSE; g_return_if_fail (dialog != NULL); xml = g_object_get_data (G_OBJECT (dialog), "xml"); g_return_if_fail (xml != NULL); widget = glade_xml_get_widget (xml, label_name); gtk_label_set_text (GTK_LABEL (widget), label); widget = glade_xml_get_widget (xml, entry_name); g_signal_connect (widget, "changed", G_CALLBACK (mpd_entry_changed), dialog); g_signal_connect (widget, "insert-text", G_CALLBACK (mpd_entry_filter), NULL); if (maxlen) gtk_entry_set_max_length (GTK_ENTRY (widget), maxlen); g_object_set_data (G_OBJECT (widget), "minlen", GUINT_TO_POINTER (minlen)); /* Tag it so we know it's active */ g_object_set_data (G_OBJECT (widget), "active", GUINT_TO_POINTER (1)); /* Make a single-entry dialog look better */ widget = glade_xml_get_widget (xml, "code2_entry"); entry2_active = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget), "active")); widget = glade_xml_get_widget (xml, "code3_entry"); entry3_active = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (widget), "active")); widget = glade_xml_get_widget (xml, "table14"); if (entry2_active || entry3_active) gtk_table_set_row_spacings (GTK_TABLE (widget), 6); else gtk_table_set_row_spacings (GTK_TABLE (widget), 0); mpd_entry_changed (NULL, dialog); }
ZLGtkApplicationWindow::GtkEntryParameter::GtkEntryParameter(ZLGtkApplicationWindow &window, const ZLToolbar::ParameterItem &item) : myWindow(window), myItem(item) { if (item.type() == ZLToolbar::Item::COMBO_BOX) { myWidget = gtk_combo_box_entry_new_text(); myEntry = GTK_ENTRY(GTK_BIN(myWidget)->child); ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myEntry), "changed", GTK_SIGNAL_FUNC(::onValueChanged), this); } else { myWidget = gtk_entry_new(); myEntry = GTK_ENTRY(myWidget); } gtk_entry_set_alignment(myEntry, 0.5); gtk_entry_set_width_chars(myEntry, item.maxWidth()); gtk_entry_set_max_length(myEntry, item.maxWidth()); if (item.symbolSet() == ZLToolbar::ParameterItem::SET_DIGITS) { hildon_gtk_entry_set_input_mode(myEntry, HILDON_GTK_INPUT_MODE_NUMERIC); } else { hildon_gtk_entry_set_input_mode(myEntry, HILDON_GTK_INPUT_MODE_FULL); } ZLGtkSignalUtil::connectSignal(GTK_OBJECT(myEntry), "key_press_event", GTK_SIGNAL_FUNC(::onKeyPressed), this); }
void sp_find_new_searchfield (GtkWidget *dlg, GtkWidget *vb, const gchar *label, const gchar *id, GtkTooltips *tt, const gchar *tip) { GtkWidget *hb = gtk_hbox_new (FALSE, 0); GtkWidget *l = gtk_label_new_with_mnemonic (label); gtk_widget_set_size_request (l, FIND_LABELWIDTH, -1); gtk_misc_set_alignment (GTK_MISC (l), 1.0, 0.5); gtk_box_pack_start (GTK_BOX (hb), l, FALSE, FALSE, 0); GtkWidget *tf = gtk_entry_new (); gtk_entry_set_max_length (GTK_ENTRY (tf), 64); gtk_box_pack_start (GTK_BOX (hb), tf, TRUE, TRUE, 0); gtk_object_set_data (GTK_OBJECT (dlg), id, tf); gtk_tooltips_set_tip (tt, tf, tip, NULL); g_signal_connect ( G_OBJECT (tf), "activate", G_CALLBACK (sp_find_dialog_find), dlg ); gtk_label_set_mnemonic_widget (GTK_LABEL(l), tf); gtk_box_pack_start (GTK_BOX (vb), hb, FALSE, FALSE, 0); }
static void gcal_date_selector_constructed (GObject *object) { GcalDateSelectorPrivate *priv; GtkWidget *label, *box; GList *l, *aux; priv = gcal_date_selector_get_instance_private (GCAL_DATE_SELECTOR (object)); /* chaining up */ G_OBJECT_CLASS (gcal_date_selector_parent_class)->constructed (object); /* set labels, on the first row */ label = gtk_grid_get_child_at (GTK_GRID (priv->grid), priv->day_pos, 0); gtk_label_set_text (GTK_LABEL (label), _("Day")); label = gtk_grid_get_child_at (GTK_GRID (priv->grid), priv->month_pos, 0); gtk_label_set_text (GTK_LABEL (label), _("Month")); label = gtk_grid_get_child_at (GTK_GRID (priv->grid), priv->year_pos, 0); gtk_label_set_text (GTK_LABEL (label), _("Year")); /* retrieve components from UI definition: entries */ box = gtk_grid_get_child_at (GTK_GRID (priv->grid), 0, 1); aux = gtk_container_get_children (GTK_CONTAINER (box)); for (l = aux; l != NULL; l = g_list_next (l)) { gint position; gtk_container_child_get (GTK_CONTAINER (box), l->data, "position", &position, NULL); if (position == priv->day_pos) priv->entries[DAY] = l->data; if (position == priv->month_pos) priv->entries[MONTH] = l->data; if (position == priv->year_pos) priv->entries[YEAR] = l->data; if (position == priv->day_pos || position == priv->month_pos) gtk_entry_set_max_length (GTK_ENTRY (l->data), 2); } g_list_free (aux); gtk_widget_set_direction (box, GTK_TEXT_DIR_LTR); gtk_widget_set_direction (priv->grid, GTK_TEXT_DIR_LTR); }