From 09cd68cbee77e56de1b7fd1be9367ea6822f0148 Mon Sep 17 00:00:00 2001 From: hiro Date: Thu, 20 Jan 2011 08:10:35 +0000 Subject: added 'textview-menu-popup' signal for plug-ins. git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@2811 ee746299-78ed-0310-b773-934348b2243d --- plugin/test/test.c | 37 +++++++++++++++++++++++++++++++++++-- plugin/test/test.h | 2 +- 2 files changed, 36 insertions(+), 3 deletions(-) (limited to 'plugin/test') diff --git a/plugin/test/test.c b/plugin/test/test.c index b8bfa7a1..f0e0fdf5 100644 --- a/plugin/test/test.c +++ b/plugin/test/test.c @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2010 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,7 +27,7 @@ static SylPluginInfo info = { "Test Plugin", - "3.0.99", + "3.1.0", "Hiroyuki Yamamoto", "Test plug-in for Sylpheed plug-in system" }; @@ -40,6 +40,11 @@ static void folderview_menu_popup_cb(GObject *obj, GtkItemFactory *ifactory, static void summaryview_menu_popup_cb(GObject *obj, GtkItemFactory *ifactory, gpointer data); +static void textview_menu_popup_cb(GObject *obj, GtkMenu *menu, + GtkTextView *textview, + const gchar *uri, + const gchar *selected_text); + static void menu_selected_cb(void); static void compose_created_cb(GObject *obj, gpointer compose); @@ -87,6 +92,8 @@ void plugin_load(void) G_CALLBACK(folderview_menu_popup_cb), NULL); syl_plugin_signal_connect("summaryview-menu-popup", G_CALLBACK(summaryview_menu_popup_cb), NULL); + syl_plugin_signal_connect("textview-menu-popup", + G_CALLBACK(textview_menu_popup_cb), NULL); syl_plugin_signal_connect("compose-created", G_CALLBACK(compose_created_cb), NULL); syl_plugin_signal_connect("compose-destroy", @@ -147,6 +154,32 @@ static void summaryview_menu_popup_cb(GObject *obj, GtkItemFactory *ifactory, gtk_widget_set_sensitive(widget, TRUE); } +static void activate_menu_cb(GtkMenuItem *menuitem, gpointer data) +{ + g_print("menu activated\n"); +} + +static void textview_menu_popup_cb(GObject *obj, GtkMenu *menu, + GtkTextView *textview, + const gchar *uri, + const gchar *selected_text) +{ + GtkWidget *separator, *menuitem; + + g_print("test: %p: textview menu popup\n", obj); + g_print("test: %p: uri: %s, text: %s\n", obj, uri ? uri : "(none)", + selected_text ? selected_text : "(none)"); + + separator = gtk_separator_menu_item_new(); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), separator); + gtk_widget_show(separator); + + menuitem = gtk_menu_item_new_with_mnemonic("Test menu"); + g_signal_connect(menuitem, "activate", G_CALLBACK(activate_menu_cb), NULL); + gtk_menu_shell_append(GTK_MENU_SHELL(menu), menuitem); + gtk_widget_show(menuitem); +} + static void menu_selected_cb(void) { gint sel; diff --git a/plugin/test/test.h b/plugin/test/test.h index 9a559b3a..253c9155 100644 --- a/plugin/test/test.h +++ b/plugin/test/test.h @@ -1,6 +1,6 @@ /* * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 1999-2009 Hiroyuki Yamamoto + * Copyright (C) 1999-2011 Hiroyuki Yamamoto * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by -- cgit v1.2.3