Ticket #63: libnotify.diff

  • libnotify/notification.c

    old new  
    207207    g_object_class_install_property 
    208208            (object_class, 
    209209            PROP_STATUS_ICON, 
    210             g_param_spec_object("status-icon", 
    211                                 "Status Icon", 
    212                                 "Status Icon", 
     210            g_param_spec_object("attach-icon", 
     211                                "Attach Icon", 
     212                                "Attach Icon", 
    213213                                GTK_TYPE_STATUS_ICON, 
    214214                                G_PARAM_READWRITE | 
    215215                                G_PARAM_CONSTRUCT | 
     
    361361    if (priv->attached_widget != NULL) 
    362362        g_object_unref(G_OBJECT(priv->attached_widget)); 
    363363 
    364 #if HAVE_STATUS_ICON 
     364#ifdef HAVE_STATUS_ICON 
    365365    if (priv->status_icon != NULL) 
    366366        g_object_remove_weak_pointer(G_OBJECT(priv->status_icon), 
    367367                                     (gpointer)&priv->status_icon); 
     
    388388    NotifyNotificationPrivate *priv = n->priv; 
    389389    GdkScreen *screen = NULL; 
    390390    GdkRectangle rect; 
     391    GtkOrientation orientation = GTK_ORIENTATION_HORIZONTAL; 
    391392 
    392393#ifdef HAVE_STATUS_ICON 
    393394    if (priv->status_icon != NULL) 
    394395    { 
    395396        if (!gtk_status_icon_get_geometry(priv->status_icon, &screen, 
    396                                           &rect, NULL)) 
     397                                          &rect, &orientation)) 
    397398        { 
    398399            return; 
    399400        } 
     
    424425    else 
    425426        return; 
    426427 
    427     notify_notification_set_geometry_hints(n, screen, &rect); 
     428    notify_notification_set_geometry_hints(n, screen, &rect, orientation); 
    428429} 
    429430 
    430431#if 0 
     
    487488                        "summary", summary, 
    488489                        "body", message, 
    489490                        "icon-name",  icon, 
    490                         "status-icon", status_icon, 
     491                        "attach-icon", status_icon, 
    491492                        NULL); 
    492493} 
    493494#endif /* HAVE_STATUS_ICON */ 
     
    552553notify_notification_attach_to_status_icon(NotifyNotification *notification, 
    553554                                          GtkStatusIcon *status_icon) 
    554555{ 
     556    NotifyNotificationPrivate *priv; 
     557 
    555558    g_return_if_fail(NOTIFY_IS_NOTIFICATION(notification)); 
    556559    g_return_if_fail(status_icon == NULL || GTK_IS_STATUS_ICON(status_icon)); 
    557560 
    558     if (notification->priv->status_icon == status_icon) 
     561    priv = notification->priv; 
     562    if (priv->status_icon == status_icon) 
    559563        return; 
    560564 
    561565    if (priv->status_icon != NULL) 
     
    579583void 
    580584notify_notification_set_geometry_hints(NotifyNotification *notification, 
    581585                                       GdkScreen *screen, 
    582                                        GdkRectangle *rect) 
     586                                       GdkRectangle *rect, 
     587                                       GtkOrientation orientation) 
    583588{ 
    584589    char *display_name; 
    585590 
     
    597602    display_name = gdk_screen_make_display_name(screen); 
    598603    notify_notification_set_hint_string(notification, "xdisplay", display_name); 
    599604    g_free(display_name); 
     605 
     606    notify_notification_set_hint_enum(notification, "orientation", 
     607                                      GTK_TYPE_ORIENTATION, 
     608                                      orientation); 
    600609} 
    601610 
    602611static void 
     
    889898} 
    890899 
    891900void 
     901notify_notification_set_hint_enum(NotifyNotification *notification, 
     902                                  const gchar *key, 
     903                                  GType enum_type, 
     904                                  gint enum_value) 
     905{ 
     906    GEnumClass *klass; 
     907    const GEnumValue *value; 
     908 
     909    g_return_if_fail(NOTIFY_IS_NOTIFICATION(notification)); 
     910    g_return_if_fail(key != NULL && *key != '\0'); 
     911 
     912    /* Translate the enum into a string since dbus cannot marshal it otherwise */ 
     913 
     914    klass = g_type_class_ref(enum_type); 
     915    value = g_enum_get_value(klass, enum_value); 
     916    g_assert(value != NULL); 
     917    notify_notification_set_hint_string(notification, key, value->value_nick); 
     918    g_type_class_unref(klass); 
     919} 
     920 
     921void 
    892922notify_notification_set_hint_byte(NotifyNotification *notification, 
    893923                                  const gchar *key, guchar value) 
    894924{ 
  • libnotify/notification.h

    old new  
    108108 
    109109void notify_notification_set_geometry_hints(NotifyNotification *notification, 
    110110                                            GdkScreen *screen, 
    111                                             GdkRectangle *rect); 
     111                                            GdkRectangle *rect, 
     112                                            GtkOrientation orientation); 
    112113 
    113114gboolean notify_notification_show(NotifyNotification *notification, 
    114115                                  GError **error); 
     
    138139void notify_notification_set_hint_byte(NotifyNotification *notification, 
    139140                                       const gchar *key, guchar value); 
    140141 
     142void notify_notification_set_hint_enum(NotifyNotification *notification, 
     143                                       const gchar *key, 
     144                                       GType enum_type, 
     145                                       gint enum_value); 
     146 
    141147void notify_notification_set_hint_byte_array(NotifyNotification *notification, 
    142148                                             const gchar *key, 
    143149                                             const guchar *value, gsize len);