Yes, it's my solution for preloading. I'm writing two classes EogNavigator and EogNavigatorView which act as model and view of a component based on a MVC pattern. You could say that EogNavigator is an EogListStore with more responsabilities because it contains data access and business logic (preloading feature is included here). In the other hand EogNavigatorView is the component responsible for displaying the thumbnails and interact with the user. Basically I'm replacing EogListStore, EogThumbNav and EogThumbView with EogNavigator and EogNavigatorView. What's my problem? EogWindow acts as controller in my MVC pattern and replace components it's a hard work.
Furthermore, we will define a correct API for this components. Maybe, we will include methods which fix bugs like Bug 567581 - Navigate between images by specifying image number (image x -> image y).
Anyway, I include as attachment of this mail EogNavigator.h and EogNavigatorView.h, review it and tell me what do you think about it.
Well, I have some ideas:
- EOG would have a new image view components based on clutter. This way we could apply not intrusive cool effects to the displayed image like do cheese.
- EOG would have a unique component for image management and navigation (EogNavigator)
- We would refactor some components to make code more readable for new contributors.
- We would add new basic image transformation operations like resize, crop, ...
- We would add new hooks for plugins. This way, the new plugins would be more powerful.
Anyway, I think that we could express our ideas in EOG wiki or discuss it on eog chat room.
/* Eye of Gnome -- Eog Image Navigator * * Copyright (C) 2012 The Free Software Foundation * * Author: Javier Sánchez <jsanchez deskblue com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __EOG_NAVIGATOR_H__ #define __EOG_NAVIGATOR_H__ #include "eog-image.h" #include <glib-object.h> #include <gtk/gtk.h> G_BEGIN_DECLS #define EOG_TYPE_NAVIGATOR (eog_navigator_get_type ()) #define EOG_NAVIGATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EOG_TYPE_NAVIGATOR, EogNavigator)) #define EOG_NAVIGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EOG_TYPE_NAVIGATOR, EogNavigatorClass)) #define EOG_IS_NAVIGATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EOG_TYPE_NAVIGATOR)) #define EOG_IS_NAVIGATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EOG_TYPE_NAVIGATOR)) #define EOG_NAVIGATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EOG_TYPE_NAVIGATOR, EogNavigatorClass)) #define EOG_NAVIGATOR_THUMB_SIZE 90 typedef enum { EOG_NAVIGATOR_THUMBNAIL = 0, EOG_NAVIGATOR_THUMB_SET, EOG_NAVIGATOR_IMAGE, EOG_NAVIGATOR_JOB, EOG_NAVIGATOR_NUM_COLUMNS } EogNavigatorColumn; typedef struct _EogNavigator EogNavigator; typedef struct _EogNavigatorClass EogNavigatorClass; typedef struct _EogNavigatorPrivate EogNavigatorPrivate; struct _EogNavigator { GtkListStore parent_instance; EogNavigatorPrivate *priv; }; struct _EogNavigatorClass { GtkListStoreClass parent_class; /* navigation signals */ void (* active_image_changed) (EogNavigator *navigator, GtkTreePath *path); }; GType eog_navigator_get_type (void) G_GNUC_CONST; EogNavigator *eog_navigator_new (void); EogNavigator *eog_navigator_new_from_glist (GList *list); /* active image */ EogImage *eog_navigator_get_active_image (EogNavigator *navigator); void eog_navigator_set_active_image (EogNavigator *navigator, EogImage *image); void eog_navigator_set_active_image_path (EogNavigator *navigator, GtkTreePath *path); gint eog_navigator_get_active_image_index (EogNavigator *navigator); /* image management */ void eog_navigator_copy_image (EogNavigator *navigator); void eog_navigator_save_image (EogNavigator *navigator); void eog_navigator_save_image_as (EogNavigator *navigator); void eog_navigator_delete_image (EogNavigator *navigator); /* image collection management */ void eog_navigator_set_image_list (EogNavigator *navigator, GList *list); gint eog_navigator_get_images_count (EogNavigator *navigator); void eog_navigator_append_image (EogNavigator *navigator, EogImage *image); void eog_navigator_insert_image (EogNavigator *navigator, EogImage *image, guint position); void eog_navigator_remove_image (EogNavigator *navigator, EogImage *image); gboolean eog_navigator_is_empty (EogNavigator *navigator); /* navigation */ void eog_navigator_go_first (EogNavigator *navigator); void eog_navigator_go_previous (EogNavigator *navigator); void eog_navigator_go_next (EogNavigator *navigator); void eog_navigator_go_last (EogNavigator *navigator); G_END_DECLS #endif /* __EOG_NAVIGATOR_H__ */
/* Eye of Gnome -- Eog Image Navigator View * * Copyright (C) 2012 The Free Software Foundation * * Author: Javier Sánchez <jsanchez deskblue com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ #ifndef __EOG_NAVIGATOR_VIEW_H__ #define __EOG_NAVIGATOR_VIEW_H__ #include "eog-navigator.h" #include <gtk/gtk.h> G_BEGIN_DECLS #define EOG_TYPE_NAVIGATOR_VIEW (eog_navigator_view_get_type ()) #define EOG_NAVIGATOR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), EOG_TYPE_NAVIGATOR_VIEW, EogNavigatorView)) #define EOG_NAVIGATOR_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), EOG_TYPE_NAVIGATOR_VIEW, EogNavigatorViewClass)) #define EOG_IS_NAVIGATOR_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EOG_TYPE_NAVIGATOR_VIEW)) #define EOG_IS_NAVIGATOR_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), EOG_TYPE_NAVIGATOR_VIEW)) #define EOG_NAVIGATOR_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), EOG_TYPE_NAVIGATOR_VIEW, EogNavigatorViewClass)) typedef enum { EOG_NAVIGATOR_VIEW_MODE_ONE_ROW, EOG_NAVIGATOR_VIEW_MODE_ONE_COLUMN, EOG_NAVIGATOR_VIEW_MODE_MULTIPLE_ROWS, EOG_NAVIGATOR_VIEW_MODE_MULTIPLE_COLUMNS } EogNavigatorViewMode; typedef struct _EogNavigatorView EogNavigatorView; typedef struct _EogNavigatorViewClass EogNavigatorViewClass; typedef struct _EogNavigatorViewPrivate EogNavigatorViewPrivate; struct _EogNavigatorView { GtkBin parent_instance; EogNavigatorViewPrivate *priv; }; struct _EogNavigatorViewClass { GtkBinClass parent_class; }; GType eog_navigator_view_get_type (void) G_GNUC_CONST; GtkWidget *eog_navigator_view_new (EogNavigatorViewMode mode, gboolean show_buttons); void eog_navigator_view_set_model (EogNavigatorView *view, EogNavigator *model); EogNavigatorViewMode eog_navigator_view_get_mode (EogNavigatorView *view); void eog_navigator_view_set_mode (EogNavigatorView *view, EogNavigatorViewMode mode); gboolean eog_navigator_view_get_show_buttons (EogNavigatorView *view); void eog_navigator_view_set_show_buttons (EogNavigatorView *view, gboolean show_buttons); guint eog_navigator_view_get_n_selected (EogNavigatorView *view); GList *eog_navigator_view_get_selected_images (EogNavigatorView *view); G_END_DECLS #endif /* __EOG_NAVIGATOR_VIEW_H__ */