After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 401946 - [eog-ng] [patch] D-Bus based activation
[eog-ng] [patch] D-Bus based activation
Status: RESOLVED FIXED
Product: eog
Classification: Core
Component: general
git master
Other Linux
: Normal normal
: ---
Assigned To: Claudio Saavedra
EOG Maintainers
Depends on:
Blocks:
 
 
Reported: 2007-01-29 03:15 UTC by Claudio Saavedra
Modified: 2007-02-02 00:03 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
D-Bus activation patch for EOG (15.13 KB, patch)
2007-01-29 03:17 UTC, Claudio Saavedra
none Details | Review
D-Bus activation patch for eog. (12.73 KB, patch)
2007-01-30 01:26 UTC, Claudio Saavedra
none Details | Review

Description Claudio Saavedra 2007-01-29 03:15:52 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.
Comment 1 Claudio Saavedra 2007-01-29 03:17:03 UTC
Created attachment 81404 [details] [review]
D-Bus activation patch for EOG
Comment 2 Claudio Saavedra 2007-01-30 01:26:35 UTC
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.
Comment 3 Lucas Rocha 2007-01-31 10:48:41 UTC
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! :-)
Comment 4 Claudio Saavedra 2007-02-02 00:03:17 UTC
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.