Re: [anjuta-devel] Last two weeks of GSoC



Hi Tamara!

So I kind of got stuck with getting the selection. I've tried a few
approaches,
trying to get the selection trough gtk_tree_model_get , then with
gtk_dialog_run and doing it afterwards when the button is clicked, also
some
other successful stuff.

My other patch for feature:
https://bugzilla.gnome.org/show_bug.cgi?id=591688;
also depends on this, so if I finish this I finish both :)

Try something like that (pseudo-code) and take a look at the
GtkTreeSelection API:

GtkTreeSelection selection = gtk_tree_view_get_selection (tree);
GtkTreeIter iter;
GtkTreeModel *model;

/* Check if we have a selection */
if (gtk_tree_selection_get_selected (selection, &model, &iter))
{
  /* We have... - maybe also connect to the changed signal to know the
selection status and enable/disable the ok button */
  GFile* file; /* or whatever you stored in the model */
  gtk_tree_model_get (model, &iter, COLUMN_FILE, &file);
  /* open file ... something like
ianjuta_document_manager_open_file_line() */
  g_object_unref (file); /* important, don't leak memory */
}

As I said you might want to check the API at
http://developer.gnome.org/gtk3/stable/GtkTreeSelection.html.

Greetings from Brisbane,
Johannes





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