[anjuta/symbol-db-model] symbol-db: Used markup for listing and tooltips.



commit cf56f6af92602b084170687a1eb934ebeac71959
Author: Naba Kumar <naba gnome org>
Date:   Sun Mar 21 18:53:00 2010 +0200

    symbol-db: Used markup for listing and tooltips.

 plugins/symbol-db/symbol-db-model-project.c |   30 ++++++++++++++++++++++----
 plugins/symbol-db/symbol-db-model.c         |   11 ++++-----
 plugins/symbol-db/symbol-db-views.c         |    2 +-
 3 files changed, 31 insertions(+), 12 deletions(-)
---
diff --git a/plugins/symbol-db/symbol-db-model-project.c b/plugins/symbol-db/symbol-db-model-project.c
index 563eec7..9fb2d9d 100644
--- a/plugins/symbol-db/symbol-db-model-project.c
+++ b/plugins/symbol-db/symbol-db-model-project.c
@@ -194,8 +194,12 @@ symbol_db_model_project_get_query_value (SymbolDBModel *model,
 				                                  DATA_COL_SYMBOL_RETURNTYPE);
 			if (ret_value && G_VALUE_HOLDS_STRING (ret_value))
 			{
-				g_string_append (label, " : ");
-				g_string_append (label, g_value_get_string (ret_value));
+				gchar *escaped =
+					g_markup_escape_text (g_value_get_string (ret_value), -1);
+				g_string_append (label, "<span style=\"italic\"> : ");
+				g_string_append (label, escaped);
+				g_string_append (label, "</span>");
+				g_free (escaped);
 			}
 		}
 		else
@@ -206,15 +210,31 @@ symbol_db_model_project_get_query_value (SymbolDBModel *model,
 			if (ret_value && G_VALUE_HOLDS_STRING (ret_value) &&
 			    g_strcmp0 (g_value_get_string (ret_value), name) != 0)
 			{
-				g_string_append (label, " : ");
-				g_string_append (label, g_value_get_string (ret_value));
+				gchar *escaped =
+					g_markup_escape_text (g_value_get_string (ret_value), -1);
+				g_string_append (label, "<span style=\"italic\"> : ");
+				g_string_append (label, escaped);
+				g_string_append (label, "</span>");
+				g_free (escaped);
 			}
 		}
 		g_value_set_string (value, label->str);
 		g_string_free (label, TRUE);
 		return TRUE;
 		break;
-			
+	case SYMBOL_DB_MODEL_PROJECT_COL_ARGS:
+		ret_value = gda_data_model_iter_get_value_at (iter,
+		                                              DATA_COL_SYMBOL_ARGS);
+		if (ret_value && G_VALUE_HOLDS_STRING (ret_value)
+		    && strlen (g_value_get_string (ret_value)) > 2)	
+		{
+			gchar *escaped =
+				g_markup_escape_text (g_value_get_string (ret_value), -1);
+			g_value_set_string (value, escaped);
+			g_free (escaped);
+		}
+		return TRUE;
+		break;
 	default:
 		return SYMBOL_DB_MODEL_CLASS (symbol_db_model_project_parent_class)->
 				get_query_value (model, data_model, iter, column, value);
diff --git a/plugins/symbol-db/symbol-db-model.c b/plugins/symbol-db/symbol-db-model.c
index 8f3def5..7abdf7d 100644
--- a/plugins/symbol-db/symbol-db-model.c
+++ b/plugins/symbol-db/symbol-db-model.c
@@ -507,7 +507,7 @@ symbol_db_model_get_iter (GtkTreeModel *tree_model,
 			/* No child available. View thinks there is child.
 			 * It's an inconsistent state. Do something fancy to fix it.
 			 */
-			symbol_db_model_update (tree_model); /* Untested path */
+			symbol_db_model_update (SYMBOL_DB_MODEL (tree_model)); /* Untested path */
 			break;
 		}
 		if (indx[i] >= node->n_children)
@@ -592,7 +592,6 @@ symbol_db_model_get_value (GtkTreeModel *tree_model,
 	if (!node->children_ensured)
 		symbol_db_model_queue_ensure_node_children (SYMBOL_DB_MODEL (tree_model),
 		                                            node);
-
 	g_value_copy (&(node->values[column]), value);
 }
 
@@ -964,11 +963,11 @@ symbol_db_model_get_query_value_real (SymbolDBModel *model,
 		return FALSE;
 
 	ret = gda_data_model_iter_get_value_at (iter, query_column);
-	if (!ret)
+	if (!ret || !G_IS_VALUE (ret))
 		return FALSE;
 
 	g_value_copy (ret, value);
-	return FALSE;
+	return TRUE;
 }
 
 static gboolean
@@ -998,11 +997,11 @@ symbol_db_model_get_query_value_at_real (SymbolDBModel *model,
 
 	ret = gda_data_model_get_value_at (data_model, query_column, position,
 	                                   NULL);
-	if (!ret)
+	if (!ret || !G_IS_VALUE (ret))
 		return FALSE;
 
 	g_value_copy (ret, value);
-	return FALSE;
+	return TRUE;
 }
 
 static gboolean
diff --git a/plugins/symbol-db/symbol-db-views.c b/plugins/symbol-db/symbol-db-views.c
index 05ef549..45a06b7 100644
--- a/plugins/symbol-db/symbol-db-views.c
+++ b/plugins/symbol-db/symbol-db-views.c
@@ -117,7 +117,7 @@ symbol_db_view_new (SymbolViewType view_type,
 
 	renderer = gtk_cell_renderer_text_new ();
 	gtk_tree_view_column_pack_start (column, renderer, TRUE);
-	gtk_tree_view_column_add_attribute (column, renderer, "text",
+	gtk_tree_view_column_add_attribute (column, renderer, "markup",
 	                                    SYMBOL_DB_MODEL_PROJECT_COL_LABEL);
 
 	gtk_tree_view_append_column (GTK_TREE_VIEW (dbv), column);



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