Commit 8489d5a5e51ed120b544ecf7a4e68aa2acaf70d4
1 parent
c39d367d
Exists in
master
and in
1 other branch
Fixing save selection as image.
Showing
3 changed files
with
20 additions
and
5 deletions
Show diff stats
src/dialogs/save/save.c
... | ... | @@ -440,7 +440,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ |
440 | 440 | GList * dynamic = NULL; |
441 | 441 | const GList * selection = NULL; |
442 | 442 | |
443 | - debug("%s",__FUNCTION__); | |
443 | + debug("%s(%d)",__FUNCTION__,dialog->mode); | |
444 | 444 | |
445 | 445 | switch(dialog->mode) |
446 | 446 | { |
... | ... | @@ -464,6 +464,8 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ |
464 | 464 | return; |
465 | 465 | } |
466 | 466 | |
467 | + debug("Selection=%p",selection); | |
468 | + | |
467 | 469 | if(!selection) |
468 | 470 | { |
469 | 471 | *error = g_error_new(g_quark_from_static_string(PACKAGE_NAME),ENOTCONN,"%s",strerror(ENODATA)); |
... | ... | @@ -524,7 +526,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ |
524 | 526 | |
525 | 527 | static void save_as_image(V3270SaveDialog * dialog, const gchar *format, GError **error) |
526 | 528 | { |
527 | - debug("%s",__FUNCTION__); | |
529 | + debug("%s(%d)",__FUNCTION__,dialog->mode); | |
528 | 530 | |
529 | 531 | GdkPixbuf * pixbuf = NULL; |
530 | 532 | |
... | ... | @@ -547,6 +549,7 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ |
547 | 549 | { |
548 | 550 | debug("%s","LIB3270_CONTENT_SELECTED"); |
549 | 551 | GList * selection = g_list_append_lib3270_selection(NULL, v3270_get_session(dialog->terminal),FALSE); |
552 | + debug("Selection=%p",selection); | |
550 | 553 | pixbuf = v3270_get_selection_as_pixbuf(GTK_V3270(dialog->terminal), selection, FALSE); |
551 | 554 | g_list_free_full(selection,(GDestroyNotify) lib3270_free); |
552 | 555 | } |
... | ... | @@ -557,10 +560,13 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ |
557 | 560 | return; |
558 | 561 | } |
559 | 562 | |
563 | + debug("pixbuff=%p",pixbuf); | |
564 | + | |
560 | 565 | if(pixbuf) |
561 | 566 | { |
562 | 567 | const gchar * filename = get_filename(dialog); |
563 | 568 | |
569 | + debug("Filename=%p",filename); | |
564 | 570 | if(filename) |
565 | 571 | { |
566 | 572 | gdk_pixbuf_save(pixbuf,filename,format,error,NULL); |
... | ... | @@ -568,6 +574,10 @@ static void icon_press(GtkEntry *entry, G_GNUC_UNUSED GtkEntryIconPosition icon_ |
568 | 574 | |
569 | 575 | g_object_unref(pixbuf); |
570 | 576 | } |
577 | + else | |
578 | + { | |
579 | + *error = g_error_new(g_quark_from_static_string(PACKAGE_NAME),-1,_( "Error saving image" )); | |
580 | + } | |
571 | 581 | |
572 | 582 | } |
573 | 583 | ... | ... |
src/selection/pixbuf.c
... | ... | @@ -57,6 +57,7 @@ GdkPixbuf * v3270_get_selection_as_pixbuf(v3270 * terminal, const GList *selecti |
57 | 57 | if(col > cols) |
58 | 58 | cols = col; |
59 | 59 | } |
60 | + src++; | |
60 | 61 | } |
61 | 62 | |
62 | 63 | if(hasSelection) |
... | ... | @@ -68,6 +69,8 @@ GdkPixbuf * v3270_get_selection_as_pixbuf(v3270 * terminal, const GList *selecti |
68 | 69 | |
69 | 70 | } |
70 | 71 | |
72 | + debug("%s: rows=%d cols=%d",__FUNCTION__,rows,cols); | |
73 | + | |
71 | 74 | if(!rows) |
72 | 75 | return NULL; |
73 | 76 | |
... | ... | @@ -76,6 +79,8 @@ GdkPixbuf * v3270_get_selection_as_pixbuf(v3270 * terminal, const GList *selecti |
76 | 79 | gint width = (cols+1) * terminal->font.width; |
77 | 80 | gint height = (rows+1) * terminal->font.spacing.value; |
78 | 81 | |
82 | + debug("%s: width=%d height=%d",__FUNCTION__,width,height); | |
83 | + | |
79 | 84 | cairo_surface_t *surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, width, height); |
80 | 85 | |
81 | 86 | cairo_t *cr = cairo_create(surface); |
... | ... | @@ -131,11 +136,11 @@ GdkPixbuf * v3270_get_selection_as_pixbuf(v3270 * terminal, const GList *selecti |
131 | 136 | } |
132 | 137 | } |
133 | 138 | |
134 | - cairo_destroy (cr); | |
139 | + cairo_destroy(cr); | |
135 | 140 | |
136 | 141 | GdkPixbuf * pixbuf = gdk_pixbuf_get_from_surface(surface,0,0,width,height); |
137 | 142 | |
138 | - cairo_surface_destroy (surface); | |
143 | + cairo_surface_destroy(surface); | |
139 | 144 | |
140 | 145 | return pixbuf; |
141 | 146 | ... | ... |
src/terminal/actions/action.c
... | ... | @@ -246,7 +246,7 @@ |
246 | 246 | } |
247 | 247 | |
248 | 248 | static gboolean bg_notify_enabled(GObject *action) { |
249 | - debug("%s(%s,%s,%d)",__FUNCTION__,g_action_get_name(G_ACTION(action)),(g_action_get_enabled(G_ACTION(action)) ? "enabled" : "disabled"),(int) v3270_action_get_group(G_ACTION(action))); | |
249 | +// debug("%s(%s,%s,%d)",__FUNCTION__,g_action_get_name(G_ACTION(action)),(g_action_get_enabled(G_ACTION(action)) ? "enabled" : "disabled"),(int) v3270_action_get_group(G_ACTION(action))); | |
250 | 250 | g_object_notify(action, "enabled"); |
251 | 251 | return FALSE; |
252 | 252 | } | ... | ... |