[libpeas] PeasGtk: Use gtk_tree_model_get_value() instead of gtk_tree_model_get()
- From: Steve Frécinaux <sfre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libpeas] PeasGtk: Use gtk_tree_model_get_value() instead of gtk_tree_model_get()
- Date: Sun, 6 Mar 2011 11:50:54 +0000 (UTC)
commit 772d67ab43a97f062a61b9bae9b1255a0ae8807b
Author: Steve Frécinaux <code istique net>
Date: Sun Mar 6 12:38:57 2011 +0100
PeasGtk: Use gtk_tree_model_get_value() instead of gtk_tree_model_get()
This makes debugging easier, especially since we're only getting a
single column value each time.
libpeas-gtk/peas-gtk-plugin-manager-store.c | 33 +++++++++++++++++++-------
libpeas-gtk/peas-gtk-plugin-manager-view.c | 2 +
2 files changed, 26 insertions(+), 9 deletions(-)
---
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-store.c b/libpeas-gtk/peas-gtk-plugin-manager-store.c
index 9f74570..7873d53 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-store.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-store.c
@@ -419,14 +419,19 @@ gboolean
peas_gtk_plugin_manager_store_get_enabled (PeasGtkPluginManagerStore *store,
GtkTreeIter *iter)
{
+ GValue value = { 0 };
gboolean enabled;
g_return_val_if_fail (PEAS_GTK_IS_PLUGIN_MANAGER_STORE (store), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
- gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
- PEAS_GTK_PLUGIN_MANAGER_STORE_ENABLED_COLUMN, &enabled,
- -1);
+ gtk_tree_model_get_value (GTK_TREE_MODEL (store), iter,
+ PEAS_GTK_PLUGIN_MANAGER_STORE_ENABLED_COLUMN, &value);
+
+ g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE);
+ enabled = g_value_get_boolean (&value);
+
+ g_value_unset (&value);
return enabled;
}
@@ -496,14 +501,19 @@ gboolean
peas_gtk_plugin_manager_store_can_enable (PeasGtkPluginManagerStore *store,
GtkTreeIter *iter)
{
+ GValue value = { 0 };
gboolean can_enable;
g_return_val_if_fail (PEAS_GTK_IS_PLUGIN_MANAGER_STORE (store), FALSE);
g_return_val_if_fail (iter != NULL, FALSE);
- gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
- PEAS_GTK_PLUGIN_MANAGER_STORE_CAN_ENABLE_COLUMN, &can_enable,
- -1);
+ gtk_tree_model_get_value (GTK_TREE_MODEL (store), iter,
+ PEAS_GTK_PLUGIN_MANAGER_STORE_CAN_ENABLE_COLUMN, &value);
+
+ g_return_val_if_fail (G_VALUE_HOLDS_BOOLEAN (&value), FALSE);
+ can_enable = g_value_get_boolean (&value);
+
+ g_value_unset (&value);
return can_enable;
}
@@ -521,14 +531,19 @@ PeasPluginInfo *
peas_gtk_plugin_manager_store_get_plugin (PeasGtkPluginManagerStore *store,
GtkTreeIter *iter)
{
+ GValue value = { 0 };
PeasPluginInfo *info;
g_return_val_if_fail (PEAS_GTK_IS_PLUGIN_MANAGER_STORE (store), NULL);
g_return_val_if_fail (iter != NULL, NULL);
- gtk_tree_model_get (GTK_TREE_MODEL (store), iter,
- PEAS_GTK_PLUGIN_MANAGER_STORE_PLUGIN_COLUMN, &info,
- -1);
+ gtk_tree_model_get_value (GTK_TREE_MODEL (store), iter,
+ PEAS_GTK_PLUGIN_MANAGER_STORE_PLUGIN_COLUMN, &value);
+
+ g_return_val_if_fail (G_VALUE_HOLDS_POINTER (&value), NULL);
+ info = g_value_get_pointer (&value);
+
+ g_value_unset (&value);
/* We register it as a pointer instead
* of a boxed so no need to unref it
diff --git a/libpeas-gtk/peas-gtk-plugin-manager-view.c b/libpeas-gtk/peas-gtk-plugin-manager-view.c
index ea862e4..a52b6e8 100644
--- a/libpeas-gtk/peas-gtk-plugin-manager-view.c
+++ b/libpeas-gtk/peas-gtk-plugin-manager-view.c
@@ -280,6 +280,8 @@ name_search_cb (GtkTreeModel *model,
if (info == NULL)
return FALSE;
+ g_print ("name_search_cb: %s", peas_plugin_info_get_name (info));
+
normalized_string = g_utf8_normalize (peas_plugin_info_get_name (info), -1, G_NORMALIZE_ALL);
normalized_key = g_utf8_normalize (key, -1, G_NORMALIZE_ALL);
case_normalized_string = g_utf8_casefold (normalized_string, -1);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]