Add Copy (to clipboard) to expert item popup menu.

svn path=/trunk/; revision=33214
This commit is contained in:
Martin Mathieson 2010-06-13 14:55:11 +00:00
parent d5140df7e1
commit d2087d514e
2 changed files with 21 additions and 2 deletions

View File

@ -331,6 +331,16 @@ error_select_filter_cb(GtkWidget *widget _U_, gpointer callback_data, guint call
g_snprintf(str, sizeof(str), "http://www.google.com/search?hl=en&q=%s+'%s'", procedure->entries[0], procedure->entries[1]);
browser_open_url(str);
break;
case ACTION_COPY:
{
GString *copyString = g_string_sized_new(0);
g_string_printf(copyString, "%s: %s",
procedure->entries[0], procedure->entries[1]);
copy_to_clipboard(copyString);
g_string_free(copyString, TRUE);
}
break;
default:
simple_dialog(ESD_TYPE_ERROR, ESD_BTN_OK, "Can't find menu action - %u", action);
}
@ -431,7 +441,12 @@ static GtkItemFactoryEntry error_list_menu_items[] =
/* Search Internet */
{"/Internet Search for Info Text", NULL,
GTK_MENU_FUNC(error_select_filter_cb), CALLBACK_WEB_LOOKUP, NULL, NULL,}
GTK_MENU_FUNC(error_select_filter_cb), CALLBACK_WEB_LOOKUP, NULL, NULL,},
/* Copy item text (protocol plus summary)*/
{"/Copy", NULL,
GTK_MENU_FUNC(error_select_filter_cb), CALLBACK_COPY, NULL, NULL,},
};
#if 0

View File

@ -30,7 +30,9 @@
#define ACTION_FIND_NEXT 3
#define ACTION_FIND_PREVIOUS 4
#define ACTION_COLORIZE 5
#define ACTION_WEB_LOOKUP 6
#define ACTION_WEB_LOOKUP 6
#define ACTION_COPY 7
/* Action type - says what to do with the filter */
#define ACTYPE_SELECTED 0
@ -48,6 +50,8 @@
#define CALLBACK_FIND_PREVIOUS(type, extra) ((ACTION_FIND_PREVIOUS<<16) | ((type)<<8) | (extra))
#define CALLBACK_COLORIZE(type, extra) ((ACTION_COLORIZE<<16) | ((type)<<8) | (extra))
#define CALLBACK_WEB_LOOKUP (ACTION_WEB_LOOKUP<<16)
#define CALLBACK_COPY (ACTION_COPY<<16)
/* Extract components of callback argument */
#define FILTER_ACTION(cb_arg) (((cb_arg)>>16) & 0xff)