[yelp] [libyelp/yelp-view] Added basic printing support



commit b143c3d1dc1778eefc17d53e387d8e8d07c94317
Author: Shaun McCance <shaunm gnome org>
Date:   Fri May 7 11:29:28 2010 -0500

    [libyelp/yelp-view] Added basic printing support
    
    That was trivially easy

 libyelp/yelp-view.c |   13 +++++++++++++
 src/yelp-window.c   |    2 ++
 2 files changed, 15 insertions(+), 0 deletions(-)
---
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 6c120aa..f6f539b 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -67,6 +67,8 @@ static void        view_resource_request          (WebKitWebView             *vi
                                                    WebKitNetworkResponse     *response,
                                                    gpointer                   user_data);
 
+static void        view_print                     (GtkAction          *action,
+                                                   YelpView           *view);
 static void        view_history_action            (GtkAction          *action,
                                                    YelpView           *view);
 static void        view_navigation_action         (GtkAction          *action,
@@ -88,6 +90,11 @@ static void        document_callback              (YelpDocument       *document,
                                                    GError             *error);
 
 static const GtkActionEntry entries[] = {
+    {"YelpViewPrint", GTK_STOCK_PRINT,
+     N_("_Print..."),
+     "<Control>P",
+     NULL,
+     G_CALLBACK (view_print) },
     {"YelpViewGoBack", GTK_STOCK_GO_BACK,
      N_("_Back"),
      "<Alt>Left",
@@ -586,6 +593,12 @@ view_resource_request (WebKitWebView         *view,
 }
 
 static void
+view_print (GtkAction *action, YelpView  *view)
+{
+    webkit_web_frame_print (webkit_web_view_get_main_frame (WEBKIT_WEB_VIEW (view)));
+}
+
+static void
 view_history_action (GtkAction *action,
                      YelpView  *view)
 {
diff --git a/src/yelp-window.c b/src/yelp-window.c
index ca08114..0cc2364 100644
--- a/src/yelp-window.c
+++ b/src/yelp-window.c
@@ -168,6 +168,8 @@ static const gchar *YELP_UI =
     "<menuitem action='NewWindow'/>"
     "<menuitem action='Find'/>"
     "<separator/>"
+    "<menuitem action='YelpViewPrint'/>"
+    "<separator/>"
     "<menuitem action='CloseWindow'/>"
     "</menu>"
     "<menu action='ViewMenu'>"



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