[anjuta/sdb-queries] symbol-db: Show empty result for emty search entry text. Restore ctrl+l to search shortcut.



commit e9cda5b156f06bd83ee75dfbac95f2af9ee30c7f
Author: Naba Kumar <naba gnome org>
Date:   Thu Jun 17 00:13:02 2010 +0300

    symbol-db: Show empty result for emty search entry text. Restore ctrl+l to search shortcut.

 plugins/symbol-db/plugin.c                 |   12 +++---------
 plugins/symbol-db/plugin.h                 |    1 +
 plugins/symbol-db/symbol-db-model-search.c |    3 +++
 plugins/symbol-db/symbol-db-views.c        |    7 +++++++
 plugins/symbol-db/symbol-db-views.h        |    2 ++
 5 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/plugins/symbol-db/plugin.c b/plugins/symbol-db/plugin.c
index 5045e45..45e3229 100644
--- a/plugins/symbol-db/plugin.c
+++ b/plugins/symbol-db/plugin.c
@@ -299,18 +299,11 @@ on_goto_file_tag_decl_activate (GtkAction *action, SymbolDBPlugin *sdb_plugin)
 static void
 on_find_symbol (GtkAction *action, SymbolDBPlugin *sdb_plugin)
 {
-#if 0
-	DEBUG_PRINT ("on_find_symbol (GtkAction *action, gpointer user_data)");
-	GtkEntry * entry;
 	anjuta_shell_present_widget(ANJUTA_PLUGIN(sdb_plugin)->shell,
 								sdb_plugin->dbv_main, NULL);
 	
-	entry = symbol_db_view_search_get_entry ( 
-					SYMBOL_DB_VIEW_SEARCH (sdb_plugin->dbv_view_tree_search));
-	entry = NULL;
 	gtk_notebook_set_current_page (GTK_NOTEBOOK(sdb_plugin->dbv_notebook), 2);
-	gtk_widget_grab_focus (GTK_WIDGET (entry));
-#endif
+	gtk_widget_grab_focus (GTK_WIDGET (sdb_plugin->search_entry));
 }
 
 static GtkActionEntry actions[] = 
@@ -2133,10 +2126,11 @@ symbol_db_activate (AnjutaPlugin *plugin)
 	gtk_notebook_append_page (GTK_NOTEBOOK (sdb_plugin->dbv_notebook),
 							  view, gtk_label_new (_("Global" )));
 
-	/* Global symbols */
+	/* Search symbols */
 	view = symbol_db_view_new (SYMBOL_DB_VIEW_SEARCH,
 	                           sdb_plugin->sdbe_project,
 	                           sdb_plugin);
+	sdb_plugin->search_entry = symbol_db_view_get_search_entry (view);
 	gtk_notebook_append_page (GTK_NOTEBOOK (sdb_plugin->dbv_notebook),
 							  view, gtk_label_new (_("Search" )));
 
diff --git a/plugins/symbol-db/plugin.h b/plugins/symbol-db/plugin.h
index b512d57..53fcae1 100644
--- a/plugins/symbol-db/plugin.h
+++ b/plugins/symbol-db/plugin.h
@@ -111,6 +111,7 @@ struct _SymbolDBPlugin {
 	GtkWidget *progress_bar_system;			/* symbol db progress bar - system (globals) */
 	
 	GtkTreeModel *file_model;               /* File symbols model */
+	GtkWidget *search_entry;                /* The search entry box */
 	GtkWidget *pref_tree_view; 				/* Preferences treeview */
 	
 	/* current editor */
diff --git a/plugins/symbol-db/symbol-db-model-search.c b/plugins/symbol-db/symbol-db-model-search.c
index 9010960..7b49a9b 100644
--- a/plugins/symbol-db/symbol-db-model-search.c
+++ b/plugins/symbol-db/symbol-db-model-search.c
@@ -95,6 +95,9 @@ sdb_model_search_get_children (SymbolDBModel *model, gint tree_level,
 
 	if (tree_level > 0)
 		return NULL; /* It's a flat list */
+
+	if (priv->search_pattern == NULL || strlen (priv->search_pattern) == 2)
+		return NULL;
 	
 	g_object_get (model, "symbol-db-engine", &dbe, NULL);
 	
diff --git a/plugins/symbol-db/symbol-db-views.c b/plugins/symbol-db/symbol-db-views.c
index 0d9d4a1..f079503 100644
--- a/plugins/symbol-db/symbol-db-views.c
+++ b/plugins/symbol-db/symbol-db-views.c
@@ -217,7 +217,14 @@ symbol_db_view_new (SymbolViewType view_type,
 		gtk_widget_show (vbox);
 		gtk_box_pack_start (GTK_BOX (vbox), entry, FALSE, FALSE, 0);
 		gtk_box_pack_start (GTK_BOX (vbox), sw, TRUE, TRUE, 0);
+		g_object_set_data (G_OBJECT (vbox), "search_entry", entry);
 		return vbox;
 	}
 	return sw;
 }
+
+GtkWidget*
+symbol_db_view_get_search_entry (GtkWidget *search_view)
+{
+	return g_object_get_data (G_OBJECT (search_view), "search_entry");
+}
diff --git a/plugins/symbol-db/symbol-db-views.h b/plugins/symbol-db/symbol-db-views.h
index 044450b..a50dbdf 100644
--- a/plugins/symbol-db/symbol-db-views.h
+++ b/plugins/symbol-db/symbol-db-views.h
@@ -34,6 +34,8 @@ typedef enum {
 GtkWidget* symbol_db_view_new (SymbolViewType view_type,
                                SymbolDBEngine *dbe, SymbolDBPlugin *plugin);
 
+GtkWidget* symbol_db_view_get_search_entry (GtkWidget *search_view);
+
 G_END_DECLS
 
 #endif /* _SYMBOL_DB_VIEWS_H_ */



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