glibmm: Gio::NetworkMonitor Class Reference
TODO. More...
#include <giomm/networkmonitor.h>

Public Member Functions | |
| virtual | ~NetworkMonitor () |
| GNetworkMonitor* | gobj () |
| Provides access to the underlying C GObject. More... | |
| const GNetworkMonitor* | gobj () const |
| Provides access to the underlying C GObject. More... | |
| bool | get_network_available () const |
| Checks if the network is available. More... | |
| NetworkConnectivity | get_connectivity () const |
| Gets a more detailed networking state than g_network_monitor_get_network_available(). More... | |
| bool | can_reach (const Glib::RefPtr< SocketConnectable >& connectable, const Glib::RefPtr< Cancellable >& cancellable) |
| Attempts to determine whether or not the host pointed to by connectable can be reached, without actually trying to connect to it. More... | |
| bool | can_reach (const Glib::RefPtr< SocketConnectable >& connectable) |
| A can_reach() convenience overload. More... | |
| void | can_reach_async (const Glib::RefPtr< SocketConnectable >& connectable, const SlotAsyncReady& slot, const Glib::RefPtr< Cancellable >& cancellable) |
| bool | can_reach_finish (const Glib::RefPtr< AsyncResult >& result) |
| Finishes an async network connectivity test. More... | |
| Glib::SignalProxy1< void, bool > | signal_network_changed () |
| Glib::PropertyProxy_ReadOnly< bool > | property_network_available () const |
| Whether the network is available. More... | |
| Glib::PropertyProxy_ReadOnly< NetworkConnectivity > | property_connectivity () const |
| Level of network connectivity. More... | |
Public Member Functions inherited from Glib::Interface | |
| Interface () | |
| A Default constructor. More... | |
| Interface (const Glib::Interface_Class& interface_class) | |
| Called by constructors of derived classes. More... | |
| Interface (GObject* castitem) | |
| Called by constructors of derived classes. More... | |
| virtual | ~Interface () |
| GObject* | gobj () |
| const GObject* | gobj () const |
Public Member Functions inherited from Glib::ObjectBase | |
| void | set_property_value (const Glib::ustring& property_name, const Glib::ValueBase& value) |
| You probably want to use a specific property_*() accessor method instead. More... | |
| void | get_property_value (const Glib::ustring& property_name, Glib::ValueBase& value) const |
| You probably want to use a specific property_*() accessor method instead. More... | |
| template<class PropertyType > | |
| void | set_property (const Glib::ustring& property_name, const PropertyType& value) |
| You probably want to use a specific property_*() accessor method instead. More... | |
| template<class PropertyType > | |
| void | get_property (const Glib::ustring& property_name, PropertyType& value) const |
| You probably want to use a specific property_*() accessor method instead. More... | |
| void | connect_property_changed (const Glib::ustring& property_name, const sigc::slot< void >& slot) |
| You can use the signal_changed() signal of the property proxy instead, but this is necessary when using the reduced API. More... | |
| sigc::connection | connect_property_changed_with_return (const Glib::ustring& property_name, const sigc::slot< void >& slot) |
| You can use the signal_changed() signal of the property proxy instead, but this is necessary when using the reduced API. More... | |
| void | freeze_notify () |
| Increases the freeze count on object. More... | |
| void | thaw_notify () |
| Reverts the effect of a previous call to freeze_notify(). More... | |
| virtual void | reference () const |
| Increment the reference count for this object. More... | |
| virtual void | unreference () const |
| Decrement the reference count for this object. More... | |
| GObject* | gobj () |
| Provides access to the underlying C GObject. More... | |
| const GObject* | gobj () const |
| Provides access to the underlying C GObject. More... | |
| GObject* | gobj_copy () const |
| Give a ref-ed copy to someone. Use for direct struct access. More... | |
Static Public Member Functions | |
| static void | add_interface (GType gtype_implementer) |
| static GType | get_type () |
| Get the GType for this class, for use with the underlying GObject type system. More... | |
| static Glib::RefPtr< NetworkMonitor > | get_default () |
| Gets the default NetworkMonitor for the system. More... | |
Protected Member Functions | |
| NetworkMonitor () | |
| You should derive from this class to use it. More... | |
| virtual void | on_network_changed (bool available) |
| This is a default handler for the signal signal_network_changed(). More... | |
Protected Member Functions inherited from Glib::ObjectBase | |
| ObjectBase () | |
| This default constructor is called implicitly from the constructor of user-derived classes, even if, for instance, Gtk::Button calls a different ObjectBase constructor. More... | |
| ObjectBase (const char* custom_type_name) | |
| A derived constructor always overrides this choice. More... | |
| ObjectBase (const std::type_info& custom_type_info) | |
| This constructor is a special feature to allow creation of derived types on the fly, without having to use g_object_new() manually. More... | |
| virtual | ~ObjectBase ()=0 |
| void | initialize (GObject* castitem) |
Related Functions | |
(Note that these are not member functions.) | |
| Glib::RefPtr< Gio::NetworkMonitor > | wrap (GNetworkMonitor* object, bool take_copy=false) |
| A Glib::wrap() method for this object. More... | |
Detailed Description
TODO.
Constructor & Destructor Documentation
|
protected |
You should derive from this class to use it.
|
virtual |
Member Function Documentation
|
static |
| bool Gio::NetworkMonitor::can_reach | ( | const Glib::RefPtr< SocketConnectable >& | connectable, |
| const Glib::RefPtr< Cancellable >& | cancellable | ||
| ) |
Attempts to determine whether or not the host pointed to by connectable can be reached, without actually trying to connect to it.
This may return true even when NetworkMonitor::property_network_available() is false, if, for example, monitor can determine that connectable refers to a host on a local network.
If monitor believes that an attempt to connect to connectable will succeed, it will return true. Otherwise, it will return false and set error to an appropriate error (such as IO_ERROR_HOST_UNREACHABLE).
Note that although this does not attempt to connect to connectable, it may still block for a brief period of time (eg, trying to do multicast DNS on the local network), so if you do not want to block, you should use g_network_monitor_can_reach_async().
- Parameters
-
connectable A SocketConnectable. cancellable A Cancellable, or 0.
- Returns
trueif connectable is reachable,falseif not.
| bool Gio::NetworkMonitor::can_reach | ( | const Glib::RefPtr< SocketConnectable >& | connectable | ) |
A can_reach() convenience overload.
| void Gio::NetworkMonitor::can_reach_async | ( | const Glib::RefPtr< SocketConnectable >& | connectable, |
| const SlotAsyncReady& | slot, | ||
| const Glib::RefPtr< Cancellable >& | cancellable | ||
| ) |
| bool Gio::NetworkMonitor::can_reach_finish | ( | const Glib::RefPtr< AsyncResult >& | result | ) |
Finishes an async network connectivity test.
See g_network_monitor_can_reach_async().
- Parameters
-
result A AsyncResult.
- Returns
trueif network is reachable,falseif not.
| NetworkConnectivity Gio::NetworkMonitor::get_connectivity | ( | ) | const |
Gets a more detailed networking state than g_network_monitor_get_network_available().
If NetworkMonitor::property_network_available() is false, then the connectivity state will be NETWORK_CONNECTIVITY_LOCAL.
If NetworkMonitor::property_network_available() is true, then the connectivity state will be NETWORK_CONNECTIVITY_FULL (if there is full Internet connectivity), NETWORK_CONNECTIVITY_LIMITED (if the host has a default route, but appears to be unable to actually reach the full Internet), or NETWORK_CONNECTIVITY_PORTAL (if the host is trapped behind a "captive portal" that requires some sort of login or acknowledgement before allowing full Internet access).
Note that in the case of NETWORK_CONNECTIVITY_LIMITED and NETWORK_CONNECTIVITY_PORTAL, it is possible that some sites are reachable but others are not. In this case, applications can attempt to connect to remote servers, but should gracefully fall back to their "offline" behavior if the connection attempt fails.
- Returns
- The network connectivity state.
|
static |
| bool Gio::NetworkMonitor::get_network_available | ( | ) | const |
Checks if the network is available.
"Available" here means that the system has a default route available for at least one of IPv4 or IPv6. It does not necessarily imply that the public Internet is reachable. See NetworkMonitor::property_network_available() for more details.
- Returns
- Whether the network is available.
|
static |
Get the GType for this class, for use with the underlying GObject type system.
|
inline |
Provides access to the underlying C GObject.
|
inline |
Provides access to the underlying C GObject.
|
protectedvirtual |
This is a default handler for the signal signal_network_changed().
| Glib::PropertyProxy_ReadOnly< NetworkConnectivity > Gio::NetworkMonitor::property_connectivity | ( | ) | const |
Level of network connectivity.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns
- A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
| Glib::PropertyProxy_ReadOnly< bool > Gio::NetworkMonitor::property_network_available | ( | ) | const |
Whether the network is available.
You rarely need to use properties because there are get_ and set_ methods for almost all of them.
- Returns
- A PropertyProxy_ReadOnly that allows you to get the value of the property, or receive notification when the value of the property changes.
| Glib::SignalProxy1< void,bool > Gio::NetworkMonitor::signal_network_changed | ( | ) |
- Slot Prototype:
void on_my_network_changed(bool available)
Emitted when the network configuration changes. If available is true, then some hosts may be reachable that were not reachable before, while others that were reachable before may no longer be reachable. If available is false, then no remote hosts are reachable.
- Parameters
-
available The current value of NetworkMonitor::property_network_available().
Friends And Related Function Documentation
|
related |
A Glib::wrap() method for this object.
- Parameters
-
object The C instance. take_copy False if the result should take ownership of the C instance. True if it should take a new copy or ref.
- Returns
- A C++ instance that wraps this C instance.

Public Member Functions inherited from