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 328842 - patch to build without gnome libraries
patch to build without gnome libraries
Status: RESOLVED FIXED
Product: evince
Classification: Core
Component: general
git master
Other All
: Normal enhancement
: ---
Assigned To: Evince Maintainers
Evince Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-01-27 14:33 UTC by Jani Monoses
Modified: 2007-12-08 14:10 UTC
See Also:
GNOME target: ---
GNOME version: Unversioned Enhancement


Attachments
the patch (27.28 KB, patch)
2006-01-27 14:34 UTC, Jani Monoses
none Details | Review
small cleanup patch (1.01 KB, patch)
2006-02-10 11:28 UTC, Jani Monoses
committed Details | Review
updated gtk patch (27.02 KB, patch)
2006-02-18 11:33 UTC, Jani Monoses
none Details | Review
updated patch (19.47 KB, patch)
2006-08-31 16:40 UTC, Jani Monoses
none Details | Review
New author, new approach, new patch (8.13 KB, patch)
2007-05-02 15:57 UTC, Ross Burton
none Details | Review
Revised patch (8.29 KB, patch)
2007-05-02 20:36 UTC, Ross Burton
none Details | Review
Revised patch (9.06 KB, patch)
2007-05-03 10:42 UTC, Ross Burton
none Details | Review
Re-revised patch (9.05 KB, patch)
2007-05-03 13:45 UTC, Eduardo Lima (Etrunko)
none Details | Review
Latest patch (10.60 KB, patch)
2007-05-04 10:39 UTC, Ross Burton
committed Details | Review

Description Jani Monoses 2006-01-27 14:33:41 UTC
configure switch and ifdefs on WITH_GNOME to allow it to build with plain gtk.
use goption and extension based mime detection to avoid explicit linking to popt
and dependence on libmagic.
Comment 1 Jani Monoses 2006-01-27 14:34:29 UTC
Created attachment 58209 [details] [review]
the patch
Comment 2 Jani Monoses 2006-02-10 11:28:28 UTC
Created attachment 59063 [details] [review]
small cleanup patch 

backend does no longer depend on vfs,remove unneeded include
This makes the gtk-only diff smaller
Comment 3 Jani Monoses 2006-02-18 11:33:13 UTC
Created attachment 59636 [details] [review]
updated gtk patch

diff against today's HEAD, with a cleaner configure.ac patch

please let me know if you're interested in this and  if I should keep it updated  against CVS.Otherwise I will make diffs only against releases.
thanks
Comment 4 Nickolay V. Shmyrev 2006-03-29 21:13:22 UTC
Jani, we are happy to see evince as gtk-only application. But in current
state it's not optimal to check such kind of patch. Probably someone
will object to that but it will create additional problems without much
win. We do need to have gnome-based features and do need to use gnome
for that. 

Let's make this process incremental, for example, we already have patch
for popt, let's review and apply it. Then let's migrate to gtk-only
recent-files (I suspect this code is already merged into gtk, we just
need to use it).

I hope after that problem will disappear automatically. Until that
please update your patch, it's really interesting and useful. 
Comment 5 Eduardo Lima (Etrunko) 2006-03-30 12:02:21 UTC
I agree with Nickolay when he says we shold do this in a incremental way. For example, maybe it is not the best approach to copy code from GNOME VFS and paste it in evince code if we are not running a GNOME environment. GNOME VFS takes care of a crucial part of the system transparently and it can be easily built in a system without any GNOME libraries (including WIN32).

In my opinion, if it is really our interest don't make use of GNOME VFS, we should implement something like a ev-file.c or ev-io.c where al #ifdef WITH_GNOMEVFS would live. 

Let's first detail things even more and find alternatives for other stuff like keyring, gconf an so on.
Comment 6 Jani Monoses 2006-03-30 12:29:07 UTC
I agree too with the incremental updates btw. I'd just like the build system patch in first to make the rest easier. Nothing is lost for those not using the --disable-gnome flag (everybody actually rigth now)

The reason for copying code from gnome-vfs is because I see no other way of doing that part of the code. There is cut-n-pasted code already, but true it's in a separate dir.

As for gnome-vfs buildability outside gnome it is not relevant here since on linux gnomevfs is built with gnome libraries and some more. So the very dependency on gnome-vfs is what I am trying to avoid.

And as said, I think evince should still use gnome-vfs I do not intend to replace that, it just needs to be made optional.

