Re: Making system scope the default one



On Saturday 23 of October 2010 13:11:48 Ozan Çağlayan wrote:
> Hi,
> 
> I want to modify nm-applet to use the system connections by default instead
> of the user-based connections. I don't have any GTK+ experience, tried a
> little bit but no hope.
> 
> All I want to do is to invert the default state of the 'Available to all
> users' checkbox to True so that it comes toggled and the buttons are
> polkit-aware. I modified the glade file and added a property active which
> is 'True', but I have to trigger the relevant callback in
> nm-connection-editor.c so that the UI is re-populated. Tried calling the
> toggled callback by hand or calling gtk_button_set_active() but nope.
> There are (editor->orig_scope == ) checks in the code which I think
> reverts the active state of the checkbox back to False I don't know why.
> 
> Can someone help me? And will defaulting to system scope break things in
> NM?
> 
> Thanks
> Ozan Caglayan

The thing is that the default state is not taken from the glade file, but 
rather it's hard-coded. So, making 'Available to all users' checked for new 
connections by default can be done with the following change:

diff --git a/src/connection-editor/ce-page.c b/src/connection-editor/ce-page.c
index bcb90de..0fa1916 100644
--- a/src/connection-editor/ce-page.c
+++ b/src/connection-editor/ce-page.c
@@ -407,7 +407,7 @@ ce_page_new_connection (const char *format,
        GSList *connections;
 
	connection = nm_connection_new ();
-	nm_connection_set_scope (connection, NM_CONNECTION_SCOPE_USER);
+	nm_connection_set_scope (connection, NM_CONNECTION_SCOPE_SYSTEM);
 
	s_con = NM_SETTING_CONNECTION (nm_setting_connection_new ());
	nm_connection_add_setting (connection, NM_SETTING (s_con));

Jirka


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