Re: gtkmm-list Digest, Vol 146, Issue 12



Hello,

I encountered the same thing when writing an internal library used to collect some pre-main-program config from users. I couldn't just make this concurrent with my main window (hidden until required) since it's reusable code. As you've suggested, I just gave the initial config window its own Application. This seems to work fine.

Of course, my main program has multiple windows, and that's OK, as long as we have 1 window we can designate as primary to make it responsible for the Application's lifetime.





On Fri, Jun 24, 2016 at 1:00 PM, <gtkmm-list-request gnome org> wrote:
Send gtkmm-list mailing list submissions to
        gtkmm-list gnome org

To subscribe or unsubscribe via the World Wide Web, visit
        https://mail.gnome.org/mailman/listinfo/gtkmm-list
or, via email, send a message with subject or body 'help' to
        gtkmm-list-request gnome org

You can reach the person managing the list at
        gtkmm-list-owner gnome org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of gtkmm-list digest..."


Today's Topics:

   1. Re: Gtk::Application - Switching between two Gtk::Window
      (Kjell Ahlstedt)


----------------------------------------------------------------------

Message: 1
Date: Fri, 24 Jun 2016 11:41:45 +0200
From: Kjell Ahlstedt <kjell ahlstedt bredband net>
To: Tiago Matias <tiago matias oncontrol-tech com>
Cc: gtkmm-list gnome org
Subject: Re: Gtk::Application - Switching between two Gtk::Window
Message-ID: <576D0059 4050207 bredband net>
Content-Type: text/plain; charset="windows-1252"; Format="flowed"

Terribly late reply. Don't know if you've found a solution.
I tested with one of the example programs in the gtkmm tutorial. I
created two identical windows, and called app->run() twice. The result was
   GLib-GIO-CRITICAL **: g_application_parse_command_line: assertion
'!application->priv->options_parsed' failed
and a segfault. I don't think Gtk::Application::run() is meant to be
called more than once. A possible solution is to create two
Gtk::Applications.

   auto app1 = Gtk::Application::create(argc, argv, "org.gtkmm.example");
   RadioButtons buttons1;
   app1->run(buttons1);

   auto app2 = Gtk::Application::create(argc, argv, "org.gtkmm.example");
   RadioButtons buttons2;
   return app2->run(buttons2);

Kjell

Den 2016-05-17 kl. 17:35, skrev Tiago Matias:
> Before the line gtkmm_main->run (GuiWindow::Instance ()), I added the
> the following line:
>
> gtkmm_main->add_window(GuiWindow::Instance ());
>
> This not have solved my problem.
>
> Best Regards,
> Tiago Matias
>
>
> On 05/17/2016 02:22 PM, Phil Wolff wrote:
>> Be sure that your Gtk::Application calls add_window() on
>> GuiWindow::Instance (). Gtk::Application can't properly handle any
>> window it isn't aware of.
>>
>> On 2016/05/17 06:09, Tiago Matias wrote:
>>> Hi,
>>>
>>>
>>> I'm with a problem in a gtkmm application.
>>>
>>> I have a main file where a Gtk::Application runs a Gtk::Window. This
>>> window loads some configurations when is showing a backgroud image.
>>> In the final of the loading this window  calls the function hide()
>>> ant the program returns to the main file program.
>>>
>>> Glib::RefPtr<Gtk::Application> gtkmm_main =
>>> Gtk::Application::create(argc, argv, "org.gtkmm.example");
>>> gtkmm_main->run (IntroWindow::Instance());
>>>
>>>
>>> After this, the Gtk::application runs other window:
>>>
>>> gtkmm_main->run (GuiWindow::Instance ());
>>>
>>> However, in this window, when i call the function hide(), the
>>> program don't return to the main file program. If i don't run the
>>> first window, the program returns. It seams that are some problem in
>>> the switching of the windows. Can anyone help me.
>>>
>>> Best Regards,
>>> Tiago Matias

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.gnome.org/archives/gtkmm-list/attachments/20160624/70312802/attachment.html>

------------------------------

Subject: Digest Footer

_______________________________________________
gtkmm-list mailing list
gtkmm-list gnome org
https://mail.gnome.org/mailman/listinfo/gtkmm-list


------------------------------

End of gtkmm-list Digest, Vol 146, Issue 12
*******************************************



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