As for keyring/gconf I don't think we need alternatives. A gtk-only build is purposely lacking features as a trade-off for not using gnome libraries.

It is not my intention to switch evince to a gtk only app while preserving all
it's functionality. When d-vfs and d-conf are more than  vapourware and project ridley achieves it's goal yes, but right now I just want a feature impaired version of the full evince (which IMHO still covers 99% of the use-cases, that
is viewing local pdf/ps files in the good old-fashioned way)
Comment 7 Jani Monoses 2006-08-31 16:40:29 UTC
Created attachment 71968 [details] [review]
updated patch

Updated against today's CVS head. It's smaller than the previous ones as the changes to use goption are no longer needed, and it assumes gtk+2.10 so the eggerecent module is not touched at all.
Comment 8 Nagy Gabor 2006-10-14 09:55:50 UTC
I updated the patch to the latest version (v0.6.1). The patched source can be found on my <a href=http://petra.hos.u-szeged.hu/~ngaba/linux/index.html>homepage</a>.
Comment 9 Nagy Gabor 2006-12-31 09:51:10 UTC
I updated the patch to the latest version (v0.7.0)
Comment 10 Marc Brockschmidt 2007-01-12 15:14:32 UTC
I think that depending on gnome-vfs wouldn't be such a big problem, at least it would be a lot better than the current situation for evince users who don't want a full-blown Gnome desktop. g-vfs is right at the bottom of the Gnome dependency tree and drags in nothing special, so it doesn't hurt that much...
Comment 11 Nickolay V. Shmyrev 2007-01-16 05:38:53 UTC
Updated patch status and committed view fix.
Comment 12 Jani Monoses 2007-01-16 09:27:09 UTC
Gabor, if you update the patch to 0.7.1 please add it as an attachment, it's easier to review than getting the full tarball. Also have you looked into GnomeIcon (a newly added dependency) and whether GtkIcon can replace it?
thanks
Comment 13 Nagy Gabor 2007-01-20 21:39:18 UTC
Patch updated to v0.7.1.
Gnome-VFS dependency optional, missing icons are downloadable.
Comment 14 Nagy Gabor 2007-02-20 22:37:48 UTC
Updated to v0.7.2.
Please test the 'open link' function (maybe I ran into a gnomeVFS bug (?)); and report the missing features (which are not listed on my homepage)

Comment 15 Jani Monoses 2007-02-20 23:21:07 UTC
attaching the patch would make it more likely that it gets reviewed and commented on.
Comment 16 Nagy Gabor 2007-02-21 12:33:58 UTC
No, because my patch keeps changing (when I'm working on it, I may update it daily).
Comment 17 Ross Burton 2007-05-02 15:57:32 UTC
Created attachment 87395 [details] [review]
New author, new approach, new patch

Attached is a patch that takes the point of view that not all of GNOME is evil.

- libgnomeui BAD
- libgnome BAD
- gnome-vfs WE CAN LIVE WITH
- gnome-keyring BEST FRIENDS FOREVER

It's not 100% finished:
- help doesn't work (can't spawn a web browser)
- MIME icons are empty (this can be fixed and the libgnomeui dependency removed too)
Comment 18 Jani Monoses 2007-05-02 17:20:12 UTC
glad to see this moving forward :)

* for gnome-client maybe the new smclient module in libegg is good enough and gets rid of ifdefs at the expense of having another egg module under copy-paste
*  for emulating gnome_help_display(), g_spawning gnome-help, or alternately 
'gnome-open yelp' should do as in the patch attached to
http://bugzilla.gnome.org/show_bug.cgi?id=399818
Comment 19 Ross Burton 2007-05-02 17:51:51 UTC
1) Agreed.  Is that module usable yet I wonder.

