network-manager-applet r1241 - in branches/NETWORKMANAGER_APPLET_0_7: . src/connection-editor
- From: dcbw svn gnome org
- To: svn-commits-list gnome org
- Subject: network-manager-applet r1241 - in branches/NETWORKMANAGER_APPLET_0_7: . src/connection-editor
- Date: Tue, 31 Mar 2009 20:27:51 +0000 (UTC)
Author: dcbw
Date: Tue Mar 31 20:27:51 2009
New Revision: 1241
URL: http://svn.gnome.org/viewvc/network-manager-applet?rev=1241&view=rev
Log:
2009-03-31 Dan Williams <dcbw redhat com>
* src/connection-editor/nm-connection-list.c
- (add_connection_buttons, delete_selection_changed_cb): disable the
delete button when the connection is read-only
Modified:
branches/NETWORKMANAGER_APPLET_0_7/ChangeLog
branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c
Modified: branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c
==============================================================================
--- branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c (original)
+++ branches/NETWORKMANAGER_APPLET_0_7/src/connection-editor/nm-connection-list.c Tue Mar 31 20:27:51 2009
@@ -1174,6 +1174,38 @@
}
static void
+delete_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data)
+{
+ ActionInfo *info = (ActionInfo *) user_data;
+ GtkTreeIter iter;
+ GtkTreeModel *model;
+ NMExportedConnection *exported;
+ NMConnection *connection = NULL;
+ NMSettingConnection *s_con;
+ gboolean can_delete = TRUE;
+
+ if (!gtk_tree_selection_get_selected (selection, &model, &iter))
+ goto done;
+
+ exported = get_active_connection (info->treeview);
+ if (exported)
+ connection = nm_exported_connection_get_connection (exported);
+ if (!connection)
+ goto done;
+
+ s_con = NM_SETTING_CONNECTION (nm_connection_get_setting (connection, NM_TYPE_SETTING_CONNECTION));
+ g_assert (s_con);
+
+ if (nm_setting_connection_get_read_only (s_con)) {
+ can_delete = FALSE;
+ goto done;
+ }
+
+done:
+ gtk_widget_set_sensitive (info->button, can_delete);
+}
+
+static void
vpn_list_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data)
{
ActionInfo *info = (ActionInfo *) user_data;
@@ -1495,7 +1527,7 @@
g_free (name);
info = new_action_info (self, treeview, button);
g_signal_connect (button, "clicked", G_CALLBACK (delete_connection_cb), info);
- g_signal_connect (selection, "changed", G_CALLBACK (list_selection_changed_cb), info);
+ g_signal_connect (selection, "changed", G_CALLBACK (delete_selection_changed_cb), info);
/* Import */
name = g_strdup_printf ("%s_import", prefix);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]