From e6e647fb236b236df1399ff4dba8faf0172002a1 Mon Sep 17 00:00:00 2001 From: Nickolay V. Shmyrev Date: Tue, 19 Apr 2005 08:57:50 +0000 Subject: Small rework of sidebar pages handling. See bug #164811 for details --- diff --git a/ChangeLog b/ChangeLog index 1555090..3d59e83 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,35 @@ 2005-04-19 Nickolay V. Shmyrev + * po/POTFILES.in: + + ev-sidebar-thumbnails now has translatable labels + + * shell/Makefile.am: + * shell/ev-sidebar-links.c: (ev_sidebar_links_set_document), + (ev_sidebar_links_support_document), (ev_sidebar_links_get_label), + (ev_sidebar_links_page_iface_init): + * shell/ev-sidebar-links.h: + * shell/ev-sidebar-page.c: (ev_sidebar_page_get_type), + (ev_sidebar_page_support_document), (ev_sidebar_page_set_document), + (ev_sidebar_page_get_label): + * shell/ev-sidebar-page.h: + * shell/ev-sidebar-thumbnails.c: (ev_sidebar_thumbnails_new), + (ev_sidebar_thumbnails_set_document), + (ev_sidebar_thumbnails_support_document), + (ev_sidebar_thumbnails_get_label), + (ev_sidebar_thumbnails_page_iface_init): + * shell/ev-sidebar-thumbnails.h: + * shell/ev-sidebar.c: (ev_sidebar_init), (ev_sidebar_add_page), + (ev_sidebar_set_document): + * shell/ev-sidebar.h: + * shell/ev-window.c: (ev_window_setup_document), (ev_window_init): + + Small rework of sidebar code. Now sidebar pages should implement + EvSidebarPage interface. That makes page management in EvSidebar + easier. See bug #164811 for details + +2005-04-19 Nickolay V. Shmyrev + * shell/ev-application.c: (ev_application_open): * shell/ev-document-types.c: diff --git a/po/POTFILES.in b/po/POTFILES.in index 927b340..74d14b1 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -14,6 +14,7 @@ shell/ev-password-view.c shell/ev-password.c shell/ev-print-job.c shell/ev-sidebar-links.c +shell/ev-sidebar-thumbnails.c shell/ev-view.c shell/ev-window.c shell/main.c diff --git a/shell/Makefile.am b/shell/Makefile.am index 95dcf83..c7181a5 100644 --- a/shell/Makefile.am +++ b/shell/Makefile.am @@ -75,6 +75,8 @@ evince_SOURCES= \ ev-sidebar.h \ ev-sidebar-links.c \ ev-sidebar-links.h \ + ev-sidebar-page.c \ + ev-sidebar-page.h \ ev-sidebar-thumbnails.c \ ev-sidebar-thumbnails.h \ ev-stock-icons.c \ diff --git a/shell/ev-sidebar-links.c b/shell/ev-sidebar-links.c index 1a4312f..830d6be 100644 --- a/shell/ev-sidebar-links.c +++ b/shell/ev-sidebar-links.c @@ -28,6 +28,7 @@ #include #include +#include "ev-sidebar-page.h" #include "ev-sidebar-links.h" #include "ev-job-queue.h" #include "ev-document-links.h" @@ -52,17 +53,30 @@ enum { }; -static void links_page_num_func (GtkTreeViewColumn *tree_column, - GtkCellRenderer *cell, - GtkTreeModel *tree_model, - GtkTreeIter *iter, - EvSidebarLinks *sidebar_links); -static void update_page_callback (EvPageCache *page_cache, - gint current_page, - EvSidebarLinks *sidebar_links); +static void links_page_num_func (GtkTreeViewColumn *tree_column, + GtkCellRenderer *cell, + GtkTreeModel *tree_model, + GtkTreeIter *iter, + EvSidebarLinks *sidebar_links); +static void update_page_callback (EvPageCache *page_cache, + gint current_page, + EvSidebarLinks *sidebar_links); +static void ev_sidebar_links_page_iface_init (EvSidebarPageIface *iface); +static void ev_sidebar_links_clear_document (EvSidebarLinks *sidebar_links); +static void ev_sidebar_links_set_document (EvSidebarPage *sidebar_page, + EvDocument *document); +static gboolean ev_sidebar_links_support_document (EvSidebarPage *sidebar_page, + EvDocument *document); +static const gchar* ev_sidebar_links_get_label (EvSidebarPage *sidebar_page); -G_DEFINE_TYPE (EvSidebarLinks, ev_sidebar_links, GTK_TYPE_VBOX) +G_DEFINE_TYPE_EXTENDED (EvSidebarLinks, + ev_sidebar_links, + GTK_TYPE_VBOX, + 0, + G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, + ev_sidebar_links_page_iface_init)) + #define EV_SIDEBAR_LINKS_GET_PRIVATE(object) \ (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_LINKS, EvSidebarLinksPrivate)) @@ -313,7 +327,7 @@ ev_sidebar_links_new (void) return ev_sidebar_links; } -void +static void ev_sidebar_links_clear_document (EvSidebarLinks *sidebar_links) { EvSidebarLinksPrivate *priv; @@ -428,14 +442,17 @@ job_finished_cb (EvJobLinks *job, } -void -ev_sidebar_links_set_document (EvSidebarLinks *sidebar_links, +static void +ev_sidebar_links_set_document (EvSidebarPage *sidebar_page, EvDocument *document) { + EvSidebarLinks *sidebar_links; EvSidebarLinksPrivate *priv; - g_return_if_fail (EV_IS_SIDEBAR_LINKS (sidebar_links)); + g_return_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page)); g_return_if_fail (EV_IS_DOCUMENT (document)); + + sidebar_links = EV_SIDEBAR_LINKS (sidebar_page); priv = sidebar_links->priv; @@ -454,3 +471,25 @@ ev_sidebar_links_set_document (EvSidebarLinks *sidebar_links, } +static gboolean +ev_sidebar_links_support_document (EvSidebarPage *sidebar_page, + EvDocument *document) +{ + return (EV_IS_DOCUMENT_LINKS (document) && + ev_document_links_has_document_links (EV_DOCUMENT_LINKS (document))); +} + +static const gchar* +ev_sidebar_links_get_label (EvSidebarPage *sidebar_page) +{ + return _("Index"); +} + +static void +ev_sidebar_links_page_iface_init (EvSidebarPageIface *iface) +{ + iface->support_document = ev_sidebar_links_support_document; + iface->set_document = ev_sidebar_links_set_document; + iface->get_label = ev_sidebar_links_get_label; +} + diff --git a/shell/ev-sidebar-links.h b/shell/ev-sidebar-links.h index 59af8bb..b9691e3 100644 --- a/shell/ev-sidebar-links.h +++ b/shell/ev-sidebar-links.h @@ -52,9 +52,6 @@ struct _EvSidebarLinksClass { GType ev_sidebar_links_get_type (void); GtkWidget *ev_sidebar_links_new (void); -void ev_sidebar_links_set_document (EvSidebarLinks *ev_sidebar_links, - EvDocument *document); -void ev_sidebar_links_clear_document (EvSidebarLinks *sidebar_links); G_END_DECLS diff --git a/shell/ev-sidebar-page.c b/shell/ev-sidebar-page.c new file mode 100644 index 0000000..dfd21d3 --- /dev/null +++ b/shell/ev-sidebar-page.c @@ -0,0 +1,98 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ +/* + * Copyright (C) 2005 Marco Pesenti Gritti + * + * 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, 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. + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ev-sidebar-page.h" + +GType +ev_sidebar_page_get_type (void) +{ + static GType type = 0; + + if (G_UNLIKELY (type == 0)) + { + static const GTypeInfo sidebar_page_info = + { + sizeof (EvDocumentIface), + NULL, + NULL, + NULL + }; + + type = g_type_register_static (G_TYPE_INTERFACE, + "EvSidebarPage", + &sidebar_page_info, (GTypeFlags)0); + } + + return type; +} + + +gboolean +ev_sidebar_page_support_document (EvSidebarPage *sidebar_page, + EvDocument *document) +{ + EvSidebarPageIface *iface; + + g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), FALSE); + g_return_val_if_fail (EV_IS_DOCUMENT (document), FALSE); + + iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page); + + g_return_val_if_fail (iface->set_document, FALSE); + + return iface->support_document (sidebar_page, document); +} + +void +ev_sidebar_page_set_document (EvSidebarPage *sidebar_page, + EvDocument *document) +{ + EvSidebarPageIface *iface; + + g_return_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page)); + g_return_if_fail (EV_IS_DOCUMENT (document)); + + iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page); + + g_return_if_fail (iface->set_document); + + iface->set_document (sidebar_page, document); + + return; +} + +const gchar* +ev_sidebar_page_get_label (EvSidebarPage *sidebar_page) +{ + EvSidebarPageIface *iface; + + g_return_val_if_fail (EV_IS_SIDEBAR_PAGE (sidebar_page), NULL); + + iface = EV_SIDEBAR_PAGE_GET_IFACE (sidebar_page); + + g_return_val_if_fail (iface->get_label, NULL); + + return iface->get_label (sidebar_page); +} + diff --git a/shell/ev-sidebar-page.h b/shell/ev-sidebar-page.h new file mode 100644 index 0000000..e4d19eb --- /dev/null +++ b/shell/ev-sidebar-page.h @@ -0,0 +1,63 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8; c-indent-level: 8 -*- */ +/* + * Copyright (C) 2005 Marco Pesenti Gritti + * + * 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, 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 EV_SIDEBAR_PAGE_H +#define EV_SIDEBAR_PAGE_H + +#include +#include + +#include "ev-document.h" + +G_BEGIN_DECLS + +#define EV_TYPE_SIDEBAR_PAGE (ev_sidebar_page_get_type ()) +#define EV_SIDEBAR_PAGE(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), EV_TYPE_SIDEBAR_PAGE, EvSidebarPage)) +#define EV_SIDEBAR_PAGE_IFACE(k) (G_TYPE_CHECK_CLASS_CAST((k), EV_TYPE_SIDEBAR_PAGE, EvSidebarPageIface)) +#define EV_IS_SIDEBAR_PAGE(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), EV_TYPE_SIDEBAR_PAGE)) +#define EV_IS_SIDEBAR_PAGE_IFACE(k) (G_TYPE_CHECK_CLASS_TYPE ((k), EV_TYPE_SIDEBAR_PAGE)) +#define EV_SIDEBAR_PAGE_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), EV_TYPE_SIDEBAR_PAGE, EvSidebarPageIface)) + +typedef struct _EvSidebarPage EvSidebarPage; +typedef struct _EvSidebarPageIface EvSidebarPageIface; + +struct _EvSidebarPageIface +{ + GTypeInterface base_iface; + + /* Methods */ + gboolean (* support_document) (EvSidebarPage *sidebar_page, + EvDocument *document); + void (* set_document) (EvSidebarPage *sidebar_page, + EvDocument *document); + const gchar* (* get_label) (EvSidebarPage *sidebar_page); +}; + +GType ev_sidebar_page_get_type (void); +gboolean ev_sidebar_page_support_document (EvSidebarPage *sidebar_page, + EvDocument *document); +void ev_sidebar_page_set_document (EvSidebarPage *sidebar_page, + EvDocument *document); +const gchar* ev_sidebar_page_get_label (EvSidebarPage *page); + + +G_END_DECLS + +#endif /* EV_SIDEBAR_PAGE */ diff --git a/shell/ev-sidebar-thumbnails.c b/shell/ev-sidebar-thumbnails.c index b2734cb..a22d70e 100644 --- a/shell/ev-sidebar-thumbnails.c +++ b/shell/ev-sidebar-thumbnails.c @@ -28,7 +28,9 @@ #include #include +#include +#include "ev-sidebar-page.h" #include "ev-sidebar-thumbnails.h" #include "ev-document-thumbnails.h" #include "ev-document-misc.h" @@ -58,13 +60,24 @@ enum { NUM_COLUMNS }; -G_DEFINE_TYPE (EvSidebarThumbnails, ev_sidebar_thumbnails, GTK_TYPE_VBOX); +static void ev_sidebar_thumbnails_clear_model (EvSidebarThumbnails *sidebar); +static gboolean ev_sidebar_thumbnails_support_document (EvSidebarPage *sidebar_page, + EvDocument *document); +static void ev_sidebar_thumbnails_page_iface_init (EvSidebarPageIface *iface); +static void ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page, + EvDocument *document); +static const gchar* ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page); + +G_DEFINE_TYPE_EXTENDED (EvSidebarThumbnails, + ev_sidebar_thumbnails, + GTK_TYPE_VBOX, + 0, + G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, + ev_sidebar_thumbnails_page_iface_init)) #define EV_SIDEBAR_THUMBNAILS_GET_PRIVATE(object) \ (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_THUMBNAILS, EvSidebarThumbnailsPrivate)); -static void -ev_sidebar_thumbnails_clear_model (EvSidebarThumbnails *sidebar); static void ev_sidebar_thumbnails_dispose (GObject *object) @@ -90,6 +103,16 @@ ev_sidebar_thumbnails_class_init (EvSidebarThumbnailsClass *ev_sidebar_thumbnail g_type_class_add_private (g_object_class, sizeof (EvSidebarThumbnailsPrivate)); } +GtkWidget * +ev_sidebar_thumbnails_new (void) +{ + GtkWidget *ev_sidebar_thumbnails; + + ev_sidebar_thumbnails = g_object_new (EV_TYPE_SIDEBAR_THUMBNAILS, NULL); + + return ev_sidebar_thumbnails; +} + static void adjustment_changed_cb (GtkAdjustment *adjustment, EvSidebarThumbnails *ev_sidebar_thumbnails) @@ -186,16 +209,6 @@ ev_sidebar_thumbnails_init (EvSidebarThumbnails *ev_sidebar_thumbnails) gtk_widget_show_all (swindow); } -GtkWidget * -ev_sidebar_thumbnails_new (void) -{ - GtkWidget *ev_sidebar_thumbnails; - - ev_sidebar_thumbnails = g_object_new (EV_TYPE_SIDEBAR_THUMBNAILS, NULL); - - return ev_sidebar_thumbnails; -} - static void page_changed_cb (EvPageCache *page_cache, int page, @@ -230,10 +243,11 @@ thumbnail_job_completed_callback (EvJobThumbnail *job, -1); } -void -ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails, +static void +ev_sidebar_thumbnails_set_document (EvSidebarPage *sidebar_page, EvDocument *document) { + EvSidebarThumbnails *sidebar_thumbnails = EV_SIDEBAR_THUMBNAILS (sidebar_page); GdkPixbuf *loading_icon; gint i, n_pages; GtkTreeIter iter; @@ -324,4 +338,25 @@ ev_sidebar_thumbnails_clear_model (EvSidebarThumbnails *sidebar_thumbnails) gtk_list_store_clear (priv->list_store); } +static gboolean +ev_sidebar_thumbnails_support_document (EvSidebarPage *sidebar_page, + EvDocument *document) +{ + return (EV_IS_DOCUMENT_THUMBNAILS (document) && + (ev_document_get_n_pages (document) > 1)); +} + +static const gchar* +ev_sidebar_thumbnails_get_label (EvSidebarPage *sidebar_page) +{ + return _("Thumbnails"); +} + +static void +ev_sidebar_thumbnails_page_iface_init (EvSidebarPageIface *iface) +{ + iface->support_document = ev_sidebar_thumbnails_support_document; + iface->set_document = ev_sidebar_thumbnails_set_document; + iface->get_label = ev_sidebar_thumbnails_get_label; +} diff --git a/shell/ev-sidebar-thumbnails.h b/shell/ev-sidebar-thumbnails.h index 45f68fc..ccfc09b 100644 --- a/shell/ev-sidebar-thumbnails.h +++ b/shell/ev-sidebar-thumbnails.h @@ -54,9 +54,6 @@ struct _EvSidebarThumbnailsClass { GType ev_sidebar_thumbnails_get_type (void); GtkWidget *ev_sidebar_thumbnails_new (void); -void ev_sidebar_thumbnails_set_document (EvSidebarThumbnails *sidebar_thumbnails, - EvDocument *document); - G_END_DECLS #endif /* __EV_SIDEBAR_THUMBNAILS_H__ */ diff --git a/shell/ev-sidebar.c b/shell/ev-sidebar.c index b1454d9..3f29607 100644 --- a/shell/ev-sidebar.c +++ b/shell/ev-sidebar.c @@ -29,21 +29,12 @@ #include #include "ev-sidebar.h" +#include "ev-sidebar-page.h" #include "ev-document-thumbnails.h" #include "ev-document-links.h" -#include "ev-sidebar-links.h" -#include "ev-sidebar-thumbnails.h" - -typedef struct -{ - char *id; - char *title; - GtkWidget *main_widget; -} EvSidebarPage; enum { - PAGE_COLUMN_ID, PAGE_COLUMN_TITLE, PAGE_COLUMN_MENU_ITEM, PAGE_COLUMN_MAIN_WIDGET, @@ -238,7 +229,6 @@ ev_sidebar_init (EvSidebar *ev_sidebar) ev_sidebar->priv->page_model = (GtkTreeModel *) gtk_list_store_new (PAGE_COLUMN_NUM_COLS, G_TYPE_STRING, - G_TYPE_STRING, GTK_TYPE_WIDGET, GTK_TYPE_WIDGET, G_TYPE_INT); @@ -310,6 +300,8 @@ ev_sidebar_init (EvSidebar *ev_sidebar) gtk_box_pack_start (GTK_BOX (ev_sidebar), ev_sidebar->priv->notebook, TRUE, TRUE, 0); gtk_widget_show (ev_sidebar->priv->notebook); + + gtk_widget_set_sensitive (GTK_WIDGET (ev_sidebar), FALSE); } /* Public functions */ @@ -326,19 +318,19 @@ ev_sidebar_new (void) void ev_sidebar_add_page (EvSidebar *ev_sidebar, - const gchar *page_id, - const gchar *title, GtkWidget *main_widget) { GtkTreeIter iter; GtkWidget *menu_item; gchar *label_title; + const gchar *title; int index; g_return_if_fail (EV_IS_SIDEBAR (ev_sidebar)); - g_return_if_fail (page_id != NULL); - g_return_if_fail (title != NULL); + g_return_if_fail (EV_IS_SIDEBAR_PAGE (main_widget)); g_return_if_fail (GTK_IS_WIDGET (main_widget)); + + title = ev_sidebar_page_get_label (EV_SIDEBAR_PAGE (main_widget)); index = gtk_notebook_append_page (GTK_NOTEBOOK (ev_sidebar->priv->notebook), main_widget, NULL); @@ -353,7 +345,6 @@ ev_sidebar_add_page (EvSidebar *ev_sidebar, gtk_list_store_insert_with_values (GTK_LIST_STORE (ev_sidebar->priv->page_model), &iter, 0, - PAGE_COLUMN_ID, page_id, PAGE_COLUMN_TITLE, title, PAGE_COLUMN_MENU_ITEM, menu_item, PAGE_COLUMN_MAIN_WIDGET, main_widget, @@ -380,19 +371,19 @@ ev_sidebar_set_document (EvSidebar *sidebar, { EvSidebarPrivate *priv; GtkTreeIter iter; - gboolean result; + gboolean valid; + gboolean has_pages; g_return_if_fail (EV_IS_SIDEBAR (sidebar)); g_return_if_fail (EV_IS_DOCUMENT (document)); priv = sidebar->priv; - /* FIXME: We should prolly make sidebars have an interface. For now, we - * do this bad hack (TM) - */ - for (result = gtk_tree_model_get_iter_first (priv->page_model, &iter); - result; - result = gtk_tree_model_iter_next (priv->page_model, &iter)) { + has_pages = FALSE; + + for (valid = gtk_tree_model_get_iter_first (priv->page_model, &iter); + valid; + valid = gtk_tree_model_iter_next (priv->page_model, &iter)) { GtkWidget *widget; GtkWidget *menu_widget; @@ -402,40 +393,18 @@ ev_sidebar_set_document (EvSidebar *sidebar, -1); - if (EV_IS_SIDEBAR_LINKS (widget)) { - if (EV_IS_DOCUMENT_LINKS (document) && - ev_document_links_has_document_links (EV_DOCUMENT_LINKS (document))) { - ev_sidebar_links_set_document (EV_SIDEBAR_LINKS (widget), document); - continue; - } else { - gtk_widget_set_sensitive (menu_widget, FALSE); - } - } - - if (EV_IS_SIDEBAR_THUMBNAILS (widget)) { - if (EV_IS_DOCUMENT_THUMBNAILS (document) && - (ev_document_get_n_pages (document) > 1)) { - ev_sidebar_thumbnails_set_document (EV_SIDEBAR_THUMBNAILS (widget), document); - continue; - } else { + if (ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (widget), document)) { + ev_sidebar_page_set_document (EV_SIDEBAR_PAGE (widget), document); + has_pages = TRUE; + } else { gtk_widget_set_sensitive (menu_widget, FALSE); - } } } + + if (!has_pages) { + gtk_widget_hide (GTK_WIDGET (sidebar)); + } else { + gtk_widget_set_sensitive (GTK_WIDGET (sidebar), TRUE); + } } -gboolean -ev_sidebar_supports_document (EvSidebar *ev_sidebar, - EvDocument *document) -{ - gboolean need_thumbnails; - gboolean need_index; - - need_thumbnails = EV_IS_DOCUMENT_THUMBNAILS (document) && (ev_document_get_n_pages (document) > 1); - need_index = (EV_IS_DOCUMENT_LINKS (document)); - - return need_thumbnails || need_index; -} - - - diff --git a/shell/ev-sidebar.h b/shell/ev-sidebar.h index 551f35f..d599fff 100644 --- a/shell/ev-sidebar.h +++ b/shell/ev-sidebar.h @@ -53,13 +53,9 @@ struct _EvSidebarClass { GType ev_sidebar_get_type (void); GtkWidget *ev_sidebar_new (void); void ev_sidebar_add_page (EvSidebar *ev_sidebar, - const gchar *page_id, - const gchar *title, GtkWidget *main_widget); void ev_sidebar_set_document (EvSidebar *ev_sidebar, EvDocument *document); -gboolean ev_sidebar_supports_document (EvSidebar *ev_sidebar, - EvDocument *document); G_END_DECLS diff --git a/shell/ev-window.c b/shell/ev-window.c index 6356056..6aabf14 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -92,7 +92,6 @@ struct _EvWindowPrivate { GtkWidget *toolbar; GtkWidget *hpaned; GtkWidget *sidebar; - GtkWidget *thumbs_sidebar; GtkWidget *find_bar; GtkWidget *scrolled_window; GtkWidget *view; @@ -449,21 +448,6 @@ update_window_title (EvDocument *document, GParamSpec *pspec, EvWindow *ev_windo } static void -hide_sidebar_and_actions (EvWindow *ev_window) -{ - GtkAction *action; - /* Alsthough we update the hiddenness of the sidebar, we don't want to - * store the value */ - g_signal_handlers_disconnect_by_func (ev_window->priv->sidebar, - ev_window_sidebar_visibility_changed_cb, - ev_window); - gtk_widget_hide (ev_window->priv->sidebar); - action = gtk_action_group_get_action (ev_window->priv->action_group, "ViewSidebar"); - gtk_action_set_sensitive (action, FALSE); - -} - -static void find_changed_cb (EvDocument *document, int page, EvWindow *ev_window) { update_action_sensitivity (ev_window); @@ -502,10 +486,7 @@ ev_window_setup_document (EvWindow *ev_window) ev_window_set_page_mode (ev_window, PAGE_MODE_SINGLE_PAGE); - if (ev_sidebar_supports_document (sidebar, document)) - ev_sidebar_set_document (sidebar, document); - else - hide_sidebar_and_actions (ev_window); + ev_sidebar_set_document (sidebar, document); if (ev_page_cache_get_n_pages (ev_window->priv->page_cache) > 0) { ev_view_set_document (view, document); @@ -2400,16 +2381,12 @@ ev_window_init (EvWindow *ev_window) ev_window); gtk_widget_show (sidebar_widget); ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar), - "index", - _("Index"), sidebar_widget); - ev_window->priv->thumbs_sidebar = ev_sidebar_thumbnails_new (); - gtk_widget_show (ev_window->priv->thumbs_sidebar); + sidebar_widget = ev_sidebar_thumbnails_new (); + gtk_widget_show (sidebar_widget); ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar), - "thumbnails", - _("Thumbnails"), - ev_window->priv->thumbs_sidebar); + sidebar_widget); ev_window->priv->scrolled_window = GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW, -- cgit v0.9.1