Re: [DNG] Experiencing with GtkBuilder
Hi All, Is it possible to use classes and objects while using gtk2/3? I noticed that only functions are used and that class use is ovoided by prepending functions with a group string. As far as I know, C can still use structs that are attached to a set of data and a set of functions, but without inheritance and polymorphyism. Edward On 22/11/2015, Edward Bartolo wrote: > Hi Aitor, > > As I told you earlier in this thread, I am am joining you in your > experimentation with gtk. I have just created a little calendar > application using the calendar widget. After this, I can try to create > the GUI for netman but obviously without the coding. > > Edward > > On 21/11/2015, aitor_czr wrote: >> Hi Rainer, >> >> And thanks for your test... >> >> On 20/11/15 12:11, Rainer Weikusat >> wrote: >>> "Works for me" (as usual, the dbus invasion could be successfully >>> repelled by deinstalling everything which came in the way until dbus >>> could be deinstalled itself without affecting any 'real' functionality). >> Almost certainly my lower version of gtk3 doesn't support spinning >> animation. See here: >> >> http://ftp.acc.umu.se/pub/GNOME/sources/gtk+/3.8/gtk+-3.8.0.news >> >> Are you in Ceres? I will try with the unstable branch. >> >>> BTW, instead of creating a README file telling people what to do, have >>> you considered using a Makefile which does it for them? >> Yes..., i will do so :) >> >> Thanks again, >> >>Aitor. >> > ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
aitor_czr writes: > On 20/11/15 12:11, Rainer Weikusat wrote: >> "Works for me" (as usual, the dbus invasion could be successfully >> repelled by deinstalling everything which came in the way until dbus >> could be deinstalled itself without affecting any 'real' functionality). > Almost certainly my lower version of gtk3 doesn't support spinning > animation. See here: > > http://ftp.acc.umu.se/pub/GNOME/sources/gtk+/3.8/gtk+-3.8.0.news > > Are you in Ceres? I will try with the unstable branch. I'm using a Debian Wheezy system I plan to keep until an update can't be avoided anymore. For the given case, this means gtk+ 3.4.2. ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
Edward Bartolo writes: > Is it possible to use classes and objects while using gtk2/3? I > noticed that only functions are used and that class use is ovoided by > prepending functions with a group string. As far as I know, C can > still use structs that are attached to a set of data and a set of > functions, but without inheritance and polymorphyism. C structs can be embedded into each other which means they can 'inherit' other structs, eg, for a totally contrived example struct something { int number0, number1; }; struct another { struct something parent; int drei; }; Assuming struct another *pa the elements of the embedded struct can now be accessed as pa->parent.number0 and a this pointer can be casted to a struct something * pointing at the first member which can thus be passed to functions expecting such a pointer as an argument. Further, the relatively puny "polymorphism support" of Pascal or C++ is easily implemented without help from the compiler. One can create structures of function pointers like this struct something_vtable { int (*calc)(struct something *); }; embed a pointer to that into the structure. Derived 'classes' can have their own vtable structures and hence, supply alternate functions to execute. This mechanism as certain tendency make C++ developers go bezerk with a particular type of strong rage, but it's entirely usuable in practice, although more work than having it all laid out for oneself. Working example: #include /* metainformation */ struct something; struct something_vtable { int (*calc)(struct something *); }; /* something */ struct something { struct something_vtable *vt; int number0, number1; }; static int calc_something(struct something *sth) { return sth->number0 + sth->number1; } static struct something_vtable sth_vt = { .calc = calc_something }; static void init_something(struct something *sth, int n0, int n1) { sth->vt = &sth_vt; sth->number0 = n0; sth->number1 = n1; } static int calc(struct something *sth) { return sth->vt->calc(sth); } /* another */ struct another { struct something parent; int drei; }; static int calc_another(struct something *sth) { struct another *ath = (void *)sth; return ath->drei + calc_something(sth); } static struct something_vtable ath_vt = { .calc = calc_another }; static void init_another(struct another *ath, int n0, int n1, int d) { init_something((void *)ath, n0, n1); ath->parent.vt = &ath_vt; ath->drei = d; } /* example program */ void print_result(struct something *sth) { printf("Result: %d\n", calc(sth)); } int main(void) { struct something sth; struct another ath; init_something(&sth, 1, 2); init_another(&ath, 1, 2, 3); print_result(&sth); print_result((void *)&ath); return 0; } ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
Yes, of course, C structures can be declared that way, but the fact remains that the contents of the ancestor's structure are not merged into the heir. This means, to access a member N ancestors deep, one has to specify all of them in the correct order. The purpose of inheritance is to avoid this requirement and to make objects behave in a polymorphic way without actually specifying or assigning any virtual methods used. On 22/11/2015, Rainer Weikusat wrote: > Edward Bartolo writes: >> Is it possible to use classes and objects while using gtk2/3? I >> noticed that only functions are used and that class use is ovoided by >> prepending functions with a group string. As far as I know, C can >> still use structs that are attached to a set of data and a set of >> functions, but without inheritance and polymorphyism. > > C structs can be embedded into each other which means they can 'inherit' > other structs, eg, for a totally contrived example > > struct something { > int number0, number1; > }; > > struct another { > struct something parent; > int drei; > }; > > Assuming > > struct another *pa > > the elements of the embedded struct can now be accessed as > > pa->parent.number0 > > and a this pointer can be casted to a struct something * pointing at the > first member which can thus be passed to functions expecting such a > pointer as an argument. > > Further, the relatively puny "polymorphism support" of Pascal or C++ is > easily implemented without help from the compiler. One can create > structures of function pointers like this > > struct something_vtable { > int (*calc)(struct something *); > }; > > embed a pointer to that into the structure. Derived 'classes' can have > their own vtable structures and hence, supply alternate functions to > execute. > > This mechanism as certain tendency make C++ developers go bezerk with a > particular type of strong rage, but it's entirely usuable in practice, > although more work than having it all laid out for oneself. > > Working example: > > > #include > > /* metainformation */ > struct something; > > struct something_vtable { > int (*calc)(struct something *); > }; > > /* something */ > struct something { > struct something_vtable *vt; > int number0, number1; > }; > > static int calc_something(struct something *sth) > { > return sth->number0 + sth->number1; > } > > static struct something_vtable sth_vt = { > .calc = calc_something > }; > > static void init_something(struct something *sth, int n0, int n1) > { > sth->vt = &sth_vt; > sth->number0 = n0; > sth->number1 = n1; > } > > static int calc(struct something *sth) > { > return sth->vt->calc(sth); > } > > /* another */ > struct another { > struct something parent; > int drei; > }; > > static int calc_another(struct something *sth) > { > struct another *ath = (void *)sth; > return ath->drei + calc_something(sth); > } > > static struct something_vtable ath_vt = { > .calc = calc_another > }; > > static void init_another(struct another *ath, int n0, int n1, int d) > { > init_something((void *)ath, n0, n1); > ath->parent.vt = &ath_vt; > ath->drei = d; > } > > /* example program */ > void print_result(struct something *sth) > { > printf("Result: %d\n", calc(sth)); > } > > int main(void) > { > struct something sth; > struct another ath; > > init_something(&sth, 1, 2); > init_another(&ath, 1, 2, 3); > > print_result(&sth); > print_result((void *)&ath); > > return 0; > } > ___ > Dng mailing list > Dng@lists.dyne.org > https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng > ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
On Sun, 22 Nov 2015 13:13:47 + Rainer Weikusat wrote: > Edward Bartolo writes: > > Is it possible to use classes and objects while using gtk2/3? I > > noticed that only functions are used and that class use is ovoided > > by prepending functions with a group string. As far as I know, C can > > still use structs that are attached to a set of data and a set of > > functions, but without inheritance and polymorphyism. > > C structs can be embedded into each other which means they can > 'inherit' other structs, eg, for a totally contrived example > > struct something { > int number0, number1; > }; > > struct another { > struct something parent; > int drei; > }; That's composition, not inheritance. It's "has-a", not "is-a". You need to name the whole chain when calling an element (someth->anoth->drei rather than someth->drei). If Edward's anything like me, we both learned OOP from that Philippe Kahn video where Philippe plays a horn and speaks of these three capabilities of objects: * Encapsulation * Inheritance * Polymorphism In my personal opinion, Encapsulation is by far the strongest benefit, and in fact I seldom use inheritance and almost never use polymorphism. So personally, I'm just fine with composing large objects with smaller component objects, all the way down the tree. Especially since a lot of that nesting can be hidden in methods (I'm pretty sure that function pointers can be used as methods in C). But technically, what you wrote above isn't inheritance. SteveT Steve Litt November 2015 featured book: Troubleshooting Techniques of the Successful Technologist http://www.troubleshooters.com/techniques ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
On Sun, 22 Nov 2015 15:09:34 + Edward Bartolo wrote: > Yes, of course, C structures can be declared that way, but the fact > remains that the contents of the ancestor's structure are not merged > into the heir. This means, to access a member N ancestors deep, one > has to specify all of them in the correct order. Hi Edward, I haven't actually done it, but I'm pretty sure the outer struct can contain function pointers that act as "methods", and that those "methods" can be the ones that access N ancestors (really subcomponents) deep. But if the "methods" are written right, the person just *using* the struct needn't know about that struct's subcomponents. > The purpose of > inheritance is to avoid this requirement and to make objects behave in > a polymorphic way without actually specifying or assigning any virtual > methods used. I'm pretty sure you could simulate polymorphism with logic that sets the struct's actual function pointer methods, but IMHO the mess that creates would exceed its benefit, kind of like the mess systemd creates exceeds its benefit. SteveT Steve Litt November 2015 featured book: Troubleshooting Techniques of the Successful Technologist http://www.troubleshooters.com/techniques ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Is netman being adopted or was it a waste of time and effort?
Hi, Font size depends on your pixels per inch setting. If your screen resolution is very high fonts can also appear smaller than intended. Please reply giving me your screen resolution and your estimate of font size in millimetres. I will try to devise a way to tell the GUI frontend to use a different size with a simple command line parameter like --auto-conn. This means, if I want netman to increase the font size by 50%, I would use --font-size-factor=1.5. If you have a better idea, please don't hesitate to share it. Thanks. Edward On 20/11/2015, ren...@openmailbox.org wrote: > Hi Edward, > > I saw your mail via dng, i install netman on devuan-x86_64 to evaluate. > > - netman works fine with ethernet and wifi connections > - i've problem with the gui, i can't resize the window and the font size > is small(i use xfce). > > i try to install lazarus to make some changes but i have some dependency > problems. > > and i download netman from gnuinos.org/netman . > > thanks. > > rennes > > ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
Steve Litt writes: > On Sun, 22 Nov 2015 13:13:47 + > Rainer Weikusat wrote: > >> Edward Bartolo writes: >> > Is it possible to use classes and objects while using gtk2/3? I >> > noticed that only functions are used and that class use is ovoided >> > by prepending functions with a group string. As far as I know, C can >> > still use structs that are attached to a set of data and a set of >> > functions, but without inheritance and polymorphyism. >> >> C structs can be embedded into each other which means they can >> 'inherit' other structs, eg, for a totally contrived example >> >> struct something { >> int number0, number1; >> }; >> >> struct another { >> struct something parent; >> int drei; >> }; > > That's composition, not inheritance. It's "has-a", not "is-a". You need > to name the whole chain when calling an element (someth->anoth->drei > rather than someth->drei). That's the implementation without any compiler support hiding its details. There's also no independent 'something object' involved here whose identity could change. [...] > * Encapsulation > * Inheritance > * Polymorphism > > In my personal opinion, Encapsulation is by far the strongest benefit, > and in fact I seldom use inheritance and almost never use > polymorphism. 'Encapsulation' is something which exists by virtue of using abstract interfaces. And if you look at this: void print_result(struct something *sth) { printf("Result: %d\n", calc(sth)); } you ought to note that the code doesn't access the implementation of the passed object but invokes an abstract function with a pointer and hence, will work with different objects: That's exactly what 'encapsulation' is about. ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Dng Digest, Vol 14, Issue 63
Hi Edward, Steve, It's possible to use classes and objects only while using gtk3. Have you a preference for using c++ in netman? As Jude Nelson said: c++ is not a standardized language. Aitor. Edward Bartolo writes: > >Is it possible to use classes and objects while using gtk2/3? I > >noticed that only functions are used and that class use is ovoided > >by prepending functions with a group string. As far as I know, C can > >still use structs that are attached to a set of data and a set of > >functions, but without inheritance and polymorphyism. > >C structs can be embedded into each other which means they can >'inherit' other structs, eg, for a totally contrived example > >struct something { >int number0, number1; >}; > >struct another { >struct something parent; > int drei; >}; That's composition, not inheritance. It's "has-a", not "is-a". You need to name the whole chain when calling an element (someth->anoth->drei rather than someth->drei). If Edward's anything like me, we both learned OOP from that Philippe Kahn video where Philippe plays a horn and speaks of these three capabilities of objects: * Encapsulation * Inheritance * Polymorphism In my personal opinion, Encapsulation is by far the strongest benefit, and in fact I seldom use inheritance and almost never use polymorphism. So personally, I'm just fine with composing large objects with smaller component objects, all the way down the tree. Especially since a lot of that nesting can be hidden in methods (I'm pretty sure that function pointers can be used as methods in C). But technically, what you wrote above isn't inheritance. SteveT ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Dng Digest, Vol 14, Issue 63
aitor_czr writes: > Hi Edward, Steve, > > It's possible to use classes and objects only while using gtk3. > > Have you a preference for using c++ in netman? > > As Jude Nelson said: c++ is not a standardized language. "The nice thing about standards is that there are so many of them" :-> ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
Hi Edward, Steve, It's possible to use classes and objects only while using gtk3. Have you a preference for using c++ in netman? As Jude Nelson said: c++ is not a standardized language. Aitor. P.D.- Sorry again for the subject, Steve, i have no choice... On 11/22/2015 06:48 PM, Steve Litt wrote: On Sun, 22 Nov 2015 13:13:47 + Rainer Weikusat wrote: >Edward Bartolo writes: > >Is it possible to use classes and objects while using gtk2/3? I > >noticed that only functions are used and that class use is ovoided > >by prepending functions with a group string. As far as I know, C can > >still use structs that are attached to a set of data and a set of > >functions, but without inheritance and polymorphyism. > >C structs can be embedded into each other which means they can >'inherit' other structs, eg, for a totally contrived example > >struct something { >int number0, number1; >}; > >struct another { >struct something parent; > int drei; >}; That's composition, not inheritance. It's "has-a", not "is-a". You need to name the whole chain when calling an element (someth->anoth->drei rather than someth->drei). If Edward's anything like me, we both learned OOP from that Philippe Kahn video where Philippe plays a horn and speaks of these three capabilities of objects: * Encapsulation * Inheritance * Polymorphism In my personal opinion, Encapsulation is by far the strongest benefit, and in fact I seldom use inheritance and almost never use polymorphism. So personally, I'm just fine with composing large objects with smaller component objects, all the way down the tree. Especially since a lot of that nesting can be hidden in methods (I'm pretty sure that function pointers can be used as methods in C). But technically, what you wrote above isn't inheritance. SteveT ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
Rainer Weikusat writes: [...] > This mechanism as certain tendency make C++ developers go bezerk with a > particular type of strong rage, but it's entirely usuable in practice, > although more work than having it all laid out for oneself. In the interest of fairness: This 'more work' of course translates to 'more opportunities for getting stuff wrong' and there's the additional problem of "get away with it"-ism, especially in closed source software: At least some people will - either based on principle[*] or because it saves them work or they at least believe it will - break every 'softly imposed' rule the believe to be able to get away with breaking. Hence, unless the language/ compiler enforces access restrictions to supposed-to-be internal-use only members of a data structure, people will ignore them. [*] I've actually encountered people who refused to comply with technical documentation on the ground that they aren't taking orders from strangers ... ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
> Have you a preference for using c++ in netman? The frontend is a complex piece of software using lists. Some parts were complicated to code even in Lazarus Pascal: imagine the complexity required to achieve the same thing in C. Edward > On 22/11/2015, Rainer Weikusat wrote: > Rainer Weikusat writes: > > [...] > >> This mechanism as certain tendency make C++ developers go bezerk with a >> particular type of strong rage, but it's entirely usuable in practice, >> although more work than having it all laid out for oneself. > > In the interest of fairness: This 'more work' of course translates to > 'more opportunities for getting stuff wrong' and there's the additional > problem of "get away with it"-ism, especially in closed source software: > At least some people will - either based on principle[*] or because it > saves them work or they at least believe it will - break every 'softly > imposed' rule the believe to be able to get away with breaking. Hence, > unless the language/ compiler enforces access restrictions to > supposed-to-be internal-use only members of a data structure, people > will ignore them. > > [*] I've actually encountered people who refused to comply with > technical documentation on the ground that they aren't taking orders > from strangers ... > ___ > Dng mailing list > Dng@lists.dyne.org > https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng > ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
Hi Aitor et al, Thinking a little bit about C, and recalling what Reiner explained earlier, I should think, we can create our own C library to handle lists as in classes without actually importing more dependencies: for that we use a struct that has function members, just like a class. Our implementation shouldn't require class inheritance, so simple structures should suffice. What do you think? Edward On 23/11/2015, Edward Bartolo wrote: >> Have you a preference for using c++ in netman? > > The frontend is a complex piece of software using lists. Some parts > were complicated to code even in Lazarus Pascal: imagine the > complexity required to achieve the same thing in C. > > Edward > >> On 22/11/2015, Rainer Weikusat wrote: >> Rainer Weikusat writes: >> >> [...] >> >>> This mechanism as certain tendency make C++ developers go bezerk with a >>> particular type of strong rage, but it's entirely usuable in practice, >>> although more work than having it all laid out for oneself. >> >> In the interest of fairness: This 'more work' of course translates to >> 'more opportunities for getting stuff wrong' and there's the additional >> problem of "get away with it"-ism, especially in closed source software: >> At least some people will - either based on principle[*] or because it >> saves them work or they at least believe it will - break every 'softly >> imposed' rule the believe to be able to get away with breaking. Hence, >> unless the language/ compiler enforces access restrictions to >> supposed-to-be internal-use only members of a data structure, people >> will ignore them. >> >> [*] I've actually encountered people who refused to comply with >> technical documentation on the ground that they aren't taking orders >> from strangers ... >> ___ >> Dng mailing list >> Dng@lists.dyne.org >> https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng >> > ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng
Re: [DNG] Experiencing with GtkBuilder
In my opinion, using C with lists will be the most suitable. Aitor. On 11/23/2015 07:42 AM, Edward Bartolo wrote: Hi Aitor et al, Thinking a little bit about C, and recalling what Reiner explained earlier, I should think, we can create our own C library to handle lists as in classes without actually importing more dependencies: for that we use a struct that has function members, just like a class. Our implementation shouldn't require class inheritance, so simple structures should suffice. What do you think? Edward On 23/11/2015, Edward Bartolo wrote: Have you a preference for using c++ in netman? The frontend is a complex piece of software using lists. Some parts were complicated to code even in Lazarus Pascal: imagine the complexity required to achieve the same thing in C. Edward On 22/11/2015, Rainer Weikusat wrote: Rainer Weikusat writes: [...] This mechanism as certain tendency make C++ developers go bezerk with a particular type of strong rage, but it's entirely usuable in practice, although more work than having it all laid out for oneself. In the interest of fairness: This 'more work' of course translates to 'more opportunities for getting stuff wrong' and there's the additional problem of "get away with it"-ism, especially in closed source software: At least some people will - either based on principle[*] or because it saves them work or they at least believe it will - break every 'softly imposed' rule the believe to be able to get away with breaking. Hence, unless the language/ compiler enforces access restrictions to supposed-to-be internal-use only members of a data structure, people will ignore them. [*] I've actually encountered people who refused to comply with technical documentation on the ground that they aren't taking orders from strangers ... ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng ___ Dng mailing list Dng@lists.dyne.org https://mailinglists.dyne.org/cgi-bin/mailman/listinfo/dng