]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-properties-dialog.c
[dualscreen] fix crash on ctrl+w and fix control window closing
[evince.git] / shell / ev-properties-dialog.c
index 7bf20e17191d8a4b6d30fef2819fd0d0a975a399..e82f2423943c0a6162f8295afc01b8bcb7e75038 100644 (file)
  *
  * 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.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
  */
 
 #ifdef HAVE_CONFIG_H
 #include "config.h"
 #endif
 
-#include "ev-properties-view.h"
-#include "ev-properties-fonts.h"
-#include "ev-properties-dialog.h"
-#include "ev-page-cache.h"
-#include "ev-document-fonts.h"
-
 #include <glib/gi18n.h>
-#include <gtk/gtkdialog.h>
-#include <gtk/gtklabel.h>
-#include <gtk/gtknotebook.h>
-#include <gtk/gtkstock.h>
-#include <gtk/gtkbox.h>
+#include <gtk/gtk.h>
+
+#include "ev-document-fonts.h"
+#include "ev-properties-dialog.h"
+#include "ev-properties-fonts.h"
+#include "ev-properties-view.h"
+#include "ev-properties-license.h"
 
 struct _EvPropertiesDialog {
        GtkDialog base_instance;
@@ -42,6 +38,7 @@ struct _EvPropertiesDialog {
        GtkWidget *notebook;
        GtkWidget *general_page;
        GtkWidget *fonts_page;
+       GtkWidget *license_page;
 };
 
 struct _EvPropertiesDialogClass {
@@ -58,17 +55,23 @@ ev_properties_dialog_class_init (EvPropertiesDialogClass *properties_class)
 static void
 ev_properties_dialog_init (EvPropertiesDialog *properties)
 {
+       GtkBox *content_area;
+
+       content_area = GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (properties)));
+
        gtk_window_set_title (GTK_WINDOW (properties), _("Properties"));
        gtk_window_set_destroy_with_parent (GTK_WINDOW (properties), TRUE);
-       gtk_dialog_set_has_separator (GTK_DIALOG (properties), FALSE);
-        gtk_container_set_border_width (GTK_CONTAINER (properties), 5);
+       gtk_container_set_border_width (GTK_CONTAINER (properties), 5);
+       gtk_box_set_spacing (content_area, 2);
 
        gtk_dialog_add_button (GTK_DIALOG (properties), GTK_STOCK_CLOSE,
-                              GTK_RESPONSE_ACCEPT);
+                              GTK_RESPONSE_CANCEL);
+       gtk_dialog_set_default_response (GTK_DIALOG (properties), 
+                                        GTK_RESPONSE_CANCEL);
 
        properties->notebook = gtk_notebook_new ();
-       gtk_box_pack_start (GTK_BOX (GTK_DIALOG (properties)->vbox),
-                           properties->notebook, TRUE, TRUE, 0);
+       gtk_container_set_border_width (GTK_CONTAINER (properties->notebook), 5);
+       gtk_box_pack_start (content_area, properties->notebook, TRUE, TRUE, 0);
        gtk_widget_show (properties->notebook);
 
        g_signal_connect (properties, "response",
@@ -77,6 +80,7 @@ ev_properties_dialog_init (EvPropertiesDialog *properties)
 
 void
 ev_properties_dialog_set_document (EvPropertiesDialog *properties,
+                                  const gchar        *uri,
                                   EvDocument         *document)
 {
        GtkWidget *label;
@@ -84,11 +88,11 @@ ev_properties_dialog_set_document (EvPropertiesDialog *properties,
 
        properties->document = document;
 
-       info = ev_page_cache_get_info (ev_page_cache_get (document));
+       info = ev_document_get_info (document);
 
        if (properties->general_page == NULL) {
                label = gtk_label_new (_("General"));
-               properties->general_page = ev_properties_view_new ();
+               properties->general_page = ev_properties_view_new (uri);
                gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
                                          properties->general_page, label);
                gtk_widget_show (properties->general_page);
@@ -104,7 +108,21 @@ ev_properties_dialog_set_document (EvPropertiesDialog *properties,
                        gtk_widget_show (properties->fonts_page);
                }
 
-               ev_properties_fonts_set_document (EV_PROPERTIES_FONTS (properties->fonts_page), document);
+               ev_properties_fonts_set_document
+                       (EV_PROPERTIES_FONTS (properties->fonts_page), document);
+       }
+
+       if (info->fields_mask & EV_DOCUMENT_INFO_LICENSE && info->license) {
+               if (properties->license_page == NULL) {
+                       label = gtk_label_new (_("Document License"));
+                       properties->license_page = ev_properties_license_new ();
+                       gtk_notebook_append_page (GTK_NOTEBOOK (properties->notebook),
+                                                 properties->license_page, label);
+                       gtk_widget_show (properties->license_page);
+               }
+
+               ev_properties_license_set_license
+                       (EV_PROPERTIES_LICENSE (properties->license_page), info->license);
        }
 }