Re: Application.activate not emitted when opening files.
On Wed, 2016-06-15 at 12:42 -0300, Victor Aurélio Santos wrote: > where should i do application's > basic things like creating windows, setting-up basic things etc... You may follow the example https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5 This way you are not concerned with signals that match. From https://developer.gnome.org/gio/unstable/GApplication.html#GApplication -activate I would assume that that signal is emitted ALWAYS on the primary instance when an activation occurs. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Application.activate not emitted when opening files.
> You may follow the example > https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5 Look at application code, I think it's very like the example you give me. > This way you are not concerned with signals that match. I can't understand what you mean. > I would assume that that signal is emitted ALWAYS on the primary instance when an activation occurs. What is exactly a *activation* ? You can build the application on the repository, if you run it without args it starts normally and _activate_ gets emitted; ie: ./build/src/qsubber but if you launch with args (files) _activate_ isn't emitted. i.e. ./build/src/qsubber /home/someone/somemovie.avi Thanks, hope you understand. my english isn't so good. 2016-06-16 10:55 GMT-03:00 Stefan Salewski : > On Wed, 2016-06-15 at 12:42 -0300, Victor Aurélio Santos wrote: >> where should i do application's >> basic things like creating windows, setting-up basic things etc... > > You may follow the example > > https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5 > > This way you are not concerned with signals that match. > > From > > https://developer.gnome.org/gio/unstable/GApplication.html#GApplication > -activate > > I would assume that that signal is emitted ALWAYS on the primary > instance when an activation occurs. -- 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: Application.activate not emitted when opening files.
> Look at application code, I think it's very like the example you give me. Sorry, forgot the link: https://github.com/hotvic/QSubber-gtk/blob/master/src/qsubber-application.vala 2016-06-16 14:44 GMT-03:00 Victor Aurélio Santos : >> You may follow the example >> https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5 > Look at application code, I think it's very like the example you give me. > >> This way you are not concerned with signals that match. > I can't understand what you mean. > >> I would assume that that signal is emitted ALWAYS on the primary > instance when an activation occurs. > What is exactly a *activation* ? > > You can build the application on the repository, if you run it without > args it starts normally and _activate_ gets emitted; ie: > ./build/src/qsubber > > but if you launch with args (files) _activate_ isn't emitted. i.e. > ./build/src/qsubber /home/someone/somemovie.avi > > Thanks, hope you understand. my english isn't so good. > > 2016-06-16 10:55 GMT-03:00 Stefan Salewski : >> On Wed, 2016-06-15 at 12:42 -0300, Victor Aurélio Santos wrote: >>> where should i do application's >>> basic things like creating windows, setting-up basic things etc... >> >> You may follow the example >> >> https://developer.gnome.org/gtk3/stable/ch01s04.html#id-1.2.3.12.5 >> >> This way you are not concerned with signals that match. >> >> From >> >> https://developer.gnome.org/gio/unstable/GApplication.html#GApplication >> -activate >> >> I would assume that that signal is emitted ALWAYS on the primary >> instance when an activation occurs. > > > > -- > Victor Aurélio Santos -- 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: Application.activate not emitted when opening files.
On Thu, 2016-06-16 at 14:44 -0300, Victor Aurélio Santos wrote: > > You may follow the example https://developer.gnome.org/gtk3/stable/ > ch01s04.html#id-1.2.3.12.5 > Look at application code, I think it's very like the example you give > me. > > > This way you are not concerned with signals that match. > I can't understand what you mean. Sorry, should be "that much" of course. For example, in https://developer.gnome.org/gtk3/stable/ch01s04.html they have static void example_app_class_init (ExampleAppClass *class) { G_APPLICATION_CLASS (class)->activate = example_app_activate; G_APPLICATION_CLASS (class)->open = example_app_open; } So example_app_open() is called when the application is started with arguments and example_app_activate() when started without. There is no direct reference to any signals. Unfortunately your example is in Vala, so we can not be sure that the problem is not vala specific. I will see if I can find some C code for testing... ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Application.activate not emitted when opening files.
On Thu, 2016-06-16 at 20:12 +0200, Stefan Salewski wrote: > I will see if I can find some C code for testing... Well, looking at the C code of example10 is already enough: gtk+-3.20.1/examples/application10 exampleapp.c static void example_app_activate (GApplication *app) { ExampleAppWindow *win; win = example_app_window_new (EXAMPLE_APP (app)); gtk_window_present (GTK_WINDOW (win)); } static void example_app_open (GApplication *app, GFile**files, gint n_files, const gchar *hint) { GList *windows; ExampleAppWindow *win; int i; windows = gtk_application_get_windows (GTK_APPLICATION (app)); if (windows) win = EXAMPLE_APP_WINDOW (windows->data); else win = example_app_window_new (EXAMPLE_APP (app)); for (i = 0; i < n_files; i++) example_app_window_open (win, files[i]); gtk_window_present (GTK_WINDOW (win)); } static void example_app_class_init (ExampleAppClass *class) { G_APPLICATION_CLASS (class)->startup = example_app_startup; G_APPLICATION_CLASS (class)->activate = example_app_activate; G_APPLICATION_CLASS (class)->open = example_app_open; } So your observed behaviour seems to be intended. When application is started with arguments, example_app_open() is called, which includes the code of example_app_activate(). This indicates that example_app_activate() is not executed when application is started with arguments, so we can assume that "activate" signal is not emitted for that case. (That was not clear for me from the docs) For testing, you may download gtk+ tar file, which includes application10. Building only this one works with these commands cd application10 glib-compile-schemas . glib-compile-resources exampleapp.gresource.xml --target=resources.c --generate-source gcc -o main main.c resources.c exampleapp.c exampleappwin.c exampleappprefs.c `pkg-config --libs --cflags gtk+-3.0` A Nim version is also available, see https://github.com/ngtk3/nim-app http://forum.nim-lang.org/t/2198#13675 Unfortunately there seems to exist no Vala version yet. ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Application.activate not emitted when opening files.
On Thu, Jun 16, 2016 at 9:11 PM Stefan Salewski wrote: > So your observed behaviour seems to be intended. When application is > started with arguments, example_app_open() is called, which includes > the code of example_app_activate(). This indicates that > example_app_activate() is not executed when application is started with > arguments, so we can assume that "activate" signal is not emitted for > that case. (That was not clear for me from the docs) It is a bit hidden in the documentation for g_application_run()[0]: "If there are no files listed, the application is activated via the "activate" signal. If there are one or more files, and G_APPLICATION_HANDLES_OPEN was specified then the files are opened via the "open" signal." [0] https://developer.gnome.org/gio/stable/GApplication.html#g-application-run ___ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
Re: Application.activate not emitted when opening files.
Thank you so much Stefan! cleared out questions. > It is a bit hidden Yeah! most of glib/gtk documentation can be much better. 2016-06-16 18:14 GMT-03:00 Florian Müllner : > > > On Thu, Jun 16, 2016 at 9:11 PM Stefan Salewski wrote: >> >> So your observed behaviour seems to be intended. When application is >> started with arguments, example_app_open() is called, which includes >> the code of example_app_activate(). This indicates that >> example_app_activate() is not executed when application is started with >> arguments, so we can assume that "activate" signal is not emitted for >> that case. (That was not clear for me from the docs) > > > It is a bit hidden in the documentation for g_application_run()[0]: > "If there are no files listed, the application is activated via the > "activate" signal. If there are one or more files, and > G_APPLICATION_HANDLES_OPEN was specified then the files are opened via the > "open" signal." > > [0] > https://developer.gnome.org/gio/stable/GApplication.html#g-application-run -- 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