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 351040 - [eog-ng] use GtkRecent
[eog-ng] use GtkRecent
Status: RESOLVED FIXED
Product: eog
Classification: Core
Component: general
git master
Other Linux
: Normal enhancement
: ---
Assigned To: EOG Maintainers
EOG Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-08-12 13:25 UTC by Felix Riemann
Modified: 2006-09-07 00:46 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
the patch (alpha 4) (9.97 KB, patch)
2006-08-12 13:26 UTC, Felix Riemann
rejected Details | Review
new patch based on gedit (14.32 KB, patch)
2006-08-16 19:13 UTC, Felix Riemann
committed Details | Review
bugfix (1.37 KB, patch)
2006-09-03 12:18 UTC, Felix Riemann
committed Details | Review

Description Felix Riemann 2006-08-12 13:25:12 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.
Comment 1 Felix Riemann 2006-08-12 13:26:25 UTC
Created attachment 70777 [details] [review]
the patch (alpha 4)

The patch I talked about earlier (Alpha 4 as I call it). 
Please comment.
Comment 2 Lucas Rocha 2006-08-14 00:34:44 UTC
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.
Comment 3 Felix Riemann 2006-08-16 19:13:32 UTC
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.
Comment 4 Lucas Rocha 2006-09-01 13:15:14 UTC
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.
Comment 5 Paolo Borelli 2006-09-01 16:21:57 UTC
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.
Comment 6 Felix Riemann 2006-09-02 09:43:09 UTC
(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.
Comment 7 Felix Riemann 2006-09-03 12:18:59 UTC
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.
Comment 8 Lucas Rocha 2006-09-07 00:46:53 UTC
Applied, thanks!