Bookmarks reworked

Hello all,

I've been working away for the past little while at restructuring the
bookmarks code of Epiphany. The result is a whopping great patch to the
current CVS or 1.3.8 version of Epiphany (a 4575 line .patch file).

A quick statistical summary of the patch:
      * Patch adds 889 lines (mainly because I add 4 files).
      * Patch removes 1638 lines (mainly because I remove 6 files).

A patch this large probably should have been done in sections/stages,
but since I am new to GTK+ programming I couldn't effectively plan out
what those sections/stages would be. So, instead I have this single one.

I have put a lot of time into this code, *but* that is more because of
inexperience with GTK+. I won't be surprised if this patch is wholly
rejected because of design or whatever. Thanks for the opportunity

While this patch is mostly a code cleanup, it does change some user-
visible aspects and makes some large architecture changes. Just remember
that the main aims I was trying to achieve were:
      * Consolidate code which generates menu.
      * Consolidate code which handles actions and their behaviours.
      * Prepare for moving the whole thing into a plugin (even if this
        never happens, it would be nice to keep the code modular).

      * The bookmarks bar no longer exists, and most references to it
        have been removed. Bookmarks and topics are added to the toolbar
        by drag-and-drop from the bookmark editor.
      * 'Open in tabs' is (temporarily) only available via the context
        menu for topics which are on the toolbar.
      * You cannot 'Move left' or 'Move right' a topic/bookmark on the
        toolbar. The only reason for removing this is to make code
        maintenance simpler. This can be done much more easily using the
        toolbar editor anyway. You can still 'Remove' topics/bookmarks
        from the toolbar by right-clicking.
      * Fixed a bug in the 'Remove' code which would occur if you tried
        to remove a bookmark/topic when it wasn't on the first toolbar.


ephy-bookmarksbar and ephy-bookmarksbar-model are no longer in use. They
are replaced by a minor modification to the normal toolbar, and the code
in ephy-bookmarks-ui.

ephy-bookmarks-menu now contains only functions to create (not maintain)
action-based bookmark menus. With the current patch ephy-bookmarks-menu
implements my hierarchical menu system, but could be easily switched
back (will do this later).

ephy-bookmarks-ui is new, and contains signal handlers which:
      * listen to changes in the bookmarks database and update menus and
        actions accordingly.
      * listen to requests for information coming from the toolbar
        model, allowing it to read/write bookmarks and topics on the

ephy-bookmark-action and ephy-topic-action now focus on being actions
and actions only (they don't listen for changes in the bookmarks
database, they don't generate menus, etc.). There are functions to
find/create actions for EphyWindows, to get a standard name for these
actions, and to synchronise the information contained in the actions
with that in the bookmarks database.


      * New file consisting of new code and stuff copied and modified
        from other files.
      * Contains signal handlers which listen to changes in the
        bookmarks database and update actions and menus for each
      * Contains signal handlers which are used to correctly read and
        write bookmark/topic entries in the toolbars XML.
      * Contains functions to attach the above signal handlers to the
        bookmarks database and the toolbar model.

      * Completely gutted it and replaced with code which only generates
        bookmark menus. It no longer maintains the menu (this is now the
        responsibility of the ephy-bookmarks-ui code). You can call upon
        this 'menu factory' by calling ephy_bookmarks_menu_build which
        returns a GtkUIManager merge id.

      * Each action now has a pointer to the EphyNode which is being
        represented, and the EphyWindow which is the target of any
        activity. This is instead of keeping the node id.
      * Removed all signals and replaced with builtin behaviours.
      * Reworked code to handle interaction with the toolbar model. 
      * Removed drag-and-drop for the topic action. Have left it in for
        bookmark actions, but would like to remove it if noone uses it.
      * Removed checks which test if the widget is on the bookmarks bar.
      * Simplified property management by removing separate functions
        for different properties.
      * Removed signal handlers which received events from
        bookmarks/topics. This is now handled by the signal handlers in
      * Added functions to get the standard names of actions (OpenTopic
        and OpenBmk), and to find/create instances of bookmark and topic
        actions within a given action group.
      * Replaced menu generation code for topic actions with a call to

      * Code to create the bookmarks bar was removed. It was replaced
        with a single call to ephy_bookmarks_ui_attach_toolbar_model
        which installs signal handlers giving the same functionality as
        the bookmarks bar.

      * Modified to accept drag-and-drop of things other than
        application/x-toolitem types. This allows drag-and-drop of URLs
        and topics to the toolbar.

      * Removed most references to the bookmarks bar and to the
        favourites menu.
      * Added a call to ephy_bookmarks_ui_attach_window immediately
        below the ephy_extension_attach_window call and taking only the
        same information. This is to prepare for the possibility of
        turning the bookmarks system into a plugin.

      * Removed any reference to the bookmarks bar.
      * Added the ephy-bookmarks-ui code.
      * Also added ephy-nodes-cover code (part of my bookmarks menu

      * Removed any reference to the bookmarks bar.

      * Added code to provide markers (used in my bookmarks menu patch).

I will upload the patch and some Debian binaries in a few days. Keep in
mind that this patch isn't finished yet. There is still phase 2 to come
where a system for adding actions to the toolbar editor is created,
which will allow moving everything bookmark related into the
src/bookmarks/ directory, and then the creation of a plugin. I have some
ideas on how to do this.

Thanks again,
Peter Harvey.

Attachment: h5.patch.bz2
Description: application/bzip

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]