2) Using gnome-open is a temporary work around, but gnome-open is provided by libgnome, so it doesn't really help. :)
Comment 20 Jani Monoses 2007-05-02 19:16:53 UTC
1) I think so, at least the svn has an example for gedit at least which uses gnome-client a lot more than evince.
2) Weird, I was under the impression it was in gnome-utils or such, but it seems not. So xdt-open and fall back on gnome-open maybe. Or just gnome-help which is provided by yelp.
Comment 21 Christian Persch 2007-05-02 19:47:49 UTC
+#else
+		dot_dir = g_build_filename (g_get_home_dir (),
+					    ".evince",

How about using g_get_user_config_dir() of g_get_home_dir() ?

+#else
+	g_option_context_add_group (context, gtk_get_option_group (TRUE));
+	g_option_context_parse (context, &argc, &argv, NULL);
+	gtk_init (&argc, &argv);

You need to check the return value of g_option_context_parse, and free the option context afterwards. And since you added the gtk option group to the context, there's no need to call gtk_init again.
Comment 22 Jani Monoses 2007-05-02 19:57:51 UTC
2) I remember what was the advantage of calling gnome-open : even if the app still depends on libgnome it is no longer a linktime hard-dependency, so it does not add up to startup time, and it can fail graciously when the whole GNOME desktop and libgnome is not present. And no ifdefs needed either.
Comment 23 Ross Burton 2007-05-02 20:36:50 UTC
Created attachment 87408 [details] [review]
Revised patch

This patch fixes the option parsing and uses g_get_user_config_dir().  I'll look at the other bug for the help de-gnome-ification later.
Comment 24 Ross Burton 2007-05-03 10:42:38 UTC
Created attachment 87440 [details] [review]
Revised patch

This patch replaces the use of libgnome when looking up icons for MIME types with from GTK+ (as used in the recent file manager and the file chooser).

This change (to shell/ev-sidebar-attachment.c) can be applied on its own.  However it is untested because I don't have any files which cause the attachments sidebar to be enabled, but it is an almost direct copy of the code in GTK+ so I can't see it failing.
Comment 25 Eduardo Lima (Etrunko) 2007-05-03 13:45:43 UTC
Created attachment 87450 [details] [review]
Re-revised patch

In libdocument/ev-file-helpers.c replaced WITH_LIBGNOME tests with WITH_GNOME
Comment 26 Ross Burton 2007-05-04 10:39:32 UTC
Created attachment 87517 [details] [review]
Latest patch

This patch incorporates Eduardo's fix, and also doesn't use libgnome to open help (instead uses a similar piece of code to the g-p-m patch).

In my opinion, this patch is now feature-complete.
Comment 27 Ross Burton 2007-05-04 10:40:23 UTC
Ignore the addition of .bzrignore obviously. :)
Comment 28 Carlos Garcia Campos 2007-05-04 13:46:37 UTC
Patch looks good to me. I only have a question, why not always use g_get_user_config_dir ()?
Comment 29 Ross Burton 2007-05-04 14:00:41 UTC
Because traditionally GNOME apps have stored configuration in .gnome2/.  If the maintainer don't mind Evince 2.20 losing the metadata, print settings, and toolbar settings, then that change can be done.
Comment 30 Ross Burton 2007-05-04 14:01:40 UTC
Note: I'll happy commit fragments of this patch, for example the help change, if it helps start the merge process.
Comment 31 Carlos Garcia Campos 2007-05-04 14:15:16 UTC
Ok, I thought g_get_user_config_dir() == gnome_user_dir_get(). The whole patch looks good to me. If Nickolay doesn't have any objections, feel free to commit it.  
Comment 32 Christian Persch 2007-05-04 14:24:13 UTC
Just one nit:

+#else
+		dot_dir = g_build_filename (g_get_user_config_dir (),
+					    ".evince",

"evince", not ".evince" :)
Comment 33 Ross Burton 2007-05-04 14:32:06 UTC
chpe: whoops, good catch.

Nickolay?
Comment 34 Nickolay V. Shmyrev 2007-05-04 14:55:53 UTC
Heh, fine for me :)

But probably we can call it not without-gnome but with-gmae or something like that?
Comment 35 Ross Burton 2007-05-04 15:01:22 UTC
It's not really GMAE specific, it literally is --without-gnome.

Would --without-libgnome be preferred?
Comment 36 Nickolay V. Shmyrev 2007-05-04 15:05:03 UTC
As you like, probably without-gnome is fine too. Please commit it.
Comment 37 Ross Burton 2007-05-04 15:16:31 UTC
Committed, thanks!
Comment 38 Nagy Gabor 2007-12-08 14:04:28 UTC
Well, I updated my patch, correct MIME handling is also implement using xdgmime: http://jedlik.vein.hu:60080/linux/evince/evince-en.html
Now --with-gnomevfs and --with-gnome should be identical to the original version (apart from my little own modifications), but those not well tested.