static GtkWidget * ekiga_window_uri_entry_new (EkigaWindow *mw) { GtkWidget *entry = NULL; GtkEntryCompletion *completion = NULL; g_return_val_if_fail (EKIGA_IS_WINDOW (mw), NULL); /* URI Entry */ entry = gm_entry_new (BASIC_URI_REGEX); gm_entry_set_activate_icon (GM_ENTRY (entry), "call-start"); mw->priv->completion = gtk_list_store_new (1, G_TYPE_STRING); completion = gtk_entry_completion_new (); gtk_entry_completion_set_model (GTK_ENTRY_COMPLETION (completion), GTK_TREE_MODEL (mw->priv->completion)); gtk_entry_completion_set_text_column (GTK_ENTRY_COMPLETION (completion), 0); gtk_entry_set_completion (GTK_ENTRY (entry), completion); gtk_entry_set_text (GTK_ENTRY (entry), "sip:"); gtk_entry_completion_set_inline_completion (GTK_ENTRY_COMPLETION (completion), true); gtk_entry_completion_set_popup_completion (GTK_ENTRY_COMPLETION (completion), true); gtk_widget_add_accelerator (entry, "grab-focus", mw->priv->accel, GDK_KEY_L, (GdkModifierType) GDK_CONTROL_MASK, (GtkAccelFlags) 0); gtk_editable_set_position (GTK_EDITABLE (entry), -1); g_signal_connect (entry, "changed", G_CALLBACK (url_changed_cb), mw); g_signal_connect (entry, "activated", G_CALLBACK (place_call_cb), mw); return entry; }
int clip_GTK_ENTRYCOMPLETIONGETMODEL(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); C_object *cmodell; GtkTreeModel *model; CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); model = gtk_entry_completion_get_model(GTK_ENTRY_COMPLETION(ccompletion->object)); if (model) { cmodell = _list_get_cobject(ClipMachineMemory, model); if (!cmodell) cmodell = _register_object(ClipMachineMemory, model, GTK_TYPE_TREE_MODEL, NULL, NULL); if (cmodell) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cmodell->obj); } return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONGETENTRY(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); C_widget *cwid; GtkWidget *wid; CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); wid = gtk_entry_completion_get_entry(GTK_ENTRY_COMPLETION(ccompletion->object)); if (wid) { cwid = _list_get_cwidget(ClipMachineMemory, wid); if (!cwid) cwid = _register_widget(ClipMachineMemory, wid, NULL); if (cwid) _clip_mclone(ClipMachineMemory, RETPTR(ClipMachineMemory), &cwid->obj); } return 0; err: return 1; }
static VALUE entry_set_completion(VALUE self, VALUE completion) { gtk_entry_set_completion(_SELF(self), GTK_ENTRY_COMPLETION(RVAL2GOBJ(completion))); G_CHILD_SET(self, rb_intern("completion"), completion); return self; }
int clip_GTK_ENTRYCOMPLETIONGETPOPUPCOMPLETION(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); _clip_retl(ClipMachineMemory, gtk_entry_completion_get_popup_completion(GTK_ENTRY_COMPLETION(ccompletion->object))); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONINSERTPREFIX(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); gtk_entry_completion_insert_prefix(GTK_ENTRY_COMPLETION(ccompletion->object)); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONCOMPLETE(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); gtk_entry_completion_complete(GTK_ENTRY_COMPLETION(ccompletion->object)); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONGETMINIMUMKEYLENGTH(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); _clip_parni(ClipMachineMemory, gtk_entry_completion_get_minimum_key_length(GTK_ENTRY_COMPLETION(ccompletion->object))); return 0; err: return 1; }
/* Autocompletion in locationbar has found a match */ static gboolean _interface_tweaks_on_insert_prefix(InterfaceTweaks *self, gchar *inPrefix, gpointer inUserData) { g_return_val_if_fail(IS_INTERFACE_TWEAKS(self), FALSE); g_return_val_if_fail(GTK_IS_ENTRY_COMPLETION(inUserData), FALSE); InterfaceTweaksPrivate *priv=self->priv; GtkEntryCompletion *completion=GTK_ENTRY_COMPLETION(inUserData); GtkEntry *entry; guint changedSignalID; const gchar *text; gint textLength; GSList *handlers; /* Check if we should auto-complete URIs in locationbar */ if(priv->autocompleteLocationbar==FALSE) return(TRUE); /* Get entry of completion */ entry=GTK_ENTRY(gtk_entry_completion_get_entry(completion)); /* Get current text (that is before text is set by completion) * and remember its length */ text=gtk_entry_get_text(entry); textLength=strlen(text); /* Get "changed" signal ID */ changedSignalID=g_signal_lookup("changed", GTK_TYPE_ENTRY); /* Emit "changed" event for all signal handlers as the entry * still contains the unmodified text. */ g_signal_emit(entry, changedSignalID, 0); /* Block all unblocked signal handlers for "changed" signal, update entry text * to the text of completion and unblock these signal handlers again. * This way we prevent "changed" signal emissions for completion-text. */ handlers=_interface_tweaks_block_all_handlers(G_OBJECT(entry), changedSignalID); gtk_entry_set_text(entry, inPrefix); gtk_editable_select_region(GTK_EDITABLE(entry), textLength, -1); _interface_tweaks_unblock_handlers(G_OBJECT(entry), handlers); g_slist_free(handlers); /* Tell emission that we handled signal and stop further processing */ return(TRUE); }
int clip_GTK_ENTRYCOMPLETIONSETMODEL(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); C_object *cmodell = _fetch_cobject(ClipMachineMemory, _clip_spar(ClipMachineMemory, 2)); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); CHECKCOBJ(cmodell, GTK_IS_TREE_MODEL(cmodell->object)); gtk_entry_completion_set_model(GTK_ENTRY_COMPLETION(ccompletion->object), GTK_TREE_MODEL(cmodell->object)); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONSETPOPUPCOMPLETION(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); gboolean set = _clip_parl(ClipMachineMemory, 2); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); CHECKARG(2, LOGICAL_type_of_ClipVarType); gtk_entry_completion_set_popup_completion(GTK_ENTRY_COMPLETION(ccompletion->object), set); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONSETMINIMUMKEYLENGTH(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); gint length = _clip_parni(ClipMachineMemory, 2); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); CHECKARG(2, NUMERIC_type_of_ClipVarType); gtk_entry_completion_set_minimum_key_length(GTK_ENTRY_COMPLETION(ccompletion->object), length); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONSETTEXTCOLUMN(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); gint index = _clip_parni(ClipMachineMemory, 2); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); CHECKARG(2, NUMERIC_type_of_ClipVarType); index--; gtk_entry_completion_set_text_column(GTK_ENTRY_COMPLETION(ccompletion->object), index); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONGETTEXTCOLUMN(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); gint column; CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); column = gtk_entry_completion_get_text_column(GTK_ENTRY_COMPLETION(ccompletion->object)); column++; _clip_retni(ClipMachineMemory, column); return 0; err: return 1; }
static gboolean city_changed_cb (GtkEntryCompletion *entry_completion, GtkTreeModel *model, GtkTreeIter *iter, CcDateTimePanel *self) { GtkWidget *entry; gchar *zone; gtk_tree_model_get (model, iter, CITY_COL_ZONE, &zone, -1); cc_timezone_map_set_timezone (CC_TIMEZONE_MAP (self->priv->map), zone); g_free (zone); entry = gtk_entry_completion_get_entry (GTK_ENTRY_COMPLETION (entry_completion)); gtk_entry_set_text (GTK_ENTRY (entry), ""); return TRUE; }
int clip_GTK_ENTRYCOMPLETIONSETMATCHFUNC(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); ClipVar *func = _clip_spar(ClipMachineMemory, 2); C_var *c = 0; CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); CHECKARG2(2, PCODE_type_of_ClipVarType, CCODE_type_of_ClipVarType); c->ClipMachineMemory = ClipMachineMemory; c->co = ccompletion; _clip_mclone(ClipMachineMemory, &c->cfunc, func); gtk_entry_completion_set_match_func(GTK_ENTRY_COMPLETION (ccompletion->object), (GtkEntryCompletionMatchFunc) _match_func, c, NULL); return 0; err: return 1; }
int clip_GTK_ENTRYCOMPLETIONINSERTACTIONMARKUP(ClipMachine * ClipMachineMemory) { C_object *ccompletion = _fetch_co_arg(ClipMachineMemory); gint index = _clip_parni(ClipMachineMemory, 2); gchar *text = _clip_parc(ClipMachineMemory, 3); CHECKCOBJ(ccompletion, GTK_IS_ENTRY_COMPLETION(ccompletion->object)); CHECKARG(2, NUMERIC_type_of_ClipVarType); CHECKARG(3, CHARACTER_type_of_ClipVarType); index--; LOCALE_TO_UTF(text); gtk_entry_completion_insert_action_markup(GTK_ENTRY_COMPLETION(ccompletion->object), index, text); FREE_TEXT(text); return 0; err: return 1; }
void completion_populate_entry_completion(const gchar *filename, GtkEntryCompletion *completion) { GtkTreeModel *model; GtkTreeIter iter; char *path; GFile *file; GFileInputStream *stream; gint column; GError *err = NULL; gchar buffer[block_size]; const gchar *ptr; gssize size; g_assert(filename != NULL); g_assert(GTK_IS_ENTRY_COMPLETION(completion)); model = gtk_entry_completion_get_model(GTK_ENTRY_COMPLETION(completion)); column = gtk_entry_completion_get_text_column(GTK_ENTRY_COMPLETION(completion)); path = g_build_filename(pathbuilder_get_user_application_directory(), G_DIR_SEPARATOR_S, filename, NULL); file = g_file_new_for_path(path); /* load strings from file & append entries to GtkEntryCompletion's model */ g_debug("Trying to load strings list from: \"%s\"", path); if(g_file_query_exists(file, NULL)) { g_debug("Found file, reading content..."); if((stream = g_file_read(file, NULL, &err))) { model = gtk_entry_completion_get_model(GTK_ENTRY_COMPLETION(completion)); do { if((size = g_input_stream_read(G_INPUT_STREAM(stream), buffer, block_size, NULL, &err)) == block_size) { ptr = buffer + COMPLETION_COUNTER_SIZE; g_debug("Found text: \"%s\"", ptr); if(GTK_IS_LIST_STORE(model)) { gtk_list_store_append(GTK_LIST_STORE(model), &iter); gtk_list_store_set(GTK_LIST_STORE(model), &iter, column, ptr, -1); } else { g_warning("gtk_entry_completion_get_model() is not GTK_LIST_STORE"); } } else { if(size) { g_warning("Invalid block size: %d", size); } break; } } while(!err && size); g_debug("Closing file: \"%s\"", path); g_input_stream_close(G_INPUT_STREAM(stream), NULL, &err); g_object_unref(stream); } else { g_warning("Couldn't read file: \"%s\"", path); } } if(err) { g_warning("%s", err->message); g_error_free(err); } g_object_unref(file); g_free(path); }
static VALUE entry_set_completion(VALUE self, VALUE completion) { gtk_entry_set_completion(_SELF(self), GTK_ENTRY_COMPLETION(RVAL2GOBJ(completion))); return self; }
GtkEntryCompletion *cast_GtkEntryCompletion(GtkWidget* widget) { return GTK_ENTRY_COMPLETION(widget); }