mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-08 11:19:16 +02:00
2005-10-24 Dan Williams <dcbw@redhat.com>
Cleanup some applet stuff: - Animation timeouts. If NM died while the applet was animating, the applet would not hide itself. This is now fixed. - Remove some dead code - Remove nmi_passphrase_dialog_schedule_cancel() and convert uses to nmi_passphrase_dialog_cancel() since we no longer use threads. - Track animation timeout using a gboolean rather than the timeout's ID, since timeout IDs can legally be 0. git-svn-id: http://svn-archive.gnome.org/svn/NetworkManager/trunk@1069 4912f4e0-d625-0410-9fb7-b9a5a253dbdc
This commit is contained in:
parent
af55ad0ff5
commit
a14cc5744e
7 changed files with 43 additions and 63 deletions
15
ChangeLog
15
ChangeLog
|
|
@ -1,3 +1,18 @@
|
||||||
|
2005-10-24 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
|
Cleanup some applet stuff:
|
||||||
|
|
||||||
|
- Animation timeouts. If NM died while the applet was animating,
|
||||||
|
the applet would not hide itself. This is now fixed.
|
||||||
|
|
||||||
|
- Remove some dead code
|
||||||
|
|
||||||
|
- Remove nmi_passphrase_dialog_schedule_cancel() and convert uses
|
||||||
|
to nmi_passphrase_dialog_cancel() since we no longer use threads.
|
||||||
|
|
||||||
|
- Track animation timeout using a gboolean rather than the timeout's
|
||||||
|
ID, since timeout IDs can legally be 0.
|
||||||
|
|
||||||
2005-10-24 Dan Williams <dcbw@redhat.com>
|
2005-10-24 Dan Williams <dcbw@redhat.com>
|
||||||
|
|
||||||
* src/backends/interface_parser.c
|
* src/backends/interface_parser.c
|
||||||
|
|
|
||||||
|
|
@ -1126,29 +1126,7 @@ DBusHandlerResult nmi_dbus_info_message_handler (DBusConnection *connection, DBu
|
||||||
if (strcmp ("getKeyForNetwork", method) == 0)
|
if (strcmp ("getKeyForNetwork", method) == 0)
|
||||||
reply = nmi_dbus_get_key_for_network (applet, message);
|
reply = nmi_dbus_get_key_for_network (applet, message);
|
||||||
else if (strcmp ("cancelGetKeyForNetwork", method) == 0)
|
else if (strcmp ("cancelGetKeyForNetwork", method) == 0)
|
||||||
nmi_passphrase_dialog_schedule_cancel (applet);
|
nmi_passphrase_dialog_cancel (applet);
|
||||||
#if 0 /* Not used at this time */
|
|
||||||
else if (strcmp ("networkNotFound", method) == 0)
|
|
||||||
{
|
|
||||||
const char * network;
|
|
||||||
DBusError error;
|
|
||||||
|
|
||||||
dbus_error_init (&error);
|
|
||||||
if (dbus_message_get_args (message, &error, DBUS_TYPE_STRING, &network, DBUS_TYPE_INVALID))
|
|
||||||
{
|
|
||||||
GtkWidget *dialog;
|
|
||||||
char *text;
|
|
||||||
|
|
||||||
dbus_error_free (&error);
|
|
||||||
text = g_strdup_printf (_("The requested wireless network '%s' does not appear to be in range. "
|
|
||||||
"A different wireless network will be used if any are available."), network);
|
|
||||||
|
|
||||||
dialog = gtk_message_dialog_new (NULL, 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_OK, text, NULL);
|
|
||||||
gtk_window_present (GTK_WINDOW (dialog));
|
|
||||||
g_signal_connect_swapped (dialog, "response", G_CALLBACK (gtk_widget_destroy), dialog);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
else if (strcmp ("getNetworks", method) == 0)
|
else if (strcmp ("getNetworks", method) == 0)
|
||||||
reply = nmi_dbus_get_networks (applet, message);
|
reply = nmi_dbus_get_networks (applet, message);
|
||||||
else if (strcmp ("getNetworkProperties", method) == 0)
|
else if (strcmp ("getNetworkProperties", method) == 0)
|
||||||
|
|
|
||||||
|
|
@ -171,7 +171,7 @@ static DBusHandlerResult nmwa_dbus_filter (DBusConnection *connection, DBusMessa
|
||||||
{
|
{
|
||||||
applet->nm_running = FALSE;
|
applet->nm_running = FALSE;
|
||||||
applet->nm_state = NM_STATE_DISCONNECTED;
|
applet->nm_state = NM_STATE_DISCONNECTED;
|
||||||
nmi_passphrase_dialog_schedule_cancel (applet);
|
nmi_passphrase_dialog_cancel (applet);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ static void nmwa_icons_free (NMWirelessApplet *applet);
|
||||||
static void nmwa_about_cb (NMWirelessApplet *applet);
|
static void nmwa_about_cb (NMWirelessApplet *applet);
|
||||||
static void nmwa_context_menu_update (NMWirelessApplet *applet);
|
static void nmwa_context_menu_update (NMWirelessApplet *applet);
|
||||||
static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet);
|
static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet);
|
||||||
|
static void nmwa_update_state (NMWirelessApplet *applet);
|
||||||
|
|
||||||
|
|
||||||
G_DEFINE_TYPE(NMWirelessApplet, nmwa, EGG_TYPE_TRAY_ICON)
|
G_DEFINE_TYPE(NMWirelessApplet, nmwa, EGG_TYPE_TRAY_ICON)
|
||||||
|
|
||||||
|
|
@ -124,7 +126,7 @@ NetworkDevice * nmwa_get_first_active_device (GSList *dev_list)
|
||||||
|
|
||||||
static void nmwa_init (NMWirelessApplet *applet)
|
static void nmwa_init (NMWirelessApplet *applet)
|
||||||
{
|
{
|
||||||
applet->animation_id = 0;
|
applet->animation_active = FALSE;
|
||||||
applet->animation_step = 0;
|
applet->animation_step = 0;
|
||||||
glade_gnome_init ();
|
glade_gnome_init ();
|
||||||
|
|
||||||
|
|
@ -825,6 +827,7 @@ static VPNConnection *nmwa_get_first_activating_vpn_connection (NMWirelessApplet
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void nmwa_set_icon (NMWirelessApplet *applet, GdkPixbuf *link_icon, GdkPixbuf *vpn_icon)
|
static void nmwa_set_icon (NMWirelessApplet *applet, GdkPixbuf *link_icon, GdkPixbuf *vpn_icon)
|
||||||
{
|
{
|
||||||
GdkPixbuf *composite;
|
GdkPixbuf *composite;
|
||||||
|
|
@ -981,8 +984,6 @@ static GdkPixbuf * nmwa_act_stage_to_pixbuf (NMWirelessApplet *applet, NetworkDe
|
||||||
return pixbuf;
|
return pixbuf;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void nmwa_update_state (NMWirelessApplet *applet);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* animation_timeout
|
* animation_timeout
|
||||||
*
|
*
|
||||||
|
|
@ -1000,14 +1001,16 @@ static gboolean animation_timeout (NMWirelessApplet *applet)
|
||||||
if (!applet->nm_running)
|
if (!applet->nm_running)
|
||||||
{
|
{
|
||||||
applet->animation_step = 0;
|
applet->animation_step = 0;
|
||||||
return TRUE;
|
applet->animation_active = FALSE;
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
act_dev = nmwa_get_first_active_device (applet->device_list);
|
act_dev = nmwa_get_first_active_device (applet->device_list);
|
||||||
if (!act_dev)
|
if (!act_dev)
|
||||||
{
|
{
|
||||||
applet->animation_step = 0;
|
applet->animation_step = 0;
|
||||||
return TRUE;
|
applet->animation_active = FALSE;
|
||||||
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applet->nm_state == NM_STATE_CONNECTING)
|
if (applet->nm_state == NM_STATE_CONNECTING)
|
||||||
|
|
@ -1036,7 +1039,7 @@ static gboolean animation_timeout (NMWirelessApplet *applet)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
applet->animation_step = 0;
|
applet->animation_step = 0;
|
||||||
applet->animation_id = 0;
|
applet->animation_active = FALSE;
|
||||||
nmwa_update_state (applet);
|
nmwa_update_state (applet);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
@ -1148,15 +1151,19 @@ done:
|
||||||
g_free (tip);
|
g_free (tip);
|
||||||
|
|
||||||
applet->animation_step = 0;
|
applet->animation_step = 0;
|
||||||
if (applet->animation_id)
|
if (need_animation && !applet->animation_active)
|
||||||
{
|
{
|
||||||
g_source_remove (applet->animation_id);
|
|
||||||
applet->animation_id = 0;
|
|
||||||
}
|
|
||||||
if (need_animation)
|
|
||||||
applet->animation_id = g_timeout_add (100, (GSourceFunc) animation_timeout, applet);
|
applet->animation_id = g_timeout_add (100, (GSourceFunc) animation_timeout, applet);
|
||||||
else
|
applet->animation_active = TRUE;
|
||||||
|
}
|
||||||
|
else if (!need_animation)
|
||||||
{
|
{
|
||||||
|
if (applet->animation_active)
|
||||||
|
{
|
||||||
|
g_source_remove (applet->animation_id);
|
||||||
|
applet->animation_active = FALSE;
|
||||||
|
}
|
||||||
|
|
||||||
if (pixbuf)
|
if (pixbuf)
|
||||||
nmwa_set_icon (applet, pixbuf, applet->vpn_lock_icon);
|
nmwa_set_icon (applet, pixbuf, applet->vpn_lock_icon);
|
||||||
else
|
else
|
||||||
|
|
@ -1179,15 +1186,10 @@ done:
|
||||||
*/
|
*/
|
||||||
static int nmwa_redraw_timeout (NMWirelessApplet *applet)
|
static int nmwa_redraw_timeout (NMWirelessApplet *applet)
|
||||||
{
|
{
|
||||||
if (!applet->animation_id)
|
if (!applet->animation_active)
|
||||||
nmwa_update_state (applet);
|
nmwa_update_state (applet);
|
||||||
|
|
||||||
return (TRUE);
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
static void nmwa_start_redraw_timeout (NMWirelessApplet *applet)
|
|
||||||
{
|
|
||||||
applet->redraw_timeout_id = g_timeout_add (1000, (GtkFunction) nmwa_redraw_timeout, applet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2359,7 +2361,7 @@ static GtkWidget * nmwa_get_instance (NMWirelessApplet *applet)
|
||||||
g_signal_connect (applet, "style-set", G_CALLBACK (nmwa_theme_change_cb), NULL);
|
g_signal_connect (applet, "style-set", G_CALLBACK (nmwa_theme_change_cb), NULL);
|
||||||
|
|
||||||
/* Start redraw timeout */
|
/* Start redraw timeout */
|
||||||
nmwa_start_redraw_timeout (applet);
|
applet->redraw_timeout_id = g_timeout_add (1000, (GtkFunction) nmwa_redraw_timeout, applet);
|
||||||
|
|
||||||
return GTK_WIDGET (applet);
|
return GTK_WIDGET (applet);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -108,6 +108,7 @@ typedef struct
|
||||||
|
|
||||||
/* Animation stuff */
|
/* Animation stuff */
|
||||||
int animation_step;
|
int animation_step;
|
||||||
|
gboolean animation_active;
|
||||||
guint animation_id;
|
guint animation_id;
|
||||||
|
|
||||||
/* Direct UI elements */
|
/* Direct UI elements */
|
||||||
|
|
|
||||||
|
|
@ -333,31 +333,15 @@ gboolean nmi_passphrase_dialog_schedule_show (NetworkDevice *dev, WirelessNetwor
|
||||||
* Cancel and hide any user key dialog that might be up
|
* Cancel and hide any user key dialog that might be up
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
static gboolean nmi_passphrase_dialog_cancel (NMWirelessApplet *applet)
|
void nmi_passphrase_dialog_cancel (NMWirelessApplet *applet)
|
||||||
{
|
{
|
||||||
GtkWidget *dialog;
|
GtkWidget *dialog;
|
||||||
|
|
||||||
g_return_val_if_fail (applet != NULL, FALSE);
|
g_return_if_fail (applet != NULL);
|
||||||
dialog = applet->passphrase_dialog;
|
dialog = applet->passphrase_dialog;
|
||||||
|
|
||||||
if (GTK_WIDGET_VISIBLE (dialog))
|
if (GTK_WIDGET_VISIBLE (dialog))
|
||||||
nmi_passphrase_dialog_clear (dialog);
|
nmi_passphrase_dialog_clear (dialog);
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* nmi_passphrase_dialog_schedule_cancel
|
|
||||||
*
|
|
||||||
* Schedule the passphrase dialog cancellation
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
void nmi_passphrase_dialog_schedule_cancel (NMWirelessApplet *applet)
|
|
||||||
{
|
|
||||||
g_return_if_fail (applet != NULL);
|
|
||||||
|
|
||||||
g_idle_add ((GSourceFunc) nmi_passphrase_dialog_cancel, applet);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,6 @@ void nmi_passphrase_dialog_destroy (GtkWidget *dialog);
|
||||||
|
|
||||||
gboolean nmi_passphrase_dialog_schedule_show (NetworkDevice *dev, WirelessNetwork *net, DBusMessage *message, NMWirelessApplet *applet);
|
gboolean nmi_passphrase_dialog_schedule_show (NetworkDevice *dev, WirelessNetwork *net, DBusMessage *message, NMWirelessApplet *applet);
|
||||||
|
|
||||||
void nmi_passphrase_dialog_schedule_cancel (NMWirelessApplet *applet);
|
void nmi_passphrase_dialog_cancel (NMWirelessApplet *applet);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue