forked from AuroraMiddleware/gtk
Bug 324282 - add selected signal to cell renderer combo.
2006-05-28 Kristian Rietveld <kris@imendio.com> Bug 324282 - add selected signal to cell renderer combo. * gtk/gtkcellrenderercombo.c (gtk_cell_renderer_combo_class_init), (gtk_cell_renderer_combo_changed), (gtk_cell_renderer_combo_start_editing): add a new "changed" signal that will be emitted as soon as the combo box emitted changed and has an active iterator. (Modified patch based on work by James Pelletier). * gtk/gtkmarshalers.list: add marshaler. svn path=/trunk/; revision=20206
This commit is contained in:
parent
1fa5cda0a9
commit
3ed120ebf8
13
ChangeLog
13
ChangeLog
@ -1,3 +1,16 @@
|
||||
2006-05-28 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Bug 324282 - add selected signal to cell renderer combo.
|
||||
|
||||
* gtk/gtkcellrenderercombo.c (gtk_cell_renderer_combo_class_init),
|
||||
(gtk_cell_renderer_combo_changed),
|
||||
(gtk_cell_renderer_combo_start_editing): add a new "changed" signal
|
||||
that will be emitted as soon as the combo box emitted changed and has
|
||||
an active iterator. (Modified patch based on work by James
|
||||
Pelletier).
|
||||
|
||||
* gtk/gtkmarshalers.list: add marshaler.
|
||||
|
||||
2008-05-28 Kristian Rietveld <kris@imendio.com>
|
||||
|
||||
Refactor expand/collapse timeout handling (amendment to bug 511217).
|
||||
|
@ -28,6 +28,7 @@
|
||||
#include "gtkcellrenderertext.h"
|
||||
#include "gtkcombobox.h"
|
||||
#include "gtkcomboboxentry.h"
|
||||
#include "gtkmarshalers.h"
|
||||
#include "gtkprivate.h"
|
||||
#include "gtkalias.h"
|
||||
|
||||
@ -59,6 +60,13 @@ enum {
|
||||
PROP_HAS_ENTRY
|
||||
};
|
||||
|
||||
enum {
|
||||
CHANGED,
|
||||
LAST_SIGNAL
|
||||
};
|
||||
|
||||
static guint cell_renderer_combo_signals[LAST_SIGNAL] = { 0, };
|
||||
|
||||
#define GTK_CELL_RENDERER_COMBO_PATH "gtk-cell-renderer-combo-path"
|
||||
|
||||
G_DEFINE_TYPE (GtkCellRendererCombo, gtk_cell_renderer_combo, GTK_TYPE_CELL_RENDERER_TEXT)
|
||||
@ -132,6 +140,39 @@ gtk_cell_renderer_combo_class_init (GtkCellRendererComboClass *klass)
|
||||
TRUE,
|
||||
GTK_PARAM_READWRITE));
|
||||
|
||||
|
||||
/**
|
||||
* GtkCellRendererCombo::changed:
|
||||
* @combo: the object on which the signal is emitted
|
||||
* @path_string: a string of the path identifying the edited cell
|
||||
* (relative to the tree view model)
|
||||
* @new_iter: the new iter selected in the combo box
|
||||
* (relative to the combo box model)
|
||||
*
|
||||
* This signal is emitted each time after the user selected an item in
|
||||
* the combo box, either by using the mouse or the arrow keys. Contrary
|
||||
* to GtkComboBox, GtkCellRendererCombo::changed is not emitted for
|
||||
* changes made to a selected item in the entry. The argument @new_iter
|
||||
* corresponds to the newly selected item in the combo box and it is relative
|
||||
* to the GtkTreeModel set via the model property on GtkCellRendererCombo.
|
||||
*
|
||||
* Note that as soon as you change the model displayed in the tree view,
|
||||
* the tree view will immediately cease the editing operating. This
|
||||
* means that you most probably want to refrain from changing the model
|
||||
* until the combo cell renderer emits the edited or editing_canceled signal.
|
||||
*
|
||||
* Since: 2.14
|
||||
*/
|
||||
cell_renderer_combo_signals[CHANGED] =
|
||||
g_signal_new (I_("changed"),
|
||||
G_TYPE_FROM_CLASS (object_class),
|
||||
G_SIGNAL_RUN_LAST,
|
||||
0,
|
||||
NULL, NULL,
|
||||
_gtk_marshal_VOID__STRING_BOXED,
|
||||
G_TYPE_NONE, 2,
|
||||
G_TYPE_STRING,
|
||||
GTK_TYPE_TREE_ITER);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -241,6 +282,25 @@ gtk_cell_renderer_combo_set_property (GObject *object,
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_combo_changed (GtkComboBox *combo,
|
||||
gpointer data)
|
||||
{
|
||||
GtkTreeIter iter;
|
||||
GtkCellRendererCombo *cell;
|
||||
|
||||
cell = GTK_CELL_RENDERER_COMBO (data);
|
||||
|
||||
if (gtk_combo_box_get_active_iter (combo, &iter))
|
||||
{
|
||||
const char *path;
|
||||
|
||||
path = g_object_get_data (G_OBJECT (combo), GTK_CELL_RENDERER_COMBO_PATH);
|
||||
g_signal_emit (cell, cell_renderer_combo_signals[CHANGED], 0,
|
||||
path, &iter);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
gtk_cell_renderer_combo_editing_done (GtkCellEditable *combo,
|
||||
gpointer data)
|
||||
@ -382,6 +442,9 @@ gtk_cell_renderer_combo_start_editing (GtkCellRenderer *cell,
|
||||
g_signal_connect (GTK_CELL_EDITABLE (combo), "editing_done",
|
||||
G_CALLBACK (gtk_cell_renderer_combo_editing_done),
|
||||
cell_combo);
|
||||
g_signal_connect (GTK_CELL_EDITABLE (combo), "changed",
|
||||
G_CALLBACK (gtk_cell_renderer_combo_changed),
|
||||
cell_combo);
|
||||
cell_combo->focus_out_id =
|
||||
g_signal_connect (combo, "focus_out_event",
|
||||
G_CALLBACK (gtk_cell_renderer_combo_focus_out_event),
|
||||
|
@ -101,6 +101,7 @@ VOID:POINTER,POINTER,BOOLEAN
|
||||
VOID:POINTER,POINTER,POINTER
|
||||
VOID:POINTER,UINT
|
||||
VOID:STRING
|
||||
VOID:STRING,BOXED
|
||||
VOID:STRING,STRING
|
||||
VOID:STRING,INT,POINTER
|
||||
VOID:STRING,UINT,FLAGS
|
||||
|
Loading…
Reference in New Issue
Block a user