From chavarria1991@gmail.com Sat Apr 20 17:14:19 2013 Return-Path: X-Original-To: gtranslator-list@gnome.org Delivered-To: gtranslator-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id E5412765C4 for ; Sat, 20 Apr 2013 17:14:19 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.449 X-Spam-Level: X-Spam-Status: No, score=-2.449 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hj08X4QDZo7T for ; Sat, 20 Apr 2013 17:14:09 +0000 (UTC) Received: from mail-oa0-f50.google.com (mail-oa0-f50.google.com [209.85.219.50]) by restaurant.gnome.org (Postfix) with ESMTP id 34D1A76A69 for ; Sat, 20 Apr 2013 17:14:08 +0000 (UTC) Received: by mail-oa0-f50.google.com with SMTP id j6so197846oag.23 for ; Sat, 20 Apr 2013 10:14:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:mime-version:from:date:message-id:subject:to :content-type; bh=qp+s9eTv51x4g+Y55Wi+LUR21DNOl0Jc/HG1b6LAW4A=; b=yzFWURJ/ZJWe+7g5j+qBN1avgyI6A9U4mcdnKmpf1sNQ2lMT7eU/mJMPgMt3hXxUys P9DqQeWVQam1qOq9WjBrPclYM8RS/Vs6fFPBRxv5+/CclY29pi02mUocTG66Hn/1qZrB PUbimRDSB+vkiYPmDtk3FKeeGQM+sJZbZiid8tFEzvjM8xBtqCqb1/AtHx4UEz77f3qa hjHz3F7xfFyhb5ee4rqkEspOU9J2oMlpJEtCtgTw+ilkDMQJeLhNQpkydH5NsA7qeIJa RhQkQvhEqHBJLCWE8Dzujr6QYl5Q4uiNL/pq/kYjbmOuHdC3+OafRoz5Q8Q7L3w0ydB1 eADQ== X-Received: by 10.182.129.101 with SMTP id nv5mr10755329obb.56.1366478047469; Sat, 20 Apr 2013 10:14:07 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.80.71 with HTTP; Sat, 20 Apr 2013 10:13:37 -0700 (PDT) From: =?ISO-8859-1?Q?Marcos_Chavarr=EDa_Teijeiro?= Date: Sat, 20 Apr 2013 19:13:37 +0200 Message-ID: Subject: SoC GTranslator port to Vala developing plan To: gtranslator-list@gnome.org Content-Type: multipart/alternative; boundary=e89a8fb1ebe49d367704dacdf630 X-BeenThere: gtranslator-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: gtranslator discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 17:14:20 -0000 --e89a8fb1ebe49d367704dacdf630 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi all, I'm working in a GSoC project proposal consisting on porting Gtranslator to Vala. I've written a developing plan in my blog[1] if someone wants to take it a look and even give me some feedback it would be great. Best regards, Marcos Chavarr=EDa Teijeiro [1] http://aquelando.info/rewriting-gtranslator-developing-plan/ --e89a8fb1ebe49d367704dacdf630 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Hi all,

I'm working in a GSoC project proposal consi= sting on porting Gtranslator to Vala. I've=A0written=A0a developing pla= n in my
blog[1] if someone wants to take it a look and even give = me some feedback it would be great.

Best regards,
Marcos Chavarr=EDa Teijeiro

