Ejemplo n.º 1
0
static void
connection_removed (CEPageMaster *master, NMConnection *connection)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (!ce_page_master_has_slaves (master))
		priv->slave_arptype = ARPHRD_VOID;
}
static void
connection_removed (CEPageMaster *master, NMConnection *connection)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (!ce_page_master_has_slaves (master)) {
		priv->slave_type = G_TYPE_INVALID;
		priv->new_slave_func = NULL;
	}
}
static gboolean
validate (CEPage *page, NMConnection *connection, GError **error)
{
	CEPageBond *self = CE_PAGE_BOND (page);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (!CE_PAGE_CLASS (ce_page_bond_parent_class)->validate (page, connection, error))
		return FALSE;

	ui_to_setting (self);
	return nm_setting_verify (NM_SETTING (priv->setting), NULL, error);
}
Ejemplo n.º 4
0
static void
connection_added (CEPageMaster *master, NMConnection *connection)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)) {
		priv->slave_arptype = ARPHRD_INFINIBAND;
		gtk_combo_box_set_active (priv->mode, MODE_ACTIVE_BACKUP);
		gtk_widget_set_sensitive (GTK_WIDGET (priv->mode), FALSE);
	} else {
		priv->slave_arptype = ARPHRD_ETHER;
		gtk_widget_set_sensitive (GTK_WIDGET (priv->mode), TRUE);
	}
}
Ejemplo n.º 5
0
static gboolean
ce_page_validate_v (CEPage *page, NMConnection *connection, GError **error)
{
	CEPageBond *self = CE_PAGE_BOND (page);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (!CE_PAGE_CLASS (ce_page_bond_parent_class)->ce_page_validate_v (page, connection, error))
		return FALSE;

	if (!ce_page_interface_name_valid (gtk_entry_get_text (priv->primary),
	                                   _("primary"), error))
		return FALSE;

	ui_to_setting (self);
	return nm_setting_verify (NM_SETTING (priv->setting), connection, error);
}
static void
connection_added (CEPageMaster *master, NMConnection *connection)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	/* A bit kludgy... */
	if (nm_connection_is_type (connection, NM_SETTING_INFINIBAND_SETTING_NAME)) {
		priv->slave_type = NM_TYPE_SETTING_INFINIBAND;
		priv->new_slave_func = infiniband_connection_new;
		gtk_combo_box_set_active (priv->mode, MODE_ACTIVE_BACKUP);
		gtk_widget_set_sensitive (GTK_WIDGET (priv->mode), FALSE);
	} else {
		priv->slave_type = NM_TYPE_SETTING_WIRED;
		priv->new_slave_func = ethernet_connection_new;
		gtk_widget_set_sensitive (GTK_WIDGET (priv->mode), TRUE);
	}
}
Ejemplo n.º 7
0
static void
add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (priv->slave_arptype == ARPHRD_INFINIBAND) {
		new_connection_of_type (priv->toplevel,
		                        NULL,
		                        CE_PAGE (self)->client,
		                        infiniband_connection_new,
		                        result_func,
		                        master);
	} else {
		new_connection_dialog (priv->toplevel,
		                       CE_PAGE (self)->client,
		                       connection_type_filter,
		                       result_func,
		                       master);
	}
}
static void
add_slave (CEPageMaster *master, NewConnectionResultFunc result_func)
{
	CEPageBond *self = CE_PAGE_BOND (master);
	CEPageBondPrivate *priv = CE_PAGE_BOND_GET_PRIVATE (self);

	if (priv->new_slave_func) {
		new_connection_of_type (priv->toplevel,
		                        NULL,
		                        CE_PAGE (self)->settings,
		                        priv->new_slave_func,
		                        result_func,
		                        master);
	} else {
		new_connection_dialog (priv->toplevel,
		                       CE_PAGE (self)->settings,
		                       connection_type_filter,
		                       result_func,
		                       master);
	}
}
Ejemplo n.º 9
0
CEPage *
ce_page_bond_new (NMConnectionEditor *editor,
                  NMConnection *connection,
                  GtkWindow *parent_window,
                  NMClient *client,
                  const char **out_secrets_setting_name,
                  GError **error)
{
	CEPageBond *self;
	CEPageBondPrivate *priv;

	self = CE_PAGE_BOND (ce_page_new (CE_TYPE_PAGE_BOND,
	                                  editor,
	                                  connection,
	                                  parent_window,
	                                  client,
	                                  UIDIR "/ce-page-bond.ui",
	                                  "BondPage",
	                                  _("Bond")));
	if (!self) {
		g_set_error_literal (error, NMA_ERROR, NMA_ERROR_GENERIC,
		                     _("Could not load bond user interface."));
		return NULL;
	}

	bond_private_init (self);
	priv = CE_PAGE_BOND_GET_PRIVATE (self);

	priv->setting = nm_connection_get_setting_bond (connection);
	if (!priv->setting) {
		priv->setting = NM_SETTING_BOND (nm_setting_bond_new ());
		nm_connection_add_setting (connection, NM_SETTING (priv->setting));
	}
	priv->wired = nm_connection_get_setting_wired (connection);

	g_signal_connect (self, "initialized", G_CALLBACK (finish_setup), NULL);

	return CE_PAGE (self);
}