Re: GMenuModel has landed



On Thu, 2011-12-08 at 19:24 -0800, John Ralls wrote:
> On Dec 8, 2011, at 4:58 PM, Ryan Lortie wrote:
> 
> > hi,
> > 
> > On Fri, 2011-12-09 at 01:34 +0100, Andrea Bolognani wrote:
> >> Does this mean different windows belonging to the same application will
> >> not be able to have different per–window menubars? I’m thinking about
> >> Empathy here, with its Buddy List and Conversation windows having
> >> different menubars, but it’s not an uncommon scenario.
> > 
> > I guess a reasonable question to ask here is what empathy would look
> > like if it were an application designed for mac os.
> 
> I think that you misunderstand how mac os works. 
> 
> Yes, a single menu bar is displayed at the top of the screen. This is correct behavior according to Fit's Law, because you can bang the pointer to the top of the screen and it can't overshoot.
> 
> No, applications are not limited to having a single menu bar. It's a one-liner to switch menubars when different window (or notebook tab, for that matter) gets focus.


I think that the (twice) mentioned solution to this problem sounds
elegant enough, i.e. if you have 2 windows with different menubars
then they can easily be '2 applications' at least in terms of data
sets.

However, I'm curious as to how elegantly one can implement this.

Can someone dish out an example (hopefully less than 10 lines of code)
that shows us how to make our applications become 
'multiple applications' ?

Of course, the prerequisites are:
  - All applications that my application creates should run in the
    same process.
  - If D-Bus is present on the system, the application set should
    still be one, single instance process.
  - There should only be one interface for loading files/uris,
    not one interface 'per application' which my application 'is'.

Also, I'm still concerned about GApplication, I raised this point
last year and I wonder if any progress has been made... what is 
the fallback ?

Can g_application_run() please at the very minimum fall back on
calling g_main_loop_run() when there is no D-Bus daemon ?

If I write an application with this abstract GMenu model and then
run it on a system that by no means has any need to run a D-Bus
daemon, nor any need to run a window manager, or has a window
manager that is not GMenu aware at all, what happens ?

Can the menu bar automatically display using a basic GtkMenuBar
in the main GtkApplicationWindow... when there is no D-Bus
daemon running ?


Also... concerning MVC menus in general:

Can this whole GMenuModel and GMenu thing be extendable 
without modifying GTK+ sources at all ?

In my imagination, all I have to do is:
  - Implement menus to understand an extra property name
    i.e. implement the view, by deriving a GtkMenuItem with
    widgets to represent that data
  - Create the data model from my application and assign
    this extra property name a value, perhaps
      "is-range" = TRUE and "range-value" = 50
  - Bingo, all of a sudden I'm using my new GtkScaleMenuItem
    with an embedded GtkHScale and it's value preset to 50

Thanks,
          -Tristan




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]