static void on_unread_count_changed (GObject *object, GParamSpec *pspec, gpointer user_data) { MailmeTelepathyAccount *account; NotifyNotification *note; gchar *display_name = NULL; guint unread_count = 0; guint last_unread_count; account = MAILME_TELEPATHY_ACCOUNT (object); note = g_object_get_data (object, "notification"); g_return_if_fail (note != NULL); print_status (account); g_object_get (account, "display-name", &display_name, "unread-count", &unread_count, NULL); last_unread_count = GPOINTER_TO_UINT (g_object_get_data (G_OBJECT (account), "last-unread-count")); update_notification (note, display_name, unread_count, last_unread_count); g_object_set_data (G_OBJECT (account), "last-unread-count", GUINT_TO_POINTER(unread_count)); g_free(display_name); }
static void port_status( uint64_t datapath_id, uint32_t transaction_id, uint8_t reason, struct ofp_phy_port phy_port, void *user_data ) { UNUSED( transaction_id ); UNUSED( user_data ); sw_entry *sw = lookup_sw_entry( &datapath_id ); if ( sw == NULL ) { warn( "Received port-status, but switch(%#" PRIx64 ") is not found.", datapath_id ); return; } port_entry *port = lookup_port_entry( sw, phy_port.port_no, phy_port.name ); switch ( reason ) { case OFPPR_ADD: if ( port != NULL ) { warn( "Failed to add port(%u, `%s'), switch(%#" PRIx64 ").", phy_port.port_no, phy_port.name, datapath_id ); return; } add_notification( sw, &phy_port ); break; case OFPPR_DELETE: if ( port == NULL ) { warn( "Failed to delete port(%u, `%s'), switch(%#" PRIx64 ").", phy_port.port_no, phy_port.name, datapath_id ); return; } delete_notification( sw, port ); break; case OFPPR_MODIFY: if ( port == NULL ) { warn( "Failed to modify port(%u, `%s'), switch(%#" PRIx64 ").", phy_port.port_no, phy_port.name, datapath_id ); return; } if ( port->port_no != phy_port.port_no ) { delete_notification( sw, port ); add_notification( sw, &phy_port ); } else { update_notification( sw, port, &phy_port ); } break; default: warn( "Failed to handle port status: unknown reason(%u) from switch(%#" PRIx64 ").", reason, datapath_id ); return; } }
static void update (GduSdMonitor *monitor) { update_problems (monitor, &monitor->ata_smart_problems, check_for_ata_smart_problem); update_notification (monitor, monitor->ata_smart_problems, &monitor->ata_smart_notification, /* Translators: This is used as the title of the SMART failure notification */ C_("notify-smart", "Hard Disk Problems Detected"), /* Translators: This is used as the text of the SMART failure notification */ C_("notify-smart", "A hard disk is likely to fail soon."), "gnome-disks", "examine-smart", /* Translators: Text for button in SMART failure notification */ C_("notify-smart", "Examine")); }
static void switch_features_reply( uint64_t datapath_id, uint32_t transaction_id, uint32_t n_buffers, uint8_t n_tables, uint32_t capabilities, uint32_t actions, const list_element *phy_ports, void *user_data ) { UNUSED( n_buffers ); UNUSED( n_tables ); UNUSED( capabilities ); UNUSED( actions ); UNUSED( user_data ); sw_entry *sw = lookup_sw_entry( &datapath_id ); if ( sw == NULL ) { warn( "Received features-reply from switch(%#" PRIx64 "), but the switch is not found.", datapath_id ); return; } debug( "Received features-reply from switch(%#" PRIx64 ").", datapath_id ); sw->id = transaction_id; const list_element *list, *next; for ( list = phy_ports; list != NULL; list = list->next ) { const struct ofp_phy_port *phy_port = list->data; if ( phy_port->port_no > OFPP_MAX && phy_port->port_no != OFPP_LOCAL ) { warn( "Ignore phy_port(port:%u) in features-reply from switch(%#" PRIx64 ").", phy_port->port_no, datapath_id ); continue; } port_entry *port = update_port_entry( sw, phy_port->port_no, phy_port->name ); port->id = transaction_id; update_notification( sw, port, phy_port ); debug( "Updated features-reply from switch(%#" PRIx64 "), port_no(%u).", datapath_id, phy_port->port_no ); } for ( list = sw->port_table; list != NULL; list = next ) { next = list->next; port_entry *port = list->data; if ( port->id == transaction_id ) { continue; } delete_notification( sw, port ); debug( "Deleted port(%u) in switch(%#" PRIx64 ")", port->port_no, datapath_id ); } }