antongiulio | 1 Oct 18:55 2004
Picon

Menu extern control


Hi,

I'm developing an app. This app includes a menu and toolbar. I have noticed with gnome-tool "Preferences
toolbar and tools" when I choose "Show icons" or "Icons and names both" many apps work properly, but my app
not... what is the right way to include this function in my app?

This functionality is not include in HIG-2.0? I don't remember to have read it

Thanks,
Giulio

 
 --
 Email.it, the professional e-mail, gratis per te: http://www.email.it/f

 Sponsor:
 Il tuo sito web primo nei Motori di Ricerca? 
* Partecipa al Workshop Nazionale SEO Italia 2004 - clicca qui 
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=2799&d=1-10
Lucas Di Pentima | 2 Oct 00:50 2004
Picon

Custom gobject property's validation


Hi people!

I'm developing a VGA Planets clients for GNOME called "GNOME War Pad",
and I'm learning about GObject's property framework. Today my
gobject's properties are implemented as simple members of a private
structura within the gobject, and the get/set functions were written by
me, but I'm interested in the features that GObject's paramaters give
to the developer, such as automatic signal emission when a value changes.

My doubt about "migrating" to this system is that I didn't  found any
reference about custom validators, every parameter type has some basic
validation feature (like min and max values for integers, for example)
but I'll need some extra checking in some attributes. So the question
is: how GNOME deal with this case? I don't think it's a rare case...is
there a way to register a validation function?

Best regards,

Lucas Di Pentima - Santa Fe - Argentina
LUNIX Soluciones S.R.L.
Jabber ID: lucas <at> lunix.com.ar
ICQ: 6782045
Lucas Di Pentima | 2 Oct 07:47 2004
Picon

Question on emission hooks


Hello,

I've read the tutorial on http://le-hacker.org/papers/gobject about 
gobject's signals, properties, etc. and started to play a little on my 
project with this.

What I don't understand completely are the emission hooks, from the 
tutorial I can say that a special callback can be connected to a signal 
and will be called on *any* emission of that signal. I have various 
gobjects subclasses defined on my project and checked their "notify" 
signal id, all gave me the number "1".

This value is then feeded to the g_signal_add_emission_hook, so any 
gobject "notify" signal will trigger the same emission hook, am I correct?

I tried this code:

------------------------------------------------------------------
static gboolean
notify_emission_hook (GSignalInvocationHint *ihint,
		      guint                  n_param_values,
		      const GValue          *param_values,
		      gpointer               data)
{
   g_message ("HOOK!!!");
   return TRUE;
}
(Continue reading)

Nickolay V. Shmyrev | 2 Oct 09:55 2004
Picon

Re: Custom gobject property's validation


Probably you need to start with reading a tutorial, many of them located
in 

http://www.developer.gnome.org

For example, this one:

http://le-hacker.org/papers/gobject/

You need to add signal to object when you create object class. About
properties, you can check their values during property-get/property-set
function.
Nickolay V. Shmyrev | 2 Oct 10:16 2004
Picon

Re:Menu extern control


You should use GnomeApp from libgnomeui to create application menus and
toolbar. 

Those trick is done with GConf, there is keys in

/desktop/gnome/interface/toolbar_style
/desktop/gnome/interface/menus_detachable
.....

which describe how toolbar and menus should look like. Probably, you
need to add notification from gconf and change the toolbar look
accordingly. But it is already implemented in libgnomeui.

But my opinion is that it is not so great problem in application.
Lucas Di Pentima | 2 Oct 14:47 2004
Picon

Re: Custom gobject property's validation


Hi Nickolay

Nickolay V. Shmyrev wrote:
> Probably you need to start with reading a tutorial, many of them located
> in 
> http://www.developer.gnome.org
> For example, this one:
> http://le-hacker.org/papers/gobject/
> You need to add signal to object when you create object class. About
Yes, I've read all the tutorials, I'm developing this GNOME application 
since 2002, it's just that I recently put attention to the GObject & 
signal features.

Here you're saying that the GObject class don't set up the "notify" 
signal for itself? I should add it so GObject will amit it automatically 
when a property changes?

> properties, you can check their values during property-get/property-set
> function.
Thanks :-)

