aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Persch <chpe@cvs.gnome.org>2005-01-05 05:31:06 +0800
committerChristian Persch <chpe@src.gnome.org>2005-01-05 05:31:06 +0800
commitc22cb479dbb9879f1b153f391b57e972f53c1b9f (patch)
treeea08d36b6d6d04b04ea3edca057831c33f3d2cf7 /src
parentaf3fc43e417a96bc31b5bda39153980486da1ca9 (diff)
downloadgsoc2013-epiphany-c22cb479dbb9879f1b153f391b57e972f53c1b9f.tar
gsoc2013-epiphany-c22cb479dbb9879f1b153f391b57e972f53c1b9f.tar.gz
gsoc2013-epiphany-c22cb479dbb9879f1b153f391b57e972f53c1b9f.tar.bz2
gsoc2013-epiphany-c22cb479dbb9879f1b153f391b57e972f53c1b9f.tar.lz
gsoc2013-epiphany-c22cb479dbb9879f1b153f391b57e972f53c1b9f.tar.xz
gsoc2013-epiphany-c22cb479dbb9879f1b153f391b57e972f53c1b9f.tar.zst
gsoc2013-epiphany-c22cb479dbb9879f1b153f391b57e972f53c1b9f.zip
Use ngettext to get the Open in New Tab[s]/Window[s] label.
2005-01-04 Christian Persch <chpe@cvs.gnome.org> * lib/widgets/ephy-node-view.c: * lib/widgets/ephy-node-view.h: * src/bookmarks/ephy-bookmarks-editor.c: (ephy_bookmarks_editor_update_menu): * src/ephy-history-window.c: (ephy_history_window_update_menu): Use ngettext to get the Open in New Tab[s]/Window[s] label. 2005-01-04 Christian Persch <chpe@cvs.gnome.org>
Diffstat (limited to 'src')
-rw-r--r--src/bookmarks/ephy-bookmarks-editor.c53
-rw-r--r--src/ephy-history-window.c45
2 files changed, 47 insertions, 51 deletions
diff --git a/src/bookmarks/ephy-bookmarks-editor.c b/src/bookmarks/ephy-bookmarks-editor.c
index 947d31911..e7cfb6b38 100644
--- a/src/bookmarks/ephy-bookmarks-editor.c
+++ b/src/bookmarks/ephy-bookmarks-editor.c
@@ -1069,15 +1069,15 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
rename, delete, properties;
const gchar *open_in_window_label, *open_in_tab_label, *copy_label;
gboolean bmk_focus, key_focus;
- gboolean key_selection, bmk_selection;
+ gboolean key_selection, bmk_selection, single_bmk_selected;
gboolean key_normal = FALSE;
- gboolean bmk_multiple_selection;
gboolean cut, copy, paste, select_all;
gboolean can_show_in_bookmarks_bar, show_in_bookmarks_bar = FALSE;
GtkActionGroup *action_group;
GtkAction *action;
GList *selected;
GtkWidget *focus_widget;
+ int num_bmk_selected;
LOG ("Update menu sensitivity")
@@ -1086,11 +1086,14 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
key_focus = ephy_node_view_is_target
(EPHY_NODE_VIEW (editor->priv->key_view));
focus_widget = gtk_window_get_focus (GTK_WINDOW (editor));
- bmk_selection = ephy_node_view_has_selection
- (EPHY_NODE_VIEW (editor->priv->bm_view),
- &bmk_multiple_selection);
- key_selection = ephy_node_view_has_selection
- (EPHY_NODE_VIEW (editor->priv->key_view), NULL);
+
+ num_bmk_selected = gtk_tree_selection_count_selected_rows
+ (gtk_tree_view_get_selection (GTK_TREE_VIEW (editor->priv->bm_view)));
+ bmk_selection = num_bmk_selected > 0;
+ single_bmk_selected = num_bmk_selected == 1;
+
+ key_selection = gtk_tree_selection_count_selected_rows
+ (gtk_tree_view_get_selection (GTK_TREE_VIEW (editor->priv->key_view))) > 0;
if (GTK_IS_EDITABLE (focus_widget))
{
@@ -1107,7 +1110,7 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
else
{
cut = FALSE;
- copy = (bmk_focus && !bmk_multiple_selection && bmk_selection);
+ copy = (bmk_focus && single_bmk_selected);
paste = FALSE;
select_all = bmk_focus;
}
@@ -1146,16 +1149,12 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
g_list_free (selected);
}
- if (bmk_multiple_selection)
- {
- open_in_window_label = N_("_Open in New Windows");
- open_in_tab_label = N_("Open in New _Tabs");
- }
- else
- {
- open_in_window_label = _("_Open in New Window");
- open_in_tab_label = _("Open in New _Tab");
- }
+ open_in_window_label = ngettext ("_Open in New Window",
+ "_Open in New Windows",
+ num_bmk_selected);
+ open_in_tab_label = ngettext ("Open in New _Tab",
+ "Open in New _Tabs",
+ num_bmk_selected);
if (bmk_focus)
{
@@ -1168,21 +1167,21 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
open_in_window = (bmk_focus && bmk_selection);
open_in_tab = (bmk_focus && bmk_selection);
- rename = (bmk_focus && bmk_selection && !bmk_multiple_selection) ||
+ rename = (bmk_focus && single_bmk_selected) ||
(key_selection && key_focus && key_normal);
delete = (bmk_focus && bmk_selection) ||
(key_selection && key_focus && key_normal);
- properties = (bmk_focus && bmk_selection && !bmk_multiple_selection);
- can_show_in_bookmarks_bar = (bmk_focus && bmk_selection && !bmk_multiple_selection) ||
+ properties = (bmk_focus && single_bmk_selected);
+ can_show_in_bookmarks_bar = (bmk_focus && single_bmk_selected) ||
(key_selection && key_focus);
action_group = editor->priv->action_group;
action = gtk_action_group_get_action (action_group, "OpenInWindow");
- g_object_set (action, "sensitive", open_in_window, NULL);
- g_object_set (action, "label", open_in_window_label, NULL);
+ g_object_set (action, "sensitive", open_in_window,
+ "label", open_in_window_label, NULL);
action = gtk_action_group_get_action (action_group, "OpenInTab");
- g_object_set (action, "sensitive", open_in_tab, NULL);
- g_object_set (action, "label", open_in_tab_label, NULL);
+ g_object_set (action, "sensitive", open_in_tab,
+ "label", open_in_tab_label, NULL);
action = gtk_action_group_get_action (action_group, "Rename");
g_object_set (action, "sensitive", rename, NULL);
action = gtk_action_group_get_action (action_group, "Delete");
@@ -1192,8 +1191,8 @@ ephy_bookmarks_editor_update_menu (EphyBookmarksEditor *editor)
action = gtk_action_group_get_action (action_group, "Cut");
g_object_set (action, "sensitive", cut, NULL);
action = gtk_action_group_get_action (action_group, "Copy");
- g_object_set (action, "sensitive", copy, NULL);
- g_object_set (action, "label", copy_label, NULL);
+ g_object_set (action, "sensitive", copy,
+ "label", copy_label, NULL);
action = gtk_action_group_get_action (action_group, "Paste");
g_object_set (action, "sensitive", paste, NULL);
action = gtk_action_group_get_action (action_group, "SelectAll");
diff --git a/src/ephy-history-window.c b/src/ephy-history-window.c
index 88117b567..a253c400c 100644
--- a/src/ephy-history-window.c
+++ b/src/ephy-history-window.c
@@ -672,9 +672,9 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
{
gboolean open_in_window, open_in_tab;
gboolean cut, copy, paste, select_all;
- gboolean pages_focus, pages_selection;
- gboolean pages_multiple_selection;
+ gboolean pages_focus, pages_selection, single_page_selected;
gboolean delete, bookmark_page;
+ int num_pages_selected;
GtkActionGroup *action_group;
GtkAction *action;
char *open_in_window_label, *open_in_tab_label, *copy_label;
@@ -682,9 +682,11 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
pages_focus = ephy_node_view_is_target
(EPHY_NODE_VIEW (editor->priv->pages_view));
- pages_selection = ephy_node_view_has_selection
- (EPHY_NODE_VIEW (editor->priv->pages_view),
- &pages_multiple_selection);
+ num_pages_selected = gtk_tree_selection_count_selected_rows
+ (gtk_tree_view_get_selection (GTK_TREE_VIEW (editor->priv->pages_view)));
+ pages_selection = num_pages_selected > 0;
+ single_page_selected = num_pages_selected == 1;
+
focus_widget = gtk_window_get_focus (GTK_WINDOW (editor));
if (GTK_IS_EDITABLE (focus_widget))
@@ -702,21 +704,17 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
else
{
cut = FALSE;
- copy = (pages_focus && !pages_multiple_selection && pages_selection);
+ copy = (pages_focus && single_page_selected);
paste = FALSE;
select_all = pages_focus;
}
- if (pages_multiple_selection)
- {
- open_in_window_label = N_("_Open in New Windows");
- open_in_tab_label = N_("Open in New _Tabs");
- }
- else
- {
- open_in_window_label = _("_Open in New Window");
- open_in_tab_label = _("Open in New _Tab");
- }
+ open_in_window_label = ngettext ("_Open in New Window",
+ "_Open in New Windows",
+ num_pages_selected);
+ open_in_tab_label = ngettext ("Open in New _Tab",
+ "Open in New _Tabs",
+ num_pages_selected);
if (pages_focus)
{
@@ -727,24 +725,23 @@ ephy_history_window_update_menu (EphyHistoryWindow *editor)
copy_label = _("_Copy");
}
-
open_in_window = (pages_focus && pages_selection);
open_in_tab = (pages_focus && pages_selection);
delete = (pages_focus && pages_selection);
- bookmark_page = (pages_focus && pages_selection && !pages_multiple_selection);
+ bookmark_page = (pages_focus && single_page_selected);
action_group = editor->priv->action_group;
action = gtk_action_group_get_action (action_group, "OpenInWindow");
- g_object_set (action, "sensitive", open_in_window, NULL);
- g_object_set (action, "label", open_in_window_label, NULL);
+ g_object_set (action, "sensitive", open_in_window,
+ "label", open_in_window_label, NULL);
action = gtk_action_group_get_action (action_group, "OpenInTab");
- g_object_set (action, "sensitive", open_in_tab, NULL);
- g_object_set (action, "label", open_in_tab_label, NULL);
+ g_object_set (action, "sensitive", open_in_tab,
+ "label", open_in_tab_label, NULL);
action = gtk_action_group_get_action (action_group, "Cut");
g_object_set (action, "sensitive", cut, NULL);
action = gtk_action_group_get_action (action_group, "Copy");
- g_object_set (action, "sensitive", copy, NULL);
- g_object_set (action, "label", copy_label, NULL);
+ g_object_set (action, "sensitive", copy,
+ "label", copy_label, NULL);
action = gtk_action_group_get_action (action_group, "Paste");
g_object_set (action, "sensitive", paste, NULL);
action = gtk_action_group_get_action (action_group, "SelectAll");