mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-01-02 11:10:16 +01:00
2006-01-04 Robert Love <rml@novell.com>
* gnome/applet/applet-dbus-devices.c, gnome/applet/applet-dbus-devices.h, gnome/applet/applet.c, src/nm-dbus-nm.c: Expose a menu item for hanging up active dialup connections. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1269 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
d08e885b2d
commit
bcbbde17ce
5 changed files with 83 additions and 2 deletions
|
|
@ -1,3 +1,9 @@
|
|||
2006-01-04 Robert Love <rml@novell.com>
|
||||
|
||||
* gnome/applet/applet-dbus-devices.c, gnome/applet/applet-dbus-devices.h,
|
||||
gnome/applet/applet.c, src/nm-dbus-nm.c: Expose a menu item for hanging up
|
||||
active dialup connections.
|
||||
|
||||
2006-01-04 Dan Williams <dcbw@redhat.com>
|
||||
|
||||
First dump of wpa_supplicant-related code. It's not hooked up to
|
||||
|
|
|
|||
|
|
@ -1013,11 +1013,34 @@ void nmwa_dbus_dialup_activate_connection (NMWirelessApplet *applet, const char
|
|||
|
||||
dbus_message_append_args (message, DBUS_TYPE_STRING, &name, DBUS_TYPE_INVALID);
|
||||
if (!dbus_connection_send (applet->connection, message, NULL))
|
||||
nm_warning ("nmwa_dbus_activate_dialup_connection(): Could not send activateDialup message!");
|
||||
nm_warning ("nmwa_dbus_dialup_activate_connection(): Could not send activateDialup message!");
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
else
|
||||
nm_warning ("nmwa_dbus_activate_dialup_connection(): Couldn't allocate the dbus message!");
|
||||
nm_warning ("nmwa_dbus_dialup_activate_connection(): Couldn't allocate the dbus message!");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nmwa_dbus_dialup_hangup_connections
|
||||
*
|
||||
* Tell NetworkManager to activate a particular dialup connection.
|
||||
*
|
||||
*/
|
||||
void nmwa_dbus_dialup_hangup_connections (NMWirelessApplet *applet)
|
||||
{
|
||||
DBusMessage *message;
|
||||
|
||||
if ((message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "hangupDialup")))
|
||||
{
|
||||
nm_info ("Hanging up dialup connections ...");
|
||||
|
||||
if (!dbus_connection_send (applet->connection, message, NULL))
|
||||
nm_warning ("nmwa_dbus_dialup_hangup_connections(): Could not send hangupDialup message!");
|
||||
dbus_message_unref (message);
|
||||
}
|
||||
else
|
||||
nm_warning ("nmwa_dbus_dialup_hangup_connections(): Couldn't allocate the dbus message!");
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,6 +40,7 @@ void nmwa_dbus_update_nm_state (NMWirelessApplet *applet);
|
|||
void nmwa_dbus_update_devices (NMWirelessApplet *applet);
|
||||
void nmwa_dbus_update_dialup (NMWirelessApplet *applet);
|
||||
void nmwa_dbus_dialup_activate_connection (NMWirelessApplet *applet, const char *name);
|
||||
void nmwa_dbus_dialup_hangup_connections (NMWirelessApplet *applet);
|
||||
void nmwa_dbus_device_update_one_device (NMWirelessApplet *applet, const char *dev_path);
|
||||
void nmwa_dbus_device_remove_one_device (NMWirelessApplet *applet, const char *dev_path);
|
||||
|
||||
|
|
|
|||
|
|
@ -1381,6 +1381,26 @@ static void nmwa_menu_dialup_item_activate (GtkMenuItem *item, gpointer user_dat
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* nmwa_menu_dialup_hangup_activate
|
||||
*
|
||||
* Signal function called when user clicks on a dialup menu item
|
||||
*
|
||||
*/
|
||||
static void nmwa_menu_dialup_hangup_activate (GtkMenuItem *item, gpointer user_data)
|
||||
{
|
||||
NMWirelessApplet *applet = (NMWirelessApplet *) user_data;
|
||||
const char *dialup;
|
||||
|
||||
g_return_if_fail (item != NULL);
|
||||
g_return_if_fail (applet != NULL);
|
||||
|
||||
nmwa_dbus_dialup_hangup_connections (applet);
|
||||
|
||||
nmi_dbus_signal_user_interface_activated (applet->connection);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* nmwa_menu_configure_vpn_item_activate
|
||||
*
|
||||
|
|
@ -1720,6 +1740,7 @@ static void nmwa_menu_add_dialup_menu (GtkWidget *menu, NMWirelessApplet *applet
|
|||
{
|
||||
GtkMenuItem *item;
|
||||
GtkMenu *dialup_menu;
|
||||
GtkWidget *hangup_item;
|
||||
GSList *elt;
|
||||
|
||||
g_return_if_fail (menu != NULL);
|
||||
|
|
@ -1742,6 +1763,10 @@ static void nmwa_menu_add_dialup_menu (GtkWidget *menu, NMWirelessApplet *applet
|
|||
gtk_menu_shell_append (GTK_MENU_SHELL (dialup_menu), GTK_WIDGET (dialup_item));
|
||||
}
|
||||
|
||||
hangup_item = gtk_menu_item_new_with_mnemonic (_("_Hangup Connections..."));
|
||||
g_signal_connect (G_OBJECT (hangup_item), "activate", G_CALLBACK (nmwa_menu_dialup_hangup_activate), NULL);
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (dialup_menu), hangup_item);
|
||||
|
||||
gtk_menu_item_set_submenu (item, GTK_WIDGET (dialup_menu));
|
||||
gtk_menu_shell_append (GTK_MENU_SHELL (menu), GTK_WIDGET (item));
|
||||
gtk_widget_show_all (GTK_WIDGET (item));
|
||||
|
|
|
|||
|
|
@ -177,6 +177,31 @@ out:
|
|||
}
|
||||
|
||||
|
||||
static DBusMessage *nm_dbus_nm_hangup_dialup (DBusConnection *connection, DBusMessage *message, NMDbusCBData *data)
|
||||
{
|
||||
DBusMessage *reply = NULL;
|
||||
NMData *nm_data = (NMData *) data->data;
|
||||
const char *dialup;
|
||||
|
||||
g_return_val_if_fail (data != NULL, NULL);
|
||||
g_return_val_if_fail (data->data != NULL, NULL);
|
||||
g_return_val_if_fail (connection != NULL, NULL);
|
||||
g_return_val_if_fail (message != NULL, NULL);
|
||||
|
||||
reply = dbus_message_new_method_return (message);
|
||||
if (!reply)
|
||||
return NULL;
|
||||
|
||||
nm_lock_mutex (nm_data->dialup_list_mutex, __FUNCTION__);
|
||||
nm_system_deactivate_all_dialup (nm_data->dialup_list);
|
||||
nm_unlock_mutex (nm_data->dialup_list_mutex, __FUNCTION__);
|
||||
|
||||
out:
|
||||
return reply;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* nm_dbus_nm_set_active_device
|
||||
*
|
||||
|
|
@ -586,6 +611,7 @@ NMDbusMethodList *nm_dbus_nm_methods_setup (void)
|
|||
nm_dbus_method_list_add_method (list, "getDevices", nm_dbus_nm_get_devices);
|
||||
nm_dbus_method_list_add_method (list, "getDialup", nm_dbus_nm_get_dialup);
|
||||
nm_dbus_method_list_add_method (list, "activateDialup", nm_dbus_nm_activate_dialup);
|
||||
nm_dbus_method_list_add_method (list, "hangupDialup", nm_dbus_nm_hangup_dialup);
|
||||
nm_dbus_method_list_add_method (list, "setActiveDevice", nm_dbus_nm_set_active_device);
|
||||
nm_dbus_method_list_add_method (list, "createWirelessNetwork", nm_dbus_nm_create_wireless_network);
|
||||
nm_dbus_method_list_add_method (list, "setWirelessEnabled", nm_dbus_nm_set_wireless_enabled);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue