SF.net SVN: geany-plugins:[202] trunk/geanysendmail

frlan at users.sourceforge.net frlan at xxxxx
Mon Oct 13 16:27:00 UTC 2008


Revision: 202
          http://geany-plugins.svn.sourceforge.net/geany-plugins/?rev=202&view=rev
Author:   frlan
Date:     2008-10-13 16:26:58 +0000 (Mon, 13 Oct 2008)

Log Message:
-----------
GeanySendMail: Added a patch to make use of new add icon to toolbar function by Nick.

Modified Paths:
--------------
    trunk/geanysendmail/ChangeLog
    trunk/geanysendmail/src/geanysendmail.c

Modified: trunk/geanysendmail/ChangeLog
===================================================================
--- trunk/geanysendmail/ChangeLog	2008-10-13 12:42:58 UTC (rev 201)
+++ trunk/geanysendmail/ChangeLog	2008-10-13 16:26:58 UTC (rev 202)
@@ -1,3 +1,9 @@
+2008-10-13  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
+
+ * Applied a patch by Nick to make use of Geany Plugin API r99 and the
+   add item to toolbar function.
+
+
 2008-10-03  Frank Lanitz  <frank(at)frank(dot)uvena(dot)de>
 
  * Implement a %b placeholder for adding basename of file to mailer command.

Modified: trunk/geanysendmail/src/geanysendmail.c
===================================================================
--- trunk/geanysendmail/src/geanysendmail.c	2008-10-13 12:42:58 UTC (rev 201)
+++ trunk/geanysendmail/src/geanysendmail.c	2008-10-13 16:26:58 UTC (rev 202)
@@ -38,12 +38,12 @@
 # include <locale.h>
 #endif
 
-PluginInfo		*plugin_info;
+GeanyPlugin		*geany_plugin;
 PluginFields	*plugin_fields;
 GeanyData		*geany_data;
 GeanyFunctions	*geany_functions;
 
-PLUGIN_VERSION_CHECK(71)
+PLUGIN_VERSION_CHECK(99)
 
 PLUGIN_SET_INFO(_("GeanySendMail"), _("A little plugin to send the current \
 file as attachment by user's favorite mailer"), "0.4svn", "Frank Lanitz <frank at frank.uvena.de>")
@@ -64,8 +64,6 @@
 gboolean use_address_dialog = FALSE;
 /* Needed global to remove from toolbar again */
 GtkWidget *mailbutton = NULL;
-GtkWidget *separator = NULL;
-GtkWidget *separator2 = NULL;
 
 
 static void locale_init(void)
@@ -238,9 +236,6 @@
 	GtkWidget *icon = NULL;
 	GtkIconSize size = geany_data->toolbar_prefs->icon_size;
 
-	int number_of_icons = 0;
-	number_of_icons = gtk_toolbar_get_n_items(GTK_TOOLBAR(geany->main_widgets->toolbar));
-
 	mailbutton_pb = gtk_icon_theme_load_icon(gtk_icon_theme_get_default(),
 					"mail-message-new", size, ICON_LOOKUP_MODE, NULL);
 
@@ -253,18 +248,10 @@
 	icon = gtk_image_new_from_pixbuf(mailbutton_pb);
 	g_object_unref(mailbutton_pb);
 
-	separator = (GtkWidget*) gtk_separator_tool_item_new();
-	gtk_widget_show (separator);
-	gtk_toolbar_insert(GTK_TOOLBAR(geany->main_widgets->toolbar), GTK_TOOL_ITEM(separator), number_of_icons - 2);
-
 	mailbutton = (GtkWidget*) gtk_tool_button_new (icon, "Mail");
-	gtk_toolbar_insert(GTK_TOOLBAR(geany->main_widgets->toolbar), GTK_TOOL_ITEM(mailbutton), number_of_icons - 1);
+	p_plugin->add_toolbar_item(geany_plugin, GTK_TOOL_ITEM(mailbutton));
 	g_signal_connect (G_OBJECT(mailbutton), "clicked", G_CALLBACK(send_as_attachment), NULL);
 	gtk_widget_show_all (mailbutton);
-
-	separator2 = (GtkWidget*) gtk_separator_tool_item_new();
-	gtk_widget_show (separator2);
-	gtk_toolbar_insert(GTK_TOOLBAR(geany->main_widgets->toolbar), GTK_TOOL_ITEM(separator2), number_of_icons);
 }
 
 void cleanup_icon()
@@ -273,14 +260,6 @@
 	{
 		gtk_container_remove(GTK_CONTAINER (geany->main_widgets->toolbar), mailbutton);
 	}
-	if (separator != NULL)
-	{
-		gtk_container_remove(GTK_CONTAINER (geany->main_widgets->toolbar), separator);
-	}
-	if (separator2 != NULL)
-	{
-		gtk_container_remove(GTK_CONTAINER (geany->main_widgets->toolbar), separator2);
-	}
 }
 
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Plugins-Commits mailing list