G_PARAM_SPEC_VALUE_TYPE() question

2012-05-15 Thread Marc Balmer
Hi

I want to set properties of an object using the g_value_set_type()
functions and to cast my value (which I get from a Lua script, which
e.g. does not differentiate between integers and floats) I need to know
the type of the property.

Ideally something like the following:

switch (G_PARAM_SPEC_VALUE_TYPE(prop)) {
case G_TYPE_INT:
g_value_set_int(...);
break;
case G_TYPE_STRING:
g_value_set_string(...);
break;
}

You get the idea...  This works for basic types, but not for e.g.
GParamEnum, i.e. when G_PARAM_SPEC_TYPE_NAME() returns GParamEnum,
above scheme seems not to work.  There is a type G_TYPE_ENUM, but it is
not returned in case of GParamEnum.

(In my example I want to set the 'tab-pos' property of a Notebook widget).

Any hints how I can discriminate on the type of an enum?

- mb
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Setting the size of tabs in a Notebook?

2012-05-15 Thread Marc Balmer
Hi

is there a way to set the width and height of the tabs in a GtkNotebook
widget?  Or can I do it only indirectly by using enough text?

Thanks,
mb
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


Re: G_PARAM_SPEC_VALUE_TYPE() question

2012-05-15 Thread David Nečas
On Tue, May 15, 2012 at 08:39:12AM +0200, Marc Balmer wrote:
 I want to set properties of an object using the g_value_set_type()
 functions and to cast my value (which I get from a Lua script, which
 e.g. does not differentiate between integers and floats) I need to know
 the type of the property.
 
 Ideally something like the following:
 
 switch (G_PARAM_SPEC_VALUE_TYPE(prop)) {
 case G_TYPE_INT:
   g_value_set_int(...);
   break;
 case G_TYPE_STRING:
   g_value_set_string(...);
   break;
 }
 
 You get the idea...  This works for basic types, but not for e.g.
 GParamEnum, i.e. when G_PARAM_SPEC_TYPE_NAME() returns GParamEnum,
 above scheme seems not to work.  There is a type G_TYPE_ENUM, but it is
 not returned in case of GParamEnum.

You need to use g_type_is_a(...) on the type obtained from
G_PARAM_SPEC_TYPE_NAME(), not direct comparison to some explicit GTypes.
Then it will work also with subclassable types such as enums.

Yeti

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


Re: Setting the size of tabs in a Notebook?

2012-05-15 Thread Olivier Sessink
I haven't found a good way, but I'm looking to make them smaller. You
can use a different font in the labels, but with some themes (most
notably the gtk3 default) the tabs are still very large.

I have the feeling there was more possible with gtk 2
gtk_notebook_set_tab_border(), but I must admit that I haven't played
with the tab-curvature and tab-overlap style properties yet.

Olivier

2012/5/15 Olivier Sessink oliviersess...@gmail.com:
 I haven't found a good way, but I'm looking to make them smaller. You
 can use a different font in the labels, but with some themes (most
 notably the gtk3 default) the tabs are still very large.

 I have the feeling there was more possible with gtk 2
 gtk_notebook_set_tab_border(), but I must admit that I haven't played
 with the tab-curvature and tab-overlap style properties yet.

 Olivier

 2012/5/15 Marc Balmer m...@msys.ch:
 Hi

 is there a way to set the width and height of the tabs in a GtkNotebook
 widget?  Or can I do it only indirectly by using enough text?

 Thanks,
 mb
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: Setting the size of tabs in a Notebook?

2012-05-15 Thread Marc Balmer
Am 15.05.12 10:56, schrieb Olivier Sessink:
 I haven't found a good way, but I'm looking to make them smaller. You
 can use a different font in the labels, but with some themes (most
 notably the gtk3 default) the tabs are still very large.
 
 I have the feeling there was more possible with gtk 2
 gtk_notebook_set_tab_border(), but I must admit that I haven't played
 with the tab-curvature and tab-overlap style properties yet.

I use Debian Squeeze, so I guess that is still gtk2.  What works halfway
is to set the tab-hborder and tab-vborder property and set the
homogeneous property on the notbook to true.  At least that way I can
make the tabs big enough for touchscreen operation.

-mb
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list