]> www.fi.muni.cz Git - evince.git/commitdiff
Add gpdf-persist-file.cc.
authorMartin Kretzschmar <mkretzschmar@src.gnome.org>
Thu, 17 Jul 2003 18:06:14 +0000 (18:06 +0000)
committerMartin Kretzschmar <mkretzschmar@src.gnome.org>
Thu, 17 Jul 2003 18:06:14 +0000 (18:06 +0000)
* po/POTFILES.in: Add gpdf-persist-file.cc.

* xpdf/gpdf-persist-file.cc (gpdf_persist_file_class_init)
(impl_bonobo_persist_file_load): emit (new) loading-failed signal
if something goes wrong during load.

* xpdf/gpdf-persist-file.h: add slot for loading-failed.

* xpdf/gpdf-marshal.list: add VOID:STRING.

* xpdf/gpdf-links-canvas-layer.cc: fix include (thanks Remi).

* xpdf/gpdf-control.cc (gpdf_control_setup_persist)
(gpdf_control_destroy): on loading-failed signal, display error
alert.

* xpdf/eog-hig-dialog.h, xpdf/eog-hig-dialog.c: copied from eog;
HIG conforming alert dialog.

* xpdf/Makefile.am (libgpdf_a_SOURCES): build eog-hig-dialog

* NEWS: updated.

pdf/xpdf/Makefile.am
pdf/xpdf/eog-hig-dialog.c [new file with mode: 0644]
pdf/xpdf/eog-hig-dialog.h [new file with mode: 0644]

index c85699acede6f86ff03fc9728c57e8d930b5e55c..e4d059c9c748d8bd1e94a1e2f8b3e19c9f7e20f5 100644 (file)
@@ -125,6 +125,8 @@ libgpdf_a_SOURCES =                 \
        GnomeVFSStream.h                \
        GPOutputDev.cc                  \
        GPOutputDev.h                   \
+       eog-hig-dialog.c                \
+       eog-hig-dialog.h                \
        gpdf-control.cc                 \
        gpdf-control.h                  \
        gpdf-g-switch.h                 \
diff --git a/pdf/xpdf/eog-hig-dialog.c b/pdf/xpdf/eog-hig-dialog.c
new file mode 100644 (file)
index 0000000..121e844
--- /dev/null
@@ -0,0 +1,89 @@
+#include <string.h>
+#include <gtk/gtk.h>
+#include <libgnome/gnome-macros.h>
+#include "eog-hig-dialog.h"
+
+
+GNOME_CLASS_BOILERPLATE (EogHigDialog, 
+                        eog_hig_dialog,
+                        GtkDialog,
+                        GTK_TYPE_DIALOG);
+
+void
+eog_hig_dialog_class_init (EogHigDialogClass *klass)
+{
+}
+
+void 
+eog_hig_dialog_instance_init (EogHigDialog *dlg)
+{
+}
+
+
+GtkWidget*  
+eog_hig_dialog_new (const char *stock_id, const char *header, const char *body, gboolean modal)
+{
+       GtkWidget *dlg;
+       GtkWidget *hbox;
+       GtkWidget *image;
+       GtkWidget *label;
+       int header_len;
+       int body_len;
+       int message_len;
+       char *message;
+       
+       g_return_val_if_fail (stock_id != NULL, NULL);
+       g_return_val_if_fail (header != NULL, NULL);
+       
+       dlg = gtk_widget_new (EOG_TYPE_HIG_DIALOG, 
+                             "border-width", 6, 
+                             "resizable", FALSE,
+                             "has-separator", FALSE,
+                             "modal", modal,
+                             "title", "",
+                             NULL);
+                             
+       hbox = gtk_widget_new (GTK_TYPE_HBOX, 
+                              "homogeneous", FALSE,
+                              "spacing", 12,
+                              "border-width", 6,
+                              NULL);
+
+       image = gtk_widget_new (GTK_TYPE_IMAGE,
+                               "stock", stock_id,
+                               "icon-size", GTK_ICON_SIZE_DIALOG,
+                               "yalign", 0.0,
+                               NULL);
+       gtk_container_add (GTK_CONTAINER (hbox), image);
+
+
+       header_len = strlen (header);
+       body_len = body ? strlen (body) : 0;
+       message_len = header_len + body_len + 64;
+
+       message = g_new0 (char, message_len);
+
+       if (body != NULL) {
+               g_snprintf (message, message_len,
+                           "<span weight=\"bold\" size=\"larger\">%s</span>\n\n%s\n", header, body);
+       }
+       else {
+               g_snprintf (message, message_len,
+                           "<span weight=\"bold\" size=\"larger\">%s</span>\n", header);
+       }
+       
+       label = gtk_label_new (message);
+       g_object_set (G_OBJECT (label),
+                     "use-markup", TRUE, 
+                     "wrap", TRUE,
+                     "yalign", 0.0,
+                     NULL); 
+                              
+       gtk_container_add (GTK_CONTAINER (hbox), label);
+       gtk_widget_show_all (hbox);
+
+       gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dlg)->vbox), hbox);
+       g_object_set (G_OBJECT (GTK_DIALOG (dlg)->vbox), "spacing", 12);
+
+       return dlg;
+}
diff --git a/pdf/xpdf/eog-hig-dialog.h b/pdf/xpdf/eog-hig-dialog.h
new file mode 100644 (file)
index 0000000..506e332
--- /dev/null
@@ -0,0 +1,34 @@
+#ifndef _EOG_HIG_DIALOG_H_
+#define _EOG_HIG_DIALOG_H_
+
+#include <gtk/gtkdialog.h>
+
+G_BEGIN_DECLS
+
+#define EOG_TYPE_HIG_DIALOG              (eog_hig_dialog_get_type ())
+#define EOG_HIG_DIALOG(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), EOG_TYPE_HIG_DIALOG, EogHigDialog))
+#define EOG_HIG_DIALOG_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), EOG_TYPE_HIG_DIALOG, EogHigDialogClass))
+#define EOG_IS_HIG_DIALOG(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), EOG_TYPE_HIG_DIALOG))
+#define EOG_IS_HIG_DIALOG_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), EOG_TYPE_HIG_DIALOG))
+
+typedef struct _EogHigDialog EogHigDialog;
+typedef struct _EogHigDialogClass EogHigDialogClass;
+typedef struct _EogHigDialogPrivate EogHigDialogPrivate;
+
+
+struct _EogHigDialog {
+       GtkDialog dialog;
+};
+
+struct _EogHigDialogClass {
+       GtkDialogClass parent_class;
+};
+
+
+GType       eog_hig_dialog_get_type         (void);
+GtkWidget*  eog_hig_dialog_new              (const char *stock_id, const char *header, const char *body, gboolean modal);
+
+
+G_END_DECLS
+
+#endif /* _EOG_HIG_DIALOG_H_ */