Returning a Calendar date string to a treeview cell



I have a treeview with a text render for a date. I wanted to be able to pop-up a calendar and select a date and have it get set in the cell of the treeview. I'm using the "editing-started" signal from GtkCellRenderer.

My callback function is below.

A couple of things are not clear. First, on entry into the cell the calendar pops up and when a date is selected it prints to the terminal just fine. The problem is I don't know how to get the date back to the calling function below in order to set it in the cell. Second, the data I set in the cell with g_object_set() and gtk_entry_set_text() is only there while the cell has focus. When I move off the cell the data disappears.

So How can I get the date string back to ipmsDateCellEditingStartedCb() to set it in the cell and have it remain there?

This is the callback function.

void ipmsDateCellEditingStartedCb(GtkCellRendererText *cell, GtkCellEditable *editable, gchar *path_string, gpointer user_data) {
  GladeXML *gxml=NULL;
  GtkWidget *tv=GTK_WIDGET(user_data);
  GtkTreeModel* tmdl=gtk_tree_view_get_model(GTK_TREE_VIEW(tv));
  GtkEntry *entry=NULL;

  g_print("ipmsDateCellEditingStartedCb\n");
  gxml=glade_xml_new(FILE_GLADE_XML0, "calendar_dialog", NULL);
  glade_xml_signal_autoconnect(gxml);
  //g_object_set(G_OBJECT(editable), "text", "Stock", NULL);
  if(GTK_IS_ENTRY(editable)) {
    entry=GTK_ENTRY(editable);
    gtk_entry_set_text(entry, "adasdadas");
  }
}

Thanks,
Dave




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