https://bugs.wireshark.org/bugzilla/show_bug.cgi?id=5119
Summary: Edit menu items should apply to the widget with the
input focus
Product: Wireshark
Version: unspecified
Platform: All
OS/Version: All
Status: NEW
Severity: Normal
Priority: Low
Component: Wireshark
AssignedTo: wireshark-bugs@xxxxxxxxxxxxx
ReportedBy: guy@xxxxxxxxxxxx
Build Information:
N/A
--
The Edit menu should, at minimum, have Cut, Copy, Paste, and Select All menu
items, and they should apply to the widget in the main window that has the
input focus. Even if we don't initially implement them for the packet summary
or packet detail window, we should, at minimum, implement them for the filter
box.
If they're not implemented for a particular widget, they should be grayed out
if that widget has the input focus.
That's how those menu items work in, for example, Internet Explorer (Windows),
Safari (Mac OS X), and Epiphany (GNOME), so that's 3 out of 4 of the main
desktop environments; I don't have a KDE virtual machine handy, but I would be
extremely surprised to see Konqueror behave differently (i.e., I'll bet KDE
apps work the same way). (It's unlikely to be specific to Web browsers; it's
probably specified by at least some of the UI guidelines for the platforms in
question.)
Epiphany uses the GTK+ UI Manager and GtkActions for its main menu, so, unless
and until we do so, I'm not certain how we would implement that. However, for
example, the callback routine for Copy in the current stable version of
Epiphany is
void
window_cmd_edit_copy (GtkAction *action,
EphyWindow *window)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
if (GTK_IS_EDITABLE (widget))
{
gtk_editable_copy_clipboard (GTK_EDITABLE (widget));
}
else
{
EphyEmbed *embed;
embed = ephy_embed_container_get_active_child (EPHY_EMBED_CONTAINER
(window));
g_return_if_fail (embed != NULL);
webkit_web_view_copy_clipboard (EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED
(embed));
}
}
so we would probably do something similar - the "if (GTK_IS_EDITABLE (widget))"
arm of the conditional would handle any editables, such as the filter text box,
and the other arm would, if we were to implement copying from the packet
summary and packet detail window, somehow have to handle them.
As for greying out, Epiphany has routines
static void
update_edit_actions_sensitivity (EphyWindow *window, gboolean hide)
{
GtkWidget *widget = gtk_window_get_focus (GTK_WINDOW (window));
GtkActionGroup *action_group;
GtkAction *action;
gboolean can_copy, can_cut, can_undo, can_redo, can_paste;
if (GTK_IS_EDITABLE (widget))
{
gboolean has_selection;
GtkActionGroup *action_group;
GtkAction *location_action;
GSList *proxies;
GtkWidget *proxy;
action_group = ephy_toolbar_get_action_group (window->priv->toolbar);
location_action = gtk_action_group_get_action (action_group,
"Location");
proxies = gtk_action_get_proxies (location_action);
proxy = GTK_WIDGET (proxies->data);
has_selection = gtk_editable_get_selection_bounds
(GTK_EDITABLE (widget), NULL, NULL);
can_copy = has_selection;
can_cut = has_selection;
can_paste = TRUE;
if (proxy != NULL &&
EPHY_IS_LOCATION_ENTRY (proxy) &&
widget == ephy_location_entry_get_entry (EPHY_LOCATION_ENTRY
(proxy)))
{
can_undo = ephy_location_entry_get_can_undo (EPHY_LOCATION_ENTRY
(proxy));
can_redo = ephy_location_entry_get_can_redo (EPHY_LOCATION_ENTRY
(proxy));
}
else
{
can_undo = FALSE;
can_redo = FALSE;
}
}
else
{
EphyEmbed *embed;
WebKitWebView *view;
embed = window->priv->active_embed;
g_return_if_fail (embed != NULL);
view = EPHY_GET_WEBKIT_WEB_VIEW_FROM_EMBED (embed);
can_copy = webkit_web_view_can_copy_clipboard (view);
can_cut = webkit_web_view_can_cut_clipboard (view);
can_paste = webkit_web_view_can_paste_clipboard (view);
can_undo = webkit_web_view_can_undo (view);
can_redo = webkit_web_view_can_redo (view);
}
action_group = window->priv->action_group;
action = gtk_action_group_get_action (action_group, "EditCopy");
gtk_action_set_sensitive (action, can_copy);
gtk_action_set_visible (action, !hide || can_copy);
action = gtk_action_group_get_action (action_group, "EditCut");
gtk_action_set_sensitive (action, can_cut);
gtk_action_set_visible (action, !hide || can_cut);
action = gtk_action_group_get_action (action_group, "EditPaste");
gtk_action_set_sensitive (action, can_paste);
gtk_action_set_visible (action, !hide || can_paste);
action = gtk_action_group_get_action (action_group, "EditUndo");
gtk_action_set_sensitive (action, can_undo);
gtk_action_set_visible (action, !hide || can_undo);
action = gtk_action_group_get_action (action_group, "EditRedo");
gtk_action_set_sensitive (action, can_redo);
gtk_action_set_visible (action, !hide || can_redo);
}
static void
enable_edit_actions_sensitivity (EphyWindow *window)
{
GtkActionGroup *action_group;
GtkAction *action;
action_group = window->priv->action_group;
action = gtk_action_group_get_action (action_group, "EditCopy");
gtk_action_set_sensitive (action, TRUE);
gtk_action_set_visible (action, TRUE);
action = gtk_action_group_get_action (action_group, "EditCut");
gtk_action_set_sensitive (action, TRUE);
gtk_action_set_visible (action, TRUE);
action = gtk_action_group_get_action (action_group, "EditPaste");
gtk_action_set_sensitive (action, TRUE);
gtk_action_set_visible (action, TRUE);
action = gtk_action_group_get_action (action_group, "EditUndo");
gtk_action_set_sensitive (action, TRUE);
gtk_action_set_visible (action, TRUE);
action = gtk_action_group_get_action (action_group, "EditRedo");
gtk_action_set_sensitive (action, TRUE);
gtk_action_set_visible (action, TRUE);
}
which are called in various situations - see ephy-window.c in the Epiphany
source for details.
--
Configure bugmail: https://bugs.wireshark.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.