+2005-01-01 Marco Pesenti Gritti <marco@gnome.org>
+
+ * ps/Makefile.am:
+ * ps/ggvutils.c:
+ * ps/ggvutils.h:
+ * ps/gsdefaults.c: (gtk_gs_defaults_get_paper_sizes):
+ * ps/gsdefaults.h:
+ * ps/gtkgs.c: (file_length), (file_readable),
+ (check_filecompressed), (check_pdf), (gtk_gs_load),
+ (gtk_gs_get_postscript):
+
+ Get rid of ggvutils
+
2004-12-31 Marco Pesenti Gritti <marco@gnome.org>
* ps/ggvutils.c:
gsdefaults.h \
ps.c \
ps.h \
- ggvutils.c \
- ggvutils.h \
gtkgs.c \
gtkgs.h
+++ /dev/null
-/*
- * ggv-utils.c: misc utility functions
- *
- * Copyright 2002 - 2005 The Free Software Foundation
- *
- * Author: Jaka Mocnik <jaka@gnu.org>
- *
- * 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 of the License, 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., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include "config.h"
-
-#include <glib/gi18n.h>
-#include <libgnomevfs/gnome-vfs-utils.h>
-
-#include "ggvutils.h"
-
-GtkGSPaperSize ggv_paper_sizes[] = {
- {N_("BBox"), 0, 0},
- {N_("Letter"), 612, 792,},
- {N_("Tabloid"), 792, 1224,},
- {N_("Ledger"), 1224, 792,},
- {N_("Legal"), 612, 1008,},
- {N_("Statement"), 396, 612,},
- {N_("Executive"), 540, 720,},
- {N_("A0"), 2380, 3368,},
- {N_("A1"), 1684, 2380,},
- {N_("A2"), 1190, 1684,},
- {N_("A3"), 842, 1190,},
- {N_("A4"), 595, 842,},
- {N_("A5"), 420, 595,},
- {N_("B4"), 729, 1032,},
- {N_("B5"), 516, 729,},
- {N_("Folio"), 612, 936,},
- {N_("Quarto"), 610, 780,},
- {N_("10x14"), 720, 1008,},
- {NULL, 0, 0}
-};
-
-const gchar *ggv_orientation_labels[] = {
- N_("Portrait"),
- N_("Landscape"),
- N_("Upside Down"),
- N_("Seascape"),
- NULL,
-};
-
-/* If file exists and is a regular file then return its length, else -1 */
-gint
-ggv_file_length(const gchar * filename)
-{
- struct stat stat_rec;
-
- if(filename && (stat(filename, &stat_rec) == 0)
- && S_ISREG(stat_rec.st_mode))
- return stat_rec.st_size;
- else
- return -1;
-}
-
-/* Test if file exists, is a regular file and its length is > 0 */
-gboolean
-ggv_file_readable(const char *filename)
-{
- return (ggv_file_length(filename) > 0);
-}
+++ /dev/null
-/*
- * ggvutils.h: misc utility functions
- *
- * Copyright 2002 - 2005 the Free Software Foundation
- *
- * Author: Jaka Mocnik <jaka@gnu.org>
- *
- * 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 of the License, 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 __GGV_UTILS_H__
-#define __GGV_UTILS_H__
-
-#include "gtkgs.h"
-
-extern GtkGSPaperSize ggv_paper_sizes[];
-
-/* If file exists and is a regular file then return its length, else -1 */
-gint ggv_file_length(const gchar * filename);
-
-/* Test if file exists, is a regular file and its length is > 0 */
-gboolean ggv_file_readable(const char *filename);
-
-#endif /* __GGV_UTILS_H__ */
#include "gtkgs.h"
#include "gsdefaults.h"
-#include "ggvutils.h"
#include <gconf/gconf-client.h>
GTK_GS_ZOOM_ABSOLUTE
};
+GtkGSPaperSize gtk_gs_paper_sizes[] = {
+ {N_("BBox"), 0, 0},
+ {N_("Letter"), 612, 792,},
+ {N_("Tabloid"), 792, 1224,},
+ {N_("Ledger"), 1224, 792,},
+ {N_("Legal"), 612, 1008,},
+ {N_("Statement"), 396, 612,},
+ {N_("Executive"), 540, 720,},
+ {N_("A0"), 2380, 3368,},
+ {N_("A1"), 1684, 2380,},
+ {N_("A2"), 1190, 1684,},
+ {N_("A3"), 842, 1190,},
+ {N_("A4"), 595, 842,},
+ {N_("A5"), 420, 595,},
+ {N_("B4"), 729, 1032,},
+ {N_("B5"), 516, 729,},
+ {N_("Folio"), 612, 936,},
+ {N_("Quarto"), 610, 780,},
+ {N_("10x14"), 720, 1008,},
+ {NULL, 0, 0}
+};
+
void
gtk_gs_defaults_set_scroll_step(gfloat step)
{
GtkGSPaperSize *
gtk_gs_defaults_get_paper_sizes()
{
- return ggv_paper_sizes;
-}
-
-gint
-gtk_gs_defaults_get_paper_count()
-{
- gint n = 0;
-
- while(ggv_paper_sizes[n].name != NULL)
- n++;
-
- return n;
+ return gtk_gs_paper_sizes;
}
gboolean
gboolean gtk_gs_defaults_get_override_orientation(void);
gfloat gtk_gs_defaults_get_zoom_factor(void);
gboolean gtk_gs_defaults_get_respect_eof(void);
-gint gtk_gs_defaults_get_paper_count(void);
gfloat gtk_gs_defaults_get_scroll_step(void);
gboolean gtk_gs_defaults_get_show_scroll_rect(void);
GtkGSPaperSize *gtk_gs_defaults_get_paper_sizes(void);
#include "ev-document.h"
#include "gtkgs.h"
-#include "ggvutils.h"
#include "ps.h"
#include "gsdefaults.h"
gs->busy = FALSE;
}
+/* If file exists and is a regular file then return its length, else -1 */
+static gint
+file_length(const gchar * filename)
+{
+ struct stat stat_rec;
+
+ if(filename && (stat(filename, &stat_rec) == 0)
+ && S_ISREG(stat_rec.st_mode))
+ return stat_rec.st_size;
+ else
+ return -1;
+}
+
+/* Test if file exists, is a regular file and its length is > 0 */
+static gboolean
+file_readable(const char *filename)
+{
+ return (file_length(filename) > 0);
+}
/*
* Decompress gs->gs_filename if necessary
cmdline = g_strdup_printf("%s %s >%s 2>%s", cmd,
filename, filename_unc, filename_err);
if((system(cmdline) == 0)
- && ggv_file_readable(filename_unc)
- && (ggv_file_length(filename_err) == 0)) {
+ && file_readable(filename_unc)
+ && (file_length(filename_err) == 0)) {
/* sucessfully uncompressed file */
gs->gs_filename_unc = filename_unc;
}
g_snprintf(buf, 1024, _("Error while decompressing file %s:\n"),
gs->gs_filename);
gtk_gs_emit_error_msg(gs, buf);
- if(ggv_file_length(filename_err) > 0) {
+ if(file_length(filename_err) > 0) {
FILE *err;
if((err = fopen(filename_err, "r"))) {
/* print file to message window */
cmdline = g_strdup_printf("%s >%s 2>&1", cmd, filename_err);
g_free(cmd);
- if((system(cmdline) == 0) && ggv_file_readable(filename_dsc)) {
+ if((system(cmdline) == 0) && file_readable(filename_dsc)) {
/* success */
filename = gs->gs_filename_dsc = filename_dsc;
- if(ggv_file_length(filename_err) > 0) {
+ if(file_length(filename_err) > 0) {
gchar *err_msg = " ";
GtkWidget *dialog;
FILE *err;
_("Error while converting pdf file %s:\n"), filename);
gtk_gs_emit_error_msg(gs, buf);
- if(ggv_file_length(filename_err) > 0) {
+ if(file_length(filename_err) > 0) {
FILE *err;
if((err = fopen(filename_err, "r"))) {
/* print file to message window */
*/
gchar *filename = NULL;
- if(!ggv_file_readable(fname)) {
+ if(!file_readable(fname)) {
gchar buf[1024];
g_snprintf(buf, 1024, _("Cannot open file %s.\n"), fname);
gtk_gs_emit_error_msg(gs, buf);
gs->gs_filename_unc : gs->gs_filename);
cmd = g_strdup_printf(gtk_gs_defaults_get_convert_pdf_cmd(), tmpn, fname);
g_free(fname);
- if((system(cmd) == 0) && ggv_file_readable(tmpn)) {
+ if((system(cmd) == 0) && file_readable(tmpn)) {
GObject *tmp_gs;
tmp_gs = gtk_gs_new_from_file(NULL, NULL, tmpn);
if(NULL != tmp_gs) {