On 30 October 2017 at 16h15, Tanu Kaskinen wrote:

Hi, 

> This is a weird function. [...]
> I think it would be better if this function was only called when the
> caller really wants to apply the heuristics.

I'll update the patch to do that.
Below are answers to the rest of your questions:

> > +Glib::RefPtr<PavuApplication> PavuApplication::create() {
> > +    return Glib::RefPtr<PavuApplication>(new PavuApplication());
> > +
> > +}  
> 
> Why does the PavuApplication need to be wrapped in a RefPtr?

I'm not sure it needs. I used the same general architecture as the
GtkMM Gtk::Application example.

> > +    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'll try that. 

> > +
> > +    if (pavucontrol_window == NULL) {
> > +        pavucontrol_window = create_window();
> > +    } else if (tab != -1) {
> > +        ((MainWindow *)pavucontrol_window)->selectBestTab(tab);
> > +    }
> > +
> > +    pavucontrol_window->present();
> > +}  
> 
> 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?

We're already in the first existing process here. I think the second
process sends a message to the first one with argc and argv[]
somewhere. It then gets handled by the first process's on_command_line
callback. I'll have to check gtkApplication's doc to know how it's
communicating. I'm guessing Unix socket, at least on Unix systems.

> 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'll add that :)

Thanks!
-- 
Colin

Attachment: pgpCPDCowD1au.pgp
Description: OpenPGP digital signature

_______________________________________________
pulseaudio-discuss mailing list
pulseaudio-discuss@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/pulseaudio-discuss

Reply via email to