Re: GtkApplication with different ApplicationWindows

2016-08-14 Thread zahlenmeer
I tested it with "normal" GtkWindows, and yes, they work the same way
GtkApplicationWindows do.
But in my case I have multiple application windows with different
semantics. And this is not the intention behind GtkApplication. I guess
I could make it work, but it would be really happy and result in unnice
code.
One could argue that my requirements are the result of bad application
design but I am quite happy with this approach. I will go a similar way
Joel has suggested. I will derive my own application object from
GApplication, not GtkApplication, so I have all the wonderful things
like process uniqueness, DBus communication, and so on and in my own
object I will implement window tracking with my application-specific
semantics.

On 08/15/16 00:13, Victor Aurélio Santos wrote:
> This is what i found on the GtkApplication docs:
> 
>> While GtkApplication works fine with plain GtkWindows, it is recommended to 
>> use it together with GtkApplicationWindow.
> 
> So, you can use just a GtkWindow, or "TaskWindow" for say...
> 
> I've not tested, but it should work.
> 
> 2016-08-13 10:21 GMT-03:00  :
>> This is exactly what I thought of, but I also want to allow to run my
>> program without the main window (like ./prog --task which only opens a
>> task window). So I would have to run a GtkApplication without any
>> GtkApplicationWindow. As the applications life cycle is tied to its
>> ApplicationWindows this approach just seems wrong.
>>
>> On 08/13/16 14:14, Victor Aurélio Santos wrote:
>>> GtkApplicationWindow, loads a menubar  from resources automatically if
>>> they exists.
>>> So, You can have main window as GtkApplicationWindow and have tasks as
>>> GtkWindow.
>>>
>>> For GtkWindow you'll add a GtkMenuBar to it as any widget.
>>>
>>> I'm not a Gtk+ expert, but this is how I would do.
>>>
>>> 2016-08-13 8:22 GMT-03:00  :
 Hi everyone,
 I am working on a project where I am struggling to decide which
 classes/objects I should use. I use gtk3 but it's still a classical
 application, so no fancy appmenu, CSD and not primarily designed for the
 Gnome DE.

 The program works as follows:
 - A unique main window, with a main menu bar
 - Multiple task windows, all with a task menu bar
 - The program can be called with ./prog --task to only open the task
 window, not the main window

 The first thing one would find in the documentation is GtkApplication
 and GtkApplicationWindow, but those have some limitations I currently
 don't know how to deal with:
 - Different menubars for different windows (main window vs. task window)

 So the idea would be to use a normal GtkWindow for the task windows, but
 in this case I have:
 - Application life-cycle without a GtkApplicationWindow?

 So for me the most promising solution would be to skip GtkApplication
 and GtkApplicationWindow at all, using plain GtkWindows and writing my
 custom application class. Of course this means extra work to get all the
 nice benefits GtkApplication offers out of the box.

 Do you have any ideas how I could design my application accordingly?

 Kind regards
 ___
 gtk-app-devel-list mailing list
 gtk-app-devel-list@gnome.org
 https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>>
>>>
>>>
>> ___
>> gtk-app-devel-list mailing list
>> gtk-app-devel-list@gnome.org
>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> 
> 
> 
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: GtkApplication with different ApplicationWindows

2016-08-14 Thread Victor Aurélio Santos
This is what i found on the GtkApplication docs:

> While GtkApplication works fine with plain GtkWindows, it is recommended to 
> use it together with GtkApplicationWindow.

So, you can use just a GtkWindow, or "TaskWindow" for say...

I've not tested, but it should work.

2016-08-13 10:21 GMT-03:00  :
> This is exactly what I thought of, but I also want to allow to run my
> program without the main window (like ./prog --task which only opens a
> task window). So I would have to run a GtkApplication without any
> GtkApplicationWindow. As the applications life cycle is tied to its
> ApplicationWindows this approach just seems wrong.
>
> On 08/13/16 14:14, Victor Aurélio Santos wrote:
>> GtkApplicationWindow, loads a menubar  from resources automatically if
>> they exists.
>> So, You can have main window as GtkApplicationWindow and have tasks as
>> GtkWindow.
>>
>> For GtkWindow you'll add a GtkMenuBar to it as any widget.
>>
>> I'm not a Gtk+ expert, but this is how I would do.
>>
>> 2016-08-13 8:22 GMT-03:00  :
>>> Hi everyone,
>>> I am working on a project where I am struggling to decide which
>>> classes/objects I should use. I use gtk3 but it's still a classical
>>> application, so no fancy appmenu, CSD and not primarily designed for the
>>> Gnome DE.
>>>
>>> The program works as follows:
>>> - A unique main window, with a main menu bar
>>> - Multiple task windows, all with a task menu bar
>>> - The program can be called with ./prog --task to only open the task
>>> window, not the main window
>>>
>>> The first thing one would find in the documentation is GtkApplication
>>> and GtkApplicationWindow, but those have some limitations I currently
>>> don't know how to deal with:
>>> - Different menubars for different windows (main window vs. task window)
>>>
>>> So the idea would be to use a normal GtkWindow for the task windows, but
>>> in this case I have:
>>> - Application life-cycle without a GtkApplicationWindow?
>>>
>>> So for me the most promising solution would be to skip GtkApplication
>>> and GtkApplicationWindow at all, using plain GtkWindows and writing my
>>> custom application class. Of course this means extra work to get all the
>>> nice benefits GtkApplication offers out of the box.
>>>
>>> Do you have any ideas how I could design my application accordingly?
>>>
>>> Kind regards
>>> ___
>>> gtk-app-devel-list mailing list
>>> gtk-app-devel-list@gnome.org
>>> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>>
>>
>>
> ___
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



-- 
Victor Aurélio Santos
___
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Re: gtk-app-devel-list Digest, Vol 148, Issue 7

2016-08-14 Thread Joël Krähemann
Hi

Why don't you inherit GtkApplication and override its functions? You
could interfaces to get what object you need.

Bests,
Joël


On Sun, Aug 14, 2016 at 12:00 PM,   wrote:
> Send gtk-app-devel-list mailing list submissions to
> gtk-app-devel-list@gnome.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
> https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
> or, via email, send a message with subject or body 'help' to
> gtk-app-devel-list-requ...@gnome.org
>
> You can reach the person managing the list at
> gtk-app-devel-list-ow...@gnome.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of gtk-app-devel-list digest..."
>
>
> Today's Topics:
>
>1. Re: GtkApplication with different ApplicationWindows
>   (Victor Aur?lio Santos)
>2. Re: GtkApplication with different ApplicationWindows
>   (zahlenm...@gmx.de)
>
>
> --
>
> Message: 1
> Date: Sat, 13 Aug 2016 09:14:46 -0300
> From: Victor Aur?lio Santos 
> To: zahlenm...@gmx.de
> Cc: gtk-app-devel-list list 
> Subject: Re: GtkApplication with different ApplicationWindows
> Message-ID:
>