GNOME Bugzilla – Bug 401946
[eog-ng] [patch] D-Bus based activation
Last modified: 2007-02-02 00:03:17 UTC
I cooked over the weekend a patch to add D-Bus based activation to EOG. It's almost complete, it's only needed to make it work with the leaftag related code, but according with bug #401939, I think it shouldn't be needed. I had to do some little tweaking to make it work: - Reorder the parameters in the eog_application_open_* functions, as for D-Bus, the remote procedures need the GError to be the last parameter. - Add a eog_application_open_uris (), which does the same as eog_application_open_uri_list (), but instead of receiving a GSList with strings, receives a NULL-terminated array with strings. This is needed because there's no way to pass a GSList as argument to a remote method in D-Bus. - To avoid duplicating too much code because of the previous point, I factorized some code in these functions and added it to a _eog_appliction_open_uri_list () static method, to be called by both methods. I didn't simply remove eog_application_open_uri_list (), because it is conveniently used by GtkRecent and GtkFileChooser related code. The patch follows.
Created attachment 81404 [details] [review] D-Bus activation patch for EOG
Created attachment 81484 [details] [review] D-Bus activation patch for eog. Now that I removed the leaftag support, this patch is fully functional. I'd like to receive some comments about the almost API redundance introduced by the e_a_open_uris () function, though. Is it ok? any suggestion to make it better? If there are no objections, I'll commit to eog-ng branch.
You forgot to add eog-application-service.xml to your patch. I had to take it from the obsolete patch. The patch works fine. I'd change those minor issued before commiting: 1. Replace this: eog-application-service.h: $(srcdir)/eog-application-service.xml dbus-binding-tool --prefix=eog_application --mode=glib-server --output=eog-application-service.h $(srcdir)/eog-application-service.xml With this (simplification): eog-application-service.h: eog-application-service.xml dbus-binding-tool --prefix=eog_application --mode=glib-server --output=eog-application-service.h $< 2. Move the URI list utility functions to eog-util. They can be useful in other contexts in the future and we keep the code cleaner and more organized. 3. Rename "_eog_application_open_uri_list" to "eog_application_real_open_uri_list". Just adding an underline doesn't give the needed visibility to the role of this function. Once more, good job! :-)
I fixed those issues, and committed to the eog-ng branch (revision 3511). 2007-02-01 Claudio Saavedra <csaavedra@alumnos.utalca.cl> * configure.ac: Add checks for GLib D-Bus bindings. * src/Makefile.am: Generate eog-application-service.h * src/eog-application-service.xml: Instrospection XML file for D-Bus methods. * src/eog-application.c: (eog_application_register_service), (eog_application_open_window), (eog_application_real_open_uri_list), (eog_application_open_uri_list), (eog_application_open_uris): * src/eog-application.h: * src/eog-util.c: (eog_util_string_list_to_uri_list), (eog_util_strings_to_uri_list), (eog_util_string_array_to_list), (eog_util_string_array_make_absolute): Moved strings lists utility functions here to keep code better organized. * src/eog-util.h: * src/eog-window.c: (eog_window_open_recent_cb), (file_open_dialog_response_cb): * src/main.c: (load_files), (load_files_remote), (main): Use remote activation if EOG service is already registered. Implement D-Bus based activation. Fixes bug #401946.