gtranslator r3907 - in trunk: . data src
- From: psanxiao svn gnome org
- To: svn-commits-list gnome org
- Subject: gtranslator r3907 - in trunk: . data src
- Date: Wed, 31 Dec 2008 17:17:49 +0000 (UTC)
Author: psanxiao
Date: Wed Dec 31 17:17:48 2008
New Revision: 3907
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3907&view=rev
Log:
* data/gtranslator-ui.xml:
* src/actions-go.c:
* src/actions.h:
* src/window.c:
Added GoNext/PrevFile actions and shortcuts.
Added shortcuts to GoFirst/Last actions.
Modified:
trunk/ChangeLog
trunk/data/gtranslator-ui.xml
trunk/src/actions-go.c
trunk/src/actions.h
trunk/src/window.c
Modified: trunk/data/gtranslator-ui.xml
==============================================================================
--- trunk/data/gtranslator-ui.xml (original)
+++ trunk/data/gtranslator-ui.xml Wed Dec 31 17:17:48 2008
@@ -61,6 +61,9 @@
</menu>--?>
<menu name="GoMenu" action="Go">
+ <menuitem name="GoPrevFileMenu" action="GoPrevFile"/>
+ <menuitem name="GoNextFileMenu" action="GoNextFile"/>
+ <separator/>
<menuitem name="GoFirstMenu" action="GoFirst"/>
<menuitem name="GoPreviousMenu" action="GoPrevious"/>
<separator/>
Modified: trunk/src/actions-go.c
==============================================================================
--- trunk/src/actions-go.c (original)
+++ trunk/src/actions-go.c Wed Dec 31 17:17:48 2008
@@ -31,6 +31,24 @@
#include "window.h"
+void
+gtranslator_file_go_to_next (GtkAction * action,
+ GtranslatorWindow *window)
+{
+ GtranslatorNotebook *notebook;
+ notebook = gtranslator_window_get_notebook (window);
+ gtk_notebook_next_page (GTK_NOTEBOOK (notebook));
+}
+
+void
+gtranslator_file_go_to_prev (GtkAction * action,
+ GtranslatorWindow *window)
+{
+ GtranslatorNotebook *notebook;
+ notebook = gtranslator_window_get_notebook (window);
+ gtk_notebook_prev_page (GTK_NOTEBOOK (notebook));
+}
+
void
gtranslator_message_go_to_first(GtkAction *action,
GtranslatorWindow *window)
Modified: trunk/src/actions.h
==============================================================================
--- trunk/src/actions.h (original)
+++ trunk/src/actions.h Wed Dec 31 17:17:48 2008
@@ -96,6 +96,12 @@
GtranslatorWindow *window);
/*Go*/
+void gtranslator_file_go_to_next (GtkAction * action,
+ GtranslatorWindow *window);
+
+void gtranslator_file_go_to_prev (GtkAction * action,
+ GtranslatorWindow *window);
+
void gtranslator_message_go_to_first (GtkAction * action,
GtranslatorWindow *window);
Modified: trunk/src/window.c
==============================================================================
--- trunk/src/window.c (original)
+++ trunk/src/window.c Wed Dec 31 17:17:48 2008
@@ -223,8 +223,14 @@
//G_CALLBACK(gtranslator_remove_all_translations_dialog) },*/
/* Go menu */
- { "GoFirst", GTK_STOCK_GOTO_FIRST, NULL, NULL,
- N_("Go to the first message"),
+ { "GoPrevFile", NULL, N_("Prev F_ile"),
+ "<control>Page_Up", N_("Go to the next file"),
+ G_CALLBACK (gtranslator_file_go_to_prev) },
+ { "GoNextFile", NULL, N_("Next Fi_le"),
+ "<control>Page_Down", N_("Go to the next file"),
+ G_CALLBACK (gtranslator_file_go_to_next) },
+ { "GoFirst", GTK_STOCK_GOTO_FIRST, NULL,
+ "<alt>Home", N_("Go to the first message"),
G_CALLBACK (gtranslator_message_go_to_first) },
{ "GoPrevious", GTK_STOCK_GO_BACK, NULL, "<alt>Left",
N_("Move back one message"),
@@ -232,14 +238,14 @@
{ "GoForward", GTK_STOCK_GO_FORWARD, NULL, "<alt>Right",
N_("Move forward one message"),
G_CALLBACK (gtranslator_message_go_to_next) },
- { "GoLast", GTK_STOCK_GOTO_LAST, NULL, NULL,
- N_("Go to the last message"),
+ { "GoLast", GTK_STOCK_GOTO_LAST, NULL,
+ "<alt>End", N_("Go to the last message"),
G_CALLBACK (gtranslator_message_go_to_last) },
{ "GoNextFuzzy", GTR_STOCK_FUZZY_NEXT, N_("Next Fuz_zy"),
- "<control>Page_Down", N_("Go to the next fuzzy message"),
+ "<alt><control>Page_Down", N_("Go to the next fuzzy message"),
G_CALLBACK (gtranslator_message_go_to_next_fuzzy) },
{ "GoPreviousFuzzy", GTR_STOCK_FUZZY_PREV, N_("Previous Fuzz_y"),
- "<control>Page_Up", N_("Go to the previous fuzzy message"),
+ "<alt><control>Page_Up", N_("Go to the previous fuzzy message"),
G_CALLBACK (gtranslator_message_go_to_prev_fuzzy) },
{ "GoNextUntranslated", GTR_STOCK_UNTRANS_NEXT, N_("Next _Untranslated"),
"<alt>Page_Down", N_("Go to the next untranslated message"),
@@ -637,13 +643,18 @@
set_sensitive_according_to_tab(GtranslatorWindow *window,
GtranslatorTab *tab)
{
+ GtranslatorNotebook *notebook;
GtranslatorView *view;
GtranslatorPo *po;
GtkSourceBuffer *buf;
GtkAction *action;
GList *current;
GtranslatorPoState state;
+ gint pages;
+ gint current_page;
+ notebook = gtranslator_window_get_notebook (window);
+ pages = gtk_notebook_get_n_pages(GTK_NOTEBOOK(window->priv->notebook));
view = gtranslator_tab_get_active_view(tab);
po = gtranslator_tab_get_po(tab);
current = gtranslator_po_get_current_message(po);
@@ -681,6 +692,18 @@
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (buf)));
/*Go*/
+ current_page = gtk_notebook_page_num (GTK_NOTEBOOK (notebook), GTK_WIDGET (tab));
+ g_return_if_fail (current_page >= 0);
+
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "GoPrevFile");
+ gtk_action_set_sensitive (action, current_page != 0);
+
+ action = gtk_action_group_get_action (window->priv->action_group,
+ "GoNextFile");
+ gtk_action_set_sensitive (action,
+ current_page < pages - 1);
+
set_sensitive_according_to_message(window, po);
}
@@ -693,7 +716,6 @@
gtk_action_group_set_sensitive(window->priv->action_group,
pages > 0);
-
}
/*
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]