user3833759
user3833759

Reputation:

GTK+:How to communicating between GtkWindow?

I want to communicate between two TOPLEVEL GtkWindow. For example,I double-clicked the row in the GtkTreeView,and the new GtkWindow is used to modify the context of the row. However,I failed to find out a solution except declaring a global variable to pass the structure.Whether I can get a ingenious way to help me solve the problem? As a green hand of GTK,I will appreciate for your help.

Upvotes: 0

Views: 62

Answers (1)

luciomrx
luciomrx

Reputation: 1195

you can pass the data through 'row-activated" signal:

this_window = gtk_window_new (mode);
that_window = gtk_window_new (mode);
tv = gtk_tree_view_new ();

g_object_connect (tv, "row_activated", 
                  G_CALLBACK (on_row_activate), that_window); 



    static mode my_func_using_data (view, that_window)
{
    // do something here to pass a data to view
    ....
    ....
    selection = view.get_selection ()
    GtkTreeModel *model;
    GtkTreeIter iter;
        if ( gtk_tree_selection_get_selected (selection))
    {
        // modify the data here with model and iter
    }

}
    static void on_row_activate (GtkTreeView *view, 
                                 GtkTreePath *path, 
                                 GtkTreeViewColumn *col,
                                 gpointer that_window)
{
    my_func_using_data (view, that_window)
}

Upvotes: 0

Related Questions