Catch toggled signal in combobox



Hello,

I'm trying to come up with a method to catch a toggled signal from a
GtkCellRendererToggle, which is placed inside ComboBox.

What I'm trying to achieve is, when the user clicks on combo box, it
pops-up. Then user selects desired elements and when finished, clicks
on search button (or something similar).

The problem I'm having is that when I'm trying to toggle renderer, the
combo pops-down and no toggled signal is emitted.


Some sample code:
---------------
GtkWidget *combo;
GtkCellRenderer *renderer;
GtkListStore *model;
GtkTreeIter iter;


/* Create model for combo */
model = gtk_list_store_new( 2, G_TYPE_BOOLEAN,
                               G_TYPE_STRING );
gtk_list_store_append( model, &iter );
gtk_list_store_set( model, &iter,
                    0, FALSE,
                    1, "Pathological function",
                   -1 );

gtk_list_store_append( model, &iter );
gtk_list_store_set( model, &iter,
                    0, FALSE,
                    1, "Physiological function",
                   -1 );

/* create combo box */
combo = gtk_combo_box_new_with_model(
            GTK_TREE_MODEL( model ) );
/* place combo somewhere */

/* create columns */
renderer = gtk_cell_renderer_toggle_new();
gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( combo ),
                            renderer, FALSE );
gtk_cell_layout( GTK_CELL_LAYOUT( combo ), renderer,
                 "active", 0,
                 NULL );

/* connect toggled signal to renderer */
/*      THIS IS NOT WORKING!!         */
g_signal_connect( G_OBJECT( renderer ), "toggled",
                  G_CALLBACK( cb_rend_togg ), NULL );

renderer = gtk_cell_renderer_text_new();
gtk_cell_layout_pack_start( GTK_CELL_LAYOUT( combo ),
                            renderer, TRUE );
gtk_cell_layout( GTK_CELL_LAYOUT( combo ), renderer,
                 "text", 1,
                 NULL );

------------------------

Thank you for the ideas/comments in advance.

-- 
Tadej Borovšak
tadeboro gmail com


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]