]> www.fi.muni.cz Git - evince.git/commitdiff
Move attachments bar to sidebar.
authorNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Wed, 10 May 2006 16:18:25 +0000 (16:18 +0000)
committerNickolay V. Shmyrev <nshmyrev@src.gnome.org>
Wed, 10 May 2006 16:18:25 +0000 (16:18 +0000)
* po/POTFILES.in:
* properties/Makefile.am:
* shell/Makefile.am:
* shell/ev-attachment-bar.c:
* shell/ev-attachment-bar.h:
* shell/ev-sidebar-attachments.c:
(ev_sidebar_attachments_icon_cache_add),
(icon_theme_get_pixbuf_from_mime_type),
(ev_sidebar_attachments_icon_cache_get), (icon_cache_update_icon),
(ev_sidebar_attachments_icon_cache_refresh),
(ev_sidebar_attachments_get_attachment_at_pos),
(ev_sidebar_attachments_popup_menu_show),
(ev_sidebar_attachments_popup_menu),
(ev_sidebar_attachments_button_press),
(ev_sidebar_attachments_update_icons),
(ev_sidebar_attachments_drag_data_get),
(ev_sidebar_attachments_get_property),
(ev_sidebar_attachments_destroy),
(ev_sidebar_attachments_class_init), (ev_sidebar_attachments_init),
(ev_sidebar_attachments_new),
(ev_sidebar_attachments_set_document),
(ev_sidebar_attachments_support_document),
(ev_sidebar_attachments_get_label),
(ev_sidebar_attachments_page_iface_init):
* shell/ev-sidebar-attachments.h:
* shell/ev-window.c: (update_chrome_visibility),
(setup_sidebar_from_metadata), (ev_window_setup_document),
(ev_window_sidebar_current_page_changed_cb),
(attachment_bar_menu_popup_cb), (ev_window_init):
* thumbnailer/Makefile.am:

Move attachments bar to sidebar.

ChangeLog
po/POTFILES.in
properties/Makefile.am
shell/Makefile.am
shell/ev-attachment-bar.h [deleted file]
shell/ev-sidebar-attachments.c [moved from shell/ev-attachment-bar.c with 73% similarity]
shell/ev-sidebar-attachments.h [new file with mode: 0644]
shell/ev-window.c
thumbnailer/Makefile.am

index d56e8fb2b891e87166205f6adba631360cd0351b..c25cfb9a01d668f097fa828c213901ebe167b3b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,38 @@
+2006-05-10  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
+
+       * po/POTFILES.in:
+       * properties/Makefile.am:
+       * shell/Makefile.am:
+       * shell/ev-attachment-bar.c:
+       * shell/ev-attachment-bar.h:
+       * shell/ev-sidebar-attachments.c:
+       (ev_sidebar_attachments_icon_cache_add),
+       (icon_theme_get_pixbuf_from_mime_type),
+       (ev_sidebar_attachments_icon_cache_get), (icon_cache_update_icon),
+       (ev_sidebar_attachments_icon_cache_refresh),
+       (ev_sidebar_attachments_get_attachment_at_pos),
+       (ev_sidebar_attachments_popup_menu_show),
+       (ev_sidebar_attachments_popup_menu),
+       (ev_sidebar_attachments_button_press),
+       (ev_sidebar_attachments_update_icons),
+       (ev_sidebar_attachments_drag_data_get),
+       (ev_sidebar_attachments_get_property),
+       (ev_sidebar_attachments_destroy),
+       (ev_sidebar_attachments_class_init), (ev_sidebar_attachments_init),
+       (ev_sidebar_attachments_new),
+       (ev_sidebar_attachments_set_document),
+       (ev_sidebar_attachments_support_document),
+       (ev_sidebar_attachments_get_label),
+       (ev_sidebar_attachments_page_iface_init):
+       * shell/ev-sidebar-attachments.h:
+       * shell/ev-window.c: (update_chrome_visibility),
+       (setup_sidebar_from_metadata), (ev_window_setup_document),
+       (ev_window_sidebar_current_page_changed_cb),
+       (attachment_bar_menu_popup_cb), (ev_window_init):
+       * thumbnailer/Makefile.am:
+       
+       Move attachments bar to sidebar.
+
 2006-05-09  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * pdf/ev-poppler.cc:
 2006-05-09  Carlos Garcia Campos  <carlosgc@gnome.org>
 
        * pdf/ev-poppler.cc:
@@ -30,7 +65,6 @@
        Update sidebar chrome flag when sidebar visibility changes. Fixes bug
        #341049
 
        Update sidebar chrome flag when sidebar visibility changes. Fixes bug
        #341049
 
-
 2006-05-05  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * djvu/Makefile.am:
 2006-05-05  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * djvu/Makefile.am:
@@ -3897,7 +3931,7 @@ Wed Jun  8 01:04:22 2005  Jonathan Blandford  <jrb@redhat.com>
 
        Implement async renderer interface.
 
 
        Implement async renderer interface.
 
-2005-06-07  Nickolay V. Shmyrev  <<nshmyrev@yandex.ru>>
+2005-06-07  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-sidebar-links.c: (ev_sidebar_links_dispose):
 
 
        * shell/ev-sidebar-links.c: (ev_sidebar_links_dispose):
 
@@ -3949,7 +3983,7 @@ Wed Jun  8 01:04:22 2005  Jonathan Blandford  <jrb@redhat.com>
 
        Cleanup the old job when changing document
 
 
        Cleanup the old job when changing document
 
-2005-06-05  Nickolay V. Shmyrev  <<nshmyrev@yandex.ru>>
+2005-06-05  Nickolay V. Shmyrev  <nshmyrev@yandex.ru>
 
        * shell/ev-stock-icons.c:
        * shell/ev-stock-icons.h:
 
        * shell/ev-stock-icons.c:
        * shell/ev-stock-icons.h:
index 141cdf709c1e01f10ed2b7f97f35ad8512890168..7ff011d1b3d67cf70358e020b50bfb1df6876083 100644 (file)
@@ -20,13 +20,13 @@ ps/gsdefaults.c
 ps/ps-document.c
 shell/eggfindbar.c
 shell/ev-application.c
 ps/ps-document.c
 shell/eggfindbar.c
 shell/ev-application.c
-shell/ev-attachment-bar.c
 shell/ev-page-action.c
 shell/ev-password.c
 shell/ev-password-view.c
 shell/ev-print-job.c
 shell/ev-properties-dialog.c
 shell/ev-properties-fonts.c
 shell/ev-page-action.c
 shell/ev-password.c
 shell/ev-password-view.c
 shell/ev-print-job.c
 shell/ev-properties-dialog.c
 shell/ev-properties-fonts.c
+shell/ev-sidebar-attachments.c
 shell/ev-sidebar-links.c
 shell/ev-sidebar-thumbnails.c
 shell/ev-view-accessible.c
 shell/ev-sidebar-links.c
 shell/ev-sidebar-thumbnails.c
 shell/ev-view-accessible.c
