gimp r27006 - in trunk: . plug-ins/help-browser



Author: neo
Date: Fri Sep 19 07:24:16 2008
New Revision: 27006
URL: http://svn.gnome.org/viewvc/gimp?rev=27006&view=rev

Log:
2008-09-19  Sven Neumann  <sven gimp org>

	* plug-ins/help-browser/dialog.c (update_actions): allow to copy
	selected text to the clipboard using Ctrl-C or the right-click
	menu.



Modified:
   trunk/ChangeLog
   trunk/plug-ins/help-browser/dialog.c

Modified: trunk/plug-ins/help-browser/dialog.c
==============================================================================
--- trunk/plug-ins/help-browser/dialog.c	(original)
+++ trunk/plug-ins/help-browser/dialog.c	Fri Sep 19 07:24:16 2008
@@ -92,6 +92,8 @@
                                            gpointer           data);
 static void       copy_location_callback  (GtkAction         *action,
                                            gpointer           data);
+static void       copy_selection_callback (GtkAction         *action,
+                                           gpointer           data);
 static void       show_index_callback     (GtkAction         *action,
                                            gpointer           data);
 static void       zoom_in_callback        (GtkAction         *action,
@@ -591,6 +593,11 @@
       G_CALLBACK (copy_location_callback)
     },
     {
+      "copy-selection", GTK_STOCK_COPY,
+      NULL, "<control>C", NULL,
+      G_CALLBACK (copy_selection_callback)
+    },
+    {
       "zoom-in", GTK_STOCK_ZOOM_IN,
       NULL, "<control>plus", NULL,
       G_CALLBACK (zoom_in_callback)
@@ -715,6 +722,20 @@
       g_clear_error (&error);
     }
 
+  gtk_ui_manager_add_ui_from_string (ui_manager,
+                                     "<ui>"
+                                     "  <popup name=\"help-browser-copy-popup\">"
+                                     "    <menuitem action=\"copy-selection\" />"
+                                     "  </popup>"
+                                     "</ui>",
+                                     -1, &error);
+
+  if (error)
+    {
+      g_warning ("error parsing ui: %s", error->message);
+      g_clear_error (&error);
+    }
+
   return ui_manager;
 }
 
@@ -809,6 +830,16 @@
 }
 
 static void
+copy_selection_callback (GtkAction *action,
+                         gpointer   data)
+{
+  if (webkit_web_view_can_copy_clipboard (WEBKIT_WEB_VIEW (view)))
+    {
+      webkit_web_view_copy_clipboard (WEBKIT_WEB_VIEW (view));
+    }
+}
+
+static void
 show_index_callback (GtkAction *action,
                      gpointer   data)
 {
@@ -1043,8 +1074,15 @@
 view_popup_menu (GtkWidget      *widget,
                  GdkEventButton *event)
 {
-  GtkWidget *menu = gtk_ui_manager_get_widget (ui_manager,
-                                               "/help-browser-popup");
+  GtkWidget   *menu;
+  const gchar *path;
+
+  if (webkit_web_view_can_copy_clipboard (WEBKIT_WEB_VIEW (view)))
+    path = "/help-browser-copy-popup";
+  else
+    path = "/help-browser-popup";
+
+  menu = gtk_ui_manager_get_widget (ui_manager, path);
 
   gtk_menu_set_screen (GTK_MENU (menu), gtk_widget_get_screen (widget));
   gtk_menu_popup (GTK_MENU (menu),



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