Mercurial > projects > package-update-indicator
comparison pui-backend.c @ 65:72f0eea06b7c
Fix checking for network state changes and string lookup
Thanks to Cliff da Serra <cliffd@gmx.com.br> for spotting this.
author | Guido Berhoerster <guido+pui@berhoerster.name> |
---|---|
date | Fri, 26 Jan 2024 16:17:20 +0100 |
parents | a5ed1047ce14 |
children |
comparison
equal
deleted
inserted
replaced
64:a5ed1047ce14 | 65:72f0eea06b7c |
---|---|
54 }; | 54 }; |
55 | 55 |
56 static const gchar * | 56 static const gchar * |
57 network_state_to_string(NetworkState state) | 57 network_state_to_string(NetworkState state) |
58 { | 58 { |
59 g_assert(state > 0 && state < NETWORK_STATE_LAST); | 59 g_assert((state >= 0) && (state < NETWORK_STATE_LAST)); |
60 | 60 |
61 return (network_state_strings[state]); | 61 return (network_state_strings[state]); |
62 } | 62 } |
63 | 63 |
64 struct _PuiBackend { | 64 struct _PuiBackend { |
600 { | 600 { |
601 PuiBackend *self = user_data; | 601 PuiBackend *self = user_data; |
602 NetworkState network_state; | 602 NetworkState network_state; |
603 | 603 |
604 network_state = get_network_state(network_monitor); | 604 network_state = get_network_state(network_monitor); |
605 if (network_state != self->network_state) { | 605 if (network_state == self->network_state) { |
606 return; | 606 return; |
607 } | 607 } |
608 self->network_state = network_state; | 608 self->network_state = network_state; |
609 g_debug("network state changed: %s", | 609 g_debug("network state changed: %s", |
610 network_state_to_string(self->network_state)); | 610 network_state_to_string(self->network_state)); |