[Xfce4-commits] <xfce4-settings:master> Optimize filter function a bit.
Nick Schermer
noreply at xfce.org
Mon Jan 23 16:44:01 CET 2012
Updating branch refs/heads/master
to 5785e87190e0a1e3cd0d73ef12c504d4ffccb983 (commit)
from 4828e19aed783df55e65e802ed73b84f9c8918da (commit)
commit 5785e87190e0a1e3cd0d73ef12c504d4ffccb983
Author: Nick Schermer <nick at xfce.org>
Date: Mon Jan 23 16:43:09 2012 +0100
Optimize filter function a bit.
dialogs/mime-settings/xfce-mime-window.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/dialogs/mime-settings/xfce-mime-window.c b/dialogs/mime-settings/xfce-mime-window.c
index 3842624..27e8e60 100644
--- a/dialogs/mime-settings/xfce-mime-window.c
+++ b/dialogs/mime-settings/xfce-mime-window.c
@@ -562,18 +562,20 @@ xfce_mime_window_row_visible_func (GtkTreeModel *model,
gpointer data)
{
XfceMimeWindow *window = XFCE_MIME_WINDOW (data);
- gchar *mime_type;
- gboolean visible = FALSE;
+ const gchar *mime_type;
+ GValue value = { 0, };
+ gboolean visible;
if (window->filter_text == NULL)
return TRUE;
- gtk_tree_model_get (model, iter, COLUMN_MIME_TYPE, &mime_type, -1);
- if (G_UNLIKELY (mime_type == NULL))
- return FALSE;
+ gtk_tree_model_get_value (model, iter, COLUMN_MIME_TYPE, &value);
+
+ mime_type = g_value_get_string (&value);
+ visible = mime_type != NULL
+ && strstr (mime_type, window->filter_text) != NULL;
- visible = strstr (mime_type, window->filter_text) != NULL;
- g_free (mime_type);
+ g_value_unset (&value);
return visible;
}
More information about the Xfce4-commits
mailing list