Ejemplo n.º 1
0
void
general_prepare (GstConnectionDialog *dialog,
		 OobsIface           *iface)
{
  NMState state;

  state = nm_integration_get_state (GST_NETWORK_TOOL (tool));

  if (nm_integration_iface_supported (iface) && state != NM_STATE_UNKNOWN)
    {
      gtk_widget_show (dialog->roaming_configured);
      gtk_widget_hide (dialog->connection_configured);
    }
  else
    {
      gtk_widget_hide (dialog->roaming_configured);
      gtk_widget_show (dialog->connection_configured);
    }
}
Ejemplo n.º 2
0
static gboolean
toggle_nm (gpointer data)
{
  GstNetworkTool *tool = GST_NETWORK_TOOL (data);
  NMState state;

  state = nm_integration_get_state (tool);

  if (state == NM_STATE_DISCONNECTED ||
      state == NM_STATE_CONNECTING ||
      state == NM_STATE_CONNECTED)
    {
      /* "reboot" NM */
      nm_integration_sleep (tool);
      nm_integration_wake (tool);
    }

  return FALSE;
}
Ejemplo n.º 3
0
static gchar*
get_iface_secondary_text (OobsIface *iface)
{
  GString *str;
  gchar *text;
  NMState state;

  str = g_string_new ("");
  state = nm_integration_get_state (GST_NETWORK_TOOL (tool));

  if (!oobs_iface_get_configured (iface))
    {
      if (!nm_integration_iface_supported (iface) ||
	  state == NM_STATE_UNKNOWN ||
	  state == NM_STATE_ASLEEP)
	str = g_string_append (str, _("This network interface is not configured"));
      else
	str = g_string_append (str, _("Roaming mode enabled"));
    }
  else if (OOBS_IS_IFACE_ETHERNET (iface))
    {
      const gchar *config_method;

      if (OOBS_IS_IFACE_WIRELESS (iface))
	g_string_append_printf (str, _("<b>Essid:</b> %s "),
				oobs_iface_wireless_get_essid (OOBS_IFACE_WIRELESS (iface)));

      config_method = oobs_iface_ethernet_get_configuration_method (OOBS_IFACE_ETHERNET (iface));

      if (config_method && strcmp (config_method, "static") == 0)
	g_string_append_printf (str, "<b>%s</b> %s </b>%s</b> %s",
				_("Address:"),
				oobs_iface_ethernet_get_ip_address (OOBS_IFACE_ETHERNET (iface)),
				 _("Subnet mask:"),
				oobs_iface_ethernet_get_network_mask (OOBS_IFACE_ETHERNET (iface)));
      else
	g_string_append_printf (str, "<b>%s</b> %s", _("Address:"), config_method);
    }
  else if (OOBS_IS_IFACE_PLIP (iface))
    {
      g_string_append_printf (str, "<b>%s</b> %s </b>%s</b> %s",
			      _("Address:"),
			      oobs_iface_plip_get_address (OOBS_IFACE_PLIP (iface)),
			      _("Remote address:"),
			      oobs_iface_plip_get_remote_address (OOBS_IFACE_PLIP (iface)));
    }
  else if (OOBS_IS_IFACE_PPP (iface))
    {
      const gchar *type;

      type = oobs_iface_ppp_get_connection_type (OOBS_IFACE_PPP (iface));

      if (strcmp (type, "modem") == 0 ||
	  strcmp (type, "isdn") == 0)
	g_string_append_printf (str,"<b>%s</b> %s </b>%s</b> %s",
				_("Type:"), type,
				_("Phone number:"),
				oobs_iface_ppp_get_phone_number (OOBS_IFACE_PPP (iface)));
      else if (strcmp (type, "gprs") == 0)
	g_string_append_printf (str, "<b>%s</b> %s </b>%s</b> %s",
				_("Type:"), type,
				_("Access point name:"),
				oobs_iface_ppp_get_apn (OOBS_IFACE_PPP (iface)));
      else if (strcmp (type, "pppoe") == 0)
	{
	  OobsIfaceEthernet *ethernet;

	  ethernet = oobs_iface_ppp_get_ethernet (OOBS_IFACE_PPP (iface));
	  g_string_append_printf (str, "<b>%s</b> %s </b>%s</b> %s",
				  _("Type:"), type,
				  _("Ethernet interface:"),
				  oobs_iface_get_device_name (OOBS_IFACE (ethernet)));
	}
      else
	g_string_append_printf (str, "<b>%s</b> %s", _("Type:"), type);
    }

  text = str->str;
  g_string_free (str, FALSE);

  return text;
}