Re: gchar * properties

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

 



> Widgets have some properties of type gchar*. For example GtkLabel has the "label" property. What happens when I use> g_object_set(lable_widget, "label", some_gchar_ptr, NULL);? Does the class just assign 'some_gchar_ptr' to the 'label'> member or does it allocate memory and copy the content pointed to by 'some_gchar_ptr'?
As far as I my experience go, it is usually safe to assume thatg_object_set( widget, "prop", value, NULL ) does the same thing asgtk_widget_set_prop( widget, value ). In the case of gchar * values,the value gets it's own copy of a string via g_strdup.
> GtkWidget has the 'name' property (of type gchar*) which default value is NULL. May I use this property to give a name> to widgets arbitrarily? Is this property used internally by GTK, is it safe to use it? And what happens with> g_object_set(widget, "name", ... ? Is this just a copy of the pointer? Is there anywhere a policy for this kind of> assignments?
  /* The widget's name. If the widget does not have a name   *  (the name is NULL), then its name (as returned by   *  "gtk_widget_get_name") is its class's name.   * Among other things, the widget name is used to determine   *  the style to use for a widget.   */  gchar *GSEAL (name);
This is a copy from gtkwidget.h file. I cannot say if it is safe tochange that, but you can always try and see what happens;)
-- Tadej Borovšak00386 (0)40 613 131tadeboro@xxxxxxxxxxxxxxxxxxxxxxx@gmail.com_______________________________________________gtk-list mailing listgtk-list@xxxxxxxxxxxxx://mail.gnome.org/mailman/listinfo/gtk-list

[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux