|
55 | 55 | #include "ui/search_dialog.h" |
56 | 56 | #include "ui/ui_common.h" |
57 | 57 | #include "ui/ui_update.h" |
| 58 | +#include "webkit/liferea_web_view.h" |
58 | 59 |
|
59 | 60 | extern gboolean searchFolderRebuild; /* db.c */ |
60 | 61 |
|
@@ -917,6 +918,25 @@ on_menu_export (GSimpleAction *action, GVariant *parameter, gpointer user_data) |
917 | 918 | export_OPML_file (); |
918 | 919 | } |
919 | 920 |
|
| 921 | +static void |
| 922 | +on_print_activate (GSimpleAction *action, GVariant *parameter, gpointer user_data) |
| 923 | +{ |
| 924 | + LifereaBrowser *browser; |
| 925 | + GtkWidget *webview; |
| 926 | + |
| 927 | + // First see if a browser tab is active |
| 928 | + browser = browser_tabs_get_active_htmlview (); |
| 929 | + |
| 930 | + // If not print the item view |
| 931 | + if (!browser) |
| 932 | + g_object_get (G_OBJECT (shell->itemview), "html-view", &browser, NULL); |
| 933 | + |
| 934 | + g_return_if_fail (browser != NULL); |
| 935 | + |
| 936 | + g_object_get (G_OBJECT (browser), "renderwidget", &webview, NULL); |
| 937 | + liferea_web_view_print (LIFEREA_WEB_VIEW (webview)); |
| 938 | +} |
| 939 | + |
920 | 940 | /* methods to receive URLs which were dropped anywhere in the main window */ |
921 | 941 | static void |
922 | 942 | liferea_shell_URL_received (GtkWidget *widget, GdkDragContext *context, gint x, gint y, GtkSelectionData *data, guint info, guint time_received) |
@@ -1025,6 +1045,7 @@ static const GActionEntry liferea_shell_gaction_entries[] = { |
1025 | 1045 | {"show-help-contents", on_topics_activate, NULL, NULL, NULL}, |
1026 | 1046 | {"show-shortcuts", on_shortcuts_activate, NULL, NULL, NULL}, |
1027 | 1047 | {"show-about", on_about_activate, NULL, NULL, NULL}, |
| 1048 | + {"print", on_print_activate, NULL, NULL, NULL}, |
1028 | 1049 |
|
1029 | 1050 | /* Parameter type must be NULL for toggle. */ |
1030 | 1051 | {"fullscreen", NULL, NULL, "@b false", on_menu_fullscreen_activate}, |
|
0 commit comments