Changeset 3014

Show
Ignore:
Timestamp:
09/25/08 18:46:40
Author:
chipx86
Message:

Prevent a backwards-compatibility breakage introduced where the "reason" code was added to the "closed" signal. This meant that existing signal handlers that passed extra data would break. We now require that you call notify_notification_get_closed_reason() to get this data.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/libnotify/ChangeLog

    r3010 r3014  
     1Thu Sep 25 18:45:41 PDT 2008  Christian Hammond <chipx86@chipx86.com> 
     2 
     3    * libnotify/notification.c: 
     4    * libnotify/notification.h: 
     5      - Prevent a backwards-compatibility breakage introduced where the 
     6        "reason" code was added to the "closed" signal. This meant that 
     7        existing signal handlers that passed extra data would break. We now 
     8        require that you call notify_notification_get_closed_reason() to get 
     9        this data. 
     10 
    111Thu Sep 25 18:05:38 PDT 2008  Christian Hammond <chipx86@chipx86.com> 
    212 
  • trunk/libnotify/libnotify/notification.c

    r3011 r3014  
    9191    gboolean updates_pending; 
    9292    gboolean signals_registered; 
     93 
     94    gint closed_reason; 
    9395}; 
    9496 
     
    107109    PROP_ICON_NAME, 
    108110    PROP_ATTACH_WIDGET, 
    109     PROP_STATUS_ICON 
     111    PROP_STATUS_ICON, 
     112    PROP_CLOSED_REASON 
    110113}; 
    111114 
     
    225228                            G_PARAM_STATIC_BLURB)); 
    226229#endif /* HAVE_STATUS_ICON */ 
     230 
     231    g_object_class_install_property(object_class, PROP_CLOSED_REASON, 
     232        g_param_spec_int("closed-reason", "Closed Reason", 
     233                         "The reason code for why the notification was closed", 
     234                         -1, 
     235                         G_MAXINT32, 
     236                         -1, 
     237                         G_PARAM_READABLE | 
     238                         G_PARAM_STATIC_NAME | 
     239                         G_PARAM_STATIC_NICK | 
     240                         G_PARAM_STATIC_BLURB)); 
    227241} 
    228242 
     
    313327#endif 
    314328 
     329        case PROP_CLOSED_REASON: 
     330            g_value_set_int(value, priv->closed_reason); 
     331            break; 
     332 
    315333        default: 
    316334            G_OBJECT_WARN_INVALID_PROPERTY_ID(object, prop_id, pspec); 
     
    340358    obj->priv = g_new0(NotifyNotificationPrivate, 1); 
    341359    obj->priv->timeout = NOTIFY_EXPIRES_DEFAULT; 
     360    obj->priv->closed_reason = -1; 
    342361    obj->priv->hints = g_hash_table_new_full(g_str_hash, g_str_equal, 
    343362                                             g_free, 
     
    718737    { 
    719738        g_object_ref(G_OBJECT(notification)); 
    720         g_signal_emit(notification, signals[SIGNAL_CLOSED], 0, reason); 
     739        notification->priv->closed_reason = reason; 
     740        g_signal_emit(notification, signals[SIGNAL_CLOSED], 0); 
    721741        notification->priv->id = 0; 
    722742        g_object_unref(G_OBJECT(notification)); 
     
    13001320    return TRUE; 
    13011321} 
     1322 
     1323/** 
     1324 * notify_notification_get_closed_reason: 
     1325 * @notification: The notification. 
     1326 * 
     1327 * Returns the closed reason code for the notification. This is valid only 
     1328 * after the "closed" signal is emitted. 
     1329 * 
     1330 * Returns: The closed reason code. 
     1331 */ 
     1332gint 
     1333notify_notification_get_closed_reason(const NotifyNotification *notification) 
     1334{ 
     1335    g_return_val_if_fail(notification != NULL, -1); 
     1336    g_return_val_if_fail(NOTIFY_IS_NOTIFICATION(notification), -1); 
     1337 
     1338    return notification->priv->closed_reason; 
     1339} 
  • trunk/libnotify/libnotify/notification.h

    r3011 r3014  
    6363 
    6464    /* Signals */ 
    65     void (*closed)(NotifyNotification *notification, gint reason); 
     65    void (*closed)(NotifyNotification *notification); 
    6666}; 
    6767 
     
    156156                                   GError **error); 
    157157 
     158gint notify_notification_get_closed_reason( 
     159    const NotifyNotification *notification); 
     160 
    158161G_END_DECLS 
    159162