[PATCH] pavucontrol: implement single-launch

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

 



On Tue, 2017-10-31 at 16:20 +0100, Colin Leroy wrote:
> On Mon, 30 Oct 2017 16:15:52 +0200, Tanu Kaskinen <tanuk at iki.fi> wrote:
> > Why does the PavuApplication need to be wrapped in a RefPtr?
> 
> To build :)
> This is apparently inherent to overloading Gtk::Application as I get
> compilation errors without it. (I find cpp errors very hard to read but
> this is rather clear that it's a template thing).

I think your problem was that the PavuApplication constructor was
declared as protected, so calling it from main() was not allowed. I
made a patch that removes the RefPtr wrapping.

> > > +    add_window(*pavucontrol_window);
> > > +    [...]
> > > +    auto windows = get_windows();
> > > +
> > > +    if (windows.size() > 0) {
> > > +        pavucontrol_window =
> > > dynamic_cast<Gtk::Window*>(windows[0]);
> > > +    }  
> > 
> > This seems a bit ugly. Couldn't the main window be a member variable
> > of PavuApplication?
> 
> I've made it a member.
> I still have to call Gtk::Application->add_window() (or the GtkApp
> doesn't correctly initialize - GtkApps need at least one window
> registered). I don't use get_windows() anymore though.
> 
> Sidenote: I still have to make an ugly (MainWindow*) cast, because I
> can't use MainWindow in pavucontrol.h as I would have to include
> mainwindow.h which already includes pavucontrol.h. (Which proves
> there's a responsabilities separation issue).

I made a patch for the cast.

> > This is probably part of the "switch tab if already running" logic,
> > but I don't understand how that works in practice. If there's already
> > one instance running, how does the tab index get passed from the new
> > process to the old one? I'm sure I could figure it out from the GLib
> > documentation, but there's apparently a lot of magic happening behind
> > the scenes, and it would be good to have a comment that explains how
> > the magic works.
> 
> I've added comments on every Gtk::Application aspect of the thing. I
> hope they make things more clear.

Thanks! I applied your patch now.

-- 
Tanu

https://www.patreon.com/tanuk


[Index of Archives]     [Linux Audio Users]     [AMD Graphics]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux