nautilus-sendto r398 - in trunk: . evolution po



Author: hadess
Date: Wed Feb 18 14:48:25 2009
New Revision: 398
URL: http://svn.gnome.org/viewvc/nautilus-sendto?rev=398&view=rev

Log:
2009-02-18  Bastien Nocera  <hadess hadess net>

	* Makefile.am:
	* configure.in:
	* evolution/Makefile.am:
	* evolution/nautilus-sendto.c (popup_free),
	(org_gnome_evolution_send_file_attachments),
	(org_gnome_evolution_send_file_part), (send_file):
	* evolution/org-gnome-evolution-send-attachments-to.eplug.xml:
	* evolution/plugin.mk: If evolution-plugin is available, compile
	a plugin for Evolution to allow sending arbitrary attachments through
	nautilus-sendto (Closes: #511685)

2009-02-18  Bastien Nocera  <hadess hadess net>

	* POTFILES.in: Update for latest changes



Added:
   trunk/evolution/
   trunk/evolution/Makefile.am
   trunk/evolution/nautilus-sendto.c
   trunk/evolution/org-gnome-evolution-send-attachments-to.eplug.xml
   trunk/evolution/plugin.mk
Modified:
   trunk/ChangeLog
   trunk/Makefile.am
   trunk/configure.in
   trunk/po/ChangeLog
   trunk/po/POTFILES.in

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Wed Feb 18 14:48:25 2009
@@ -6,9 +6,13 @@
 PIDGIN_PLUGIN_DIR=pidgin_plugin
 endif
 
-SUBDIRS = src $(GAIM_PLUGIN_DIR) $(PIDGIN_PLUGIN_DIR) po
+if HAVE_EVOLUTION
+EVOLUTION_PLUGIN_DIR=evolution
+endif
+
+SUBDIRS = src $(GAIM_PLUGIN_DIR) $(PIDGIN_PLUGIN_DIR) $(EVOLUTION_PLUGIN_DIR) po
 
-DIST_SUBDIRS = gaim_plugin pidgin_plugin src po
+DIST_SUBDIRS = gaim_plugin pidgin_plugin evolution src po
 
 man_MANS = nautilus-sendto.1
 

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Wed Feb 18 14:48:25 2009
@@ -70,6 +70,21 @@
 NAUTILUS_EXTENSION_DIR=`$PKG_CONFIG --variable=extensiondir libnautilus-extension`
 AC_SUBST(NAUTILUS_EXTENSION_DIR)
 
+dnl Get details about evolution
+
+PKG_CHECK_MODULES(EVOLUTION, evolution-plugin libglade-2.0,
+		  enable_evo=yes, enable_evo=no)
+AM_CONDITIONAL(HAVE_EVOLUTION, test "x$enable_evo" = "xyes")
+
+SOEXT=".so"
+AC_SUBST(SOEXT)
+
+plugindir=`$PKG_CONFIG --variable=plugindir evolution-plugin`
+AC_SUBST(plugindir)
+
+EVO_PLUGIN_RULE=$srcdir/evolution/plugin.mk
+AC_SUBST_FILE(EVO_PLUGIN_RULE)
+
 # The full list of plugins
 allowed_plugins="bluetooth empathy evolution gaim gajim nautilus-burn pidgin removable-devices upnp"
 
@@ -299,6 +314,7 @@
 src/plugins/pidgin/Makefile
 src/plugins/removable-devices/Makefile
 src/plugins/upnp/Makefile
+evolution/Makefile
 gaim_plugin/Makefile
 pidgin_plugin/Makefile
 po/Makefile.in
@@ -321,7 +337,13 @@
 		AC_MSG_NOTICE([   ${allowed_plugin} plugin disabled])
 	done
 else
-	AC_MSG_NOTICE([   No Totem plugins enabled])
+	AC_MSG_NOTICE([   No nautilus-sendto plugins enabled])
+fi
+
+if test "x$enable_evo" = "xyes"; then
+	AC_MSG_NOTICE([** Evolution send-to plugin enabled])
+else
+	AC_MSG_NOTICE([   Evolution send-to plugin disabled])
 fi
 
 echo "                                                       "

Added: trunk/evolution/Makefile.am
==============================================================================
--- (empty file)
+++ trunk/evolution/Makefile.am	Wed Feb 18 14:48:25 2009
@@ -0,0 +1,17 @@
+INCLUDES =						\
+	$(EVOLUTION_CFLAGS)				\
+	$(WARN_CFLAGS)
+
+ EVO_PLUGIN_RULE@
+
+plugin_DATA = org-gnome-evolution-send-attachments-to.eplug
+plugin_LTLIBRARIES = liborg-gnome-evolution-send-attachments-to.la
+
+liborg_gnome_evolution_send_attachments_to_la_SOURCES = nautilus-sendto.c
+liborg_gnome_evolution_send_attachments_to_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
+liborg_gnome_evolution_send_attachments_to_la_LIBADD = $(EVOLUTION_LIBS)
+
+EXTRA_DIST = org-gnome-evolution-send-attachments-to.eplug.xml
+
+BUILT_SOURCES = $(plugin_DATA)
+CLEANFILES = $(BUILT_SOURCES)

Added: trunk/evolution/nautilus-sendto.c
==============================================================================
--- (empty file)
+++ trunk/evolution/nautilus-sendto.c	Wed Feb 18 14:48:25 2009
@@ -0,0 +1,112 @@
+/*
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) version 3.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with the program; if not, see <http://www.gnu.org/licenses/>  
+ *
+ *
+ * Authors:
+ *		Johnny Jacob <johnnyjacob gmail com>
+ *
+ * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com)
+ *
+ */
+
+#include <config.h>
+
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <glib/gi18n-lib.h>
+#include <e-util/e-config.h>
+#include <e-util/e-popup.h>
+#include <mail/em-popup.h>
+#include <mail/em-menu.h>
+#include <mail/em-utils.h>
+#include <misc/e-attachment.h>
+
+static void send_file (EPlugin *ep, EPopupTarget *t, void *data);
+void org_gnome_evolution_send_file_attachments (EPlugin *ep, EMPopupTargetAttachments *t);
+void org_gnome_evolution_send_file_part (EPlugin *ep, EMPopupTargetPart *t);
+
+static void
+popup_free (EPopup *ep, GSList *items, void *data)
+{
+	g_slist_free (items);
+}
+
+static EPopupItem popup_attachment_items[] = {
+	{ E_POPUP_BAR, "25.display.00"},
+	{ E_POPUP_ITEM, "25.display.01", N_("_Send to..."), (EPopupActivateFunc)send_file, NULL, "document-send"}
+};
+
+void org_gnome_evolution_send_file_attachments (EPlugin *ep, EMPopupTargetAttachments *t)
+{
+	GSList *menus = NULL;
+	int len = 0;
+
+	g_message ("org_gnome_evolution_send_file_attachments called");
+
+	len = g_slist_length(t->attachments);
+
+	if (len != 1)
+		return;
+
+	menus = g_slist_prepend (menus, &popup_attachment_items[0]);
+	menus = g_slist_prepend (menus, &popup_attachment_items[1]);
+	e_popup_add_items (t->target.popup, menus, GETTEXT_PACKAGE, popup_free, t);
+}
+
+void org_gnome_evolution_send_file_part (EPlugin *ep, EMPopupTargetPart *t)
+{
+	GSList *menus = NULL;
+
+	g_message ("org_gnome_evolution_send_file_attachments called");
+
+	menus = g_slist_prepend (menus, &popup_attachment_items[0]);
+	menus = g_slist_prepend (menus, &popup_attachment_items[1]);
+	e_popup_add_items (t->target.popup, menus, GETTEXT_PACKAGE, popup_free, t);
+}
+
+static void
+send_file (EPlugin *ep, EPopupTarget *t, void *data)
+{
+	CamelMimePart *part;
+	char *path;
+	EPopupTarget *target = (EPopupTarget *) data;
+	GPtrArray *argv;
+	gboolean ret;
+	GError *err = NULL;
+
+	if (target->type == EM_POPUP_TARGET_ATTACHMENTS)
+		part = ((EAttachment *) ((EMPopupTargetAttachments *) target)->attachments->data)->body;
+	else
+		part = ((EMPopupTargetPart *) target)->part;
+
+	path = em_utils_temp_save_part (NULL, part, FALSE);
+	g_message ("saved part as %s", path);
+
+	argv = g_ptr_array_new ();
+	g_ptr_array_add (argv, "nautilus-sendto");
+	g_ptr_array_add (argv, path);
+	g_ptr_array_add (argv, NULL);
+
+	ret = g_spawn_async (NULL, (gchar **) argv->pdata,
+			     NULL, G_SPAWN_SEARCH_PATH, NULL, NULL, NULL, &err);
+	g_ptr_array_free (argv, TRUE);
+
+	if (ret == FALSE) {
+		g_warning ("Couldn't send the attachment: %s", err->message);
+		g_error_free (err);
+	}
+
+	g_free (path);
+}
+

Added: trunk/evolution/org-gnome-evolution-send-attachments-to.eplug.xml
==============================================================================
--- (empty file)
+++ trunk/evolution/org-gnome-evolution-send-attachments-to.eplug.xml	Wed Feb 18 14:48:25 2009
@@ -0,0 +1,28 @@
+<?xml version="1.0"?>
+<e-plugin-list>
+  <!-- the path to the shared library -->
+  <e-plugin
+    id="org-gnome-evolution-send-attachments-to"
+    type="shlib"
+    location="@PLUGINDIR@/liborg-gnome-evolution-send-attachments-to SOEXT@"
+    _name="Send to..."
+    domain="@GETTEXT_PACKAGE@">
+    
+    <author name="Bastien Nocera" email="hadess hadess net"/>
+    <_description>Send files to remote devices, or people</_description>
+        <!-- Attachment to received e-mail -->
+	<hook class="org.gnome.evolution.mail.popup:1.0">
+		<menu id="org.gnome.evolution.mail.formathtmldisplay.popup" target="part" factory="org_gnome_evolution_send_file_part">
+		</menu>
+	</hook>
+	<hook class="org.gnome.evolution.mail.popup:1.0">
+		<menu id="org.gnome.evolution.mail.attachments.popup" target="attachments" factory="org_gnome_evolution_send_file_attachments">
+		</menu>
+	</hook>
+	<!-- Right-click in the attachment bar when creating a new mail -->
+	<hook class="org.gnome.evolution.mail.popup:1.0">
+		<menu id="org.gnome.evolution.mail.composer.attachmentbar.popup" target="attachments" factory="org_gnome_evolution_send_file_attachments">
+		</menu>
+	</hook>
+  </e-plugin>
+</e-plugin-list>

Added: trunk/evolution/plugin.mk
==============================================================================
--- (empty file)
+++ trunk/evolution/plugin.mk	Wed Feb 18 14:48:25 2009
@@ -0,0 +1,11 @@
+%.eplug: %.eplug.in
+	sed -e 's|\ PLUGINDIR\@|$(plugindir)|'		\
+	-e 's|\ SOEXT\@|$(SOEXT)|'			\
+	-e 's|\ GETTEXT_PACKAGE\@|$(GETTEXT_PACKAGE)|'	\
+	-e 's|\ LOCALEDIR\@|$(localedir)|' $< > $@
+
+%.eplug.in: %.eplug.xml
+	LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $@
+
+%.error: %.error.xml
+	LC_ALL=C $(INTLTOOL_MERGE) -x -u /tmp $< $@

Modified: trunk/po/POTFILES.in
==============================================================================
--- trunk/po/POTFILES.in	(original)
+++ trunk/po/POTFILES.in	Wed Feb 18 14:48:25 2009
@@ -1,6 +1,8 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
 nst.schemas.in
+evolution/nautilus-sendto.c
+evolution/org-gnome-evolution-send-attachments-to.eplug.xml
 gaim_plugin/nautilus-sendto-plugin.c
 pidgin_plugin/nautilus-sendto-plugin.c
 src/nautilus-nste.c
@@ -8,7 +10,6 @@
 src/nautilus-sendto-command.c
 src/nautilus-sendto-module.c
 src/nautilus-sendto.glade
-src/plugins/balsa/balsa.c
 src/plugins/bluetooth/bluetooth.c
 src/plugins/empathy/empathy.c
 src/plugins/evolution/evolution.c
@@ -17,6 +18,5 @@
 src/plugins/gajim/gajim.c
 src/plugins/nautilus-burn/nautilus-burn.c
 src/plugins/pidgin/pidgin.c
-src/plugins/sylpheed-claws/sylpheed-claws.c
-src/plugins/thunderbird/thunderbird.c
+src/plugins/removable-devices/removable-devices.c
 src/plugins/upnp/upnp.c



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