Bug in GtkHScale (again)



Hi,

I found a bug in the implementation of GtkHScale. I don't know who is
the right person to address, 
so I send it to this list.


Normally the following code sequence should run without error:

//"ThresholdSlider" is a GtkHScale.
wid = GTK_WIDGET(gtk_object_get_data(GTK_OBJECT(widget),
"ThresholdSlider"));
GtkArg test;
test.name = "adjustment";
gtk_widget_get(wid, &test);
cout << "Type is " << gtk_type_name(test.type) << endl;
adj = GTK_ADJUSTMENT(GTK_VALUE_OBJECT(test));
g_assert(GTK_IS_ADJUSTMENT(adj));

...but it does not, the "cout" prints out the correct type, namly
GtkAdjustment,
but the object returned by GTK_VALUE_OBJECT(test) returns the GtkHScale.


Implementation and fix for gtk_hscale_get_arg:

static void
gtk_hscale_get_arg (GtkObject          *object,
                    GtkArg             *arg,
                    guint               arg_id)
{
  GtkHScale *hscale;
  
  hscale = GTK_HSCALE (object);
  
  switch (arg_id)
    {
    case ARG_ADJUSTMENT:
      GTK_VALUE_POINTER (*arg) = GTK_RANGE (hscale); 
//Preceeding line is wrong!!! Should be :
//GTK_VALUE_POINTER (*arg) =
gtk_range_get_adjustment(GTK_RANGE(hscale));
      break;
    default:
      arg->type = GTK_TYPE_INVALID;
      break;
    }
}

Ciao,

Thomas
-- 
Thomas Kulessa                          GMD/IMK/Mars - Exploratory Media Lab
                                        Schloss Birlinghoven
Phone : +49-2241-14-2166                53754 Sankt Augustin
eMail : thomas kulessa gmd de           Germany

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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