Regards,
--

-- 
Lucas Di Pentima - Santa Fe, Argentina - Jabber ID: lucas <at> lunix.com.ar
LUNIX: Soluciones en GNU/Linux - http://www.lunix.com.ar
GnuPG Public Key:
http://random.sks.keyserver.penguin.de:11371/pks/lookup?op=get&search=0x6AA54FC9
(Continue reading)

Nickolay V. Shmyrev | 2 Oct 16:30 2004
Picon

Re: Question on emission hooks


Hello.

Sorry for style of my first answer, it seems that you have quite old
glib, because now (in 2.4.0 )it is impossible to g_signal_lookup on
G_TYPE_OBJECT, since it is not G_TYPE_IS_INSTANTIABLE, that's why I
thought that you are trying to to add emission hook to "notify" signale
of your type GWP_TYPE_SHIP, not G_TYPE_OBJECT. 

Even if you can get signal_id, it is not clear, that you can add
emission hook to that signal, because signal can have flag
G_SIGNAL_NO_HOOKS. The "notify" signal of g_object is exactly such
signal, that is why you get warning message. 

Look at glib sources:

  gobject_signals[NOTIFY] =
    g_signal_new ("notify",
                  G_TYPE_FROM_CLASS (class),
                  G_SIGNAL_RUN_FIRST | G_SIGNAL_NO_RECURSE |
G_SIGNAL_DETAILED | G_STRUCT_OFFSET (GObjectClass, notify),
                  NULL, NULL,
                  g_cclosure_marshal_VOID__PARAM,
                  G_TYPE_NONE,
                  1, G_TYPE_PARAM);

g_signal_add_emission_hook (guint               signal_id,
                            GQuark              detail,
                            GSignalEmissionHook hook_func,
                            gpointer            hook_data,
(Continue reading)

Lucas Di Pentima | 2 Oct 16:54 2004
Picon

Re: Question on emission hooks


Nickolay,

Nickolay V. Shmyrev wrote:

> Sorry for style of my first answer, it seems that you have quite old
> glib, because now (in 2.4.0 )it is impossible to g_signal_lookup on
> G_TYPE_OBJECT, since it is not G_TYPE_IS_INSTANTIABLE, that's why I
> thought that you are trying to to add emission hook to "notify" signale
> of your type GWP_TYPE_SHIP, not G_TYPE_OBJECT. 
I'm using glib 2.4.0, and what I wanted to do (I don't know if it's 
possible) is to use a emission hook callback every time one of my own 
types's properties changes. I have 500 GWP_TYPE_SHIPs on my application, 
so I don't want to connect to the "notify" signal in every ship.

What I don't know is if I have a GwpShip object that is a subclass of 
GObject...the "notify" signal if inherited? I tried both...I defined it 
on GwpShip and got the same signal_id = 1, I changed its name to 
something else and got a higher number and the error message disappeared 
when I connected an emission hook to it...so my code not so bad written :-)

> Even if you can get signal_id, it is not clear, that you can add
> emission hook to that signal, because signal can have flag
> G_SIGNAL_NO_HOOKS. The "notify" signal of g_object is exactly such
> signal, that is why you get warning message. 
So I cannot override it? Nevertheless the code you copied from glib's 
sources don't have the G_SIGNAL_NO_HOOKS flag.

(Continue reading)

Nickolay V. Shmyrev | 2 Oct 16:55 2004
Picon

Re: Question on emission hooks


I also filled bug #154299 with patch to fix gobject documentation.
Nickolay V. Shmyrev | 2 Oct 17:39 2004
Picon

Re: Question on emission hooks



> I'm using glib 2.4.0, and what I wanted to do (I don't know if it's 
> possible) is to use a emission hook callback every time one of my own 
> types's properties changes. I have 500 GWP_TYPE_SHIPs on my application, 
> so I don't want to connect to the "notify" signal in every ship.

Of course, it is possible. Try attached example

Attachment (test.c): text/x-csrc, 3641 bytes
_______________________________________________
gnome-devel-list mailing list
gnome-devel-list <at> gnome.org
http://mail.gnome.org/mailman/listinfo/gnome-devel-list

Gmane