Commit 696f54a8 authored by Matthias Clasen's avatar Matthias Clasen
Browse files

Make GtkEntryCompletion::text_column a property.

parent c5f4278b
Thu May 27 00:45:07 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.h:
* gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column):
Getter for text_column. Also make ::text_column a property.
Thu May 27 00:11:01 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
......
Thu May 27 00:45:07 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.h:
* gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column):
Getter for text_column. Also make ::text_column a property.
Thu May 27 00:11:01 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
......
Thu May 27 00:45:07 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.h:
* gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column):
Getter for text_column. Also make ::text_column a property.
Thu May 27 00:11:01 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
......
Thu May 27 00:45:07 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkentrycompletion.h:
* gtk/gtkentrycompletion.c (gtk_entry_completion_get_text_column):
Getter for text_column. Also make ::text_column a property.
Thu May 27 00:11:01 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtkmenuitem.c (gtk_menu_item_size_request): Fix a typo.
......
Thu May 27 00:44:48 2004 Matthias Clasen <maclas@gmx.de>
* gtk/gtk-sections.txt: Add gtk_entry_completion_get_text_column.
Thu May 27 00:20:52 2004 Matthias Clasen <maclas@gmx.de>
* gtk/tmpl/gtkentrycompletion.sgml: Add notes about
GtkEntryCompletionMatchFunc.
Tue May 25 21:54:55 2004 Matthias Clasen <maclas@gmx.de>
* gtk/tmpl/gtkframe.sgml: Move docs inline.
......
......@@ -1047,6 +1047,7 @@ gtk_entry_completion_insert_action_text
gtk_entry_completion_insert_action_markup
gtk_entry_completion_delete_action
gtk_entry_completion_set_text_column
gtk_entry_completion_get_text_column
<SUBSECTION Standard>
GTK_TYPE_ENTRY_COMPLETION
GTK_ENTRY_COMPLETION
......
......@@ -80,11 +80,14 @@ The GtkEntryCompletion struct contains only private data.
<!-- ##### USER_FUNCTION GtkEntryCompletionMatchFunc ##### -->
<para>
A function which decides whether the row indicated by @iter matches a given
@key, and should be displayed as a possible completion for @key.
@key, and should be displayed as a possible completion for @key. Note that
@key is normalized and case-folded (see g_utf8_normalize() and
g_utf8_casefold()). If this is not appropriate, match functions have access
to the unmodified key via <literal>gtk_entry_get_text (GTK_ENTRY (gtk_entry_completion_get_entry (<!-- -->)))</literal>.
</para>
@completion: the #GtkEntryCompletion
@key: the string to match
@key: the string to match, normalized and case-folded
@iter: a #GtkTreeIter indicating the row to match
@user_data: user data given to gtk_entry_completion_set_match_func()
@Returns: %TRUE if @iter should be displayed as a possible completion for @key
......
......@@ -51,7 +51,8 @@ enum
{
PROP_0,
PROP_MODEL,
PROP_MINIMUM_KEY_LENGTH
PROP_MINIMUM_KEY_LENGTH,
PROP_TEXT_COLUMN
};
#define GTK_ENTRY_COMPLETION_GET_PRIVATE(obj)(G_TYPE_INSTANCE_GET_PRIVATE ((obj), GTK_TYPE_ENTRY_COMPLETION, GtkEntryCompletionPrivate))
......@@ -238,6 +239,22 @@ gtk_entry_completion_class_init (GtkEntryCompletionClass *klass)
G_MAXINT,
1,
G_PARAM_READWRITE));
/**
* GtkEntryCompletion::text-column:
*
* The column of the model containing the strings.
*
* Since: 2.6
*/
g_object_class_install_property (object_class,
PROP_TEXT_COLUMN,
g_param_spec_int ("text_column",
P_("Text column"),
P_("The column of the model containing the strings."),
-1,
G_MAXINT,
-1,
G_PARAM_READWRITE));
g_type_class_add_private (object_class, sizeof (GtkEntryCompletionPrivate));
}
......@@ -358,6 +375,7 @@ gtk_entry_completion_set_property (GObject *object,
GParamSpec *pspec)
{
GtkEntryCompletion *completion = GTK_ENTRY_COMPLETION (object);
GtkEntryCompletionPrivate *priv = GTK_ENTRY_COMPLETION_GET_PRIVATE (completion);
switch (prop_id)
{
......@@ -371,6 +389,10 @@ gtk_entry_completion_set_property (GObject *object,
g_value_get_int (value));
break;
case PROP_TEXT_COLUMN:
priv->text_column = g_value_get_int (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -396,6 +418,10 @@ gtk_entry_completion_get_property (GObject *object,
g_value_set_int (value, gtk_entry_completion_get_minimum_key_length (completion));
break;
case PROP_TEXT_COLUMN:
g_value_set_int (value, gtk_entry_completion_get_text_column (completion));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -1021,8 +1047,9 @@ gtk_entry_completion_delete_action (GtkEntryCompletion *completion,
* to have a list displaying all (and just) strings in the completion list,
* and to get those strings from @column in the model of @completion.
*
* This functions creates and adds a GtkCellRendererText for the selected column.
* This functions creates and adds a #GtkCellRendererText for the selected
* column.
*
* Since: 2.4
*/
void
......@@ -1042,6 +1069,26 @@ gtk_entry_completion_set_text_column (GtkEntryCompletion *completion,
gtk_cell_layout_add_attribute (GTK_CELL_LAYOUT (completion),
cell,
"text", column);
g_object_notify (completion, "text_column");
}
/**
* gtk_entry_completion_get_text_column:
* @completion: a #GtkEntryCompletion
*
* Returns the column in the model of @completion to get strings from.
*
* Return value: the column containing the strings
*
* Since: 2.6
**/
gint
gtk_entry_completion_get_text_column (GtkEntryCompletion *completion)
{
g_return_if_fail (GTK_IS_ENTRY_COMPLETION (completion));
return completion->priv->text_column;
}
/* private */
......
......@@ -102,6 +102,7 @@ void gtk_entry_completion_delete_action (GtkEntryComplet
/* convenience */
void gtk_entry_completion_set_text_column (GtkEntryCompletion *completion,
gint column);
gint gtk_entry_completion_get_text_column (GtkEntryCompletion *completion);
G_END_DECLS
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment