Remove the use of "Phrase" when searching.

Remove the word "Phrase" and use "%s" instead to visualized what it was searched. (Fixes bug #572901).
parent 80a35dfb
......@@ -155,8 +155,8 @@ restore_last_searched_data (GeditSearchDialog *dialog,
/* Use occurences only for Replace All */
static void
phrase_found (GeditWindow *window,
gint occurrences)
text_found (GeditWindow *window,
gint occurrences)
{
if (occurrences > 1)
{
......@@ -180,12 +180,19 @@ phrase_found (GeditWindow *window,
}
}
#define MAX_MSG_LENGTH 40
static void
phrase_not_found (GeditWindow *window)
text_not_found (GeditWindow *window,
const gchar *text)
{
gchar *searched;
searched = gedit_utils_str_end_truncate (text, MAX_MSG_LENGTH);
gedit_statusbar_flash_message (GEDIT_STATUSBAR (window->priv->statusbar),
window->priv->generic_message_cid,
_("Phrase not found"));
_("\"%s\" not found"), searched);
g_free (searched);
}
static gboolean
......@@ -312,9 +319,9 @@ do_find (GeditSearchDialog *dialog,
search_backwards);
if (found)
phrase_found (window, 0);
text_found (window, 0);
else
phrase_not_found (window);
text_not_found (window, entry_text);
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
GEDIT_SEARCH_DIALOG_REPLACE_RESPONSE,
......@@ -464,11 +471,11 @@ do_replace_all (GeditSearchDialog *dialog,
if (count > 0)
{
phrase_found (window, count);
text_found (window, count);
}
else
{
phrase_not_found (window);
text_not_found (window, search_entry_text);
}
gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
......
......@@ -567,9 +567,10 @@ gedit_utils_escape_underscores (const gchar* text,
/* the following functions are taken from eel */
gchar *
gedit_utils_str_middle_truncate (const gchar *string,
guint truncate_length)
static gchar *
gedit_utils_str_truncate (const gchar *string,
guint truncate_length,
gboolean middle)
{
GString *truncated;
guint length;
......@@ -602,17 +603,41 @@ gedit_utils_str_middle_truncate (const gchar *string,
}
/* Find the 'middle' where the truncation will occur. */
num_left_chars = (truncate_length - delimiter_length) / 2;
right_offset = n_chars - truncate_length + num_left_chars + delimiter_length;
if (middle)
{
num_left_chars = (truncate_length - delimiter_length) / 2;
right_offset = n_chars - truncate_length + num_left_chars + delimiter_length;
truncated = g_string_new_len (string,
g_utf8_offset_to_pointer (string, num_left_chars) - string);
g_string_append (truncated, delimiter);
g_string_append (truncated, g_utf8_offset_to_pointer (string, right_offset));
truncated = g_string_new_len (string,
g_utf8_offset_to_pointer (string, num_left_chars) - string);
g_string_append (truncated, delimiter);
g_string_append (truncated, g_utf8_offset_to_pointer (string, right_offset));
}
else
{
num_left_chars = truncate_length - delimiter_length;
truncated = g_string_new_len (string,
g_utf8_offset_to_pointer (string, num_left_chars) - string);
g_string_append (truncated, delimiter);
}
return g_string_free (truncated, FALSE);
}
gchar *
gedit_utils_str_middle_truncate (const gchar *string,
guint truncate_length)
{
return gedit_utils_str_truncate (string, truncate_length, TRUE);
}
gchar *
gedit_utils_str_end_truncate (const gchar *string,
guint truncate_length)
{
return gedit_utils_str_truncate (string, truncate_length, FALSE);
}
gchar *
gedit_utils_make_valid_utf8 (const char *name)
{
......
......@@ -80,6 +80,9 @@ gchar *gedit_utils_escape_underscores (const gchar *text,
gchar *gedit_utils_str_middle_truncate (const gchar *string,
guint truncate_length);
gchar *gedit_utils_str_end_truncate (const gchar *string,
guint truncate_length);
gboolean g_utf8_caselessnmatch (const char *s1,
const char *s2,
gssize n1,
......@@ -103,9 +106,6 @@ void gedit_warning (GtkWindow *parent,
const gchar *format,
...) G_GNUC_PRINTF(2, 3);
gchar *gedit_utils_str_middle_truncate (const char *string,
guint truncate_length);
gchar *gedit_utils_make_valid_utf8 (const char *name);
/* Note that this function replace home dir with ~ */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment