--- Begin Message ---
Package: gnome-network-admin
Version: 2.22.0-1
Severity: wishlist
Tags: patch
User: [email protected]
Usertags: origin-ubuntu intrepid ubuntu-patch
Forwarded: http://bugzilla.gnome.org/show_bug.cgi?id=540478
Hi,
The attached patch is used in Ubuntu to add an apply button to
network-admin, to prevent users from accidentally reconfiguring
their network settings too easily. Please consider applying it.
Thanks,
James
Index: ubuntu/interfaces/network.ui
===================================================================
--- ubuntu.orig/interfaces/network.ui 2008-06-24 12:04:27.000000000 +0100
+++ ubuntu/interfaces/network.ui 2008-06-24 17:06:50.000000000 +0100
@@ -193,6 +193,31 @@
<property name="fill">False</property>
</packing>
</child>
+ <child>
+ <object class="GtkButton" id="apply_location">
+ <property name="visible">True</property>
+ <property name="tooltip-text" translatable="yes">Apply location as the current configuration</property>
+ <property name="can_focus">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <child>
+ <object class="GtkImage" id="image11">
+ <property name="visible">True</property>
+ <property name="icon_size">4</property>
+ <property name="icon_name">gtk-apply</property>
+ <property name="xalign">0.5</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
</object>
<packing>
<property name="padding">0</property>
Index: ubuntu/src/network/locations-combo.c
===================================================================
--- ubuntu.orig/src/network/locations-combo.c 2008-06-24 12:04:27.000000000 +0100
+++ ubuntu/src/network/locations-combo.c 2008-06-24 17:06:50.000000000 +0100
@@ -34,6 +34,7 @@
GtkWidget *combo;
GtkWidget *save_button;
GtkWidget *delete_button;
+ GtkWidget *apply_button;
GtkWidget *save_dialog;
GtkWidget *location_entry;
@@ -44,7 +45,8 @@
PROP_TOOL,
PROP_COMBO,
PROP_SAVE,
- PROP_DELETE
+ PROP_DELETE,
+ PROP_APPLY
};
static void gst_locations_combo_class_init (GstLocationsComboClass *class);
@@ -108,6 +110,13 @@
"Delete",
GTK_TYPE_BUTTON,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
+ g_object_class_install_property (object_class,
+ PROP_APPLY,
+ g_param_spec_object ("apply",
+ "Apply",
+ "Apply",
+ GTK_TYPE_BUTTON,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY));
g_type_class_add_private (object_class,
sizeof (GstLocationsComboPrivate));
}
@@ -137,6 +146,9 @@
if (priv->delete_button)
g_object_unref (priv->delete_button);
+ if (priv->apply_button)
+ g_object_unref (priv->apply_button);
+
if (priv->model)
g_object_unref (priv->model);
}
@@ -166,6 +178,9 @@
case PROP_DELETE:
priv->delete_button = GTK_WIDGET (g_value_dup_object (value));
break;
+ case PROP_APPLY:
+ priv->apply_button = GTK_WIDGET (g_value_dup_object (value));
+ break;
}
}
@@ -194,6 +209,9 @@
case PROP_DELETE:
g_value_set_object (value, priv->delete_button);
break;
+ case PROP_APPLY:
+ g_value_set_object (value, priv->apply_button);
+ break;
}
}
@@ -215,11 +233,9 @@
gtk_tree_model_get (model, &iter, 0, &str, -1);
gst_network_locations_set_location (locations, str);
gst_tool_update_gui (priv->tool);
-
- oobs_object_commit (locations->hosts_config);
- gst_tool_commit_async (priv->tool, locations->ifaces_config,
- _("Changing network location"), NULL, NULL);
g_free (str);
+
+ gtk_widget_set_sensitive (priv->apply_button, TRUE);
}
}
@@ -430,6 +446,22 @@
}
static void
+on_apply_button_clicked (GtkWidget *widget, gpointer data)
+{
+ GstNetworkLocations *locations;
+ GstLocationsComboPrivate *priv;
+
+ priv = GST_LOCATIONS_COMBO (data)->_priv;
+ locations = GST_NETWORK_LOCATIONS (data);
+
+ oobs_object_commit (locations->hosts_config);
+ gst_tool_commit_async (priv->tool, locations->ifaces_config,
+ _("Changing network location"), NULL, NULL);
+
+ gtk_widget_set_sensitive (widget, FALSE);
+}
+
+static void
fill_model (GstLocationsCombo *combo,
GtkTreeModel *model)
{
@@ -480,6 +512,11 @@
G_CALLBACK (on_save_button_clicked), object);
g_signal_connect (G_OBJECT (priv->delete_button), "clicked",
G_CALLBACK (on_delete_button_clicked), object);
+ g_signal_connect (G_OBJECT (priv->apply_button), "clicked",
+ G_CALLBACK (on_apply_button_clicked), object);
+
+ /* set the apply button initially unsensitive */
+ gtk_widget_set_sensitive (priv->apply_button, FALSE);
return object;
}
@@ -501,12 +538,14 @@
gst_locations_combo_new (GstTool *tool,
GtkWidget *combo,
GtkWidget *save,
- GtkWidget *delete)
+ GtkWidget *delete,
+ GtkWidget *apply)
{
return g_object_new (GST_TYPE_LOCATIONS_COMBO,
"tool", tool,
"combo", combo,
"save", save,
"delete", delete,
+ "apply", apply,
NULL);
}
Index: ubuntu/src/network/locations-combo.h
===================================================================
--- ubuntu.orig/src/network/locations-combo.h 2008-06-24 12:04:27.000000000 +0100
+++ ubuntu/src/network/locations-combo.h 2008-06-24 17:06:50.000000000 +0100
@@ -53,7 +53,8 @@
GstLocationsCombo* gst_locations_combo_new (GstTool *tool,
GtkWidget *combo,
GtkWidget *add,
- GtkWidget *remove);
+ GtkWidget *remove,
+ GtkWidget *apply);
G_END_DECLS
Index: ubuntu/src/network/network-tool.c
===================================================================
--- ubuntu.orig/src/network/network-tool.c 2008-06-24 12:04:27.000000000 +0100
+++ ubuntu/src/network/network-tool.c 2008-06-24 17:06:50.000000000 +0100
@@ -109,7 +109,7 @@
{
GObject *object;
GstNetworkTool *tool;
- GtkWidget *widget, *add_button, *delete_button;
+ GtkWidget *widget, *add_button, *delete_button, *apply_button;
object = (* G_OBJECT_CLASS (gst_network_tool_parent_class)->constructor) (type,
n_construct_properties,
@@ -147,7 +147,8 @@
widget = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "locations_combo");
add_button = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "add_location");
delete_button = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "remove_location");
- tool->location = gst_locations_combo_new (GST_TOOL (tool), widget, add_button, delete_button);
+ apply_button = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "apply_location");
+ tool->location = gst_locations_combo_new (GST_TOOL (tool), widget, add_button, delete_button, apply_button);
tool->dialog = connection_dialog_init (GST_TOOL (tool));
tool->host_aliases_dialog = gst_dialog_get_widget (GST_TOOL (tool)->main_dialog, "host_aliases_edit_dialog");
--- End Message ---