[yelp] [libyelp/yelp-view.c] Added nautilus-sendto support for images
- From: Shaun McCance <shaunm src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [yelp] [libyelp/yelp-view.c] Added nautilus-sendto support for images
- Date: Wed, 19 May 2010 16:01:52 +0000 (UTC)
commit fc36cdd168dd0bc8156fc852f5abd5027891a9b7
Author: Shaun McCance <shaunm gnome org>
Date: Wed May 19 11:00:50 2010 -0500
[libyelp/yelp-view.c] Added nautilus-sendto support for images
libyelp/yelp-view.c | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/libyelp/yelp-view.c b/libyelp/yelp-view.c
index 5aeee86..d5f00c8 100644
--- a/libyelp/yelp-view.c
+++ b/libyelp/yelp-view.c
@@ -66,6 +66,8 @@ static void popup_open_link_new (GtkMenuItem *item,
YelpView *view);
static void popup_save_image (GtkMenuItem *item,
YelpView *view);
+static void popup_send_image (GtkMenuItem *item,
+ YelpView *view);
static void view_populate_popup (YelpView *view,
GtkMenu *menu,
gpointer data);
@@ -132,6 +134,8 @@ static const GtkActionEntry entries[] = {
G_CALLBACK (view_navigation_action) }
};
+static gchar *nautilus_sendto = NULL;
+
enum {
PROP_0,
PROP_URI,
@@ -311,6 +315,8 @@ yelp_view_class_init (YelpViewClass *klass)
GObjectClass *object_class = G_OBJECT_CLASS (klass);
YelpSettings *settings = yelp_settings_get_default ();
+ nautilus_sendto = g_find_program_in_path ("nautilus-sendto");
+
websettings = webkit_web_settings_new ();
g_signal_connect (settings,
"fonts-changed",
@@ -758,6 +764,23 @@ popup_save_image (GtkMenuItem *item,
}
static void
+popup_send_image (GtkMenuItem *item,
+ YelpView *view)
+{
+ gchar *command;
+ YelpViewPrivate *priv = GET_PRIV (view);
+
+ command = g_strdup_printf ("%s %s", nautilus_sendto, priv->popup_image_uri);
+
+ gdk_spawn_command_line_on_screen (gtk_widget_get_screen (GTK_WIDGET (view)),
+ command, NULL);
+
+ g_free (command);
+ g_free (priv->popup_image_uri);
+ priv->popup_image_uri = NULL;
+}
+
+static void
view_populate_popup (YelpView *view,
GtkMenu *menu,
gpointer data)
@@ -822,10 +845,17 @@ view_populate_popup (YelpView *view,
item = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
- item = gtk_menu_item_new_with_mnemonic (_("Sa_ve Image As..."));
+ item = gtk_menu_item_new_with_mnemonic (_("_Save Image As..."));
g_signal_connect (item, "activate",
G_CALLBACK (popup_save_image), view);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+
+ if (nautilus_sendto) {
+ item = gtk_menu_item_new_with_mnemonic (_("S_end Image To..."));
+ g_signal_connect (item, "activate",
+ G_CALLBACK (popup_send_image), view);
+ gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
+ }
}
g_object_unref (result);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]