[Gtk-osx-users] FW: Widget name no longer working?

OK... according to this http://www.gtkforums.com/about6610.html, and I'm recalling some back and forth on the list about this....

So my mind is having a hard time figuring out how to nkow what widget is calling this generic function, given the interface is automatically build with gtkbuilder.

Was I just using a bad hack here, what are others doing?

From: shashaness hotmail com
To: gtk-osx-users lists sourceforge net
Subject: Widget name no longer working?
Date: Tue, 28 Sep 2010 12:58:43 -0400

In GTK 2.18 i386, This code worked, and GTK_WIDGET(widget)->name would point to the name assigned to the widget in glade-3 builder.  I have not changed anything in the XML files nor this code, but now that I am using GTK 2.20 i386, this value points to an empty string "". I have tried to get the string from the name property and it still gives me the same results an empty string "". I don't see any warnings about it not being a property either.

What am I missing?

Breakpoint 1, on_generic_entry_changed (widget=0x1812b50, user_data=0x10a1be8) at callbacks.c:190
190        for (i=0; i< num_widgets; i++){
(gdb) next
193            g_object_get((GObject*)widget,"name",&wname,NULL);
196            if( cwid == -1 && !g_ascii_strcasecmp(wname,focus_widget_str[i])) {
(gdb) print wname
$1 = (gchar *) 0x2096820 ""
(gdb) print widget
$2 = (GtkEditable *) 0x1812b50

What am I missing?

/* Widgets we can focus on */
guint num_widgets = 123;
gchar *focus_widget_str[] = {
                "account_entry"            ,"name_entry"                ,"BLANK_BLANK_BLANK_BLANK_"    ,

  on_generic_entry_changed(GtkEditable *widget, gpointer user_data)
    gchar *ctext = NULL;
    gchar *wname = NULL;
    guint i = 0;
    gint cwid = -1;

    for (i=0; i< num_widgets; i++){
       /* THIS USE TO BE: */    
       //    if( cwid == -1 && !g_ascii_strcasecmp(GTK_WIDGET(widget)->name,focus_widget_str[i])) {
        if( cwid == -1 && !g_ascii_strcasecmp(wname,focus_widget_str[i])) {

        } else if  (cwid >= 0){



GtkWidget *
 isi_display_get_widget(IsiDisplay *self, const gchar* object)

     /* Sanity Check */
    g_return_val_if_fail(self != NULL, FALSE);
    g_return_val_if_fail(self->priv != NULL, FALSE);
    g_return_val_if_fail(self->priv->dispose_has_run != TRUE, FALSE);
    /* Get teh XML File and load XML Object */
    /* UPDATE 11272009 1102 NO BUG - migration to Gtkbuilder from libglade */
    //return glade_xml_get_widget (self->priv->xml, object);
    return GTK_WIDGET (gtk_builder_get_object (self->priv->xml, object));

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