[empathy] Group all matching functions together



commit f77a8afd5d85a230b743d97e12ed069a0309b660
Author: Xavier Claessens <xclaesse gmail com>
Date:   Fri Jul 23 14:41:32 2010 +0200

    Group all matching functions together
    
    This is only code move, no change

 libempathy-gtk/empathy-live-search.c |  138 +++++++++++++++++-----------------
 1 files changed, 69 insertions(+), 69 deletions(-)
---
diff --git a/libempathy-gtk/empathy-live-search.c b/libempathy-gtk/empathy-live-search.c
index a008d81..399733c 100644
--- a/libempathy-gtk/empathy-live-search.c
+++ b/libempathy-gtk/empathy-live-search.c
@@ -154,6 +154,75 @@ strip_utf8_string (const gchar *string)
 }
 
 static gboolean
+live_search_match_prefix (const gchar *string,
+    const gchar *prefix)
+{
+  const gchar *p;
+  const gchar *prefix_p;
+  gboolean next_word = FALSE;
+
+  if (prefix == NULL || prefix[0] == 0)
+    return TRUE;
+
+  if (EMP_STR_EMPTY (string))
+    return FALSE;
+
+  prefix_p = prefix;
+  for (p = string; *p != '\0'; p = g_utf8_next_char (p))
+    {
+      gunichar sc;
+
+      /* Make the char lower-case, remove its accentuation marks, and ignore it
+       * if it is just unicode marks */
+      sc = stripped_char (g_utf8_get_char (p));
+      if (sc == 0)
+        continue;
+
+      /* If we want to go to next word, ignore alpha-num chars */
+      if (next_word && g_unichar_isalnum (sc))
+        continue;
+      next_word = FALSE;
+
+      /* Ignore word separators */
+      if (!g_unichar_isalnum (sc))
+        continue;
+
+      /* If this char does not match prefix_p, go to next word and start again
+       * from the beginning of prefix */
+      if (sc != g_utf8_get_char (prefix_p))
+        {
+          next_word = TRUE;
+          prefix_p = prefix;
+          continue;
+        }
+
+      /* prefix_p match, verify to next char. If this was the last of prefix,
+       * it means it completely machted and we are done. */
+      prefix_p = g_utf8_next_char (prefix_p);
+      if (*prefix_p == '\0')
+        return TRUE;
+    }
+
+  return FALSE;
+}
+
+static gboolean
+live_search_match_words (const gchar *string,
+    GPtrArray *words)
+{
+  guint i;
+
+  if (words == NULL)
+    return TRUE;
+
+  for (i = 0; i < words->len; i++)
+    if (!live_search_match_prefix (string, g_ptr_array_index (words, i)))
+      return FALSE;
+
+  return TRUE;
+}
+
+static gboolean
 live_search_entry_key_pressed_cb (GtkEntry *entry,
     GdkEventKey *event,
     gpointer user_data)
@@ -548,75 +617,6 @@ empathy_live_search_set_text (EmpathyLiveSearch *self,
   gtk_entry_set_text (GTK_ENTRY (priv->search_entry), text);
 }
 
-static gboolean
-live_search_match_prefix (const gchar *string,
-    const gchar *prefix)
-{
-  const gchar *p;
-  const gchar *prefix_p;
-  gboolean next_word = FALSE;
-
-  if (prefix == NULL || prefix[0] == 0)
-    return TRUE;
-
-  if (EMP_STR_EMPTY (string))
-    return FALSE;
-
-  prefix_p = prefix;
-  for (p = string; *p != '\0'; p = g_utf8_next_char (p))
-    {
-      gunichar sc;
-
-      /* Make the char lower-case, remove its accentuation marks, and ignore it
-       * if it is just unicode marks */
-      sc = stripped_char (g_utf8_get_char (p));
-      if (sc == 0)
-        continue;
-
-      /* If we want to go to next word, ignore alpha-num chars */
-      if (next_word && g_unichar_isalnum (sc))
-        continue;
-      next_word = FALSE;
-
-      /* Ignore word separators */
-      if (!g_unichar_isalnum (sc))
-        continue;
-
-      /* If this char does not match prefix_p, go to next word and start again
-       * from the beginning of prefix */
-      if (sc != g_utf8_get_char (prefix_p))
-        {
-          next_word = TRUE;
-          prefix_p = prefix;
-          continue;
-        }
-
-      /* prefix_p match, verify to next char. If this was the last of prefix,
-       * it means it completely machted and we are done. */
-      prefix_p = g_utf8_next_char (prefix_p);
-      if (*prefix_p == '\0')
-        return TRUE;
-    }
-
-  return FALSE;
-}
-
-static gboolean
-live_search_match_words (const gchar *string,
-    GPtrArray *words)
-{
-  guint i;
-
-  if (words == NULL)
-    return TRUE;
-
-  for (i = 0; i < words->len; i++)
-    if (!live_search_match_prefix (string, g_ptr_array_index (words, i)))
-      return FALSE;
-
-  return TRUE;
-}
-
 /**
  * empathy_live_search_match:
  * @self: a #EmpathyLiveSearch



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]