--e89a8fb1ebe49d367704dacdf630-- From vilmar@informal.com.br Sat Apr 20 20:09:47 2013 Return-Path: X-Original-To: gtranslator-list@gnome.org Delivered-To: gtranslator-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id 021E176A68 for ; Sat, 20 Apr 2013 20:09:47 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -1.9 X-Spam-Level: X-Spam-Status: No, score=-1.9 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_NONE=-0.0001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qck5IpZoJN0D for ; Sat, 20 Apr 2013 20:09:45 +0000 (UTC) X-Greylist: delayed 809 seconds by postgrey-1.34 at restaurant.gnome.org; Sat, 20 Apr 2013 20:09:44 UTC Received: from rot03c2.mail.alog.com.br (rot03c2.mail.alog.com.br [177.126.164.23]) by restaurant.gnome.org (Postfix) with ESMTP id F1B06765C4 for ; Sat, 20 Apr 2013 20:09:44 +0000 (UTC) Received: from localhost (localhost.localdomain [127.0.0.1]) by rot03c2.mail.alog.com.br (LSOS-MTA) with ESMTP id 3ZtPty6PWMz77h3 for ; Sat, 20 Apr 2013 19:56:10 +0000 (UTC) X-Virus-Scanned: Scanned by LSOS-Amavis at rot03c2 Received: from rot03c2.mail.alog.com.br ([127.0.0.1]) by localhost (rot03c2.mail.alog.com.br [127.0.0.1]) (LSOS-Amavis, port 10024) with ESMTP id QWYsIgWXJA6K for ; Sat, 20 Apr 2013 19:56:04 +0000 (UTC) X-WhiteBlackList-Status: undef Received: from [192.168.1.103] (187-15-189-99.user.veloxzone.com.br [187.15.189.99]) (Authenticated sender: vilmar@informal.com.br) by rot03c2.mail.alog.com.br (LSOS-MTA) with ESMTPA id 3ZtPtr3z7dz77gW for ; Sat, 20 Apr 2013 19:56:04 +0000 (UTC) Message-ID: <5172F2D4.50704@informal.com.br> Date: Sat, 20 Apr 2013 16:56:04 -0300 From: =?ISO-8859-1?Q?Jos=E9_Vilmar_Est=E1cio_de_Souza?= Organization: Informal Informatica User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130403 Thunderbird/17.0.5 MIME-Version: 1.0 To: gtranslator-list@gnome.org Subject: Re: SoC GTranslator port to Vala developing plan References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-BeenThere: gtranslator-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list Reply-To: vilmar@informal.com.br List-Id: gtranslator discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 20 Apr 2013 20:09:47 -0000 Hi. Please, take the accessibility in consideration too. Thanks. On 04/20/2013 02:13 PM, Marcos Chavarría Teijeiro wrote: > Hi all, > > I'm working in a GSoC project proposal consisting on porting Gtranslator > to Vala. I've written a developing plan in my > blog[1] if someone wants to take it a look and even give me some > feedback it would be great. > > Best regards, > Marcos Chavarría Teijeiro > > [1] http://aquelando.info/rewriting-gtranslator-developing-plan/ > > > _______________________________________________ > gtranslator-list mailing list > gtranslator-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtranslator-list > -- {}S José Vilmar Estácio de Souza From mickael.albertus@gmail.com Thu Apr 25 19:12:09 2013 Return-Path: X-Original-To: gtranslator-list@gnome.org Delivered-To: gtranslator-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id B593976C0F for ; Thu, 25 Apr 2013 19:12:09 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.7 X-Spam-Level: X-Spam-Status: No, score=-2.7 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id EbIhGZMi1Zbu for ; Thu, 25 Apr 2013 19:12:07 +0000 (UTC) Received: from mail-wi0-f181.google.com (mail-wi0-f181.google.com [209.85.212.181]) by restaurant.gnome.org (Postfix) with ESMTP id 1D64D76944 for ; Thu, 25 Apr 2013 19:12:06 +0000 (UTC) Received: by mail-wi0-f181.google.com with SMTP id c10so3811926wiw.2 for ; Thu, 25 Apr 2013 12:12:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:message-id:disposition-notification-to:date:from :user-agent:mime-version:to:subject:content-type; bh=frjWfOg3wdIyr7Eel7rxVQMbLiW93Gz/mrFs2cVro8E=; b=SJWQWKWe8LxJuTSbF1Aesw/jgGcohQvwVpaKJ4wmcdjPdkA0GM/VrdhrFmGvNqL1CG ego7+longkPphZiV5uaBxldxhkJhejcZtkCVdY8tm/s5yXgvUETFrK4XRjvyHZuK3gFr WGdfasvIqXXJ6tObEXuOfp/IMg7+8E1p+qY9ErBLiq88iQ3n+EkkaKrYaoymYY++4Tet 6xLhxaFE5ALpTLSgFtE/27eLIsBeCw/VEQmJOr/SLhXKTrohEqPN7Otmh7gALdFoIPbg PPQ4R+XWUoQHNB5fPLw70tQhac80AlY4tKLwIuLZrQWxFCBXuGyNmZzF0f56eN6GafF2 S6qw== X-Received: by 10.194.92.231 with SMTP id cp7mr13228418wjb.3.1366917124837; Thu, 25 Apr 2013 12:12:04 -0700 (PDT) Received: from [192.168.0.12] (rng31-1-88-168-248-118.fbx.proxad.net. [88.168.248.118]) by mx.google.com with ESMTPSA id q18sm40430090wiw.8.2013.04.25.12.12.01 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 25 Apr 2013 12:12:04 -0700 (PDT) Message-ID: <51797FFF.1000507@gmail.com> Date: Thu, 25 Apr 2013 21:11:59 +0200 From: Mickael Albertus User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130329 Thunderbird/17.0.5 MIME-Version: 1.0 To: gtranslator-list@gnome.org Subject: Repair search and repair functions Content-Type: multipart/mixed; boundary="------------020204060506050700000707" X-Mailman-Approved-At: Fri, 26 Apr 2013 08:03:44 +0000 X-BeenThere: gtranslator-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: gtranslator discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 25 Apr 2013 19:12:09 -0000 This is a multi-part message in MIME format. --------------020204060506050700000707 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, I tried to fix the problem concerning the search and replace function. I attached the patch. I hope it will be helpful! Regards, Mickael Albertus --------------020204060506050700000707 Content-Type: text/x-patch; name="0001-Repair-search-replace-functions.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-Repair-search-replace-functions.patch" >From 57a0992b735e3846a8d1a0317c329e793797354b Mon Sep 17 00:00:00 2001 From: Mickael Albertus Date: Sat, 27 Apr 2013 08:56:31 +0200 Subject: [PATCH] Repair search&replace functions --- src/gtr-actions-go.c | 14 ++--- src/gtr-actions-search.c | 153 ++++++++++++++++++----------------------------- src/gtr-tab.c | 68 ++++++++++++--------- src/gtr-tab.h | 16 ++--- src/gtr-view.c | 105 ++++++++++++++++---------------- 5 files changed, 167 insertions(+), 189 deletions(-) diff --git a/src/gtr-actions-go.c b/src/gtr-actions-go.c index 4d10242..37bfefa 100644 --- a/src/gtr-actions-go.c +++ b/src/gtr-actions-go.c @@ -1,16 +1,16 @@ /* * Copyright (C) 2007 Ignacio Casal Quinteiro - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * @@ -39,7 +39,7 @@ gtr_message_go_to_first (GtkAction * action, GtrWindow * window) current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); - gtr_tab_go_to_first (current); + gtr_tab_go_to_first (current, FALSE); _gtr_window_set_sensitive_according_to_message (window, po); } @@ -51,7 +51,7 @@ gtr_message_go_to_previous (GtkAction * action, GtrWindow * window) current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); - gtr_tab_go_to_prev (current); + gtr_tab_go_to_prev (current, FALSE); _gtr_window_set_sensitive_according_to_message (window, po); } @@ -63,7 +63,7 @@ gtr_message_go_to_next (GtkAction * action, GtrWindow * window) current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); - gtr_tab_go_to_next (current); + gtr_tab_go_to_next (current, FALSE); _gtr_window_set_sensitive_according_to_message (window, po); } @@ -75,7 +75,7 @@ gtr_message_go_to_last (GtkAction * action, GtrWindow * window) current = gtr_window_get_active_tab (window); po = gtr_tab_get_po (current); - gtr_tab_go_to_last (current); + gtr_tab_go_to_last (current, FALSE); _gtr_window_set_sensitive_according_to_message (window, po); } diff --git a/src/gtr-actions-search.c b/src/gtr-actions-search.c index 8872726..bd3fb46 100644 --- a/src/gtr-actions-search.c +++ b/src/gtr-actions-search.c @@ -193,7 +193,7 @@ phrase_not_found (GtrWindow * window) } static gboolean -run_search (GtrView * view, gboolean follow) +run_search (GtrView * view) { GtkSourceBuffer *doc; GtkTextIter start_iter; @@ -205,121 +205,86 @@ run_search (GtrView * view, gboolean follow) doc = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW (view))); - if (!follow) + if(!gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), + NULL, &start_iter)) gtk_text_buffer_get_start_iter (GTK_TEXT_BUFFER (doc), &start_iter); - else - gtk_text_buffer_get_selection_bounds (GTK_TEXT_BUFFER (doc), - NULL, &start_iter); - found = gtr_view_search_forward (view, - &start_iter, + found = gtr_view_search_forward (view, &start_iter, NULL, &match_start, &match_end); if (found) - { - gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &match_start); - - gtk_text_buffer_move_mark_by_name (GTK_TEXT_BUFFER (doc), - "selection_bound", &match_end); - - } + gtk_text_buffer_select_range(GTK_TEXT_BUFFER(doc), &match_start, &match_end); else - { - gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &start_iter); - } + gtk_text_buffer_place_cursor (GTK_TEXT_BUFFER (doc), &start_iter); return found; } static gboolean find_in_list (GtrWindow * window, - GList * views, + gboolean original_text, gboolean translated_text, gboolean fuzzy, gboolean wrap_around, gboolean search_backwards) { GtrTab *tab = gtr_window_get_active_tab (window); GtrPo *po = gtr_tab_get_po (tab); GList *l = gtr_po_get_current_message (po); - GList *current; - static GList *viewsaux = NULL; - - current = l; - - if (viewsaux == NULL) - viewsaux = views; - - /* - * Variable used to know when start search in from the beggining of the view - */ - static gboolean found = FALSE; + GList *current = l; do { - if (gtr_msg_is_fuzzy (GTR_MSG (l->data)) && !fuzzy) + if (!gtr_msg_is_fuzzy (GTR_MSG (l->data)) || fuzzy) { - if (!search_backwards) + GtrView *translated_view = gtr_tab_get_active_view(tab); + GtrView *original_view = gtr_tab_get_active_original_view(tab); + + if (original_text) + { + if (run_search(original_view)) + return TRUE; + else if (translated_text) { - if (l->next == NULL) - { - if (!wrap_around) - return FALSE; - l = g_list_first (l); - } - else - l = l->next; + if (run_search(translated_view)) + return TRUE; } - else - { - if (l->prev == NULL) - { - if (!wrap_around) - return FALSE; - l = g_list_last (l); - } - else - l = l->prev; - } - gtr_tab_message_go_to (tab, l->data, TRUE, GTR_TAB_MOVE_NONE); + } + else if (translated_text) + { + if (run_search(translated_view)) + return TRUE; + } } - else - { - while (viewsaux != NULL) - { - gboolean aux = found; - - found = run_search (GTR_VIEW (viewsaux->data), found); - if (found) - { - gtr_tab_message_go_to (tab, l->data, FALSE, GTR_TAB_MOVE_NONE); - run_search (GTR_VIEW (viewsaux->data), aux); - return TRUE; - } - viewsaux = viewsaux->next; - } - if (!search_backwards) + + if (!search_backwards) + { + if (l->next == NULL) + { + if (!wrap_around) + return FALSE; + + l = g_list_first (l); + gtr_tab_go_to_first(tab, TRUE); + } + else { - if (l->next == NULL) - { - if (!wrap_around) - return FALSE; - l = g_list_first (l); - } - else - l = l->next; + l = l->next; + gtr_tab_go_to_next(tab, TRUE); } + } else + { + if (l->prev == NULL) + { + if (!wrap_around) + return FALSE; + l = g_list_last (l); + gtr_tab_go_to_last(tab, TRUE); + } + else { - if (l->prev == NULL) - { - if (!wrap_around) - return FALSE; - l = g_list_last (l); - } - else - l = l->prev; + l = l->prev; + gtr_tab_go_to_prev(tab, TRUE); } - gtr_tab_message_go_to (tab, l->data, TRUE, GTR_TAB_MOVE_NONE); - viewsaux = views; - } + } } while (l != current); @@ -330,7 +295,7 @@ static void do_find (GtrSearchDialog * dialog, GtrWindow * window) { GtrTab *tab; - GList *views, *list; + GList *views; gchar *search_text; const gchar *entry_text; gboolean original_text; @@ -368,27 +333,25 @@ do_find (GtrSearchDialog * dialog, GtrWindow * window) g_return_if_fail (views != NULL); - list = views; - GTR_SEARCH_SET_CASE_SENSITIVE (flags, match_case); GTR_SEARCH_SET_ENTIRE_WORD (flags, entire_word); - while (list != NULL) + while (views != NULL) { search_text = - gtr_view_get_search_text (GTR_VIEW (list->data), &old_flags); + gtr_view_get_search_text (GTR_VIEW (views->data), &old_flags); if ((search_text == NULL) || (strcmp (search_text, entry_text) != 0) || (flags != old_flags)) { - gtr_view_set_search_text (GTR_VIEW (list->data), entry_text, flags); + gtr_view_set_search_text (GTR_VIEW (views->data), entry_text, flags); } g_free (search_text); - list = list->next; + views = views->next; } - found = find_in_list (window, views, fuzzy, wrap_around, search_backwards); + found = find_in_list (window, original_text, translated_text, fuzzy, wrap_around, search_backwards); if (found) phrase_found (window, 0); diff --git a/src/gtr-tab.c b/src/gtr-tab.c index 211c7ff..879c251 100644 --- a/src/gtr-tab.c +++ b/src/gtr-tab.c @@ -10,12 +10,12 @@ * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * @@ -474,7 +474,7 @@ gtr_message_plural_forms (GtrTab * tab, GtrMsg * msg) * gtr_tab_show_message: * @tab: a #GtranslationTab * @msg: a #GtrMsg - * + * * Shows the @msg in the @tab TextViews * */ @@ -1075,9 +1075,9 @@ gtr_tab_class_init (GtrTabClass * klass) /** * gtr_tab_new: * @po: a #GtrPo - * + * * Creates a new #GtrTab. - * + * * Return value: a new #GtrTab object **/ GtrTab * @@ -1126,7 +1126,7 @@ gtr_tab_get_po (GtrTab * tab) /** * gtr_tab_get_active_trans_tab: * @tab: a #GtranslationTab - * + * * Return value: the number of the active translation notebook. **/ gint @@ -1165,6 +1165,18 @@ gtr_tab_get_active_view (GtrTab * tab) } /** + * gtr_tab_get_active_original_view: + * @tab: a #GtranslationTab + * + * Return value: (transfer none): the active page of the original active text. +**/ +GtrView * +gtr_tab_get_active_original_view (GtrTab * tab) +{ + return GTR_VIEW (tab->priv->text_msgid); +} + +/** * gtr_tab_get_all_views: * @tab: the #GtranslationTab * @original: TRUE if you want original TextViews. @@ -1231,10 +1243,10 @@ gtr_tab_message_go_to (GtrTab * tab, * we have to change to the next/prev plural tab in case is not * the last * To implement that: - * if the tabs are showed then we check if we want prev or - * next and then if we need to change the tab we change it + * if the tabs are showed then we check if we want prev or + * next and then if we need to change the tab we change it * in other case we show the message - * + * * I don't like too much this implementation so if anybody can * rewrite this is a better way would be great. */ @@ -1290,8 +1302,8 @@ gtr_tab_message_go_to (GtrTab * tab, /** * _gtr_tab_get_name: - * @tab: a #GtrTab - * + * @tab: a #GtrTab + * * Return value: a new allocated string with the name of the @tab. */ gchar * @@ -1371,9 +1383,9 @@ gtr_tab_get_from_document (GtrPo * po) /** * gtr_tab_get_autosave_enabled: * @tab: a #GtrTab - * + * * Gets the current state for the autosave feature - * + * * Return value: TRUE if the autosave is enabled, else FALSE **/ gboolean @@ -1388,7 +1400,7 @@ gtr_tab_get_autosave_enabled (GtrTab * tab) * gtr_tab_set_autosave_enabled: * @tab: a #GtrTab * @enable: enable (TRUE) or disable (FALSE) auto save - * + * * Enables or disables the autosave feature. It does not install an * autosave timeout if the document is new or is read-only **/ @@ -1422,9 +1434,9 @@ gtr_tab_set_autosave_enabled (GtrTab * tab, gboolean enable) /** * gtr_tab_get_autosave_interval: * @tab: a #GtrTab - * + * * Gets the current interval for the autosaves - * + * * Return value: the value of the autosave **/ gint @@ -1439,7 +1451,7 @@ gtr_tab_get_autosave_interval (GtrTab * tab) * gtr_tab_set_autosave_interval: * @tab: a #GtrTab * @interval: the new interval - * + * * Sets the interval for the autosave feature. It does nothing if the * interval is the same as the one already present. It removes the old * interval timeout and adds a new one with the autosave passed as @@ -1542,7 +1554,7 @@ gtr_tab_show_widget (GtrTab *tab, /** * gtr_tab_clear_msgstr_views: * @tab: a #GtrTab - * + * * Clears all text from msgstr text views. */ void @@ -1616,7 +1628,7 @@ gtr_tab_block_movement (GtrTab * tab) /** * gtr_tab_unblock_movement: * @tab: a #GtrTab - * + * * Unblocks the movement to the next/prev message. */ void @@ -1648,7 +1660,7 @@ _gtr_tab_finish_edition (GtrTab * tab) * Moves to the next message or plural tab in case the message has plurals. */ void -gtr_tab_go_to_next (GtrTab * tab) +gtr_tab_go_to_next (GtrTab * tab, gboolean searching) { GtrMsg *msg; @@ -1658,7 +1670,7 @@ gtr_tab_go_to_next (GtrTab * tab) GTR_NAVIGATE_NEXT, NULL); if (msg) gtr_tab_message_go_to (tab, msg, - FALSE, GTR_TAB_MOVE_NEXT); + searching, GTR_TAB_MOVE_NEXT); } } @@ -1669,7 +1681,7 @@ gtr_tab_go_to_next (GtrTab * tab) * Moves to the previous message or plural tab in case the message has plurals. */ void -gtr_tab_go_to_prev (GtrTab * tab) +gtr_tab_go_to_prev (GtrTab * tab, gboolean searching) { GtrMsg *msg; @@ -1679,7 +1691,7 @@ gtr_tab_go_to_prev (GtrTab * tab) GTR_NAVIGATE_PREV, NULL); if (msg) gtr_tab_message_go_to (tab, msg, - FALSE, GTR_TAB_MOVE_PREV); + searching, GTR_TAB_MOVE_PREV); } } @@ -1690,7 +1702,7 @@ gtr_tab_go_to_prev (GtrTab * tab) * Jumps to the first message. */ void -gtr_tab_go_to_first (GtrTab * tab) +gtr_tab_go_to_first (GtrTab * tab, gboolean searching) { GtrMsg *msg; @@ -1700,18 +1712,18 @@ gtr_tab_go_to_first (GtrTab * tab) GTR_NAVIGATE_FIRST, NULL); if (msg) gtr_tab_message_go_to (tab, msg, - FALSE, GTR_TAB_MOVE_NONE); + searching, GTR_TAB_MOVE_NONE); } } /** * gtr_tab_go_to_last: - * @tab: a #GtrTab + * @tab: a #GtrTab * * Jumps to the last message. */ void -gtr_tab_go_to_last (GtrTab * tab) +gtr_tab_go_to_last (GtrTab * tab, gboolean searching) { GtrMsg *msg; @@ -1721,7 +1733,7 @@ gtr_tab_go_to_last (GtrTab * tab) GTR_NAVIGATE_LAST, NULL); if (msg) gtr_tab_message_go_to (tab, msg, - FALSE, GTR_TAB_MOVE_NONE); + searching, GTR_TAB_MOVE_NONE); } } diff --git a/src/gtr-tab.h b/src/gtr-tab.h index 98b90fa..0d1ac04 100644 --- a/src/gtr-tab.h +++ b/src/gtr-tab.h @@ -1,17 +1,17 @@ /* * Copyright (C) 2007 Ignacio Casal Quinteiro - * 2008 Igalia + * 2008 Igalia * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * @@ -106,6 +106,8 @@ GtrContextPanel *gtr_tab_get_context_panel (GtrTab * tab); GtrView *gtr_tab_get_active_view (GtrTab * tab); +GtrView *gtr_tab_get_active_original_view (GtrTab * tab); + GList *gtr_tab_get_all_views (GtrTab * tab, gboolean original, gboolean translated); @@ -143,13 +145,13 @@ void gtr_tab_block_movement (GtrTab * tab); void gtr_tab_unblock_movement (GtrTab * tab); -void gtr_tab_go_to_next (GtrTab * tab); +void gtr_tab_go_to_next (GtrTab * tab, gboolean searching); -void gtr_tab_go_to_prev (GtrTab * tab); +void gtr_tab_go_to_prev (GtrTab * tab, gboolean searching); -void gtr_tab_go_to_first (GtrTab * tab); +void gtr_tab_go_to_first (GtrTab * tab, gboolean searching); -void gtr_tab_go_to_last (GtrTab * tab); +void gtr_tab_go_to_last (GtrTab * tab, gboolean searching); gboolean gtr_tab_go_to_next_fuzzy (GtrTab * tab); diff --git a/src/gtr-view.c b/src/gtr-view.c index b9c4f6a..2ea57de 100644 --- a/src/gtr-view.c +++ b/src/gtr-view.c @@ -1,21 +1,21 @@ /* * Copyright (C) 2007 Ignacio Casal Quinteiro * 1998, 1999 Alex Roberts, Evan Lawrence - * 2000 2002 Chema Celorio, Paolo Maggi - * 2003 2005 Paolo Maggi - * + * 2000 2002 Chema Celorio, Paolo Maggi + * 2003 2005 Paolo Maggi + * * Some funcs based in gedit-view.c file. - * + * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program. If not, see . * @@ -195,7 +195,7 @@ gtr_view_class_init (GtrViewClass * klass) * gtr_view_new: * * Creates a new #GtrView. An empty default buffer will be created for you. - * + * * Returns: a new #GtrView */ GtkWidget * @@ -250,7 +250,7 @@ gtr_view_get_selected_text (GtrView * view, * gtr_view_enable_spellcheck: * @view: a #GtrView * @enable: TRUE if you want enable the spellcheck - * + * * Enables the spellcheck **/ void @@ -386,7 +386,7 @@ gtr_view_paste_clipboard (GtrView * view) * @view: a #GtrView * @def: TRUE if you want to use the default font * @font_name: The name of the font you want to use in the #GtrView - * + * * Sets the #GtrView font. **/ void @@ -485,10 +485,10 @@ gtr_view_set_search_text (GtrView * view, const gchar * text, guint flags) * gtr_view_get_search_text: * @view: a #GtrView * @flags: the #GtrSearchFlags of the stored text. - * + * * Returns the text to search for it and the #GtrSearchFlags of that * text. - * + * * Returns: the text to search for it. */ gchar * @@ -505,7 +505,7 @@ gtr_view_get_search_text (GtrView * view, guint * flags) /** * gtr_view_get_can_search_again: * @view: a #GtrView - * + * * Returns: TRUE if it can search again */ gboolean @@ -520,17 +520,17 @@ gtr_view_get_can_search_again (GtrView * view) /** * gtr_view_search_forward: * @view: a #GtrView - * @start: start of search + * @start: start of search * @end: bound for the search, or %NULL for the end of the buffer * @match_start: return location for start of match, or %NULL * @match_end: return location for end of match, or %NULL - * + * * Searches forward for str. Any match is returned by setting match_start to the * first character of the match and match_end to the first character after the match. * The search will not continue past limit. * Note that a search is a linear or O(n) operation, so you may wish to use limit - * to avoid locking up your UI on large buffers. - * + * to avoid locking up your UI on large buffers. + * * Returns: whether a match was found */ gboolean @@ -608,17 +608,17 @@ gtr_view_search_forward (GtrView * view, /** * gtr_view_search_backward: * @view: a #GtrView - * @start: start of search + * @start: start of search * @end: bound for the search, or %NULL for the end of the buffer * @match_start: return location for start of match, or %NULL * @match_end: return location for end of match, or %NULL - * + * * Searches backward for str. Any match is returned by setting match_start to the * first character of the match and match_end to the first character after the match. * The search will not continue past limit. * Note that a search is a linear or O(n) operation, so you may wish to use limit - * to avoid locking up your UI on large buffers. - * + * to avoid locking up your UI on large buffers. + * * Returns: whether a match was found */ gboolean @@ -699,10 +699,10 @@ gtr_view_search_backward (GtrView * view, * @find: the text to find * @replace: the text to replace @find * @flags: a #GtrSearchFlags - * - * Replaces all matches of @find with @replace and returns the number of + * + * Replaces all matches of @find with @replace and returns the number of * replacements. - * + * * Returns: the number of replacements made it. */ gint @@ -752,47 +752,48 @@ gtr_view_replace_all (GtrView * view, */ //view->priv->stop_cursor_moved_emission = TRUE; - gtk_text_buffer_begin_user_action (buffer); - - do - { - found = gtk_text_iter_forward_search (&iter, + found = gtk_text_iter_forward_search (&iter, search_text, search_flags, &m_start, &m_end, NULL); + if (found) + { + gtk_text_buffer_begin_user_action (buffer); - if (found && GTR_SEARCH_IS_ENTIRE_WORD (flags)) - { - gboolean word; + while (found) + { + if (GTR_SEARCH_IS_ENTIRE_WORD (flags)) + { + gboolean word; - word = gtk_text_iter_starts_word (&m_start) && - gtk_text_iter_ends_word (&m_end); + word = gtk_text_iter_starts_word (&m_start) && + gtk_text_iter_ends_word (&m_end); - if (!word) - { - iter = m_end; - continue; - } - } + if (!word) + { + iter = m_end; + continue; + } + } - if (found) - { - ++cont; + ++cont; + gtk_text_buffer_delete (buffer, &m_start, &m_end); + gtk_text_buffer_insert (buffer, &m_start, replace_text, replace_text_len); + iter = m_start; - gtk_text_buffer_delete (buffer, &m_start, &m_end); - gtk_text_buffer_insert (buffer, - &m_start, replace_text, replace_text_len); + found = gtk_text_iter_forward_search (&iter, + search_text, + search_flags, + &m_start, &m_end, NULL); + } - iter = m_start; - } - } - while (found); + gtk_text_buffer_end_user_action (buffer); + } - gtk_text_buffer_end_user_action (buffer); /* re-enable cursor_moved emission and notify - * the current position + * the current position */ //view->priv->stop_cursor_moved_emission = FALSE; //emit_cursor_moved (GTK_SOURCE_BUFFER(buffer)); @@ -807,7 +808,7 @@ gtr_view_replace_all (GtrView * view, * gtr_view_reload_scheme_color: * @view: a #GtrView * - * Reloads the gtksourceview scheme color. Neccessary when the scheme color + * Reloads the gtksourceview scheme color. Neccessary when the scheme color * changes. */ void -- 1.8.1.4 --------------020204060506050700000707-- From nacho.resa@gmail.com Fri Apr 26 08:11:14 2013 Return-Path: X-Original-To: gtranslator-list@gnome.org Delivered-To: gtranslator-list@gnome.org Received: from localhost (localhost.localdomain [127.0.0.1]) by restaurant.gnome.org (Postfix) with ESMTP id C3D8376C1A for ; Fri, 26 Apr 2013 08:11:14 +0000 (UTC) X-Virus-Scanned: by amavisd-new at gnome.org X-Spam-Flag: NO X-Spam-Score: -2.699 X-Spam-Level: X-Spam-Status: No, score=-2.699 tagged_above=-999 required=2 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_LOW=-0.7, SPF_PASS=-0.001] autolearn=ham Received: from restaurant.gnome.org ([127.0.0.1]) by localhost (restaurant.gnome.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 1FWw-cXeQCPm for ; Fri, 26 Apr 2013 08:11:04 +0000 (UTC) Received: from mail-lb0-f179.google.com (mail-lb0-f179.google.com [209.85.217.179]) by restaurant.gnome.org (Postfix) with ESMTP id BCED676A39 for ; Fri, 26 Apr 2013 08:11:03 +0000 (UTC) Received: by mail-lb0-f179.google.com with SMTP id t1so3470582lbd.24 for ; Fri, 26 Apr 2013 01:11:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=mRLmtHGnH+Sp+zKFZXiOk9KNZyE5TCN/MjsST2Zfq6E=; b=YxPHC7MwJ7yJ+bVkpniLGdHCU+1tGqQbXJ32HZ2n/jjOMxFBF4d25pOymEvtTmrtlk MKpuKGMDTy8uspwirUrFsY7tCPkVMaH3rdHOv5EIGCTTwganXcmlIbIuC/K7hlzgmc6a S6Yu5qRhBJ3zixdYYbNuPu0FPaG/IKw1msJbqRPpurMDJQEeytpgIbyUBd9zkGj2kReF j7jda2rb9hxR+PY7TyS9J4KejRl/YG9MuaVSAmxe3qbUzoJj9krVhuTyzWdG6de2oydP FrbPY1Q0FfB+xr3I59iFoPyxSdoT+1rjPlmMdhQtgznCDQWktP4JGO0HiVMP8MjkvkDk N1hw== MIME-Version: 1.0 X-Received: by 10.112.199.194 with SMTP id jm2mr20501485lbc.21.1366963861472; Fri, 26 Apr 2013 01:11:01 -0700 (PDT) Received: by 10.114.161.201 with HTTP; Fri, 26 Apr 2013 01:11:01 -0700 (PDT) In-Reply-To: <51797FFF.1000507@gmail.com> References: <51797FFF.1000507@gmail.com> Date: Fri, 26 Apr 2013 10:11:01 +0200 Message-ID: Subject: Re: Repair search and repair functions From: Ignacio Casal Quinteiro To: Mickael Albertus Content-Type: multipart/alternative; boundary=001a11c33a52624b5e04db3f1392 Cc: Gtranslator List X-BeenThere: gtranslator-list@gnome.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: gtranslator discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 26 Apr 2013 08:11:14 -0000 --001a11c33a52624b5e04db3f1392 Content-Type: text/plain; charset=ISO-8859-1 Hi Mickael, the search in gtranslator should be made from scratch using a filter. any other tries to fix it will be a hack over the hack :) Regards. On Thu, Apr 25, 2013 at 9:11 PM, Mickael Albertus < mickael.albertus@gmail.com> wrote: > Hi, > > I tried to fix the problem concerning the search and replace function. I > attached the patch. > I hope it will be helpful! > > Regards, > Mickael Albertus > > _______________________________________________ > gtranslator-list mailing list > gtranslator-list@gnome.org > https://mail.gnome.org/mailman/listinfo/gtranslator-list > -- Ignacio Casal Quinteiro --001a11c33a52624b5e04db3f1392 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable
Hi Mickael,

the search in gtranslator sho= uld be made from scratch using a filter.
any other tries to fix it= will be a hack over the hack :)

Regards.


On Thu, Apr 25, 2013 at 9:11 PM, Mickael= Albertus <mickael.albertus@gmail.com> wrote:
Hi,

I tried to fix the problem concerning the search and replace function. I at= tached the patch.
I hope it will be helpful!

Regards,
Mickael Albertus

_______________________________________________
gtranslator-list mailing list
gtranslator-list@gnome.org
https://mail.gnome.org/mailman/listinfo/gtranslator-list



--
Ignacio Casal Quinteir= o
--001a11c33a52624b5e04db3f1392--