index fab35143ab2813483cb03caee9c0dbae04929ce7..b4ef6f051575362f9899c293b6dd1f1b46a0435e 100644 (file)
@@ -36,7 +36,7 @@ if ENABLE_DJVU
 libevince_properties_page_la_LIBADD +=         $(DJVU_LIBS)
 endif
 
 libevince_properties_page_la_LIBADD +=         $(DJVU_LIBS)
 endif
 
-if ENABLE_DJVU
+if ENABLE_DVI
 libevince_properties_page_la_LIBADD +=         -lkpathsea
 endif
 
 libevince_properties_page_la_LIBADD +=         -lkpathsea
 endif
 
index 80764d295e7ffbfd0d550b2cebac74b4afa98fb3..4712686ea9d904d04b7afdc937e876f800b7576b 100644 (file)
@@ -55,14 +55,14 @@ evince_SOURCES=                             \
        ev-window-title.h               \
        ev-sidebar.c                    \
        ev-sidebar.h                    \
        ev-window-title.h               \
        ev-sidebar.c                    \
        ev-sidebar.h                    \
+       ev-sidebar-attachments.c        \
+       ev-sidebar-attachments.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-sidebar-links.c              \
        ev-sidebar-links.h              \
        ev-sidebar-page.c               \
        ev-sidebar-page.h               \
        ev-sidebar-thumbnails.c         \
        ev-sidebar-thumbnails.h         \
-       ev-attachment-bar.c             \
-       ev-attachment-bar.h             \
        ev-stock-icons.c                \
        ev-stock-icons.h                \
        main.c
        ev-stock-icons.c                \
        ev-stock-icons.h                \
        main.c
@@ -87,7 +87,7 @@ if ENABLE_DJVU
 evince_LDADD +=        $(DJVU_LIBS)
 endif
 
 evince_LDADD +=        $(DJVU_LIBS)
 endif
 
-if ENABLE_DJVU
+if ENABLE_DVI
 evince_LDADD +=        -lkpathsea
 endif
 
 evince_LDADD +=        -lkpathsea
 endif
 
diff --git a/shell/ev-attachment-bar.h b/shell/ev-attachment-bar.h
deleted file mode 100644 (file)
index 4099067..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-/* ev-attachment-bar.h
- *  this file is part of evince, a gnome document viewer
- *
- * Copyright (C) 2006 Carlos Garcia Campos
- *
- * Author:
- *   Carlos Garcia Campos <carlosgc@gnome.org>
- *
- * Evince 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.
- *
- * Evince 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_ATTACHMENT_BAR_H__
-#define __EV_ATTACHMENT_BAR_H__
-
-#include <gtk/gtkexpander.h>
-#include "ev-attachment.h"
-#include "ev-document.h"
-
-G_BEGIN_DECLS
-
-typedef struct _EvAttachmentBar        EvAttachmentBar;
-typedef struct _EvAttachmentBarClass   EvAttachmentBarClass;
-typedef struct _EvAttachmentBarPrivate EvAttachmentBarPrivate;
-
-#define EV_TYPE_ATTACHMENT_BAR              (ev_attachment_bar_get_type())
-#define EV_ATTACHMENT_BAR(object)           (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_ATTACHMENT_BAR, EvAttachmentBar))
-#define EV_ATTACHMENT_BAR_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_ATTACHMENT_BAR, EvAttachmentBarClass))
-#define EV_IS_ATTACHMENT_BAR(object)        (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_ATTACHMENT_BAR))
-#define EV_IS_ATTACHMENT_BAR_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_ATTACHMENT_BAR))
-#define EV_ATTACHMENT_BAR_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_ATTACHMENT_BAR, EvAttachmentBarClass))
-
-struct _EvAttachmentBar {
-       GtkExpander base_instance;
-
-       EvAttachmentBarPrivate *priv;
-};
-
-struct _EvAttachmentBarClass {
-       GtkExpanderClass base_class;
-
-       /* Signals */
-       void (*popup_menu) (EvAttachmentBar *ev_attachbar,
-                           EvAttachment    *attachment);
-};
-
-GType      ev_attachment_bar_get_type     (void) G_GNUC_CONST;
-GtkWidget *ev_attachment_bar_new          (void);
-
-void       ev_attachment_bar_set_document (EvAttachmentBar *ev_attachbar,
-                                          EvDocument      *document);
-
-G_END_DECLS
-
-#endif /* __EV_ATTACHMENT_BAR_H__ */
similarity index 73%
rename from shell/ev-attachment-bar.c
rename to shell/ev-sidebar-attachments.c
index cdeba899fafac559c170331a3310af37f0726ce5..aac63cf7a5158fd3f67d73ad9b2f4a1ac79cd770 100644 (file)
@@ -1,4 +1,4 @@
-/* ev-attachment-bar.c
+/* ev-sidebar-attachments.c
  *  this file is part of evince, a gnome document viewer
  *
  * Copyright (C) 2006 Carlos Garcia Campos
  *  this file is part of evince, a gnome document viewer
  *
  * Copyright (C) 2006 Carlos Garcia Campos
@@ -31,9 +31,8 @@
 #include <string.h>
 #include <libgnomeui/gnome-icon-lookup.h>
 
 #include <string.h>
 #include <libgnomeui/gnome-icon-lookup.h>
 
-#include "ev-attachment-bar.h"
-
-#define MIN_HEIGHT 92
+#include "ev-sidebar-attachments.h"
+#include "ev-sidebar-page.h"
 
 enum {
        COLUMN_ICON,
 
 enum {
        COLUMN_ICON,
@@ -43,6 +42,12 @@ enum {
        N_COLS
 };
 
        N_COLS
 };
 
+
+enum {
+       PROP_0,
+       PROP_WIDGET,
+};
+
 enum {
        SIGNAL_POPUP_MENU,
        N_SIGNALS
 enum {
        SIGNAL_POPUP_MENU,
        N_SIGNALS
@@ -54,8 +59,7 @@ static const GtkTargetEntry drag_targets[] = {
 
 static guint signals[N_SIGNALS];
 
 
 static guint signals[N_SIGNALS];
 
-struct _EvAttachmentBarPrivate {
-       GtkWidget      *label;
+struct _EvSidebarAttachmentsPrivate {
        GtkWidget      *icon_view;
        GtkListStore   *model;
 
        GtkWidget      *icon_view;
        GtkListStore   *model;
 
@@ -64,14 +68,21 @@ struct _EvAttachmentBarPrivate {
        GHashTable     *icon_cache;
 };
 
        GHashTable     *icon_cache;
 };
 
-G_DEFINE_TYPE (EvAttachmentBar, ev_attachment_bar, GTK_TYPE_EXPANDER)
+static void ev_sidebar_attachments_page_iface_init (EvSidebarPageIface *iface);
+
+G_DEFINE_TYPE_EXTENDED (EvSidebarAttachments,
+                        ev_sidebar_attachments,
+                        GTK_TYPE_VBOX,
+                        0, 
+                        G_IMPLEMENT_INTERFACE (EV_TYPE_SIDEBAR_PAGE, 
+                                              ev_sidebar_attachments_page_iface_init))
 
 
-#define EV_ATTACHMENT_BAR_GET_PRIVATE(object) \
-                (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_ATTACHMENT_BAR, EvAttachmentBarPrivate))
+#define EV_SIDEBAR_ATTACHMENTS_GET_PRIVATE(object) \
+                (G_TYPE_INSTANCE_GET_PRIVATE ((object), EV_TYPE_SIDEBAR_ATTACHMENTS, EvSidebarAttachmentsPrivate))
 
 /* Icon cache */
 static void
 
 /* Icon cache */
 static void
