static void update_bookmark_from_text (void) { if (text_changed) { NautilusBookmark *bookmark, *bookmark_in_list; char *name; GdkPixbuf *pixbuf; guint selected_row; GtkTreeIter iter; GFile *location; g_assert (GTK_IS_ENTRY (name_field)); g_assert (GTK_IS_ENTRY (uri_field)); location = g_file_new_for_uri (gtk_entry_get_text (GTK_ENTRY (uri_field))); bookmark = nautilus_bookmark_new_with_icon (location, gtk_entry_get_text (GTK_ENTRY (name_field)), name_text_changed, NULL); g_object_unref (location); selected_row = get_selected_row (); /* turn off list updating 'cuz otherwise the list-reordering code runs * after repopulate(), thus reordering the correctly-ordered list. */ g_signal_handler_block (bookmarks, bookmark_list_changed_signal_id); nautilus_bookmark_list_delete_item_at (bookmarks, selected_row); nautilus_bookmark_list_insert_item (bookmarks, bookmark, selected_row); g_signal_handler_unblock (bookmarks, bookmark_list_changed_signal_id); g_object_unref (bookmark); /* We also have to update the bookmark pointer in the list store. */ gtk_tree_selection_get_selected (bookmark_selection, NULL, &iter); g_signal_handler_block (bookmark_list_store, row_changed_signal_id); bookmark_in_list = nautilus_bookmark_list_item_at (bookmarks, selected_row); name = nautilus_bookmark_get_name (bookmark_in_list); pixbuf = nautilus_bookmark_get_pixbuf (bookmark_in_list, GTK_ICON_SIZE_MENU); gtk_list_store_set (bookmark_list_store, &iter, BOOKMARK_LIST_COLUMN_BOOKMARK, bookmark_in_list, BOOKMARK_LIST_COLUMN_NAME, name, BOOKMARK_LIST_COLUMN_ICON, pixbuf, -1); g_signal_handler_unblock (bookmark_list_store, row_changed_signal_id); gdk_pixbuf_unref (pixbuf); g_free (name); } }
void TCPUnixAccountHandler::loadProperties() { UT_DEBUGMSG(("TCPUnixAccountHandler::loadProperties()\n")); bool serve = getProperty("server") == ""; if (server_button && GTK_IS_TOGGLE_BUTTON(server_button)) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(server_button), serve); if (client_button && GTK_IS_TOGGLE_BUTTON(client_button)) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(client_button), !serve); if (server_entry && GTK_IS_ENTRY(server_entry)) gtk_entry_set_text(GTK_ENTRY(server_entry), getProperty("server").c_str()); int port = DEFAULT_TCP_PORT; try { if (hasProperty("port")) port = boost::lexical_cast<int>(getProperty("port")); } catch (boost::bad_lexical_cast &) { UT_ASSERT_HARMLESS(UT_SHOULD_NOT_HAPPEN); } if (port_button && GTK_IS_ENTRY(port_button)) gtk_spin_button_set_value(GTK_SPIN_BUTTON(port_button), port); if (allow_all_button && GTK_IS_TOGGLE_BUTTON(allow_all_button)) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(allow_all_button), hasProperty("allow-all") ? getProperty("allow-all") == "true" : false); bool autoconnect = hasProperty("autoconnect") ? getProperty("autoconnect") == "true" : true; if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button)) gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(autoconnect_button), autoconnect); }
void SIPSimpleUnixAccountHandler::storeProperties() { if (address_entry && GTK_IS_ENTRY(address_entry)) addProperty("address", gtk_entry_get_text(GTK_ENTRY(address_entry))); if (password_entry && GTK_IS_ENTRY(password_entry)) addProperty("password", gtk_entry_get_text(GTK_ENTRY(password_entry))); if (proxy_entry && GTK_IS_ENTRY(proxy_entry)) addProperty("outbound-proxy", gtk_entry_get_text(GTK_ENTRY(proxy_entry))); if (autoconnect_button && GTK_IS_TOGGLE_BUTTON(autoconnect_button)) addProperty("autoconnect", gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(autoconnect_button)) ? "true" : "false" ); }
/** * e_widget_undo_attach: * @widget: a #GtkWidget, where to attach undo functionality * @focus_tracker: an #EFocusTracker, can be %NULL * * The function does nothing, if the widget is not of a supported type * for undo functionality, same as when the undo is already attached. * It is ensured that the actions of the provided @focus_tracker are * updated on change of the @widget. * * See @e_widget_undo_is_attached(). * * Since: 3.12 **/ void e_widget_undo_attach (GtkWidget *widget, EFocusTracker *focus_tracker) { EUndoData *data; if (e_widget_undo_is_attached (widget)) return; if (GTK_IS_EDITABLE (widget)) { data = g_new0 (EUndoData, 1); data->undo_len = DEFAULT_MAX_UNDO_LEVEL; data->undo_stack = g_new0 (EUndoInfo *, data->undo_len); g_object_set_data_full (G_OBJECT (widget), UNDO_DATA_KEY, data, free_undo_data); data->insert_handler_id = g_signal_connect ( widget, "insert-text", G_CALLBACK (editable_undo_insert_text_cb), NULL); data->delete_handler_id = g_signal_connect ( widget, "delete-text", G_CALLBACK (editable_undo_delete_text_cb), NULL); if (focus_tracker) g_signal_connect_swapped ( widget, "changed", G_CALLBACK (e_focus_tracker_update_actions), focus_tracker); if (GTK_IS_ENTRY (widget)) g_signal_connect ( widget, "populate-popup", G_CALLBACK (widget_undo_populate_popup_cb), NULL); } else if (GTK_IS_TEXT_VIEW (widget)) {
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) { GtkEntry* const entry = (GtkEntry*)GetEditable(); wxCHECK_MSG(GTK_IS_ENTRY(entry), false, "auto completion doesn't work with this control"); GtkListStore * const store = gtk_list_store_new(1, G_TYPE_STRING); GtkTreeIter iter; #if defined(__INTEL_COMPILER) && 1 /* VDM auto patch */ # pragma ivdep # pragma swp # pragma unroll # pragma prefetch # if 0 # pragma simd noassert # endif #endif /* VDM auto patch */ for ( wxArrayString::const_iterator i = choices.begin(); i != choices.end(); ++i ) { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, (const gchar *)i->utf8_str(), -1); } GtkEntryCompletion * const completion = gtk_entry_completion_new(); gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store)); gtk_entry_completion_set_text_column(completion, 0); gtk_entry_set_completion(entry, completion); g_object_unref(completion); return true; }
gboolean ce_page_mac_entry_valid (GtkEntry *entry, int type, const char *property_name, GError **error) { const char *mac; g_return_val_if_fail (GTK_IS_ENTRY (entry), FALSE); mac = gtk_entry_get_text (entry); if (mac && *mac) { if (!nm_utils_hwaddr_valid (mac, nm_utils_hwaddr_len (type))) { const char *addr_type; addr_type = type == ARPHRD_ETHER ? _("MAC address") : _("HW address"); if (property_name) { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid %s for %s (%s)"), addr_type, property_name, mac); } else { g_set_error (error, NMA_ERROR, NMA_ERROR_GENERIC, _("invalid %s (%s)"), addr_type, mac); } return FALSE; } } return TRUE; }
/** * e_categories_config_open_dialog_for_entry: * @entry: a #GtkEntry on which to get/set the categories list * * This is a self-contained function that lets you open a popup dialog for * the user to select a list of categories. * * The @entry parameter is used, at initialization time, as the list of * initial categories that are selected in the categories selection dialog. * Then, when the user commits its changes, the list of selected categories * is put back on the entry widget. */ void e_categories_config_open_dialog_for_entry (GtkEntry *entry) { GtkDialog *dialog; const gchar *text; gint result; g_return_if_fail (entry != NULL); g_return_if_fail (GTK_IS_ENTRY (entry)); text = gtk_entry_get_text (GTK_ENTRY (entry)); dialog = GTK_DIALOG (e_categories_dialog_new (text)); gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (entry)))); /* run the dialog */ result = gtk_dialog_run (dialog); if (result == GTK_RESPONSE_OK) { gchar *categories; categories = e_categories_dialog_get_categories (E_CATEGORIES_DIALOG (dialog)); gtk_entry_set_text (GTK_ENTRY (entry), categories); g_free (categories); } gtk_widget_destroy (GTK_WIDGET (dialog)); }
//-------------------------------------------------------------------------------- void DbMySQLTableEditorFKPage::cell_editing_started(GtkCellRenderer* cr, GtkCellEditable* ce, gchar* path, gpointer udata) { DbMySQLTableEditorFKPage* self = reinterpret_cast<DbMySQLTableEditorFKPage*>(udata); bec::NodeId node(path); if ( node.is_valid() ) self->_fk_node = node; if ( GTK_IS_ENTRY(ce) ) // Fill in name of the foreign key column { ::bec::FKConstraintListBE *fk_be = self->_be->get_fks(); Gtk::Entry* entry = Glib::wrap(GTK_ENTRY(ce)); std::string name; if (node.back() == fk_be->count()-1) fk_be->set_field(node, bec::FKConstraintListBE::Name, 1); fk_be->get_field(node, bec::FKConstraintListBE::Name, name); entry->set_text(name); } // clean up edit_done signal/slotl if ( self->_ce && self->_edit_conn ) { g_signal_handler_disconnect (self->_ce, self->_edit_conn); self->_ce = 0; self->_edit_conn = 0; } if (GTK_IS_CELL_EDITABLE(ce)) { self->_ce = ce; self->_edit_conn = g_signal_connect(ce, "editing-done", GCallback(&DbMySQLTableEditorFKPage::cell_editing_done), udata); } }
wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const { wxASSERT_MSG( m_widget, wxS("GetSizeFromTextSize called before creation") ); // a GtkEntry for wxComboBox and a GtkCellView for wxChoice GtkWidget* childPart = gtk_bin_get_child(GTK_BIN(m_widget)); // Set a as small as possible size for the control, so preferred sizes // return "natural" sizes, not taking into account the previous ones (which // seems to be GTK+3 behaviour) gtk_widget_set_size_request(m_widget, 0, 0); // We are interested in the difference of sizes between the whole contol // and its child part. I.e. arrow, separators, etc. GtkRequisition req; gtk_widget_get_preferred_size(childPart, NULL, &req); wxSize totalS = GTKGetPreferredSize(m_widget); wxSize tsize(xlen + totalS.x - req.width, totalS.y); // For a wxChoice, not for wxComboBox, add some margins if ( !GTK_IS_ENTRY(childPart) ) tsize.IncBy(5, 0); // Perhaps the user wants something different from CharHeight if ( ylen > 0 ) tsize.IncBy(0, ylen - GetCharHeight()); return tsize; }
/** set the widget value as float */ void XAP_UnixWidget::setValueFloat(float val) { if (GTK_IS_ENTRY(m_widget)) { std::string str = UT_std_string_sprintf("%f", val); gtk_entry_set_text(GTK_ENTRY(m_widget), str.c_str()); } }
void cterm_set_term_title_dialog_onresponse(GtkWidget* dialog, int response, gpointer data) { CTerm* term = (CTerm*) data; GtkWidget* content_area; GtkWidget* widget; GtkWidget* entry = NULL; const gchar* new_title; GList* node; GList* list; if(response == GTK_RESPONSE_OK) { // Get entry widget from dialog content_area = gtk_dialog_get_content_area(GTK_DIALOG(dialog)); list = GTK_BOX(content_area)->children; for(node = list; node; node = node->next) { widget = ((GtkBoxChild*) node->data)->widget; if(GTK_IS_ENTRY(widget)) { entry = widget; break; } } if(entry) { new_title = gtk_entry_get_text(GTK_ENTRY(entry)); gtk_window_set_title(GTK_WINDOW(term->window), new_title); } else { fprintf(stderr, "Error: Could not find entry in dialog widget!\n"); } } gtk_widget_destroy(dialog); }
/* * Our callbacks to insert/find/retrieve text from one widget to another. */ static void on_insert_clicked (GtkButton *button, Widgets *w) { g_return_if_fail (GTK_IS_TEXT_VIEW(w->textview)); g_return_if_fail (GTK_IS_ENTRY(w->entry)); /* * The subtle difference between a text mark and a text iter: one is a * GObject, the other is not. Also, when GtkTextIter is called "opaque", as * in "private", it actually isn't all that private. But please, pretend to * use it as if it were ... It is A-OK to put text iterators on the stack! * Furthermore, iterators are invalidated after *every* use, so create one, * use often! */ GtkTextBuffer *buffer; GtkTextMark *mark; GtkTextIter iter = {0,}; const gchar *text; buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW(w->textview)); text = gtk_entry_get_text (GTK_ENTRY(w->entry)); /* * Sets text marker to current cursor position. Also, cursors are simply * *visible* text markers. -1 means "read until \0". */ mark = gtk_text_buffer_get_insert (buffer); gtk_text_buffer_get_iter_at_mark (buffer, &iter, mark); gtk_text_buffer_insert (buffer, &iter, text, -1); }
void _fcitx_im_context_set_capacity(FcitxIMContext* fcitxcontext, gboolean force) { if (fcitx_client_is_valid(fcitxcontext->client)) { FcitxCapacityFlags flags = fcitxcontext->capacity & ~(CAPACITY_PREEDIT | CAPACITY_FORMATTED_PREEDIT | CAPACITY_PASSWORD); if (fcitxcontext->use_preedit) flags |= CAPACITY_PREEDIT | CAPACITY_FORMATTED_PREEDIT; if (fcitxcontext->client_window != NULL) { GtkWidget *widget; gdk_window_get_user_data (fcitxcontext->client_window, (gpointer *)&widget); if (GTK_IS_ENTRY (widget) && !gtk_entry_get_visibility (GTK_ENTRY (widget))) { flags |= CAPACITY_PASSWORD; } } gboolean update = FALSE; if (G_UNLIKELY(fcitxcontext->capacity != flags)) { fcitxcontext->capacity = flags; update = TRUE; } if (G_UNLIKELY(update || force)) fcitx_client_set_capacity(fcitxcontext->client, fcitxcontext->capacity); } }
/* When enter is pressed in the confirm entry, move */ static void confirm_callback (GtkWidget *widget, GtkDialog *dialog) { GtkWidget *entry = GTK_WIDGET (g_object_get_data (G_OBJECT (dialog), "secure-entry")); g_assert (GTK_IS_ENTRY (entry)); gtk_widget_grab_focus (entry); }
static void ide_editor_spell_widget__dict_word_entry_changed_cb (IdeEditorSpellWidget *self, GtkEntry *dict_word_entry) { g_assert (IDE_IS_EDITOR_SPELL_WIDGET (self)); g_assert (GTK_IS_ENTRY (dict_word_entry)); if (self->dict_check_word_state == CHECK_WORD_CHECKING) { self->is_dict_check_word_invalid = TRUE; return; } if (self->dict_check_word_state == CHECK_WORD_IDLE) { g_source_remove (self->dict_check_word_timeout_id); self->dict_check_word_timeout_id = 0; } self->dict_check_word_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT, CHECK_WORD_INTERVAL_MIN, (GSourceFunc)dict_check_word_timeout_cb, self, NULL); self->dict_check_word_state = CHECK_WORD_IDLE; }
static void preferences_widget_sync_string (const gchar *key, GtkWidget *widget) { gchar *value; if (empathy_conf_get_string (empathy_conf_get (), key, &value) && value) { if (GTK_IS_ENTRY (widget)) { gtk_entry_set_text (GTK_ENTRY (widget), value); } else if (GTK_IS_RADIO_BUTTON (widget)) { if (strcmp (key, EMPATHY_PREFS_CONTACTS_SORT_CRITERIUM) == 0) { GType type; GEnumClass *enum_class; GEnumValue *enum_value; GSList *list; GtkWidget *toggle_widget; /* Get index from new string */ type = empathy_contact_list_store_sort_get_type (); enum_class = G_ENUM_CLASS (g_type_class_peek (type)); enum_value = g_enum_get_value_by_nick (enum_class, value); if (enum_value) { list = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); toggle_widget = g_slist_nth_data (list, enum_value->value); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (toggle_widget), TRUE); } } else { g_warning ("Unhandled key:'%s' just had string change", key); } } g_free (value); } }
/* Helper method to clear the text in a GtkEntry or GtkTextView and hide it */ static void contacts_remove_entries (GtkWidget *entry) { if (GTK_IS_ENTRY (entry)) { if (gtk_widget_get_ancestor (entry, GTK_TYPE_COMBO_BOX_ENTRY)) return; gtk_entry_set_text (GTK_ENTRY (entry), ""); gtk_widget_hide (entry); } else if (GTK_IS_TEXT_VIEW (entry)) { GtkTextBuffer *buffer = gtk_text_view_get_buffer (GTK_TEXT_VIEW (entry)); gtk_text_buffer_set_text (buffer, "", -1); entry = gtk_widget_get_ancestor (entry, GTK_TYPE_BIN); gtk_widget_hide (entry); } else if (GTK_IS_CONTAINER (entry)) { GList *c, *children = gtk_container_get_children (GTK_CONTAINER (entry)); for (c = children; c; c = c->next) contacts_remove_entries (GTK_WIDGET (c->data)); gtk_widget_hide (entry); g_list_free (children); } }
wxSize wxChoice::DoGetSizeFromTextSize(int xlen, int ylen) const { wxASSERT_MSG( m_widget, wxS("GetSizeFromTextSize called before creation") ); // a GtkEntry for wxComboBox and a GtkCellView for wxChoice GtkWidget* childPart = gtk_bin_get_child(GTK_BIN(m_widget)); // We are interested in the difference of sizes between the whole contol // and its child part. I.e. arrow, separators, etc. GtkRequisition req; gtk_widget_get_preferred_size(childPart, NULL, &req); wxSize totalS = GTKGetPreferredSize(m_widget); wxSize tsize(xlen + totalS.x - req.width, totalS.y); // For a wxChoice, not for wxComboBox, add some margins if ( !GTK_IS_ENTRY(childPart) ) tsize.IncBy(5, 0); // Perhaps the user wants something different from CharHeight if ( ylen > 0 ) tsize.IncBy(0, ylen - GetCharHeight()); return tsize; }
//-------------------------------------------------------------------------------- void DbMySQLTableEditorIndexPage::cell_editing_done(GtkCellEditable *ce) { if (_editing_done_id != 0 && _editable_cell != 0) { g_signal_handler_disconnect(_editable_cell, _editing_done_id); _editing_done_id = 0; _editable_cell = 0; } // If it's Gtk::Entry, we try to find out if maybe user leave edit field empty, // if so we revert it to the last known value or to the default one. if (GTK_IS_ENTRY(ce)) { GtkEntry *entry_widget = GTK_ENTRY(ce); if (entry_widget) { Gtk::Entry *entry = Glib::wrap(entry_widget); if (entry && entry->get_text_length() == 0) { Gtk::TreeModel::Path path; Gtk::TreeView::Column *column(0); _indexes_tv->get_cursor(path, column); bec::NodeId node(path.to_string()); if (node.is_valid()) { std::string name = _user_index_name; if (name.empty()) name = strfmt("index%i", path[0] + 1); _be->get_indexes()->set_field(node, MySQLTableIndexListBE::Name, name); entry->set_text(name); } } } } }
static void gtk_search_bar_add (GtkContainer *container, GtkWidget *child) { GtkSearchBar *bar = GTK_SEARCH_BAR (container); GtkSearchBarPrivate *priv = gtk_search_bar_get_instance_private (bar); /* When constructing the widget, we want the revealer to be added * as the first child of the search bar, as an implementation detail. * After that, the child added by the application should be added * to box_center. */ if (priv->box_center == NULL) { GTK_CONTAINER_CLASS (gtk_search_bar_parent_class)->add (container, child); } else { gtk_container_add (GTK_CONTAINER (priv->box_center), child); /* If an entry is the only child, save the developer a couple of * lines of code */ if (GTK_IS_ENTRY (child)) gtk_search_bar_connect_entry (bar, GTK_ENTRY (child)); } }
static void on_menuitem_edit_activate(void) { GtkWidget *widget = gtk_window_get_focus(gui.window); bool selectable = false; bool editable = false; bool selection_ready = false; bool clipboard_ready = false; if (GTK_IS_ENTRY(widget)) { selectable = gtk_entry_get_text_length(GTK_ENTRY(widget)); editable = gtk_editable_get_editable(GTK_EDITABLE(widget)); selection_ready = gtk_editable_get_selection_bounds( GTK_EDITABLE(widget), NULL, NULL); clipboard_ready = gtk_clipboard_wait_is_text_available( gtk_clipboard_get(GDK_NONE)); } gtk_widget_set_sensitive(GTK_WIDGET(gui.menuitem_cut), selection_ready && editable); gtk_widget_set_sensitive(GTK_WIDGET(gui.menuitem_copy), selection_ready); gtk_widget_set_sensitive(GTK_WIDGET(gui.menuitem_paste), editable && clipboard_ready); gtk_widget_set_sensitive(GTK_WIDGET(gui.menuitem_delete), selection_ready && editable); gtk_widget_set_sensitive(GTK_WIDGET(gui.menuitem_select_all), selectable); }
static void widget_entry_changed_cb (GtkWidget *widget, gpointer data) { const gchar *value; gint port = -1; GConfClient *client; client = gconf_client_get_default (); /* * Do not change the order of comparison - * GtkSpinButton is an extended form of GtkEntry */ if (GTK_IS_SPIN_BUTTON (widget)) { port = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (widget)); gconf_client_set_int (client, (const gchar *) data, port, NULL); d(g_print ("%s:%s: %s is SpinButton: value = [%d]\n", G_STRLOC, G_STRFUNC, (const gchar *)data, port)); } else if (GTK_IS_ENTRY (widget)) { value = gtk_entry_get_text (GTK_ENTRY (widget)); gconf_client_set_string (client, (const gchar *) data, value, NULL); d(g_print ("%s:%s: %s is Entry: value = [%s]\n", G_STRLOC, G_STRFUNC, (const gchar *)data, value)); } g_object_unref (client); }
bool wxTextEntry::DoAutoCompleteStrings(const wxArrayString& choices) { GtkEntry* const entry = (GtkEntry*)GetEditable(); wxCHECK_MSG(GTK_IS_ENTRY(entry), false, "auto completion doesn't work with this control"); GtkListStore * const store = gtk_list_store_new(1, G_TYPE_STRING); GtkTreeIter iter; for ( wxArrayString::const_iterator i = choices.begin(); i != choices.end(); ++i ) { gtk_list_store_append(store, &iter); gtk_list_store_set(store, &iter, 0, (const gchar *)i->utf8_str(), -1); } GtkEntryCompletion * const completion = gtk_entry_completion_new(); gtk_entry_completion_set_model(completion, GTK_TREE_MODEL(store)); gtk_entry_completion_set_text_column(completion, 0); gtk_entry_set_completion(entry, completion); g_object_unref(completion); return true; }
static void editing_done_cb (GtkCellEditable *editable, struct editing_data *data) { gboolean canceled; g_signal_handler_disconnect (editable, data->editing_done_sid); g_object_get (editable, "editing-canceled", &canceled, NULL); if (!canceled) { GError *err = NULL; if (G_UNLIKELY (!GTK_IS_ENTRY (editable))) { gchar *fl = donna_node_get_full_location (data->node); donna_app_show_error (data->ctname->priv->app, NULL, "ColumnType name: Unable to change property 'name' for '%s': " "Editable widget isn't a GtkEntry", fl); g_free (fl); g_free (data); return; } if (!set_value ("name", gtk_entry_get_text ((GtkEntry *) editable), data->node, data->tree, &err)) { donna_app_show_error (data->ctname->priv->app, err, NULL); g_clear_error (&err); g_free (data); return; } } g_free (data); }
static gboolean gstyle_slidein_event_box_key_pressed_cb (GstyleSlidein *self, GdkEventKey *event, GtkWidget *widget) { GtkWidget *focus; g_assert (GSTYLE_IS_SLIDEIN (self)); g_assert (event != NULL); g_assert (GTK_IS_WIDGET (widget)); focus = gtk_window_get_focus (GTK_WINDOW (gtk_widget_get_toplevel (widget))); if (focus == NULL) return GDK_EVENT_PROPAGATE; if (event->keyval == GDK_KEY_Escape && !GTK_IS_ENTRY (focus)) { gstyle_slidein_reveal_slide (self, FALSE); return GDK_EVENT_STOP; } if (gtk_widget_is_ancestor (focus, widget)) return gtk_widget_event (focus, (GdkEvent*) event); return GDK_EVENT_PROPAGATE; }
static void on_name_field_changed (GtkEditable *editable, gpointer user_data) { GtkTreeIter iter; g_return_if_fail(GTK_IS_TREE_VIEW(bookmark_list_widget)); g_return_if_fail(GTK_IS_ENTRY(name_field)); if (!get_selection_exists()) return; /* Update text displayed in list instantly. Also remember that * user has changed text so we update real bookmark later. */ gtk_tree_selection_get_selected (bookmark_selection, NULL, &iter); gtk_list_store_set (bookmark_list_store, &iter, BOOKMARK_LIST_COLUMN_NAME, gtk_entry_get_text (GTK_ENTRY (name_field)), -1); text_changed = TRUE; name_text_changed = TRUE; }
bool GtkAReViWidget::getWidgetString(const StlString &propName,StlString &propValueOut) { GtkWidget *widget=glade_xml_get_widget(_xmlObject,propName.c_str()); if (!widget) { cerr << "[getPropertyString] property '" << propName << "' no exist" << endl; return false; } if (GTK_IS_ENTRY(widget)) propValueOut=/*strFromUTF8*/(gtk_entry_get_text(GTK_ENTRY(widget))); else if (GTK_IS_TOGGLE_BUTTON(widget)) { if (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget))) propValueOut="true"; else propValueOut="false"; } else if (GTK_IS_TEXT_VIEW(widget)) { GtkTextBuffer* buffer=gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)); GtkTextIter start, end; gtk_text_buffer_get_bounds(buffer,&start,&end); propValueOut=/*strFromUTF8*/(gtk_text_buffer_get_text(buffer,&start,&end,true)); } else return false; return true; }
static void gal_view_new_dialog_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec) { GalViewNewDialog *dialog; GtkWidget *entry; dialog = GAL_VIEW_NEW_DIALOG (object); switch (property_id) { case PROP_NAME: entry = e_builder_get_widget(dialog->builder, "entry-name"); if (entry && GTK_IS_ENTRY (entry)) { g_value_set_string (value, gtk_entry_get_text (GTK_ENTRY (entry))); } break; case PROP_FACTORY: g_value_set_object (value, dialog->selected_factory); break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); break; } }
/* Specific "focus-out-event" handler for shortcut GtkEntry events */ static gboolean preferences_dialog_shortcut_focus_out_event(GtkWidget * widget, GdkEventFocus * event, gchar * s) { guint key = 0; GdkModifierType mods = 0; const gchar * cur = gtk_entry_get_text(GTK_ENTRY(widget)); GList * sib; if(g_strcmp0(s, cur) == 0) /* Nothing changed. */ return FALSE; /* Look for dupplicate accelerator. */ for(sib = gtk_container_get_children(GTK_CONTAINER(gtk_widget_get_parent(widget))); sib; sib = sib->next) if(GTK_IS_ENTRY(sib->data) && GTK_WIDGET(sib->data) != widget && !g_strcmp0(cur, gtk_entry_get_text(GTK_ENTRY(sib->data)))) { gtk_entry_set_text(GTK_ENTRY(widget), s); return FALSE; } gtk_accelerator_parse(cur, &key, &mods); /* Make sure accelerator is valid. */ if( ! (key == 0 && mods == 0) && gtk_accelerator_valid(key, mods)) { g_free(s); s = g_strdup(cur); } else { gtk_entry_set_text(GTK_ENTRY(widget), s); } return FALSE; }
GtkWidget * gtk_utils_create_browse_button (gboolean with_text, GtkWidget *associated_entry, gboolean is_command_line_entry, const gchar *browsing_dialog_caption, GtkUtilsBrowsingDoneCallback callback, gpointer user_data) { GtkWidget *button; GtkUtilsBrowseButtonData *data; g_return_val_if_fail (browsing_dialog_caption, NULL); #ifdef GTK_TYPE_FILE_SELECTOR g_return_val_if_fail (GTK_IS_ENTRY (associated_entry) || GTK_IS_FILE_SELECTOR (associated_entry), NULL); #else g_return_val_if_fail (GTK_IS_ENTRY (associated_entry), NULL); #endif data = g_malloc (sizeof (GtkUtilsBrowseButtonData)); if (with_text) button = gtk_button_new_from_stock (QUARRY_STOCK_BROWSE); else { button = gtk_button_new (); gtk_container_add (GTK_CONTAINER (button), gtk_image_new_from_stock (QUARRY_STOCK_BROWSE, GTK_ICON_SIZE_BUTTON)); } data->browsing_dialog = NULL; data->browsing_dialog_caption = browsing_dialog_caption; data->associated_entry = associated_entry; data->is_command_line_entry = is_command_line_entry; data->callback = callback; data->user_data = user_data; g_signal_connect (button, "clicked", G_CALLBACK (browse_button_clicked), data); g_signal_connect_swapped (button, "destroy", G_CALLBACK (g_free), data); return button; }