network-manager-applet r497 - in branches/network-manager-applet-0-6: . editor



Author: tambeti
Date: Wed Jan 30 23:00:53 2008
New Revision: 497
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=497&view=rev

Log:
2008-01-30  Tambet Ingo  <tambet gmail com>

	Sort wireless networks in the list.

	* editor/editor-app.c (sort_networks): Implement.
	(setup_dialog): Add sort function to the list store.
	(populate_model): Sort the model.



Modified:
   branches/network-manager-applet-0-6/ChangeLog
   branches/network-manager-applet-0-6/editor/editor-app.c

Modified: branches/network-manager-applet-0-6/editor/editor-app.c
==============================================================================
--- branches/network-manager-applet-0-6/editor/editor-app.c	(original)
+++ branches/network-manager-applet-0-6/editor/editor-app.c	Wed Jan 30 23:00:53 2008
@@ -299,13 +299,31 @@
 #endif
 }
 
-
 gboolean setup_dialog_idle(WE_DATA *we_data)
 {
 	setup_dialog(we_data);
 	return FALSE;
 }
 
+static gint
+sort_networks (GtkTreeModel *model,
+			   GtkTreeIter *a,
+			   GtkTreeIter *b,
+			   gpointer user_data)
+{
+	char *aa;
+	char *bb;
+	gint result;
+
+	gtk_tree_model_get (model, a, WNTV_DISPLAY_COLUMN, &aa, -1);
+	gtk_tree_model_get (model, b, WNTV_DISPLAY_COLUMN, &bb, -1);
+	result = strcmp (aa, bb);
+
+	g_free (aa);
+	g_free (bb);
+
+	return result;
+}
 
 void setup_dialog(WE_DATA *we_data)
 {
@@ -320,6 +338,12 @@
 			GDK_TYPE_PIXBUF,
 			G_TYPE_POINTER);
 
+	gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (store),
+									 WNTV_DISPLAY_COLUMN,
+									 sort_networks,
+									 NULL,
+									 NULL);
+
 	populate_model (we_data, store);
 
 	filter = gtk_tree_model_filter_new (GTK_TREE_MODEL (store), NULL);
@@ -436,6 +460,10 @@
 
 		gconf_dirs = g_slist_delete_link (gconf_dirs, gconf_dirs);
 	}
+
+	gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (store),
+										  WNTV_DISPLAY_COLUMN,
+										  GTK_SORT_ASCENDING);
 }
 
 



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