-ev_attachment_bar_icon_cache_add (EvAttachmentBar *ev_attachbar,
+ev_sidebar_attachments_icon_cache_add (EvSidebarAttachments *ev_attachbar,
                                  const gchar     *mime_type,
                                  const GdkPixbuf *pixbuf)
 {
                                  const gchar     *mime_type,
                                  const GdkPixbuf *pixbuf)
 {
@@ -106,7 +117,7 @@ icon_theme_get_pixbuf_from_mime_type (GtkIconTheme *icon_theme,
 }
 
 static GdkPixbuf *
 }
 
 static GdkPixbuf *
-ev_attachment_bar_icon_cache_get (EvAttachmentBar *ev_attachbar,
+ev_sidebar_attachments_icon_cache_get (EvSidebarAttachments *ev_attachbar,
                                  const gchar     *mime_type)
 {
        GdkPixbuf *pixbuf = NULL;
                                  const gchar     *mime_type)
 {
        GdkPixbuf *pixbuf = NULL;
@@ -123,7 +134,7 @@ ev_attachment_bar_icon_cache_get (EvAttachmentBar *ev_attachbar,
                                                       mime_type);
 
        if (GDK_IS_PIXBUF (pixbuf))
                                                       mime_type);
 
        if (GDK_IS_PIXBUF (pixbuf))
-               ev_attachment_bar_icon_cache_add (ev_attachbar,
+               ev_sidebar_attachments_icon_cache_add (ev_attachbar,
                                                  mime_type,
                                                  pixbuf);
 
                                                  mime_type,
                                                  pixbuf);
 
@@ -133,14 +144,14 @@ ev_attachment_bar_icon_cache_get (EvAttachmentBar *ev_attachbar,
 static gboolean
 icon_cache_update_icon (gchar           *key,
                        GdkPixbuf       *value,
 static gboolean
 icon_cache_update_icon (gchar           *key,
                        GdkPixbuf       *value,
-                       EvAttachmentBar *ev_attachbar)
+                       EvSidebarAttachments *ev_attachbar)
 {
        GdkPixbuf *pixbuf = NULL;
 
        pixbuf = icon_theme_get_pixbuf_from_mime_type (ev_attachbar->priv->icon_theme,
                                                       key);
 
 {
        GdkPixbuf *pixbuf = NULL;
 
        pixbuf = icon_theme_get_pixbuf_from_mime_type (ev_attachbar->priv->icon_theme,
                                                       key);
 
-       ev_attachment_bar_icon_cache_add (ev_attachbar,
+       ev_sidebar_attachments_icon_cache_add (ev_attachbar,
                                          key,
                                          pixbuf);
        
                                          key,
                                          pixbuf);
        
@@ -148,35 +159,15 @@ icon_cache_update_icon (gchar           *key,
 }
 
 static void
 }
 
 static void
-ev_attachment_bar_icon_cache_refresh (EvAttachmentBar *ev_attachbar)
+ev_sidebar_attachments_icon_cache_refresh (EvSidebarAttachments *ev_attachbar)
 {
        g_hash_table_foreach_remove (ev_attachbar->priv->icon_cache,
                                     (GHRFunc) icon_cache_update_icon,
                                     ev_attachbar);
 }
 
 {
        g_hash_table_foreach_remove (ev_attachbar->priv->icon_cache,
                                     (GHRFunc) icon_cache_update_icon,
                                     ev_attachbar);
 }
 
-static void
-ev_attachment_bar_toggled (GObject    *object,
-                          GParamSpec *param_spec,
-                          gpointer    user_data)
-{
-       EvAttachmentBar *attachbar = EV_ATTACHMENT_BAR (object);
-       GtkExpander     *expander = GTK_EXPANDER (object);
-
-       if (!attachbar->priv->label)
-               return;
-       
-       if (gtk_expander_get_expanded (expander)) {
-               gtk_label_set_text (GTK_LABEL (attachbar->priv->label),
-                                   _("Hide attachments bar"));
-       } else {
-               gtk_label_set_text (GTK_LABEL (attachbar->priv->label),
-                                   _("Show attachments bar"));
-       }
-}
-
 static EvAttachment *
 static EvAttachment *
-ev_attachment_bar_get_attachment_at_pos (EvAttachmentBar *ev_attachbar,
+ev_sidebar_attachments_get_attachment_at_pos (EvSidebarAttachments *ev_attachbar,
                                         gint             x,
                                         gint             y)
 {
                                         gint             x,
                                         gint             y)
 {
@@ -205,7 +196,7 @@ ev_attachment_bar_get_attachment_at_pos (EvAttachmentBar *ev_attachbar,
 }
 
 static gboolean
 }
 
 static gboolean
-ev_attachment_bar_popup_menu_show (EvAttachmentBar *ev_attachbar,
+ev_sidebar_attachments_popup_menu_show (EvSidebarAttachments *ev_attachbar,
                                   gint             x,
                                   gint             y)
 {
                                   gint             x,
                                   gint             y)
 {
@@ -260,18 +251,18 @@ ev_attachment_bar_popup_menu_show (EvAttachmentBar *ev_attachbar,
 }
 
 static gboolean
 }
 
 static gboolean
-ev_attachment_bar_popup_menu (GtkWidget *widget)
+ev_sidebar_attachments_popup_menu (GtkWidget *widget)
 {
 {
-       EvAttachmentBar *ev_attachbar = EV_ATTACHMENT_BAR (widget);
+       EvSidebarAttachments *ev_attachbar = EV_SIDEBAR_ATTACHMENTS (widget);
        gint             x, y;
 
        gtk_widget_get_pointer (widget, &x, &y);
 
        gint             x, y;
 
        gtk_widget_get_pointer (widget, &x, &y);
 
-       return ev_attachment_bar_popup_menu_show (ev_attachbar, x, y);
+       return ev_sidebar_attachments_popup_menu_show (ev_attachbar, x, y);
 }
 
 static gboolean
 }
 
 static gboolean
-ev_attachment_bar_button_press (EvAttachmentBar *ev_attachbar,
+ev_sidebar_attachments_button_press (EvSidebarAttachments *ev_attachbar,
                                GdkEventButton  *event,
                                GtkWidget       *icon_view)
 {
                                GdkEventButton  *event,
                                GtkWidget       *icon_view)
 {
@@ -288,7 +279,7 @@ ev_attachment_bar_button_press (EvAttachmentBar *ev_attachbar,
                        GError *error = NULL;
                        EvAttachment *attachment;
 
                        GError *error = NULL;
                        EvAttachment *attachment;
 
-                       attachment = ev_attachment_bar_get_attachment_at_pos (ev_attachbar,
+                       attachment = ev_sidebar_attachments_get_attachment_at_pos (ev_attachbar,
                                                                              event->x,
                                                                              event->y);
                        if (!attachment)
                                                                              event->x,
                                                                              event->y);
                        if (!attachment)
@@ -307,32 +298,20 @@ ev_attachment_bar_button_press (EvAttachmentBar *ev_attachbar,
                }
                break;
        case 3: 
                }
                break;
        case 3: 
-               return ev_attachment_bar_popup_menu_show (ev_attachbar, event->x, event->y);
+               return ev_sidebar_attachments_popup_menu_show (ev_attachbar, event->x, event->y);
        }
 
        return FALSE;
 }
 
        }
 
        return FALSE;
 }
 
-static gboolean
-ev_attachment_bar_focus_in (GtkWidget     *widget,
-                           GdkEventFocus *event)
-{
-       EvAttachmentBar *ev_attachbar = EV_ATTACHMENT_BAR (widget);
-
-       if (gtk_expander_get_expanded (GTK_EXPANDER (ev_attachbar)))
-               gtk_widget_grab_focus (ev_attachbar->priv->icon_view);
-
-       return TRUE;
-}
-
 static void
 static void
-ev_attachment_bar_update_icons (EvAttachmentBar *ev_attachbar,
+ev_sidebar_attachments_update_icons (EvSidebarAttachments *ev_attachbar,
                                gpointer         user_data)
 {
        GtkTreeIter iter;
        gboolean    valid;
 
                                gpointer         user_data)
 {
        GtkTreeIter iter;
        gboolean    valid;
 
-       ev_attachment_bar_icon_cache_refresh (ev_attachbar);
+       ev_sidebar_attachments_icon_cache_refresh (ev_attachbar);
        
        valid = gtk_tree_model_get_iter_first (
                GTK_TREE_MODEL (ev_attachbar->priv->model),
        
        valid = gtk_tree_model_get_iter_first (
                GTK_TREE_MODEL (ev_attachbar->priv->model),
@@ -352,7 +331,7 @@ ev_attachment_bar_update_icons (EvAttachmentBar *ev_attachbar,
                if (attachment)
                        g_object_unref (attachment);
 
                if (attachment)
                        g_object_unref (attachment);
 
-               pixbuf = ev_attachment_bar_icon_cache_get (ev_attachbar,
+               pixbuf = ev_sidebar_attachments_icon_cache_get (ev_attachbar,
                                                           mime_type);
 
                gtk_list_store_set (ev_attachbar->priv->model, &iter,
                                                           mime_type);
 
                gtk_list_store_set (ev_attachbar->priv->model, &iter,
@@ -366,14 +345,14 @@ ev_attachment_bar_update_icons (EvAttachmentBar *ev_attachbar,
 }
 
 static void
 }
 
 static void
-ev_attachment_bar_drag_data_get (GtkWidget        *widget,
+ev_sidebar_attachments_drag_data_get (GtkWidget        *widget,
                                 GdkDragContext   *drag_context,
                                 GtkSelectionData *data,
                                 guint             info,
                                 guint             time,
                                 gpointer          user_data)
 {
                                 GdkDragContext   *drag_context,
                                 GtkSelectionData *data,
                                 guint             info,
                                 guint             time,
                                 gpointer          user_data)
 {
-       EvAttachmentBar *ev_attachbar = EV_ATTACHMENT_BAR (user_data);
+       EvSidebarAttachments *ev_attachbar = EV_SIDEBAR_ATTACHMENTS (user_data);
        GString         *uri_list;
        gchar           *uris = NULL;
        GList           *selected = NULL, *l;
        GString         *uri_list;
        gchar           *uris = NULL;
        GList           *selected = NULL, *l;
@@ -434,9 +413,30 @@ ev_attachment_bar_drag_data_get (GtkWidget        *widget,
 }
 
 static void
 }
 
 static void
-ev_attachment_bar_destroy (GtkObject *object)
+ev_sidebar_attachments_get_property (GObject    *object,
+                                    guint       prop_id,
+                                    GValue     *value,
+                                    GParamSpec *pspec)
+{
+       EvSidebarAttachments *ev_sidebar_attachments;
+  
+       ev_sidebar_attachments = EV_SIDEBAR_ATTACHMENTS (object);
+
+       switch (prop_id)
+       {
+       case PROP_WIDGET:
+               g_value_set_object (value, ev_sidebar_attachments->priv->icon_view);
+               break;
+       default:
+               G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+               break;
+       }
+}
+
+static void
+ev_sidebar_attachments_destroy (GtkObject *object)
 {
 {
-       EvAttachmentBar *ev_attachbar = EV_ATTACHMENT_BAR (object);
+       EvSidebarAttachments *ev_attachbar = EV_SIDEBAR_ATTACHMENTS (object);
 
        if (ev_attachbar->priv->model) {
                g_object_unref (ev_attachbar->priv->model);
 
        if (ev_attachbar->priv->model) {
                g_object_unref (ev_attachbar->priv->model);
@@ -448,11 +448,11 @@ ev_attachment_bar_destroy (GtkObject *object)
                ev_attachbar->priv->icon_cache = NULL;
        }
 
                ev_attachbar->priv->icon_cache = NULL;
        }
 
-       (* GTK_OBJECT_CLASS (ev_attachment_bar_parent_class)->destroy) (object);
+       (* GTK_OBJECT_CLASS (ev_sidebar_attachments_parent_class)->destroy) (object);
 }
 
 static void
 }
 
 static void
-ev_attachment_bar_class_init (EvAttachmentBarClass *ev_attachbar_class)
+ev_sidebar_attachments_class_init (EvSidebarAttachmentsClass *ev_attachbar_class)
 {
        GObjectClass   *g_object_class;
        GtkObjectClass *gtk_object_class;
 {
        GObjectClass   *g_object_class;
        GtkObjectClass *gtk_object_class;
@@ -462,30 +462,34 @@ ev_attachment_bar_class_init (EvAttachmentBarClass *ev_attachbar_class)
        gtk_object_class = GTK_OBJECT_CLASS (ev_attachbar_class);
        gtk_widget_class = GTK_WIDGET_CLASS (ev_attachbar_class);
 
        gtk_object_class = GTK_OBJECT_CLASS (ev_attachbar_class);
        gtk_widget_class = GTK_WIDGET_CLASS (ev_attachbar_class);
 
-       gtk_object_class->destroy = ev_attachment_bar_destroy;
-       gtk_widget_class->popup_menu = ev_attachment_bar_popup_menu;
-       gtk_widget_class->focus_in_event = ev_attachment_bar_focus_in;
+       g_object_class->get_property = ev_sidebar_attachments_get_property;
+       gtk_object_class->destroy = ev_sidebar_attachments_destroy;
+       gtk_widget_class->popup_menu = ev_sidebar_attachments_popup_menu;
 
 
-       g_type_class_add_private (g_object_class, sizeof (EvAttachmentBarPrivate));
+       g_type_class_add_private (g_object_class, sizeof (EvSidebarAttachmentsPrivate));
 
        /* Signals */
        signals[SIGNAL_POPUP_MENU] =
                g_signal_new ("popup",
                              G_TYPE_FROM_CLASS (g_object_class),
                              G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
 
        /* Signals */
        signals[SIGNAL_POPUP_MENU] =
                g_signal_new ("popup",
                              G_TYPE_FROM_CLASS (g_object_class),
                              G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
-                             G_STRUCT_OFFSET (EvAttachmentBarClass, popup_menu),
+                             G_STRUCT_OFFSET (EvSidebarAttachmentsClass, popup_menu),
                              NULL, NULL,
                              g_cclosure_marshal_VOID__POINTER,
                              G_TYPE_NONE, 1,
                              G_TYPE_POINTER);
                              NULL, NULL,
                              g_cclosure_marshal_VOID__POINTER,
                              G_TYPE_NONE, 1,
                              G_TYPE_POINTER);
+
+       g_object_class_override_property (g_object_class,
+                                         PROP_WIDGET,
+                                         "main-widget");
 }
 
 static void
 }
 
 static void
-ev_attachment_bar_init (EvAttachmentBar *ev_attachbar)
+ev_sidebar_attachments_init (EvSidebarAttachments *ev_attachbar)
 {
        GtkWidget *swindow;
        
 {
        GtkWidget *swindow;
        
-       ev_attachbar->priv = EV_ATTACHMENT_BAR_GET_PRIVATE (ev_attachbar);
+       ev_attachbar->priv = EV_SIDEBAR_ATTACHMENTS_GET_PRIVATE (ev_attachbar);
 
        swindow = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
 
        swindow = gtk_scrolled_window_new (NULL, NULL);
        gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swindow),
@@ -493,8 +497,6 @@ ev_attachment_bar_init (EvAttachmentBar *ev_attachbar)
                                        GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
                                             GTK_SHADOW_IN);
                                        GTK_POLICY_AUTOMATIC);
        gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swindow),
                                             GTK_SHADOW_IN);
-       gtk_widget_set_size_request (swindow, -1, MIN_HEIGHT);
-
        /* Data Model */
        ev_attachbar->priv->model = gtk_list_store_new (N_COLS,
                                                        GDK_TYPE_PIXBUF, 
        /* Data Model */
        ev_attachbar->priv->model = gtk_list_store_new (N_COLS,
                                                        GDK_TYPE_PIXBUF, 
@@ -514,7 +516,7 @@ ev_attachment_bar_init (EvAttachmentBar *ev_attachbar)
                      NULL);
        g_signal_connect_swapped (G_OBJECT (ev_attachbar->priv->icon_view),
                                  "button-press-event",
                      NULL);
        g_signal_connect_swapped (G_OBJECT (ev_attachbar->priv->icon_view),
                                  "button-press-event",
-                                 G_CALLBACK (ev_attachment_bar_button_press),
+                                 G_CALLBACK (ev_sidebar_attachments_button_press),
                                  (gpointer) ev_attachbar);
 
        gtk_container_add (GTK_CONTAINER (swindow),
                                  (gpointer) ev_attachbar);
 
        gtk_container_add (GTK_CONTAINER (swindow),
@@ -529,7 +531,7 @@ ev_attachment_bar_init (EvAttachmentBar *ev_attachbar)
        ev_attachbar->priv->icon_theme = gtk_icon_theme_get_default ();
        g_signal_connect_swapped (G_OBJECT (ev_attachbar->priv->icon_theme),
                                  "changed",
        ev_attachbar->priv->icon_theme = gtk_icon_theme_get_default ();
        g_signal_connect_swapped (G_OBJECT (ev_attachbar->priv->icon_theme),
                                  "changed",
-                                 G_CALLBACK (ev_attachment_bar_update_icons),
+                                 G_CALLBACK (ev_sidebar_attachments_update_icons),
                                  (gpointer) ev_attachbar);
 
        /* Icon Cache */
                                  (gpointer) ev_attachbar);
 
        /* Icon Cache */
@@ -549,56 +551,25 @@ ev_attachment_bar_init (EvAttachmentBar *ev_attachbar)
 #endif
        g_signal_connect (G_OBJECT (ev_attachbar->priv->icon_view),
                          "drag-data-get",
 #endif
        g_signal_connect (G_OBJECT (ev_attachbar->priv->icon_view),
                          "drag-data-get",
-                         G_CALLBACK (ev_attachment_bar_drag_data_get),
-                         (gpointer) ev_attachbar);
-
-       g_signal_connect (G_OBJECT (ev_attachbar),
-                         "notify::expanded",
-                         G_CALLBACK (ev_attachment_bar_toggled),
-                         NULL);
-       
-}
-
-static void
-ev_attachment_bar_setup (EvAttachmentBar *ev_attachbar)
-{
-       GtkWidget *hbox;
-       GtkWidget *image;
-
-       hbox = gtk_hbox_new (FALSE, 6);
-       image = gtk_image_new_from_stock ("gnome-stock-attach",
-                                         GTK_ICON_SIZE_MENU);
-       gtk_box_pack_start (GTK_BOX (hbox),
-                           image,
-                           FALSE, FALSE, 0);
-       gtk_widget_show (image);
-
-       ev_attachbar->priv->label = gtk_label_new (_("Show attachments bar"));
-       gtk_box_pack_start (GTK_BOX (hbox),
-                           ev_attachbar->priv->label,
-                           FALSE, FALSE, 0);
-       gtk_widget_show (ev_attachbar->priv->label);
-
-       gtk_expander_set_label_widget (GTK_EXPANDER (ev_attachbar), hbox);
-       gtk_widget_show (hbox);
+                         G_CALLBACK (ev_sidebar_attachments_drag_data_get),
+                         (gpointer) ev_attachbar);     
 }
 
 GtkWidget *
 }
 
 GtkWidget *
-ev_attachment_bar_new (void)
+ev_sidebar_attachments_new (void)
 {
        GtkWidget *ev_attachbar;
 
 {
        GtkWidget *ev_attachbar;
 
-       ev_attachbar = g_object_new (EV_TYPE_ATTACHMENT_BAR, NULL);
-
-       ev_attachment_bar_setup (EV_ATTACHMENT_BAR (ev_attachbar));
+       ev_attachbar = g_object_new (EV_TYPE_SIDEBAR_ATTACHMENTS, NULL);
 
        return ev_attachbar;
 }
 
 
        return ev_attachbar;
 }
 
-void
-ev_attachment_bar_set_document (EvAttachmentBar *ev_attachbar,
-                               EvDocument      *document)
+static void
+ev_sidebar_attachments_set_document (EvSidebarPage   *page,
+                                    EvDocument      *document)
 {
 {
+       EvSidebarAttachments *ev_attachbar = EV_SIDEBAR_ATTACHMENTS (page);
        GList *attachments = NULL;
        GList *l;
        
        GList *attachments = NULL;
        GList *l;
        
@@ -618,7 +589,7 @@ ev_attachment_bar_set_document (EvAttachmentBar *ev_attachbar,
                attachment = EV_ATTACHMENT (l->data);
 
                mime_type = ev_attachment_get_mime_type (attachment);
                attachment = EV_ATTACHMENT (l->data);
 
                mime_type = ev_attachment_get_mime_type (attachment);
-               pixbuf = ev_attachment_bar_icon_cache_get (ev_attachbar,
+               pixbuf = ev_sidebar_attachments_icon_cache_get (ev_attachbar,
                                                           mime_type);
 
                gtk_list_store_append (ev_attachbar->priv->model, &iter);
                                                           mime_type);
 
                gtk_list_store_append (ev_attachbar->priv->model, &iter);
@@ -633,3 +604,25 @@ ev_attachment_bar_set_document (EvAttachmentBar *ev_attachbar,
 
        g_list_free (attachments);
 }
 
        g_list_free (attachments);
 }
+
+static gboolean
+ev_sidebar_attachments_support_document (EvSidebarPage   *sidebar_page,
+                                       EvDocument *document)
+{
+       return ev_document_has_attachments (document);
+}
+
+static const gchar*
+ev_sidebar_attachments_get_label (EvSidebarPage *sidebar_page)
+{
+    return _("Attachments");
+}
+
+static void
+ev_sidebar_attachments_page_iface_init (EvSidebarPageIface *iface)
+{
+       iface->support_document = ev_sidebar_attachments_support_document;
+       iface->set_document = ev_sidebar_attachments_set_document;
+       iface->get_label = ev_sidebar_attachments_get_label;
+}
+
diff --git a/shell/ev-sidebar-attachments.h b/shell/ev-sidebar-attachments.h
new file mode 100644 (file)
index 0000000..9f34b0c
--- /dev/null
@@ -0,0 +1,62 @@
+/* ev-sidebar-attachments.h
+ *  this file is part of evince, a gnome document viewer
+ *
+ * Copyright (C) 2006 Carlos Garcia Campos
+ *
+ * Author:
+ *   Carlos Garcia Campos <carlosgc@gnome.org>
+ *
+ * Evince 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.
+ *
+ * Evince 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_ATTACHMENTS_H__
+#define __EV_SIDEBAR_ATTACHMENTS_H__
+
+#include "ev-attachment.h"
+#include "ev-document.h"
+
+G_BEGIN_DECLS
+
+typedef struct _EvSidebarAttachments        EvSidebarAttachments;
+typedef struct _EvSidebarAttachmentsClass   EvSidebarAttachmentsClass;
+typedef struct _EvSidebarAttachmentsPrivate EvSidebarAttachmentsPrivate;
+
+#define EV_TYPE_SIDEBAR_ATTACHMENTS              (ev_sidebar_attachments_get_type())
+#define EV_SIDEBAR_ATTACHMENTS(object)           (G_TYPE_CHECK_INSTANCE_CAST((object), EV_TYPE_SIDEBAR_ATTACHMENTS, EvSidebarAttachments))
+#define EV_SIDEBAR_ATTACHMENTS_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST((klass), EV_TYPE_SIDEBAR_ATTACHMENTS, EvSidebarAttachmentsClass))
+#define EV_IS_SIDEBAR_ATTACHMENTS(object)        (G_TYPE_CHECK_INSTANCE_TYPE((object), EV_TYPE_SIDEBAR_ATTACHMENTS))
+#define EV_IS_SIDEBAR_ATTACHMENTS_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE((klass), EV_TYPE_SIDEBAR_ATTACHMENTS))
+#define EV_SIDEBAR_ATTACHMENTS_GET_CLASS(object) (G_TYPE_INSTANCE_GET_CLASS((object), EV_TYPE_SIDEBAR_ATTACHMENTS, EvSidebarAttachmentsClass))
+
+struct _EvSidebarAttachments {
+       GtkVBox base_instance;
+
+       EvSidebarAttachmentsPrivate *priv;
+};
+
+struct _EvSidebarAttachmentsClass {
+       GtkVBoxClass base_class;
+
+       /* Signals */
+       void (*popup_menu) (EvSidebarAttachments *ev_attachbar,
+                           EvAttachment    *attachment);
+};
+
+GType      ev_sidebar_attachments_get_type     (void) G_GNUC_CONST;
+GtkWidget *ev_sidebar_attachments_new          (void);
+
+G_END_DECLS
+
+#endif /* __EV_SIDEBAR_ATTACHMENTS_H__ */
index 169eb799d5e9ae02206093ca04140b39ba5ed287..1bfb26f636c05b491015de20d90d17051b32a8c6 100644 (file)
 #include "ev-page-action.h"
 #include "ev-sidebar.h"
 #include "ev-sidebar-links.h"
 #include "ev-page-action.h"
 #include "ev-sidebar.h"
 #include "ev-sidebar-links.h"
+#include "ev-sidebar-attachments.h"
 #include "ev-sidebar-thumbnails.h"
 #include "ev-view.h"
 #include "ev-password.h"
 #include "ev-password-view.h"
 #include "ev-sidebar-thumbnails.h"
 #include "ev-view.h"
 #include "ev-password.h"
 #include "ev-password-view.h"
-#include "ev-attachment-bar.h"
 #include "ev-properties-dialog.h"
 #include "ev-ps-exporter.h"
 #include "ev-document-thumbnails.h"
 #include "ev-properties-dialog.h"
 #include "ev-ps-exporter.h"
 #include "ev-document-thumbnails.h"
@@ -92,7 +92,6 @@ typedef enum {
        EV_CHROME_RAISE_TOOLBAR = 1 << 3,
        EV_CHROME_FULLSCREEN_TOOLBAR    = 1 << 4,
        EV_CHROME_SIDEBAR       = 1 << 5,
        EV_CHROME_RAISE_TOOLBAR = 1 << 3,
        EV_CHROME_FULLSCREEN_TOOLBAR    = 1 << 4,
        EV_CHROME_SIDEBAR       = 1 << 5,
-       EV_CHROME_ATTACHBAR     = 1 << 6,
        EV_CHROME_NORMAL        = EV_CHROME_MENUBAR | EV_CHROME_TOOLBAR | EV_CHROME_SIDEBAR
 } EvChrome;
 
        EV_CHROME_NORMAL        = EV_CHROME_MENUBAR | EV_CHROME_TOOLBAR | EV_CHROME_SIDEBAR
 } EvChrome;
 
@@ -112,7 +111,7 @@ struct _EvWindowPrivate {
        GtkWidget *password_view;
        GtkWidget *sidebar_thumbs;
        GtkWidget *sidebar_links;
        GtkWidget *password_view;
        GtkWidget *sidebar_thumbs;
        GtkWidget *sidebar_links;
-       GtkWidget *attachment_bar;
+       GtkWidget *sidebar_attachments;
 
        /* Dialogs */
        GtkWidget *properties;
 
        /* Dialogs */
        GtkWidget *properties;
@@ -178,6 +177,7 @@ static const GtkTargetEntry ev_drop_types[] = {
 #define SIDEBAR_DEFAULT_SIZE    132
 #define LINKS_SIDEBAR_ID "links"
 #define THUMBNAILS_SIDEBAR_ID "thumbnails"
 #define SIDEBAR_DEFAULT_SIZE    132
 #define LINKS_SIDEBAR_ID "links"
 #define THUMBNAILS_SIDEBAR_ID "thumbnails"
+#define ATTACHMENTS_SIDEBAR_ID "attachments"
 
 static void    ev_window_update_actions                (EvWindow *ev_window);
 static void     ev_window_update_fullscreen_popup       (EvWindow         *window);
 
 static void    ev_window_update_actions                (EvWindow *ev_window);
 static void     ev_window_update_fullscreen_popup       (EvWindow         *window);
@@ -419,7 +419,7 @@ static void
 update_chrome_visibility (EvWindow *window)
 {
        EvWindowPrivate *priv = window->priv;
 update_chrome_visibility (EvWindow *window)
 {
        EvWindowPrivate *priv = window->priv;
-       gboolean menubar, toolbar, findbar, fullscreen_toolbar, sidebar, attachbar;
+       gboolean menubar, toolbar, findbar, fullscreen_toolbar, sidebar;
        gboolean fullscreen_mode, presentation, fullscreen;
 
        presentation = ev_view_get_presentation (EV_VIEW (priv->view));
        gboolean fullscreen_mode, presentation, fullscreen;
 
        presentation = ev_view_get_presentation (EV_VIEW (priv->view));
@@ -433,13 +433,11 @@ update_chrome_visibility (EvWindow *window)
                              (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && fullscreen;
        findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
        sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && !fullscreen_mode;
                              (priv->chrome & EV_CHROME_RAISE_TOOLBAR) != 0) && fullscreen;
        findbar = (priv->chrome & EV_CHROME_FINDBAR) != 0;
        sidebar = (priv->chrome & EV_CHROME_SIDEBAR) != 0 && !fullscreen_mode;
-       attachbar = (priv->chrome & EV_CHROME_ATTACHBAR) != 0 && !fullscreen_mode;
 
        set_widget_visibility (priv->menubar, menubar); 
        set_widget_visibility (priv->toolbar_dock, toolbar);
        set_widget_visibility (priv->find_bar, findbar);
        set_widget_visibility (priv->sidebar, sidebar);
 
        set_widget_visibility (priv->menubar, menubar); 
        set_widget_visibility (priv->toolbar_dock, toolbar);
        set_widget_visibility (priv->find_bar, findbar);
        set_widget_visibility (priv->sidebar, sidebar);
-       set_widget_visibility (priv->attachment_bar, attachbar);
 
        ev_window_set_action_sensitive (window, "EditToolbar", toolbar);
        gtk_widget_set_sensitive (priv->menubar, menubar);
 
        ev_window_set_action_sensitive (window, "EditToolbar", toolbar);
        gtk_widget_set_sensitive (priv->menubar, menubar);
@@ -626,6 +624,7 @@ setup_sidebar_from_metadata (EvWindow *window, EvDocument *document)
        GtkWidget *sidebar = window->priv->sidebar;
        GtkWidget *links = window->priv->sidebar_links;
        GtkWidget *thumbs = window->priv->sidebar_thumbs;
        GtkWidget *sidebar = window->priv->sidebar;
        GtkWidget *links = window->priv->sidebar_links;
        GtkWidget *thumbs = window->priv->sidebar_thumbs;
+       GtkWidget *attachments = window->priv->sidebar_attachments;
        GValue sidebar_size = { 0, };
        GValue sidebar_page = { 0, };
        GValue sidebar_visibility = { 0, };
        GValue sidebar_size = { 0, };
        GValue sidebar_page = { 0, };
        GValue sidebar_visibility = { 0, };
@@ -638,9 +637,11 @@ setup_sidebar_from_metadata (EvWindow *window, EvDocument *document)
        if (ev_metadata_manager_get (uri, "sidebar_page", &sidebar_page, FALSE)) {
                const char *page_id = g_value_get_string (&sidebar_page);
 
        if (ev_metadata_manager_get (uri, "sidebar_page", &sidebar_page, FALSE)) {
                const char *page_id = g_value_get_string (&sidebar_page);
 
-               if (strcmp (page_id, "links") == 0 && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (links), document)) {
+               if (strcmp (page_id, LINKS_SIDEBAR_ID) == 0 && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (links), document)) {
                        ev_sidebar_set_page (EV_SIDEBAR (sidebar), links);
                        ev_sidebar_set_page (EV_SIDEBAR (sidebar), links);
-               } else if (strcmp (page_id, "thumbnails") && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (thumbs), document)) {
+               } else if (strcmp (page_id, THUMBNAILS_SIDEBAR_ID) && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (thumbs), document)) {
+                       ev_sidebar_set_page (EV_SIDEBAR (sidebar), thumbs);
+               } else if (strcmp (page_id, ATTACHMENTS_SIDEBAR_ID) && ev_sidebar_page_support_document (EV_SIDEBAR_PAGE (attachments), document)) {
                        ev_sidebar_set_page (EV_SIDEBAR (sidebar), thumbs);
                }
        } else {
                        ev_sidebar_set_page (EV_SIDEBAR (sidebar), thumbs);
                }
        } else {
@@ -764,7 +765,6 @@ ev_window_setup_document (EvWindow *ev_window)
        EvDocument *document;
        EvView *view = EV_VIEW (ev_window->priv->view);
        EvSidebar *sidebar = EV_SIDEBAR (ev_window->priv->sidebar);
        EvDocument *document;
        EvView *view = EV_VIEW (ev_window->priv->view);
        EvSidebar *sidebar = EV_SIDEBAR (ev_window->priv->sidebar);
-       EvAttachmentBar *attachbar = EV_ATTACHMENT_BAR (ev_window->priv->attachment_bar);
        GtkAction *action;
 
        document = ev_window->priv->document;
        GtkAction *action;
 
        document = ev_window->priv->document;
@@ -785,11 +785,6 @@ ev_window_setup_document (EvWindow *ev_window)
        }
        ev_window_set_page_mode (ev_window, PAGE_MODE_DOCUMENT);
 
        }
        ev_window_set_page_mode (ev_window, PAGE_MODE_DOCUMENT);
 
-       ev_attachment_bar_set_document (attachbar, document);
-       update_chrome_flag (ev_window, EV_CHROME_ATTACHBAR, 
-                          (ev_window->priv->document &&
-                           ev_document_has_attachments (ev_window->priv->document)));
-
        ev_window_title_set_document (ev_window->priv->title, document);
        ev_window_title_set_uri (ev_window->priv->title, ev_window->priv->uri);
 
        ev_window_title_set_document (ev_window->priv->title, document);
        ev_window_title_set_uri (ev_window->priv->title, ev_window->priv->uri);
 
@@ -2460,6 +2455,8 @@ ev_window_sidebar_current_page_changed_cb (EvSidebar  *ev_sidebar,
                id = LINKS_SIDEBAR_ID;
        } else if (current_page == ev_window->priv->sidebar_thumbs) {
                id = THUMBNAILS_SIDEBAR_ID;
                id = LINKS_SIDEBAR_ID;
        } else if (current_page == ev_window->priv->sidebar_thumbs) {
                id = THUMBNAILS_SIDEBAR_ID;
+       } else if (current_page == ev_window->priv->sidebar_attachments) {
+               id = ATTACHMENTS_SIDEBAR_ID;
        } else {
                g_assert_not_reached();
        }
        } else {
                g_assert_not_reached();
        }
@@ -2490,18 +2487,6 @@ ev_window_sidebar_visibility_changed_cb (EvSidebar  *ev_sidebar,
        }
 }
 
        }
 }
 
-static void
-ev_window_attachment_bar_toggled_cb (EvAttachmentBar *ev_attachbar,
-                                    GParamSpec      *param_spec,
-                                    EvWindow        *ev_window)
-{
-       if (gtk_expander_get_expanded (GTK_EXPANDER (ev_attachbar))) {
-               gtk_widget_grab_focus (GTK_WIDGET (ev_attachbar));
-       } else {
-               gtk_widget_grab_focus (ev_window->priv->view);
-       }
-}
-
 static gboolean
 view_menu_popup_cb (EvView   *view,
                    EvLink   *link,
 static gboolean
 view_menu_popup_cb (EvView   *view,
                    EvLink   *link,
@@ -2565,7 +2550,7 @@ view_menu_popup_cb (EvView   *view,
 }
 
 static gboolean
 }
 
 static gboolean
-attachment_bar_menu_popup_cb (EvAttachmentBar *attachbar,
+attachment_bar_menu_popup_cb (EvSidebarAttachments *attachbar,
                              GList           *attach_list,
                              EvWindow        *ev_window)
 {
                              GList           *attach_list,
                              EvWindow        *ev_window)
 {
@@ -3596,6 +3581,27 @@ ev_window_init (EvWindow *ev_window)
        gtk_widget_show (ev_window->priv->sidebar);
 
        /* Stub sidebar, for now */
        gtk_widget_show (ev_window->priv->sidebar);
 
        /* Stub sidebar, for now */
+
+       sidebar_widget = ev_sidebar_thumbnails_new ();
+       ev_window->priv->sidebar_thumbs = sidebar_widget;
+       g_signal_connect (sidebar_widget,
+                         "notify::main-widget",
+                         G_CALLBACK (sidebar_page_main_widget_update_cb),
+                         ev_window);
+       sidebar_page_main_widget_update_cb (G_OBJECT (sidebar_widget), NULL, ev_window);
+       gtk_widget_show (sidebar_widget);
+       ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
+                            sidebar_widget);
+
+       sidebar_widget = ev_sidebar_attachments_new ();
+       ev_window->priv->sidebar_attachments = sidebar_widget;
+       g_signal_connect_object (sidebar_widget,
+                                "popup",
+                                G_CALLBACK (attachment_bar_menu_popup_cb),
+                                ev_window, 0);
+       ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
+                            sidebar_widget);
+
        sidebar_widget = ev_sidebar_links_new ();
        ev_window->priv->sidebar_links = sidebar_widget;
        g_signal_connect (sidebar_widget,
        sidebar_widget = ev_sidebar_links_new ();
        ev_window->priv->sidebar_links = sidebar_widget;
        g_signal_connect (sidebar_widget,
@@ -3611,18 +3617,6 @@ ev_window_init (EvWindow *ev_window)
        ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
                             sidebar_widget);
 
        ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
                             sidebar_widget);
 
-       sidebar_widget = ev_sidebar_thumbnails_new ();
-       ev_window->priv->sidebar_thumbs = sidebar_widget;
-       g_signal_connect (sidebar_widget,
-                         "notify::main-widget",
-                         G_CALLBACK (sidebar_page_main_widget_update_cb),
-                         ev_window);
-       sidebar_page_main_widget_update_cb (G_OBJECT (sidebar_widget), NULL, ev_window);
-       gtk_widget_show (sidebar_widget);
-       ev_sidebar_add_page (EV_SIDEBAR (ev_window->priv->sidebar),
-                            sidebar_widget);
-
-
        ev_window->priv->scrolled_window =
                GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW,
                                          "shadow-type", GTK_SHADOW_IN,
        ev_window->priv->scrolled_window =
                GTK_WIDGET (g_object_new (GTK_TYPE_SCROLLED_WINDOW,
                                          "shadow-type", GTK_SHADOW_IN,
@@ -3654,16 +3648,6 @@ ev_window_init (EvWindow *ev_window)
        gtk_widget_show (ev_window->priv->view);
        gtk_widget_show (ev_window->priv->password_view);
 
        gtk_widget_show (ev_window->priv->view);
        gtk_widget_show (ev_window->priv->password_view);
 
-       /* Attachments Bar */
-       ev_window->priv->attachment_bar = ev_attachment_bar_new ();
-       gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
-                         ev_window->priv->attachment_bar,
-                         FALSE, TRUE, 0);
-       g_signal_connect_object (ev_window->priv->attachment_bar,
-                                "popup",
-                                G_CALLBACK (attachment_bar_menu_popup_cb),
-                                ev_window, 0);
-
        /* Find Bar */
        ev_window->priv->find_bar = egg_find_bar_new ();
        gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
        /* Find Bar */
        ev_window->priv->find_bar = egg_find_bar_new ();
        gtk_box_pack_end (GTK_BOX (ev_window->priv->main_box),
@@ -3716,12 +3700,6 @@ ev_window_init (EvWindow *ev_window)
                          G_CALLBACK (ev_window_sidebar_current_page_changed_cb),
                          ev_window);
 
                          G_CALLBACK (ev_window_sidebar_current_page_changed_cb),
                          ev_window);
 
-       /* Connect attachment bar sgignals */
-       g_signal_connect (G_OBJECT (ev_window->priv->attachment_bar),
-                         "notify::expanded",
-                         G_CALLBACK (ev_window_attachment_bar_toggled_cb),
-                         ev_window);
-
        /* Connect to find bar signals */
        g_signal_connect (ev_window->priv->find_bar,
                          "previous",
        /* Connect to find bar signals */
        g_signal_connect (ev_window->priv->find_bar,
                          "previous",
index 3bce3f91ea36b91dfe252468b4e95b8da7469c1b..981172b7134f0ff83f7e464e0decd2ed5f3bc28d 100644 (file)
@@ -24,7 +24,7 @@ if ENABLE_DJVU
 evince_thumbnailer_LDADD += $(DJVU_LIBS)
 endif
 
 evince_thumbnailer_LDADD += $(DJVU_LIBS)
 endif
 
-if ENABLE_DJVU
+if ENABLE_DVI
 evince_thumbnailer_LDADD += -lkpathsea
 endif
 
 evince_thumbnailer_LDADD += -lkpathsea
 endif