]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-window.c
only call ev_properties_fonts_set_document() if the document implements
[evince.git] / shell / ev-window.c
index 63b1b9c1e618cfdbe08fb7f216d0e64e880d4c57..854079b573e0888cfbb9a4c2929daeafce1adf06 100644 (file)
@@ -37,7 +37,8 @@
 #include "ev-password.h"
 #include "ev-password-view.h"
 #include "ev-print-job.h"
-#include "ev-properties.h"
+#include "ev-properties-dialog.h"
+#include "ev-ps-exporter.h"
 #include "ev-document-thumbnails.h"
 #include "ev-document-links.h"
 #include "ev-document-fonts.h"
@@ -107,7 +108,7 @@ struct _EvWindowPrivate {
        GtkWidget *sidebar_thumbs;
 
        /* Dialogs */
-       EvProperties *properties;
+       GtkWidget *properties;
 
        /* UI Builders */
        GtkActionGroup *action_group;
@@ -180,8 +181,8 @@ static void     ev_window_zoom_changed_cb           (EvView           *view,
                                                         EvWindow         *ev_window);
 static void     ev_window_add_recent                    (EvWindow         *window,
                                                         const char       *filename);
-static void     ev_window_fullscreen                    (EvWindow         *window);
-static void     ev_window_unfullscreen                  (EvWindow         *window);
+static void     ev_window_run_fullscreen                (EvWindow         *window);
+static void     ev_window_stop_fullscreen               (EvWindow         *window);
 static void     ev_window_cmd_view_fullscreen           (GtkAction        *action,
                                                         EvWindow         *window);
 static void     ev_window_run_presentation              (EvWindow         *window);
@@ -237,6 +238,9 @@ update_action_sensitivity (EvWindow *ev_window)
                ok_to_copy = (info->permissions & EV_DOCUMENT_PERMISSIONS_OK_TO_COPY);
        }
 
+       if (has_document && !EV_IS_PS_EXPORTER(document))
+               ok_to_print = FALSE;
+
        if (!info || info->fields_mask == 0) {
                has_properties = FALSE;
        }
@@ -623,7 +627,7 @@ update_document_mode (EvWindow *window, EvDocumentMode mode)
                ev_window_run_presentation (window);
        }
        else if (mode == EV_DOCUMENT_MODE_FULL_SCREEN) {
-               ev_window_fullscreen (window);
+               ev_window_run_fullscreen (window);
        }
 }
 
@@ -668,8 +672,8 @@ ev_window_setup_document (EvWindow *ev_window)
        update_document_mode (ev_window, info->mode);
 
        if (ev_window->priv->properties) {
-               ev_properties_set_document (ev_window->priv->properties,
-                                           ev_window->priv->document);
+               ev_properties_dialog_set_document (EV_PROPERTIES_DIALOG (ev_window->priv->properties),
+                                                  ev_window->priv->document);
        }
 }
 
@@ -1319,14 +1323,16 @@ static void
 ev_window_cmd_file_properties (GtkAction *action, EvWindow *ev_window)
 {
        if (ev_window->priv->properties == NULL) {
-               ev_window->priv->properties = ev_properties_new ();
-               ev_properties_set_document (ev_window->priv->properties,
-                                           ev_window->priv->document);
+               ev_window->priv->properties = ev_properties_dialog_new ();
+               ev_properties_dialog_set_document (EV_PROPERTIES_DIALOG (ev_window->priv->properties),
+                                                  ev_window->priv->document);
                g_object_add_weak_pointer (G_OBJECT (ev_window->priv->properties),
                                           (gpointer *) &(ev_window->priv->properties));
+               gtk_window_set_transient_for (GTK_WINDOW (ev_window->priv->properties),
+                                             GTK_WINDOW (ev_window));
        }
 
-       ev_properties_show (ev_window->priv->properties, GTK_WIDGET (ev_window));
+       gtk_widget_show (ev_window->priv->properties);
 }
                                        
 static void
@@ -1634,7 +1640,7 @@ ev_window_update_fullscreen_action (EvWindow *window)
 }
 
 static void
-ev_window_fullscreen (EvWindow *window)
+ev_window_run_fullscreen (EvWindow *window)
 {
        ev_view_set_fullscreen (EV_VIEW (window->priv->view), TRUE);
        if (window->priv->fullscreen_popup == NULL)
@@ -1663,10 +1669,13 @@ ev_window_fullscreen (EvWindow *window)
 }
 
 static void
-ev_window_unfullscreen (EvWindow *window)
+ev_window_stop_fullscreen (EvWindow *window)
 {
        EvView *view = EV_VIEW (window->priv->view);
 
+       if (!ev_view_get_fullscreen (EV_VIEW (view)))
+               return;
+
        ev_view_set_fullscreen (view, FALSE);
        g_object_set (G_OBJECT (window->priv->scrolled_window),
                      "shadow-type", GTK_SHADOW_IN,
@@ -1695,9 +1704,9 @@ ev_window_cmd_view_fullscreen (GtkAction *action, EvWindow *window)
 
        fullscreen = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
        if (fullscreen) {
-               ev_window_fullscreen (window);
+               ev_window_run_fullscreen (window);
        } else {
-               ev_window_unfullscreen (window);
+               ev_window_stop_fullscreen (window);
        }
 }
 
@@ -1732,7 +1741,7 @@ ev_window_run_presentation (EvWindow *window)
 static void
 ev_window_stop_presentation (EvWindow *window)
 {
-       if (! ev_view_get_presentation (EV_VIEW (window->priv->view)))
+       if (!ev_view_get_presentation (EV_VIEW (window->priv->view)))
                return;
 
        g_object_set (G_OBJECT (window->priv->scrolled_window),
@@ -1750,6 +1759,7 @@ ev_window_cmd_view_presentation (GtkAction *action, EvWindow *window)
        gboolean presentation;
 
         g_return_if_fail (EV_IS_WINDOW (window));
+       ev_window_stop_fullscreen (window);
 
        presentation = gtk_toggle_action_get_active (GTK_TOGGLE_ACTION (action));
        if (presentation) {
@@ -2042,7 +2052,7 @@ ev_window_cmd_escape (GtkAction *action, EvWindow *window)
                              NULL);
 
                if (fullscreen)
-                       ev_window_unfullscreen (window);
+                       ev_window_stop_fullscreen (window);
                if (presentation)
                        ev_window_stop_presentation (window);
 
@@ -3011,9 +3021,9 @@ window_configure_event_cb (EvWindow *window, gpointer dummy)
 
        ev_metadata_manager_set_int (window->priv->uri, "window_width", width);
        ev_metadata_manager_set_int (window->priv->uri, "window_height", height);
+#endif
 
        return FALSE;
-#endif
 }
 
 static void