<div dir="ltr"><br><br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Message: 4<br>
Date: Sat, 20 Sep 2008 15:54:10 -0700<br>
From: "Brian J. Tarricone" <<a href="mailto:bjt23@cornell.edu" target="_blank">bjt23@cornell.edu</a>><br>
Subject: Re: About XfconfChannel Object (Brian J. Tarricone)<br>
To: <a href="mailto:xfce4-dev@xfce.org" target="_blank">xfce4-dev@xfce.org</a><br>
Message-ID: <20080920155410.1cd9a786@kepler><br>
Content-Type: text/plain; charset=US-ASCII<br>
<br>
On Sat, 20 Sep 2008 23:07:11 +0200 ali abdallah wrote:<br>
<br>
> > On Sat, 20 Sep 2008 13:42:12 +0200 ali abdallah wrote:<br>
> ><br>
> > > On Sat, Sep 20, 2008 at 12:32 PM, Brian Tarricone wrote:<br>
> > > > ali abdallah wrote:<br>
> > > > > Hi,<br>
> > > > ><br>
> > > > > Why the XfconfChannel and XfconfChannelClass are defined in<br>
> > > > > the xfconf-channel.c, i'm asking this question since i<br>
> > > > > couldn't derive an object<br>
> > > > > from the XfconfChannel object!<br>
> > > ><br>
> > > > Er, why do you want to?  I assumed no one would.<br>
> > > ><br>
> > > > Not saying you don't have a valid use-case, but I'd rather not<br>
> > > > go and change things without a reason.<br>
> > > ><br>
> > > I wanted to have an object wish is derived from XfconfChannel<br>
> > > object and contains more data and functions to be used in my<br>
> > > application, then i can call the *channel_get* and *channel_set*<br>
> > > functions by casting the object to XfconfChannel type, just like<br>
> > > a GtkWidget and GtkButton for example.<br>
> ><br>
> > So are you actually *extending* the XfconfChannel type?  I mean, are<br>
> > you actually adding settings-related functionality to it, or are you<br>
> > just using subclassing as a quick-and-dirty shortcut to avoid<br>
> > having to carry around an extra pointer?<br>
> ><br>
> > If you're actually extending the object, I'd consider making the<br>
> > class struct public, but otherwise you should just be using<br>
> > g_object_set_data() to carry around a pointer to the XfconfChannel,<br>
> > or stuffing it in a struct that has other data you're passing<br>
> > around.<br>
> ><br>
><br>
> Yes actually i'm extending the object and i want to add some<br>
> functions to it, it's not really<br>
> mandatory since the second solution that you are proposing is always<br>
> valid, but well having to work<br>
> with the GObject system for a long time now, i thought it is kind of<br>
> standard the<br>
> declaration of the GObjects.<br>
<br>
What kind of functions do you want to add?  If you want to add normal<br>
functions that operate on an XfconfChannel object, you don't need to<br>
subclass it.  If you want to add *virtual* functions to<br>
XfconfChannelClass (or rather, subclass it and add vfuncs), then yeah,<br>
you need to subclass, but I can't think of a reason why you need to.<br>
<br>
Really, I'm perfectly willing to make the XfconfChannel and<br>
XfconfChannelClass structs public, and if you have a good use case,<br>
please do let me know.  This is the perfect time to do it, before we<br>
have a 'real' release of the library... if there's good reason.<br>
</blockquote><div><br>Well, my idea was to have let's say a conf object derived from the XfconfChannel object,<br>and has a callbacks for "property-changed" with the property and the new value.<br>i simply didn't want to have the XfconfChannel object in the private data of the conf<br>

object, since from outside to call *channel_set* and *channel_get*  i have to provide <br>the XfconfChannel and i don't like to have anything in the conf public struct<br>other than the parent and priv.<br><br>I hope that i made myself clear.<br>

<br> </div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><br>
        -brian<br>
<br>
P.S.  Subclassing using GObject actually isn't done all that often<br>
unless there's a decent benefit... In a language like C++, you'd<br>
probably subclass a lot more often since it's trivial.  But with all<br>
the work it takes to subclass a GObject in C, it's not done unless<br>
there are clear benefits to doing so, in general.  (I remember when I<br>
used to write Qt2 apps, it was common practice to always subclass<br>
QWindow for your app's main window... but that's probably not so common<br>
to do with GtkWindow in straight C, though admittedly I do it<br>
sometimes.)</blockquote><div><br>Even when i write using C++ my code looks like C, the only one difference is the compiler.<br>i hate C++.<br><br>Many thanks for answering my questions.<br><br>Best Regards,<br>Ali. <br></div>
</div><br></div>