network: Allow NetObjects to get the main panel object so they can show modal dialogs
This commit is contained in:
parent
26b5169bee
commit
de8993eddb
4 changed files with 30 additions and 2 deletions
|
@ -468,6 +468,7 @@ panel_add_device (CcNetworkPanel *panel, NMDevice *device)
|
||||||
/* create device */
|
/* create device */
|
||||||
title = panel_device_to_localized_string (device);
|
title = panel_device_to_localized_string (device);
|
||||||
net_device = g_object_new (device_g_type,
|
net_device = g_object_new (device_g_type,
|
||||||
|
"panel", panel,
|
||||||
"removable", FALSE,
|
"removable", FALSE,
|
||||||
"cancellable", panel->priv->cancellable,
|
"cancellable", panel->priv->cancellable,
|
||||||
"client", panel->priv->client,
|
"client", panel->priv->client,
|
||||||
|
@ -1852,6 +1853,7 @@ panel_add_vpn_device (CcNetworkPanel *panel, NMConnection *connection)
|
||||||
|
|
||||||
/* add as a virtual object */
|
/* add as a virtual object */
|
||||||
net_vpn = g_object_new (NET_TYPE_VPN,
|
net_vpn = g_object_new (NET_TYPE_VPN,
|
||||||
|
"panel", panel,
|
||||||
"removable", TRUE,
|
"removable", TRUE,
|
||||||
"id", id,
|
"id", id,
|
||||||
"connection", connection,
|
"connection", connection,
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#include <nm-remote-connection.h>
|
#include <nm-remote-connection.h>
|
||||||
|
|
||||||
#include "panel-common.h"
|
#include "panel-common.h"
|
||||||
|
#include "network-dialogs.h"
|
||||||
|
|
||||||
#include "net-device-mobile.h"
|
#include "net-device-mobile.h"
|
||||||
|
|
||||||
|
@ -105,6 +106,7 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
|
||||||
NMDevice *device;
|
NMDevice *device;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
NMRemoteSettings *remote_settings;
|
NMRemoteSettings *remote_settings;
|
||||||
|
CcNetworkPanel *panel;
|
||||||
|
|
||||||
if (device_mobile->priv->updating_device)
|
if (device_mobile->priv->updating_device)
|
||||||
goto out;
|
goto out;
|
||||||
|
@ -125,12 +127,11 @@ mobile_connection_changed_cb (GtkComboBox *combo_box, NetDeviceMobile *device_mo
|
||||||
COLUMN_ID, &object_path,
|
COLUMN_ID, &object_path,
|
||||||
-1);
|
-1);
|
||||||
if (g_strcmp0 (object_path, NULL) == 0) {
|
if (g_strcmp0 (object_path, NULL) == 0) {
|
||||||
#if 0
|
panel = net_object_get_panel (NET_OBJECT (device_mobile));
|
||||||
cc_network_panel_connect_to_3g_network (panel,
|
cc_network_panel_connect_to_3g_network (panel,
|
||||||
client,
|
client,
|
||||||
remote_settings,
|
remote_settings,
|
||||||
device);
|
device);
|
||||||
#endif
|
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,7 @@ struct _NetObjectPrivate
|
||||||
GCancellable *cancellable;
|
GCancellable *cancellable;
|
||||||
NMClient *client;
|
NMClient *client;
|
||||||
NMRemoteSettings *remote_settings;
|
NMRemoteSettings *remote_settings;
|
||||||
|
CcNetworkPanel *panel;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
@ -46,6 +47,7 @@ enum {
|
||||||
PROP_CLIENT,
|
PROP_CLIENT,
|
||||||
PROP_REMOTE_SETTINGS,
|
PROP_REMOTE_SETTINGS,
|
||||||
PROP_CANCELLABLE,
|
PROP_CANCELLABLE,
|
||||||
|
PROP_PANEL,
|
||||||
PROP_LAST
|
PROP_LAST
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,6 +132,13 @@ net_object_get_cancellable (NetObject *object)
|
||||||
return object->priv->cancellable;
|
return object->priv->cancellable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
CcNetworkPanel *
|
||||||
|
net_object_get_panel (NetObject *object)
|
||||||
|
{
|
||||||
|
g_return_val_if_fail (NET_IS_OBJECT (object), NULL);
|
||||||
|
return object->priv->panel;
|
||||||
|
}
|
||||||
|
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
net_object_add_to_notebook (NetObject *object,
|
net_object_add_to_notebook (NetObject *object,
|
||||||
GtkNotebook *notebook,
|
GtkNotebook *notebook,
|
||||||
|
@ -206,6 +215,9 @@ net_object_get_property (GObject *object_,
|
||||||
case PROP_CANCELLABLE:
|
case PROP_CANCELLABLE:
|
||||||
g_value_set_object (value, priv->cancellable);
|
g_value_set_object (value, priv->cancellable);
|
||||||
break;
|
break;
|
||||||
|
case PROP_PANEL:
|
||||||
|
g_value_set_object (value, priv->panel);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -245,6 +257,9 @@ net_object_set_property (GObject *object_,
|
||||||
case PROP_CANCELLABLE:
|
case PROP_CANCELLABLE:
|
||||||
priv->cancellable = g_value_dup_object (value);
|
priv->cancellable = g_value_dup_object (value);
|
||||||
break;
|
break;
|
||||||
|
case PROP_PANEL:
|
||||||
|
priv->panel = g_value_dup_object (value);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -265,6 +280,8 @@ net_object_finalize (GObject *object)
|
||||||
g_object_unref (priv->remote_settings);
|
g_object_unref (priv->remote_settings);
|
||||||
if (priv->cancellable != NULL)
|
if (priv->cancellable != NULL)
|
||||||
g_object_unref (priv->cancellable);
|
g_object_unref (priv->cancellable);
|
||||||
|
if (priv->panel != NULL)
|
||||||
|
g_object_unref (priv->panel);
|
||||||
G_OBJECT_CLASS (net_object_parent_class)->finalize (object);
|
G_OBJECT_CLASS (net_object_parent_class)->finalize (object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,6 +324,11 @@ net_object_class_init (NetObjectClass *klass)
|
||||||
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||||
g_object_class_install_property (object_class, PROP_CANCELLABLE, pspec);
|
g_object_class_install_property (object_class, PROP_CANCELLABLE, pspec);
|
||||||
|
|
||||||
|
pspec = g_param_spec_object ("panel", NULL, NULL,
|
||||||
|
CC_TYPE_NETWORK_PANEL,
|
||||||
|
G_PARAM_READWRITE | G_PARAM_CONSTRUCT);
|
||||||
|
g_object_class_install_property (object_class, PROP_PANEL, pspec);
|
||||||
|
|
||||||
signals[SIGNAL_CHANGED] =
|
signals[SIGNAL_CHANGED] =
|
||||||
g_signal_new ("changed",
|
g_signal_new ("changed",
|
||||||
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
G_TYPE_FROM_CLASS (object_class), G_SIGNAL_RUN_LAST,
|
||||||
|
|
|
@ -27,6 +27,8 @@
|
||||||
#include <nm-client.h>
|
#include <nm-client.h>
|
||||||
#include <nm-remote-settings.h>
|
#include <nm-remote-settings.h>
|
||||||
|
|
||||||
|
#include "cc-network-panel.h"
|
||||||
|
|
||||||
G_BEGIN_DECLS
|
G_BEGIN_DECLS
|
||||||
|
|
||||||
#define NET_TYPE_OBJECT (net_object_get_type ())
|
#define NET_TYPE_OBJECT (net_object_get_type ())
|
||||||
|
@ -73,6 +75,7 @@ void net_object_set_title (NetObject *object,
|
||||||
NMClient *net_object_get_client (NetObject *object);
|
NMClient *net_object_get_client (NetObject *object);
|
||||||
NMRemoteSettings *net_object_get_remote_settings (NetObject *object);
|
NMRemoteSettings *net_object_get_remote_settings (NetObject *object);
|
||||||
GCancellable *net_object_get_cancellable (NetObject *object);
|
GCancellable *net_object_get_cancellable (NetObject *object);
|
||||||
|
CcNetworkPanel *net_object_get_panel (NetObject *object);
|
||||||
void net_object_emit_changed (NetObject *object);
|
void net_object_emit_changed (NetObject *object);
|
||||||
void net_object_emit_removed (NetObject *object);
|
void net_object_emit_removed (NetObject *object);
|
||||||
void net_object_delete (NetObject *object);
|
void net_object_delete (NetObject *object);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue