[Commits] poppler_viewer.c 1.1.2.102 1.1.2.103 poppler_viewer.h 1.1.2.16 1.1.2.17
iwkse at claws-mail.org
iwkse at claws-mail.org
Fri Oct 5 21:30:07 CEST 2012
Update of /home/claws-mail/plugins/pdf_viewer/src
In directory srv:/tmp/cvs-serv14065/src
Modified Files:
Tag: gtk2
poppler_viewer.c poppler_viewer.h
Log Message:
2012-10-05 [iwkse] 0.9.2cvs6
* src/poppler_viewer.c
* src/poppler_viewer.h
Fix bug: 2745, Crash when click on button "Document Info"
Use alerpanel for warnings and errors
New compact way for showing the number of document's pages
Index: poppler_viewer.c
===================================================================
RCS file: /home/claws-mail/plugins/pdf_viewer/src/Attic/poppler_viewer.c,v
retrieving revision 1.1.2.102
retrieving revision 1.1.2.103
diff -u -d -r1.1.2.102 -r1.1.2.103
--- poppler_viewer.c 10 Sep 2012 18:47:05 -0000 1.1.2.102
+++ poppler_viewer.c 5 Oct 2012 19:30:05 -0000 1.1.2.103
@@ -127,7 +127,7 @@
dst += pixbuf_n_channels;
src++;
}
- }
+ }
}
static void
_poppler_page_render_to_pixbuf (PopplerPage *page,
@@ -652,10 +652,13 @@
gtk_table_attach(viewer->table_doc_info, label, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); \
row++;
+
static GtkTable * pdf_viewer_fill_info_table(PdfViewer *viewer)
{
GtkWidget *label;
- gchar *title, *format, *author, *subject, *keywords, *creator, *producer, *linearized, *tmp;
+ const gchar *title, *format, *author, *subject, *keywords, *creator, *producer;
+ gboolean linearized;
+ gchar *tmp;
gint row = 0;
GTime creation_date, mod_date;
@@ -665,7 +668,7 @@
PopplerPermissions permissions;
PopplerViewerPreferences view_prefs;
- title = format = author = subject = keywords = creator = producer = linearized = tmp = 0;
+ title = format = author = subject = keywords = creator = producer = tmp = 0;
g_object_get(viewer->pdf_doc,
"title", &title,
@@ -683,7 +686,7 @@
"page-layout", &layout,
"viewer-preferences", &view_prefs,
NULL);
-
+
viewer->table_doc_info = GTK_TABLE(gtk_table_new(13, 2, FALSE));
ADD_TO_TABLE(_("Filename:"), viewer->target_filename)
@@ -703,20 +706,16 @@
tmp = pdf_viewer_get_document_format_data(mod_date);
ADD_TO_TABLE(_("Modified:"), tmp)
g_free(tmp);
-
+
ADD_TO_TABLE(_("Format:"), format)
- ADD_TO_TABLE(_("Optimized:"), linearized)
- /* ADD_TO_TABLE(_("Page Mode:"), pdf_viewer_get_document_info_mode(mode)) */
- /* ADD_TO_TABLE(_("Page Layout:"), pdf_viewer_get_document_info_layout(layout)) */
-
- g_free(title);
- g_free(format);
- g_free(author);
- g_free(subject);
- g_free(keywords);
- g_free(creator);
- g_free(producer);
- g_free(linearized);
+ if (linearized) {
+ ADD_TO_TABLE(_("Optimized:"), _("Yes"))
+ }
+ else {
+ ADD_TO_TABLE(_("Optimized:"), _("No"))
+ }
+ //ADD_TO_TABLE(_("Page Mode:"), pdf_viewer_get_document_info_mode(mode))
+ //ADD_TO_TABLE(_("Page Layout:"), pdf_viewer_get_document_info_layout(layout))
return(GtkTable *) viewer->table_doc_info;
}
@@ -1195,7 +1194,7 @@
gtk_widget_show(viewer->zoom_fit);
gtk_widget_show(viewer->zoom_width);
gtk_widget_show(viewer->zoom_scroll);
- gtk_widget_show(viewer->buttons_table);
+ gtk_widget_show(viewer->widgets_table);
gtk_widget_show(viewer->rotate_right);
gtk_widget_show(viewer->rotate_left);
gtk_widget_show(viewer->doc_info);
@@ -1210,7 +1209,7 @@
gtk_widget_hide(viewer->zoom_out);
gtk_widget_hide(viewer->zoom_fit);
gtk_widget_hide(viewer->zoom_width);
- gtk_widget_hide(viewer->buttons_table);
+ gtk_widget_hide(viewer->widgets_table);
gtk_widget_hide(viewer->rotate_right);
gtk_widget_hide(viewer->rotate_left);
gtk_widget_hide(viewer->doc_info);
@@ -1285,7 +1284,7 @@
else {
g_warning("gs conversion failed: %s returned %d\n", cmdline, result);
tmp = g_strdup_printf("gs: err %d", result);
- gtk_label_set_text(GTK_LABEL(viewer->doc_label), tmp);
+ alertpanel_warning("%s", tmp);
g_free(tmp);
}
@@ -1295,8 +1294,7 @@
}
else {
g_warning("gs conversion disabled: gs binary was not found\n");
- gtk_label_set_text(GTK_LABEL(viewer->doc_label),
- _("PostScript view disabled: required gs program not found"));
+ alertpanel_warning("PostScript view disabled: required gs program not found");
result = 1;
}
@@ -1324,8 +1322,7 @@
tmp);
g_free(tmp);
- tmp = g_strdup_printf(ngettext("%d page", "%d pages", viewer->num_pages),
- viewer->num_pages);
+ tmp = g_strdup_printf(_("of %d"), viewer->num_pages);
gtk_label_set_text(GTK_LABEL(viewer->doc_label), tmp);
g_free(tmp);
@@ -1339,7 +1336,7 @@
&viewer->icon_pixbuf);
gtk_image_set_from_pixbuf(GTK_IMAGE(viewer->icon_type), viewer->icon_pixbuf);
- gtk_label_set_text(GTK_LABEL(viewer->doc_label), error->message);
+ alertpanel_error("%s", error->message);
pdf_viewer_show_controls(viewer, FALSE);
g_error_free(error);
@@ -1566,15 +1563,15 @@
widget = gtk_button_new(); \
img = gtk_image_new_from_stock(stock_image, GTK_ICON_SIZE_MENU); \
gtk_button_set_image(GTK_BUTTON(widget), img); \
- gtk_table_attach(GTK_TABLE(viewer->buttons_table), GTK_WIDGET(widget), \
+ gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(widget), \
col, col+1, 0, 1, 0, 0, BUTTON_H_PADDING, 0); \
col++;
#define ADD_SEP_TO_TABLE \
sep = gtk_label_new(""); \
- gtk_table_attach(GTK_TABLE(viewer->buttons_table), GTK_WIDGET(sep), \
+ gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(sep), \
col, col+1, 0, 1, 0, 0, 0, 0); \
- gtk_table_set_col_spacing(GTK_TABLE(viewer->buttons_table), col, 3*BUTTON_H_PADDING); \
+ gtk_table_set_col_spacing(GTK_TABLE(viewer->widgets_table), col, 3*BUTTON_H_PADDING); \
col++;
#if GTK_CHECK_VERSION(2,10,0) && POPPLER_HAS_CAIRO && !USE_LIBGNOMEPRINT
@@ -1695,7 +1692,7 @@
viewer->doc_label = gtk_label_new("");
- viewer->buttons_table = gtk_table_new(1, 1, FALSE);
+ viewer->widgets_table = gtk_table_new(1, 1, FALSE);
viewer->doc_index_pane = gtk_hpaned_new();
@@ -1717,7 +1714,13 @@
viewer->zoom = 1.0;
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(viewer->cur_page), TRUE);
gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(viewer->zoom_scroll), TRUE);
- gtk_table_attach(GTK_TABLE(viewer->buttons_table), GTK_WIDGET(viewer->cur_page),
+ gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(viewer->cur_page),
+ col, col+1,
+ 0, 1, 0, 0,
+ BUTTON_H_PADDING,
+ 0);
+ col++;
+ gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(viewer->doc_label),
col, col+1,
0, 1, 0, 0,
BUTTON_H_PADDING,
@@ -1729,7 +1732,7 @@
ADD_SEP_TO_TABLE
ADD_BUTTON_TO_TABLE(viewer->zoom_fit, GTK_STOCK_ZOOM_FIT)
ADD_BUTTON_TO_TABLE(viewer->zoom_in, GTK_STOCK_ZOOM_IN)
- gtk_table_attach(GTK_TABLE(viewer->buttons_table), GTK_WIDGET(viewer->zoom_scroll),
+ gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(viewer->zoom_scroll),
col, col+1,
0, 1, 0, 0,
BUTTON_H_PADDING,
@@ -1745,7 +1748,7 @@
viewer->doc_index = GTK_WIDGET(gtk_toggle_tool_button_new_from_stock(GTK_STOCK_INDEX));
gtk_widget_set_size_request(GTK_WIDGET(viewer->doc_index), 26, 26);
- gtk_table_attach(GTK_TABLE(viewer->buttons_table), GTK_WIDGET(viewer->doc_index),
+ gtk_table_attach(GTK_TABLE(viewer->widgets_table), GTK_WIDGET(viewer->doc_index),
col, col+1,
0, 1, 0, 0,
BUTTON_H_PADDING,
@@ -1811,8 +1814,7 @@
/* pack widgets*/
gtk_box_pack_start(GTK_BOX(viewer->hbox), viewer->icon_type_ebox, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(viewer->hbox), viewer->doc_label, FALSE, FALSE, 0);
- gtk_box_pack_start(GTK_BOX(viewer->hbox), viewer->buttons_table, FALSE, FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(viewer->hbox), viewer->widgets_table, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(viewer->frame_index), viewer->scrollwin_index);
@@ -1837,8 +1839,8 @@
gtk_widget_show(GTK_WIDGET(viewer->vbox));
g_object_ref(GTK_WIDGET(viewer->vbox));
- gtk_widget_show(GTK_WIDGET(viewer->buttons_table));
- g_object_ref(GTK_WIDGET(viewer->buttons_table));
+ gtk_widget_show(GTK_WIDGET(viewer->widgets_table));
+ g_object_ref(GTK_WIDGET(viewer->widgets_table));
gtk_widget_show(GTK_WIDGET(viewer->cur_page));
g_object_ref(GTK_WIDGET(viewer->cur_page));
Index: poppler_viewer.h
===================================================================
RCS file: /home/claws-mail/plugins/pdf_viewer/src/Attic/poppler_viewer.h,v
retrieving revision 1.1.2.16
retrieving revision 1.1.2.17
diff -u -d -r1.1.2.16 -r1.1.2.17
--- poppler_viewer.h 10 Sep 2012 18:47:05 -0000 1.1.2.16
+++ poppler_viewer.h 5 Oct 2012 19:30:05 -0000 1.1.2.17
@@ -61,7 +61,7 @@
struct _PdfViewer
{
MimeViewer mimeviewer;
- GtkWidget *buttons_table;
+ GtkWidget *widgets_table;
GtkWidget *vbox;
GtkWidget *hbox;
GtkWidget *frame_index;
More information about the Commits
mailing list