コード例 #1
0
void
connection_save (GstConnectionDialog *dialog)
{
  gboolean active, was_configured;

  was_configured = oobs_iface_get_configured (dialog->iface);
  active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->connection_configured));

  if (OOBS_IS_IFACE_PPP (dialog->iface))
    ppp_dialog_save (dialog);
  else if (OOBS_IS_IFACE_ETHERNET (dialog->iface))
    {
      if (OOBS_IS_IFACE_WIRELESS (dialog->iface))
	wireless_dialog_save (dialog);

      ethernet_dialog_save (dialog, active);
    }
  else if (OOBS_IS_IFACE_PLIP (dialog->iface))
    plip_dialog_save (dialog);

  oobs_iface_set_configured (dialog->iface, active);

  if (!was_configured)
    oobs_iface_set_active (dialog->iface, TRUE);

  /* sync auto and active, this may happen either because
   * it was just set active, or the interface was already
   * manually configured, but not marked as auto.
   */
  if (oobs_iface_get_active (dialog->iface))
    oobs_iface_set_auto (dialog->iface, TRUE);
}
コード例 #2
0
void
on_iface_toggled (GtkCellRendererToggle *renderer,
		  gchar                 *path_str,
		  gpointer               data)
{
  GtkTreePath *path;
  GtkTreeModel *model = GTK_TREE_MODEL (data);
  GtkTreeIter iter;
  gboolean active, inconsistent;
  OobsIface *iface;

  path = gtk_tree_path_new_from_string (path_str);

  if (gtk_tree_model_get_iter (model, &iter, path))
    {
      gtk_tree_model_get (model, &iter,
			  COL_ACTIVE, &active,
			  COL_INCONSISTENT, &inconsistent,
			  COL_OBJECT, &iface,
			  -1);

      if (!inconsistent)
	{
	  active ^= 1;

	  oobs_iface_set_active (iface, active);
	  oobs_iface_set_auto (iface, active);
	  ifaces_model_modify_interface_at_iter (&iter);

	  gst_tool_commit_async (tool, OOBS_OBJECT (GST_NETWORK_TOOL (tool)->ifaces_config),
				 _("Changing interface configuration"),
				 on_configuration_changed, tool);
	}

      g_object_unref (iface);
    }

  gtk_tree_path_free (path);
}