2005-08-16 Robert Love <rml@novell.com>
* src/backends/NetworkManagerSuSE.c: improve the SUSE-backend dial up support. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@848 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
@@ -1,3 +1,8 @@
|
|||||||
|
2005-08-16 Robert Love <rml@novell.com>
|
||||||
|
|
||||||
|
* src/backends/NetworkManagerSuSE.c: improve the SUSE-backend dial up
|
||||||
|
support.
|
||||||
|
|
||||||
2005-08-16 Christopher Aillon <caillon@redhat.com>
|
2005-08-16 Christopher Aillon <caillon@redhat.com>
|
||||||
|
|
||||||
* gnome/applet/applet.c: Split markup out of translatable strings
|
* gnome/applet/applet.c: Split markup out of translatable strings
|
||||||
|
@@ -1749,7 +1749,7 @@ static void nmwa_menu_add_dialup_menu (GtkWidget *menu, NMWirelessApplet *applet
|
|||||||
char *name = elt->data;
|
char *name = elt->data;
|
||||||
const char *label;
|
const char *label;
|
||||||
|
|
||||||
label = g_strdup_printf (_("Connect via %s..."), name);
|
label = g_strdup_printf (_("Connect to %s..."), name);
|
||||||
dialup_item = GTK_MENU_ITEM (gtk_menu_item_new_with_label (label));
|
dialup_item = GTK_MENU_ITEM (gtk_menu_item_new_with_label (label));
|
||||||
g_object_set_data (G_OBJECT (dialup_item), "dialup", name);
|
g_object_set_data (G_OBJECT (dialup_item), "dialup", name);
|
||||||
|
|
||||||
|
@@ -716,6 +716,42 @@ gboolean nm_system_activate_dialup (GSList *list, const char *dialup)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* verify_and_return_provider - given a provider identifier, verify that it is able to dial without
|
||||||
|
* prompting and return the provider name. On failure, return NULL. Caller is responsible for
|
||||||
|
* free'ing the return.
|
||||||
|
*/
|
||||||
|
static char * verify_and_return_provider (const char *provider)
|
||||||
|
{
|
||||||
|
shvarFile *file;
|
||||||
|
char *name, *buf = NULL;
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
name = g_strdup_printf ("/etc/sysconfig/network/providers/%s", provider);
|
||||||
|
|
||||||
|
file = svNewFile (name);
|
||||||
|
if (!file)
|
||||||
|
goto out_gfree;
|
||||||
|
|
||||||
|
buf = svGetValue (file, "ASKPASSWORD");
|
||||||
|
if (!buf)
|
||||||
|
goto out_close;
|
||||||
|
ret = strcmp (buf, "no");
|
||||||
|
free (buf);
|
||||||
|
if (ret)
|
||||||
|
goto out_close;
|
||||||
|
|
||||||
|
buf = svGetValue (file, "PROVIDER");
|
||||||
|
|
||||||
|
out_close:
|
||||||
|
svCloseFile (file);
|
||||||
|
out_gfree:
|
||||||
|
g_free (name);
|
||||||
|
|
||||||
|
return buf;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* nm_system_get_dialup_config
|
* nm_system_get_dialup_config
|
||||||
*
|
*
|
||||||
@@ -742,26 +778,42 @@ GSList * nm_system_get_dialup_config (void)
|
|||||||
while ((dentry = g_dir_read_name (dir)))
|
while ((dentry = g_dir_read_name (dir)))
|
||||||
{
|
{
|
||||||
NMDialUpConfig *config;
|
NMDialUpConfig *config;
|
||||||
|
shvarFile *modem_file;
|
||||||
|
char *name, *buf, *provider_name;
|
||||||
|
|
||||||
/* we only want modems */
|
/* we only want modems */
|
||||||
if (!g_str_has_prefix (dentry, "ifcfg-modem"))
|
if (!g_str_has_prefix (dentry, "ifcfg-modem"))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
/* open the configuration file */
|
||||||
|
name = g_strdup_printf ("/etc/sysconfig/network/%s", dentry);
|
||||||
|
modem_file = svNewFile (name);
|
||||||
|
if (!modem_file)
|
||||||
|
goto out_gfree;
|
||||||
|
/* get the name of the provider used for this entry */
|
||||||
|
buf = svGetValue (modem_file, "PROVIDER");
|
||||||
|
if (!buf)
|
||||||
|
goto out_close;
|
||||||
|
|
||||||
|
provider_name = verify_and_return_provider (buf);
|
||||||
|
if (!provider_name)
|
||||||
|
goto out_free;
|
||||||
|
|
||||||
config = g_malloc (sizeof (NMDialUpConfig));
|
config = g_malloc (sizeof (NMDialUpConfig));
|
||||||
config->name = g_strdup_printf ("Modem (#%d)", i++);
|
config->name = g_strdup_printf ("%s via Modem", provider_name);
|
||||||
config->data = g_strdup (dentry + 6); /* skip the "ifcfg-" prefix */
|
config->data = g_strdup (dentry + 6); /* skip the "ifcfg-" prefix */
|
||||||
|
|
||||||
list = g_slist_append (list, config);
|
list = g_slist_append (list, config);
|
||||||
|
|
||||||
nm_info ("Found dial up configuration for %s: %s", config->name, (char *) config->data);
|
nm_info ("Found dial up configuration for %s: %s", config->name, (char *) config->data);
|
||||||
}
|
|
||||||
|
|
||||||
/* Hack: Go back and remove the "(#0)" if there is only one device */
|
free (provider_name);
|
||||||
if (i == 1)
|
out_free:
|
||||||
{
|
free (buf);
|
||||||
NMDialUpConfig *config = (NMDialUpConfig *) list->data;
|
out_close:
|
||||||
g_free (config->name);
|
svCloseFile (modem_file);
|
||||||
config->name = g_strdup ("Modem");
|
out_gfree:
|
||||||
|
g_free (name);
|
||||||
}
|
}
|
||||||
|
|
||||||
g_dir_close (dir);
|
g_dir_close (dir);
|
||||||
|
Reference in New Issue
Block a user