X-Git-Url: http://pileus.org/git/?a=blobdiff_plain;f=gtk%2Fgtkcellrenderercombo.c;h=4f84d2905b7cfb88db9aa7e0968cbb29c09ae436;hb=f35439bfacf90900e2c24f7ae3da173183c79d34;hp=f15bc7bad77f61f13db3a62f3a14d5fce3a02563;hpb=82129275f22c61cd3510c72345846402ecfcdbbd;p=~andy%2Fgtk diff --git a/gtk/gtkcellrenderercombo.c b/gtk/gtkcellrenderercombo.c index f15bc7bad..4f84d2905 100644 --- a/gtk/gtkcellrenderercombo.c +++ b/gtk/gtkcellrenderercombo.c @@ -20,7 +20,6 @@ #include #include -#include "gtkalias.h" #include "gtkintl.h" #include "gtkbin.h" #include "gtkentry.h" @@ -29,6 +28,8 @@ #include "gtkcellrenderertext.h" #include "gtkcombobox.h" #include "gtkcomboboxentry.h" +#include "gtkprivate.h" +#include "gtkalias.h" static void gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass); static void gtk_cell_renderer_combo_init (GtkCellRendererCombo *self); @@ -60,7 +61,7 @@ enum { #define GTK_CELL_RENDERER_COMBO_PATH "gtk-cell-renderer-combo-path" -G_DEFINE_TYPE (GtkCellRendererCombo, gtk_cell_renderer_combo, GTK_TYPE_CELL_RENDERER_TEXT); +G_DEFINE_TYPE (GtkCellRendererCombo, gtk_cell_renderer_combo, GTK_TYPE_CELL_RENDERER_TEXT) static void gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass) @@ -88,43 +89,48 @@ gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass) P_("Model"), P_("The model containing the possible values for the combo box"), GTK_TYPE_TREE_MODEL, - G_PARAM_READWRITE)); + GTK_PARAM_READWRITE)); /** * GtkCellRendererCombo:text-column: * - * Specifies the model column which holds the possible values for the combo box. + * Specifies the model column which holds the possible values for the + * combo box. + * * Note that this refers to the model specified in the model property, - * not the model backing the tree view to which this cell - * renderer is attached. + * not the model backing the tree view to which + * this cell renderer is attached. * + * #GtkCellRendererCombo automatically adds a text cell renderer for + * this column to its combo box. + * * Since: 2.6 */ g_object_class_install_property (object_class, PROP_TEXT_COLUMN, - g_param_spec_int ("text_column", + g_param_spec_int ("text-column", P_("Text Column"), P_("A column in the data source model to get the strings from"), -1, G_MAXINT, -1, - G_PARAM_READWRITE)); + GTK_PARAM_READWRITE)); /** * GtkCellRendererCombo:has-entry: * - * If %TRUE, the cell renderer will include an entry and allow to enter values - * other than the ones in the popup list. + * If %TRUE, the cell renderer will include an entry and allow to enter + * values other than the ones in the popup list. * * Since: 2.6 */ g_object_class_install_property (object_class, PROP_HAS_ENTRY, - g_param_spec_boolean ("has_entry", + g_param_spec_boolean ("has-entry", P_("Has Entry"), P_("If FALSE, don't allow to enter strings other than the chosen ones"), TRUE, - G_PARAM_READWRITE)); + GTK_PARAM_READWRITE)); } @@ -140,7 +146,7 @@ gtk_cell_renderer_combo_init (GtkCellRendererCombo *self) /** * gtk_cell_renderer_combo_new: * - * Creates a new #GtkCellRendererCombo + * Creates a new #GtkCellRendererCombo. * Adjust how text is drawn using object properties. * Object properties can be set globally (with g_object_set()). * Also, with #GtkTreeViewColumn, you can bind a property to a value @@ -251,6 +257,7 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo, GtkTreeIter iter; GtkCellRendererCombo *cell; GtkEntry *entry; + gboolean canceled; cell = GTK_CELL_RENDERER_COMBO (data); @@ -259,12 +266,11 @@ gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo, g_signal_handler_disconnect (combo, cell->focus_out_id); cell->focus_out_id = 0; } - - if (_gtk_combo_box_editing_canceled (GTK_COMBO_BOX (combo))) - { - gtk_cell_renderer_editing_canceled (GTK_CELL_RENDERER (data)); - return; - } + + canceled = _gtk_combo_box_editing_canceled (GTK_COMBO_BOX (combo)); + gtk_cell_renderer_stop_editing (GTK_CELL_RENDERER (data), canceled); + if (canceled) + return; if (GTK_IS_COMBO_BOX_ENTRY (combo)) { @@ -372,9 +378,9 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell, &(search_data.iter)); } - g_object_set (combo, "has_frame", FALSE, NULL); + g_object_set (combo, "has-frame", FALSE, NULL); g_object_set_data_full (G_OBJECT (combo), - GTK_CELL_RENDERER_COMBO_PATH, + I_(GTK_CELL_RENDERER_COMBO_PATH), g_strdup (path), g_free); gtk_widget_show (combo); @@ -389,3 +395,6 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell, return GTK_CELL_EDITABLE (combo); } + +#define __GTK_CELL_RENDERER_COMBO_C__ +#include "gtkaliasdef.c"