aboutsummaryrefslogtreecommitdiffstats
path: root/applets/notify/mb-notification.c
diff options
context:
space:
mode:
Diffstat (limited to 'applets/notify/mb-notification.c')
-rw-r--r--applets/notify/mb-notification.c38
1 files changed, 21 insertions, 17 deletions
diff --git a/applets/notify/mb-notification.c b/applets/notify/mb-notification.c
index 0d0e97c..e440ec9 100644
--- a/applets/notify/mb-notification.c
+++ b/applets/notify/mb-notification.c
@@ -9,7 +9,7 @@ enum {
};
static guint signals[N_SIGNALS];
-
+
#define GET_PRIVATE(o) \
(G_TYPE_INSTANCE_GET_PRIVATE ((o), MB_TYPE_NOTIFICATION, MbNotificationPrivate))
@@ -31,17 +31,21 @@ on_button_release (MbNotification *notification, GdkEventButton *event)
}
}
-static gint
-expose (GtkWidget *widget, GdkEventExpose *event)
+static gboolean
+on_draw (GtkWidget *widget, cairo_t *cr)
{
- if (gtk_widget_is_drawable (widget)) {
- gtk_paint_box (widget->style, widget->window,
- widget->state, GTK_SHADOW_OUT,
- &event->area, widget, "notification",
- 0, 0, -1, -1);
-
- (*GTK_WIDGET_CLASS (mb_notification_parent_class)->expose_event) (widget, event);
- }
+ GtkStyleContext *style;
+ int width, height;
+
+ style = gtk_widget_get_style_context (widget);
+
+ width = gtk_widget_get_allocated_width (widget);
+ height = gtk_widget_get_allocated_height (widget);
+
+ gtk_render_frame (style, cr, 0, 0, width, height);
+
+ (*GTK_WIDGET_CLASS (mb_notification_parent_class)->draw) (widget, cr);
+
return FALSE;
}
@@ -52,8 +56,8 @@ mb_notification_class_init (MbNotificationClass *klass)
g_type_class_add_private (klass, sizeof (MbNotificationPrivate));
- widget_class->expose_event = expose;
-
+ widget_class->draw = on_draw;
+
signals[CLOSED] = g_signal_new ("closed",
G_OBJECT_CLASS_TYPE (klass),
G_SIGNAL_RUN_FIRST,
@@ -73,13 +77,13 @@ mb_notification_init (MbNotification *self)
gtk_event_box_set_visible_window (GTK_EVENT_BOX (self), FALSE);
gtk_widget_add_events (GTK_WIDGET (self), GDK_BUTTON_RELEASE_MASK);
g_signal_connect (self, "button-release-event", G_CALLBACK (on_button_release), NULL);
-
- box = gtk_hbox_new (FALSE, 8);
+
+ box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 8);
gtk_container_add (GTK_CONTAINER (self), box);
priv->image = gtk_image_new ();
gtk_box_pack_start (GTK_BOX (box), priv->image, FALSE, FALSE, 0);
-
+
priv->label = gtk_label_new (NULL);
gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5);
gtk_box_pack_start (GTK_BOX (box), priv->label, TRUE, TRUE, 0);
@@ -106,7 +110,7 @@ mb_notification_update (MbNotification *notification, Notification *n)
/* TODO: should this default to no image, or "info" */
gtk_image_clear (GTK_IMAGE (priv->image));
}
-
+
s = g_strdup_printf ("<big><b>%s</b></big>\n"
"\n%s", n->summary, n->body ?: NULL);
gtk_label_set_markup (GTK_LABEL (priv->label), s);