[gimp] plug-ins: port file-pdf-load to GimpUnitComboBox and build it again



commit 73d7fbedeb2b0184f7262e5b04f87dc848d56ac1
Author: Michael Natterer <mitch gimp org>
Date:   Sun Oct 31 21:38:27 2010 +0100

    plug-ins: port file-pdf-load to GimpUnitComboBox and build it again

 plug-ins/common/.gitignore      |    2 ++
 plug-ins/common/Makefile.am     |   22 ++++++++++++++++++++++
 plug-ins/common/file-pdf-load.c |   15 ++++++++++-----
 plug-ins/common/gimprc.common   |    1 +
 plug-ins/common/plugin-defs.pl  |    2 +-
 5 files changed, 36 insertions(+), 6 deletions(-)
---
diff --git a/plug-ins/common/.gitignore b/plug-ins/common/.gitignore
index 08f9f39..11db5ef 100644
--- a/plug-ins/common/.gitignore
+++ b/plug-ins/common/.gitignore
@@ -130,6 +130,8 @@
 /file-pat.exe
 /file-pcx
 /file-pcx.exe
+/file-pdf-load
+/file-pdf-load.exe
 /file-pdf-save
 /file-pdf-save.exe
 /file-pix
diff --git a/plug-ins/common/Makefile.am b/plug-ins/common/Makefile.am
index 9a8a260..bb8d0d2 100644
--- a/plug-ins/common/Makefile.am
+++ b/plug-ins/common/Makefile.am
@@ -107,6 +107,7 @@ libexec_PROGRAMS = \
 	$(FILE_MNG) \
 	file-pat \
 	file-pcx \
+	$(FILE_PDF_LOAD) \
 	$(FILE_PDF_SAVE) \
 	file-pix \
 	$(FILE_PNG) \
@@ -192,6 +193,7 @@ EXTRA_PROGRAMS = \
 	file-aa \
 	file-jp2-load \
 	file-mng \
+	file-pdf-load \
 	file-pdf-save \
 	file-png \
 	file-psp \
@@ -1270,6 +1272,26 @@ file_pcx_LDADD = \
 	$(INTLLIBS)		\
 	$(file_pcx_RC)
 
+file_pdf_load_CFLAGS = $(POPPLER_CFLAGS)
+
+file_pdf_load_SOURCES = \
+	file-pdf-load.c
+
+file_pdf_load_LDADD = \
+	$(libgimpui)		\
+	$(libgimpwidgets)	\
+	$(libgimpmodule)	\
+	$(libgimp)		\
+	$(libgimpmath)		\
+	$(libgimpconfig)	\
+	$(libgimpcolor)		\
+	$(libgimpbase)		\
+	$(GTK_LIBS)		\
+	$(POPPLER_LIBS)		\
+	$(RT_LIBS)		\
+	$(INTLLIBS)		\
+	$(file_pdf_load_RC)
+
 file_pdf_save_CFLAGS = $(CAIRO_PDF_CFLAGS)
 
 file_pdf_save_SOURCES = \
diff --git a/plug-ins/common/file-pdf-load.c b/plug-ins/common/file-pdf-load.c
index 84dd7c4..24f0477 100644
--- a/plug-ins/common/file-pdf-load.c
+++ b/plug-ins/common/file-pdf-load.c
@@ -1147,6 +1147,7 @@ gimp_resolution_entry_new (const gchar *width_label,
                            GimpUnit     initial_unit)
 {
   GimpResolutionEntry *gre;
+  GtkTreeModel        *model;
 
   gre = g_object_new (GIMP_TYPE_RESOLUTION_ENTRY, NULL);
 
@@ -1170,13 +1171,17 @@ gimp_resolution_entry_new (const gchar *width_label,
 
   gtk_widget_show (gre->x.spinbutton);
 
-  gre->unitmenu = gimp_unit_menu_new (_("pixels/%s"), initial_unit,
-                                      FALSE, FALSE,
-                                      TRUE);
+  gre->unitmenu = gimp_unit_combo_box_new ();
+  model = gtk_combo_box_get_model (GTK_COMBO_BOX (gre->unitmenu));
+  gimp_unit_store_set_has_pixels (GIMP_UNIT_STORE (model), FALSE);
+  gimp_unit_store_set_has_percent (GIMP_UNIT_STORE (model), FALSE);
+  gimp_unit_combo_box_set_active (GIMP_UNIT_COMBO_BOX (gre->unitmenu),
+                                  initial_unit);
+
   gtk_table_attach (GTK_TABLE (gre), gre->unitmenu,
                     3, 4, 3, 4,
                     GTK_SHRINK | GTK_FILL, GTK_SHRINK | GTK_FILL, 0, 0);
-  g_signal_connect (gre->unitmenu, "unit-changed",
+  g_signal_connect (gre->unitmenu, "changed",
                     G_CALLBACK (gimp_resolution_entry_unit_callback),
                     gre);
   gtk_widget_show (gre->unitmenu);
@@ -1416,7 +1421,7 @@ gimp_resolution_entry_unit_callback (GtkWidget           *widget,
 {
   GimpUnit new_unit;
 
-  new_unit = gimp_unit_menu_get_unit (GIMP_UNIT_MENU (widget));
+  new_unit = gimp_unit_combo_box_get_active (GIMP_UNIT_COMBO_BOX (widget));
 
   if (gre->unit != new_unit)
     gimp_resolution_entry_update_unit (gre, new_unit);
diff --git a/plug-ins/common/gimprc.common b/plug-ins/common/gimprc.common
index 871789d..b90d25b 100644
--- a/plug-ins/common/gimprc.common
+++ b/plug-ins/common/gimprc.common
@@ -62,6 +62,7 @@ file_jp2_load_RC = file-jp2-load.rc.o
 file_mng_RC = file-mng.rc.o
 file_pat_RC = file-pat.rc.o
 file_pcx_RC = file-pcx.rc.o
+file_pdf_load_RC = file-pdf-load.rc.o
 file_pdf_save_RC = file-pdf-save.rc.o
 file_pix_RC = file-pix.rc.o
 file_png_RC = file-png.rc.o
diff --git a/plug-ins/common/plugin-defs.pl b/plug-ins/common/plugin-defs.pl
index 1ef7edb..1b778ba 100644
--- a/plug-ins/common/plugin-defs.pl
+++ b/plug-ins/common/plugin-defs.pl
@@ -66,7 +66,7 @@
     'file-pix' => { ui => 1 },
     'file-png' => { ui => 1, optional => 1, libs => 'PNG_LIBS', cflags => 'PNG_CFLAGS' },
     'file-pnm' => { ui => 1 },
-#    'file-pdf-load' => { ui => 1, optional => 1, libs => 'POPPLER_LIBS', cflags => 'POPPLER_CFLAGS' },
+    'file-pdf-load' => { ui => 1, optional => 1, libs => 'POPPLER_LIBS', cflags => 'POPPLER_CFLAGS' },
     'file-pdf-save' => { ui => 1, optional => 1, libs => 'CAIRO_PDF_LIBS', cflags => 'CAIRO_PDF_CFLAGS' },
     'file-ps' => { ui => 1 },
     'file-psp' => { ui => 1, optional => 1, libs => 'Z_LIBS' },



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]