mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-09-06 09:04:55 +00:00
2006-11-19 Dan Williams <dcbw@redhat.com>
Patch from Dan Berrange <dan@berrange.com> * gnome/applet/applet-dbus-vpn.c - (nma_dbus_vpn_properties_cb): sort VPN connections * gnome/vpn-properties/nm-vpn-properties.c - (init_app): sort VPN connections git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@2110 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
5dd4e01de6
commit
cb0ede9685
|
@ -1,3 +1,12 @@
|
|||
2006-11-19 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
Patch from Dan Berrange <dan@berrange.com>
|
||||
* gnome/applet/applet-dbus-vpn.c
|
||||
- (nma_dbus_vpn_properties_cb): sort VPN connections
|
||||
|
||||
* gnome/vpn-properties/nm-vpn-properties.c
|
||||
- (init_app): sort VPN connections
|
||||
|
||||
2006-11-09 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
* src/NetworkManagerAPList.c
|
||||
|
|
|
@ -95,6 +95,15 @@ static void free_vpn_props_cb_data (VpnPropsCBData *data)
|
|||
}
|
||||
}
|
||||
|
||||
static gint vpn_sorter (gconstpointer a,
|
||||
gconstpointer b) {
|
||||
VPNConnection *va = (VPNConnection *)a;
|
||||
VPNConnection *vb = (VPNConnection *)b;
|
||||
|
||||
return strcmp(nma_vpn_connection_get_name(va),
|
||||
nma_vpn_connection_get_name(vb));
|
||||
}
|
||||
|
||||
/*
|
||||
* nma_dbus_vpn_properties_cb
|
||||
*
|
||||
|
@ -154,7 +163,7 @@ static void nma_dbus_vpn_properties_cb (DBusPendingCall *pcall, void *user_data)
|
|||
vpn = nma_vpn_connection_new (name);
|
||||
nma_vpn_connection_set_service (vpn, service);
|
||||
nma_vpn_connection_set_stage (vpn, stage);
|
||||
applet->vpn_connections = g_slist_append (applet->vpn_connections, vpn);
|
||||
applet->vpn_connections = g_slist_insert_sorted (applet->vpn_connections, vpn, vpn_sorter);
|
||||
}
|
||||
}
|
||||
dbus_message_unref (reply);
|
||||
|
|
|
@ -876,6 +876,29 @@ out:
|
|||
|
||||
#define VPN_NAME_FILES_DIR SYSCONFDIR"/NetworkManager/VPN"
|
||||
|
||||
static gint
|
||||
vpn_list_sorter(GtkTreeModel *model,
|
||||
GtkTreeIter *a,
|
||||
GtkTreeIter *b,
|
||||
gpointer user_data)
|
||||
{
|
||||
GValue aval = {0};
|
||||
GValue bval = {0};
|
||||
const char *aname;
|
||||
const char *bname;
|
||||
gint res;
|
||||
|
||||
gtk_tree_model_get_value(model, a, VPNCONN_NAME_COLUMN, &aval);
|
||||
gtk_tree_model_get_value(model, b, VPNCONN_NAME_COLUMN, &bval);
|
||||
aname = g_value_get_string(&aval);
|
||||
bname = g_value_get_string(&bval);
|
||||
res = strcmp(aname, bname);
|
||||
g_value_unset(&aval);
|
||||
g_value_unset(&bval);
|
||||
return res;
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
init_app (void)
|
||||
{
|
||||
|
@ -966,6 +989,16 @@ init_app (void)
|
|||
|
||||
vpn_conn_view = GTK_TREE_VIEW (glade_xml_get_widget (xml, "vpnlist"));
|
||||
vpn_conn_list = gtk_list_store_new (VPNCONN_N_COLUMNS, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_BOOLEAN);
|
||||
|
||||
gtk_tree_sortable_set_sort_func(GTK_TREE_SORTABLE(vpn_conn_list),
|
||||
VPNCONN_NAME_COLUMN,
|
||||
vpn_list_sorter,
|
||||
NULL,
|
||||
NULL);
|
||||
gtk_tree_sortable_set_sort_column_id(GTK_TREE_SORTABLE(vpn_conn_list),
|
||||
VPNCONN_NAME_COLUMN,
|
||||
GTK_SORT_ASCENDING);
|
||||
|
||||
gtk_signal_connect_after (GTK_OBJECT (vpn_conn_view), "cursor-changed",
|
||||
GTK_SIGNAL_FUNC (vpn_list_cursor_changed_cb), NULL);
|
||||
|
||||
|
|
Loading…
Reference in a new issue