gtranslator r3594 - in trunk: . data plugins/alternate-language plugins/insert-tags plugins/open-tran src src/dialogs
- From: icq svn gnome org
- To: svn-commits-list gnome org
- Subject: gtranslator r3594 - in trunk: . data plugins/alternate-language plugins/insert-tags plugins/open-tran src src/dialogs
- Date: Mon, 22 Sep 2008 09:38:16 +0000 (UTC)
Author: icq
Date: Mon Sep 22 09:38:16 2008
New Revision: 3594
URL: http://svn.gnome.org/viewvc/gtranslator?rev=3594&view=rev
Log:
Merge fixings into the master branch to fix several bugs
Modified:
trunk/ChangeLog
trunk/data/po.lang
trunk/plugins/alternate-language/alternate-language-panel.c
trunk/plugins/alternate-language/alternate-language-plugin.c
trunk/plugins/insert-tags/insert-tags-plugin.c
trunk/plugins/open-tran/open-tran-panel.c
trunk/src/ChangeLog
trunk/src/actions-edit.c
trunk/src/actions-file.c
trunk/src/actions-go.c
trunk/src/actions-search.c
trunk/src/application.c
trunk/src/application.h
trunk/src/dialogs/file-dialogs.c
trunk/src/dialogs/file-dialogs.h
trunk/src/draw-spaces.c
trunk/src/message-table.c
trunk/src/msg.c
trunk/src/msg.h
trunk/src/tab.c
trunk/src/tab.h
Modified: trunk/data/po.lang
==============================================================================
--- trunk/data/po.lang (original)
+++ trunk/data/po.lang Mon Sep 22 09:38:16 2008
@@ -45,6 +45,9 @@
</context>
<context ref="python:format" style-ref="special-variable"/>
<context ref="c:printf"/>
+ <context id="csharp" style-ref="c:printf">
+ <match>{[0-9][0-9:\#\%,./cdefgnrxtsuDTFGMY]*}</match>
+ </context>
</include>
</context>
</definitions>
Modified: trunk/plugins/alternate-language/alternate-language-panel.c
==============================================================================
--- trunk/plugins/alternate-language/alternate-language-panel.c (original)
+++ trunk/plugins/alternate-language/alternate-language-panel.c Mon Sep 22 09:38:16 2008
@@ -200,7 +200,8 @@
*/
dialog = gtranslator_file_chooser_new (NULL,
FILESEL_OPEN,
- _("Open file for alternate language"));
+ _("Open file for alternate language"),
+ NULL);
gtk_file_chooser_set_local_only(GTK_FILE_CHOOSER(dialog), TRUE);
Modified: trunk/plugins/alternate-language/alternate-language-plugin.c
==============================================================================
--- trunk/plugins/alternate-language/alternate-language-plugin.c (original)
+++ trunk/plugins/alternate-language/alternate-language-plugin.c Mon Sep 22 09:38:16 2008
@@ -120,20 +120,21 @@
tabs = gtranslator_window_get_all_tabs(window);
notebook = gtranslator_window_get_notebook(window);
- if(tabs == NULL)
- return;
- do{
- alternatelang = g_object_get_data(G_OBJECT(tabs->data), WINDOW_DATA_KEY);
- panel = gtranslator_tab_get_panel (GTR_TAB(tabs->data));
+ if (tabs != NULL)
+ {
+ do{
+ alternatelang = g_object_get_data(G_OBJECT(tabs->data), WINDOW_DATA_KEY);
+ panel = gtranslator_tab_get_panel (GTR_TAB(tabs->data));
- page_num = gtk_notebook_page_num (GTK_NOTEBOOK (panel),
- alternatelang);
- gtk_notebook_remove_page (GTK_NOTEBOOK (panel),
- page_num);
+ page_num = gtk_notebook_page_num (GTK_NOTEBOOK (panel),
+ alternatelang);
+ gtk_notebook_remove_page (GTK_NOTEBOOK (panel),
+ page_num);
- g_object_set_data (G_OBJECT (tabs->data), WINDOW_DATA_KEY, NULL);
+ g_object_set_data (G_OBJECT (tabs->data), WINDOW_DATA_KEY, NULL);
- }while((tabs = g_list_next(tabs)));
+ }while((tabs = g_list_next(tabs)));
+ }
g_signal_handlers_disconnect_by_func(notebook,
create_alternate_lang_plugin_panel,
Modified: trunk/plugins/insert-tags/insert-tags-plugin.c
==============================================================================
--- trunk/plugins/insert-tags/insert-tags-plugin.c (original)
+++ trunk/plugins/insert-tags/insert-tags-plugin.c Mon Sep 22 09:38:16 2008
@@ -70,7 +70,7 @@
{ "InsertTags", NULL, N_("_Insert Tags") }
};
-const gchar submenu[] =
+static const gchar submenu[] =
"<ui>"
" <menubar name='MainMenu'>"
" <menu name='EditMenu' action='Edit'>"
@@ -126,6 +126,12 @@
static void
gtranslator_insert_tags_plugin_finalize (GObject *object)
{
+ if (tags != NULL)
+ {
+ g_slist_free (tags);
+ tags = NULL;
+ }
+
G_OBJECT_CLASS (gtranslator_insert_tags_plugin_parent_class)->finalize (object);
}
@@ -290,9 +296,11 @@
submenu,
-1,
&error);
- if (data->ui_id == 0)
+ if (error)
{
g_warning (error->message);
+ g_error_free (error);
+ g_free (data);
return;
}
@@ -344,6 +352,12 @@
g_signal_handlers_disconnect_by_func(notebook,
page_added_cb,
window);
+
+ if (tags != NULL)
+ {
+ g_slist_free (tags);
+ tags = NULL;
+ }
}
static void
Modified: trunk/plugins/open-tran/open-tran-panel.c
==============================================================================
--- trunk/plugins/open-tran/open-tran-panel.c (original)
+++ trunk/plugins/open-tran/open-tran-panel.c Mon Sep 22 09:38:16 2008
@@ -157,6 +157,9 @@
-1);
g_free (panel->priv->text);
+
+ if (icon)
+ g_object_unref (icon);
}
}
Modified: trunk/src/actions-edit.c
==============================================================================
--- trunk/src/actions-edit.c (original)
+++ trunk/src/actions-edit.c Mon Sep 22 09:38:16 2008
@@ -153,7 +153,7 @@
if(gtranslator_msg_is_fuzzy(msg->data) && gtranslator_prefs_manager_get_unmark_fuzzy())
gtranslator_msg_set_fuzzy(msg->data, FALSE);
- gtranslator_tab_message_go_to(current, msg);
+ gtranslator_tab_message_go_to(current, msg, FALSE);
/*
* Emit that message was changed.
Modified: trunk/src/actions-file.c
==============================================================================
--- trunk/src/actions-file.c (original)
+++ trunk/src/actions-file.c Mon Sep 22 09:38:16 2008
@@ -27,8 +27,10 @@
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <string.h>
+#include <gio/gio.h>
#include "actions.h"
+#include "application.h"
#include "dialogs/close-confirmation-dialog.h"
#include "file-dialogs.h"
#include "notebook.h"
@@ -87,7 +89,7 @@
* Show the current message.
*/
current = gtranslator_po_get_current_message(po);
- gtranslator_tab_message_go_to(tab, current);
+ gtranslator_tab_message_go_to (tab, current, FALSE);
/*
* Grab the focus
@@ -107,10 +109,26 @@
GtranslatorWindow *window)
{
GSList *po_files;
+ GFile *file, *parent;
+ gchar *uri;
po_files = gtk_file_chooser_get_uris (GTK_FILE_CHOOSER (dialog));
/*
+ * We store latest directory
+ */
+ file = g_file_new_for_uri (po_files->data);
+ parent = g_file_get_parent (file);
+ g_object_unref (file);
+
+ uri = g_file_get_uri (parent);
+ g_object_unref (parent);
+ _gtranslator_application_set_last_dir (GTR_APP,
+ uri);
+
+ g_free (uri);
+
+ /*
* Open the file via our centralized opening function.
*/
load_file_list (window, (const GSList *)po_files);
@@ -166,7 +184,9 @@
}
dialog = gtranslator_file_chooser_new (GTK_WINDOW(window),
FILESEL_OPEN,
- _("Open file for translation"));
+ _("Open file for translation"),
+ _gtranslator_application_get_last_dir (GTR_APP));
+
/*
* With the gettext parser/writer API, we can't currently read/write
* to remote files with gnome-vfs. Eventually, we should intercept
@@ -279,7 +299,8 @@
dialog = gtranslator_file_chooser_new (GTK_WINDOW (window),
FILESEL_SAVE,
- _("Save file as..."));
+ _("Save file as..."),
+ _gtranslator_application_get_last_dir (GTR_APP));
gtk_file_chooser_set_do_overwrite_confirmation (GTK_FILE_CHOOSER (dialog),
TRUE);
Modified: trunk/src/actions-go.c
==============================================================================
--- trunk/src/actions-go.c (original)
+++ trunk/src/actions-go.c Mon Sep 22 09:38:16 2008
@@ -40,7 +40,8 @@
current = gtranslator_window_get_active_tab(window);
po = gtranslator_tab_get_po(current);
gtranslator_tab_message_go_to(current,
- g_list_first(gtranslator_po_get_current_message(po)));
+ g_list_first(gtranslator_po_get_current_message(po)),
+ FALSE);
set_sensitive_according_to_message(window, po);
}
@@ -54,7 +55,8 @@
current = gtranslator_window_get_active_tab(window);
po = gtranslator_tab_get_po(current);
gtranslator_tab_message_go_to(current,
- g_list_previous(gtranslator_po_get_current_message(po)));
+ g_list_previous(gtranslator_po_get_current_message(po)),
+ FALSE);
set_sensitive_according_to_message(window, po);
}
@@ -68,7 +70,8 @@
current = gtranslator_window_get_active_tab(window);
po = gtranslator_tab_get_po(current);
gtranslator_tab_message_go_to(current,
- g_list_next(gtranslator_po_get_current_message(po)));
+ g_list_next(gtranslator_po_get_current_message(po)),
+ FALSE);
set_sensitive_according_to_message(window, po);
}
@@ -82,7 +85,8 @@
current = gtranslator_window_get_active_tab(window);
po = gtranslator_tab_get_po(current);
gtranslator_tab_message_go_to(current,
- g_list_last(gtranslator_po_get_current_message(po)));
+ g_list_last(gtranslator_po_get_current_message(po)),
+ FALSE);
set_sensitive_according_to_message(window, po);
}
@@ -107,7 +111,7 @@
msg = gtranslator_po_get_next_fuzzy(po);
if(msg != NULL)
{
- gtranslator_tab_message_go_to(current, msg);
+ gtranslator_tab_message_go_to(current, msg, FALSE);
set_sensitive_according_to_message(window, po);
}
}
@@ -125,7 +129,7 @@
msg = gtranslator_po_get_prev_fuzzy(po);
if(msg != NULL)
{
- gtranslator_tab_message_go_to(current, msg);
+ gtranslator_tab_message_go_to(current, msg, FALSE);
set_sensitive_according_to_message(window, po);
}
}
@@ -143,7 +147,7 @@
msg = gtranslator_po_get_next_untrans(po);
if(msg != NULL)
{
- gtranslator_tab_message_go_to(current, msg);
+ gtranslator_tab_message_go_to(current, msg, FALSE);
set_sensitive_according_to_message(window, po);
}
}
@@ -161,7 +165,7 @@
msg = gtranslator_po_get_prev_untrans(po);
if(msg != NULL)
{
- gtranslator_tab_message_go_to(current, msg);
+ gtranslator_tab_message_go_to(current, msg, FALSE);
set_sensitive_according_to_message(window, po);
}
}
Modified: trunk/src/actions-search.c
==============================================================================
--- trunk/src/actions-search.c (original)
+++ trunk/src/actions-search.c Mon Sep 22 09:38:16 2008
@@ -274,7 +274,7 @@
if(l->next == NULL)
{
if(!wrap_around)
- return;
+ return FALSE;
l = g_list_first(l);
}
else l = l->next;
@@ -283,19 +283,25 @@
if(l->prev == NULL)
{
if(!wrap_around)
- return;
+ return FALSE;
l = g_list_last(l);
}
else l = l->prev;
}
- gtranslator_tab_message_go_to(tab, l);
+ gtranslator_tab_message_go_to(tab, l, TRUE);
}
else{
while(viewsaux != NULL)
{
+ gboolean aux = found;
+
found = run_search(GTR_VIEW(viewsaux->data), found);
if(found)
+ {
+ gtranslator_tab_message_go_to (tab, l, FALSE);
+ run_search (GTR_VIEW (viewsaux->data), aux);
return TRUE;
+ }
viewsaux = viewsaux->next;
}
if(!search_backwards)
@@ -303,7 +309,7 @@
if(l->next == NULL)
{
if(!wrap_around)
- return;
+ return FALSE;
l = g_list_first(l);
}
else l = l->next;
@@ -312,16 +318,16 @@
if(l->prev == NULL)
{
if(!wrap_around)
- return;
+ return FALSE;
l = g_list_last(l);
}
else l = l->prev;
}
- gtranslator_tab_message_go_to(tab, l);
+ gtranslator_tab_message_go_to(tab, l, TRUE);
viewsaux = views;
}
}while(l != current);
-
+
return FALSE;
}
@@ -538,9 +544,11 @@
if(aux->next == NULL)
aux = g_list_first(aux);
else aux = aux->next;
- gtranslator_tab_message_go_to(tab, aux);
+ gtranslator_tab_message_go_to(tab, aux, TRUE);
}while(current_msg != aux);
+ gtranslator_tab_message_go_to(tab, aux, FALSE);
+
if (count > 0)
{
phrase_found (window, count);
Modified: trunk/src/application.c
==============================================================================
--- trunk/src/application.c (original)
+++ trunk/src/application.c Mon Sep 22 09:38:16 2008
@@ -47,6 +47,8 @@
EggToolbarsModel *toolbars_model;
GtkIconFactory *icon_factory;
+
+ gchar *last_dir;
};
static gchar *
@@ -123,6 +125,7 @@
priv = application->priv;
priv->windows = NULL;
+ priv->last_dir = NULL;
/*
* Creating config folder
@@ -205,6 +208,8 @@
if (app->priv->icon_factory)
g_object_unref (app->priv->icon_factory);
+
+ g_free (app->priv->last_dir);
G_OBJECT_CLASS (gtranslator_application_parent_class)->finalize (object);
}
@@ -385,3 +390,32 @@
g_free (path);
gtk_icon_source_free (icon_source);
}
+
+/**
+ * gtranslator_application_get_last_dir:
+ * @app: a #GtranslatorApplication
+ *
+ * Return value: the last dir where a file was opened in the GtkFileChooser
+ */
+const gchar *
+_gtranslator_application_get_last_dir (GtranslatorApplication *app)
+{
+ g_return_val_if_fail (GTR_IS_APPLICATION (app), NULL);
+
+ return app->priv->last_dir;
+}
+
+/**
+ * gtranslator_application_set_last_dir:
+ * @app: a #GtranslatorApplication
+ * @last_dir: the path of the last directory where a file was opened in the
+ * GtkFileChooser.
+ */
+void
+_gtranslator_application_set_last_dir (GtranslatorApplication *app,
+ const gchar *last_dir)
+{
+ g_return_if_fail (GTR_IS_APPLICATION (app));
+
+ app->priv->last_dir = g_strdup (last_dir);
+}
Modified: trunk/src/application.h
==============================================================================
--- trunk/src/application.h (original)
+++ trunk/src/application.h Mon Sep 22 09:38:16 2008
@@ -93,6 +93,11 @@
void _gtranslator_application_save_toolbars_model (GtranslatorApplication *application);
+const gchar * _gtranslator_application_get_last_dir (GtranslatorApplication *app);
+
+void _gtranslator_application_set_last_dir (GtranslatorApplication *app,
+ const gchar *last_dir);
+
G_END_DECLS
#endif /* __APPLICATION_H__ */
Modified: trunk/src/dialogs/file-dialogs.c
==============================================================================
--- trunk/src/dialogs/file-dialogs.c (original)
+++ trunk/src/dialogs/file-dialogs.c Mon Sep 22 09:38:16 2008
@@ -31,7 +31,8 @@
GtkWidget *
gtranslator_file_chooser_new (GtkWindow *parent,
FileselMode mode,
- gchar *title)
+ const gchar *title,
+ const gchar *dir)
{
GtkWidget *dialog;
GtkFileFilter *filter;
@@ -43,6 +44,11 @@
(mode == FILESEL_SAVE) ? GTK_STOCK_SAVE : GTK_STOCK_OPEN, GTK_RESPONSE_ACCEPT,
NULL);
gtk_dialog_set_default_response(GTK_DIALOG(dialog),GTK_RESPONSE_ACCEPT);
+
+ if (dir)
+ gtk_file_chooser_set_current_folder_uri (GTK_FILE_CHOOSER (dialog),
+ dir);
+
if (mode != FILESEL_SAVE)
{
/* We set a multi selection dialog */
Modified: trunk/src/dialogs/file-dialogs.h
==============================================================================
--- trunk/src/dialogs/file-dialogs.h (original)
+++ trunk/src/dialogs/file-dialogs.h Mon Sep 22 09:38:16 2008
@@ -29,6 +29,7 @@
GtkWidget *gtranslator_file_chooser_new (GtkWindow *parent,
FileselMode mode,
- gchar *title);
+ const gchar *title,
+ const gchar *dir);
#endif
Modified: trunk/src/draw-spaces.c
==============================================================================
--- trunk/src/draw-spaces.c (original)
+++ trunk/src/draw-spaces.c Mon Sep 22 09:38:16 2008
@@ -87,15 +87,30 @@
gtk_text_view_get_iter_location(view, iter, &rect);
gtk_text_view_buffer_to_window_coords(view, GTK_TEXT_WINDOW_TEXT,
rect.x,
- rect.y + rect.height / 2, &x, &y);
+ rect.y + rect.height / 2, &x, &y);
+
+
cairo_save(cr);
- cairo_move_to(cr, x+2, y-2);
- cairo_rel_line_to(cr, +7, 0);
- cairo_rel_line_to(cr, 0, 4);
- cairo_rel_move_to(cr, -3, 0);
- cairo_rel_line_to(cr, 5, 0);
- cairo_rel_line_to(cr, -2.5, 4);
- cairo_rel_line_to(cr, -2.5, -4);
+
+ if (gtk_widget_get_default_direction () == GTK_TEXT_DIR_LTR)
+ {
+ cairo_move_to(cr, x+2, y-2);
+ cairo_rel_line_to(cr, +7, 0);
+ cairo_rel_line_to(cr, 0, 4);
+ cairo_rel_move_to(cr, -3, 0);
+ cairo_rel_line_to(cr, 6, 0);
+ cairo_rel_line_to(cr, -3, 4);
+ cairo_rel_line_to(cr, -3, -4);
+ }else
+ {
+ cairo_move_to (cr, x-2, y-2);
+ cairo_rel_line_to(cr, -7, 0);
+ cairo_rel_line_to(cr, 0, 4);
+ cairo_rel_move_to(cr, 3, 0);
+ cairo_rel_line_to(cr, -6, 0);
+ cairo_rel_line_to(cr, 3, 4);
+ cairo_rel_line_to(cr, 3, -4);
+ }
cairo_restore(cr);
cairo_fill(cr);
Modified: trunk/src/message-table.c
==============================================================================
--- trunk/src/message-table.c (original)
+++ trunk/src/message-table.c Mon Sep 22 09:38:16 2008
@@ -76,7 +76,7 @@
if (msg != NULL && g_utf8_collate (gtranslator_msg_get_msgid (msg->data),
gtranslator_msg_get_msgid (current_msg->data)))
{
- gtranslator_tab_message_go_to (table->priv->tab, msg);
+ gtranslator_tab_message_go_to (table->priv->tab, msg, FALSE);
}
}
}
@@ -245,7 +245,8 @@
gtranslator_po_set_messages (po, messages);
gtranslator_tab_message_go_to (table->priv->tab,
- g_list_first (messages));
+ g_list_first (messages),
+ FALSE);
}
static void
Modified: trunk/src/msg.c
==============================================================================
--- trunk/src/msg.c (original)
+++ trunk/src/msg.c Mon Sep 22 09:38:16 2008
@@ -60,7 +60,6 @@
static void
gtranslator_msg_finalize (GObject *object)
{
- g_free(message_error);
G_OBJECT_CLASS (gtranslator_msg_parent_class)->finalize (object);
}
@@ -484,7 +483,9 @@
const gchar *filename, size_t lineno, size_t column,
gint multiline_p, const gchar *message_text)
{
- message_error = g_strdup(message_text);
+ if (message_text)
+ message_error = g_strdup (message_text);
+ else message_error = NULL;
}
static void
@@ -504,12 +505,13 @@
* gtranslator_msg_check:
* @msg: a #GtranslatorMsg
*
- * Return value: the message error or NULL if there is not any error.
+ * Return value: the message error or NULL if there is not any error. Must be
+ * freed with g_free.
*
* Test whether the message translation is a valid format string if the message
* is marked as being a format string.
**/
-const gchar *
+gchar *
gtranslator_msg_check(GtranslatorMsg *msg)
{
struct po_xerror_handler handler;
@@ -519,16 +521,14 @@
handler.xerror = &on_gettext_po_xerror;
handler.xerror2 = &on_gettext_po_xerror2;
- if(message_error != NULL)
- {
- g_free(message_error);
- message_error = NULL;
- }
-
po_message_check_all(msg->priv->message, msg->priv->iterator, &handler);
if(gtranslator_msg_is_fuzzy(msg) || !gtranslator_msg_is_translated(msg))
+ {
+ if (message_error)
+ g_free (message_error);
message_error = NULL;
+ }
/*Are there any other way to do this?*/
return message_error;
Modified: trunk/src/msg.h
==============================================================================
--- trunk/src/msg.h (original)
+++ trunk/src/msg.h Mon Sep 22 09:38:16 2008
@@ -139,7 +139,7 @@
const gchar *gtranslator_msg_get_format (GtranslatorMsg *msg);
-const gchar *gtranslator_msg_check (GtranslatorMsg *msg);
+gchar *gtranslator_msg_check (GtranslatorMsg *msg);
G_END_DECLS
Modified: trunk/src/tab.c
==============================================================================
--- trunk/src/tab.c (original)
+++ trunk/src/tab.c Mon Sep 22 09:38:16 2008
@@ -759,18 +759,20 @@
* gtranslator_tab_message_go_to:
* @tab: a #GtranslatorTab
* @to_go: the #GtranslatorMsg you want to jump
+ * @searching: TRUE if we are searching in the message list
*
* Jumps to the specific @to_go pointer message and show the message
* in the #GtranslatorView.
**/
void
gtranslator_tab_message_go_to(GtranslatorTab *tab,
- GList * to_go)
+ GList * to_go,
+ gboolean searching)
{
GtranslatorPo *po;
static gint pos = 0;
GList *current_msg;
- const gchar *message_error;
+ gchar *message_error;
GtkWidget *message_area;
g_return_if_fail (tab != NULL);
@@ -791,13 +793,16 @@
message_area = create_error_message_area(_("There is an error in the message:"),
message_error);
set_message_area(tab, message_area);
+ g_free (message_error);
return;
}
/*
* Emitting showed-message signal
*/
- g_signal_emit(G_OBJECT(tab), signals[SHOWED_MESSAGE], 0, GTR_MSG(to_go->data));
+ if (!searching)
+ g_signal_emit (G_OBJECT (tab), signals[SHOWED_MESSAGE], 0,
+ GTR_MSG (to_go->data));
}
Modified: trunk/src/tab.h
==============================================================================
--- trunk/src/tab.h (original)
+++ trunk/src/tab.h Mon Sep 22 09:38:16 2008
@@ -99,7 +99,8 @@
gchar *gtranslator_tab_get_name (GtranslatorTab *tab);
void gtranslator_tab_message_go_to (GtranslatorTab *tab,
- GList * to_go);
+ GList * to_go,
+ gboolean searching);
GtranslatorTab *gtranslator_tab_get_from_document (GtranslatorPo *po);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]