GNOME Bugzilla – Bug 351040
[eog-ng] use GtkRecent
Last modified: 2006-09-07 00:46:53 UTC
The following patch adds a first try to replace EggRecent with GtkRecent in the eog-ng branch. It has some issues which I couldn't figure out yet: 1. Running file-roller seems to do strange things with the recent-files list (clearing eog's recent-list). I currently don't have another GtkRecent-enabled program to test if it's an issue with file-roller, GtkRecent or my own implementation. 2. Adding numbers to the menu entries doesn't work. They all get the number 5. I couln't find out why that happens yet. The open_recent handler isn't probably very nice too.
Created attachment 70777 [details] [review] the patch (alpha 4) The patch I talked about earlier (Alpha 4 as I call it). Please comment.
Hey Felix, some issues: 1 Uptade glib dependency to 2.12.0 2 Keep the embedded recently opened images in 'File' menu 3 Handle screen-safety 4 Because of 3, you should store the GtkRecentManager in each window instance 5 Remove obsolete commented code 6 You should define mime-type, appname, group, ... when adding a new URI to the recently used resource db (See gtk_recent_manager_add_full and GtkRecentData for reference). A very godo reference for this is the patch commited by Paolo Borelli in Gedit. See bug #349694.
Created attachment 71033 [details] [review] new patch based on gedit Thanks for the hint! :) So this is basically a port of Paolo Borelli's patch for gedit to eog. This means it keeps the recent files inlined in the files menu (I additionally added a mime icon), includes the full GtkRecentInfo when adding a file and should be screen-safe (untested). What's yet missing is adding files after using "Save as..." and removing a file from the recent file list.
Applied with a code fix (you should have disconnected the GtkRecentManager's "changed" signal on EogWindow dispose) and some minor coding style fixes. Thanks! 2006-09-01 Lucas Rocha <lucasr@gnome.org> * configure.ac * data/eog-ui.xml * shell/Makefile.am * shell/eog-application.c * shell/eog-application.h * shell/eog-window.c Migration to GtkRecent (Fixes bug #351040). Patch from Felix Riemann (felix@hsgheli.de) based on Gedit's patch from Paolo Borelli.
I have not checked your patch, but since I have seen this pass by on the cvs commits, it's worth nothing that there have been a couple of really important bugfixes in that code in gedit after that patch: 1 - you should disconnect the manager's changed callback when the window is destroyed 2 - when setting the inline menus tooltips you must be careful to null check some of the functions, since for a bug in gtk they return NULL on some uris, leading to memory corruption. It may well be that you already fixed this, if not look at gedit code in cvs HEAD.
(In reply to comment #5) > 1 - you should disconnect the manager's changed callback when the window is > destroyed That has already been taken care of by Lucas. > 2 - when setting the inline menus tooltips you must be careful to null check > some of the functions, since for a bug in gtk they return NULL on some uris, > leading to memory corruption. Thanks for the hint. :-) I think I already found the corresponding commit in gedit's cvs. But I'm going to check if there is another possible fix for that (as I did for the menu label; which, as I found out now, is broken too for remote uris), because I didn't want to copy gedit's utility functions at first (although it looks like I don't have a choice in the end). Reopening this bug until I got this fixed.
Created attachment 72129 [details] [review] bugfix This should fix the problem with remote uris. Using gnome_vfs_format_uri_for_display() should be sufficient as the passwords (if any) are already stripped when the file is added to the recently used files list. Additionally it turned out that the algorith for the menu label was not broken. I just was not used to the case that the protocol is displayed for remote files.
Applied, thanks!