aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Conti <jason.conti@gmail.com>2011-05-14 16:17:13 -0400
committerJason Conti <jason.conti@gmail.com>2011-05-14 16:17:13 -0400
commit11998bfc8d952c346f2eb0318db9a6f3ea93fd14 (patch)
tree3f4a5ba31125842a805cb358e44839e0dfa6b5ae /src
parentd98fb2f1a159332f09026527ce833e3f4b73dd7a (diff)
downloadayatana-indicator-notifications-11998bfc8d952c346f2eb0318db9a6f3ea93fd14.tar.gz
ayatana-indicator-notifications-11998bfc8d952c346f2eb0318db9a6f3ea93fd14.tar.bz2
ayatana-indicator-notifications-11998bfc8d952c346f2eb0318db9a6f3ea93fd14.zip
Added the icon to the indicator. Currently using a hardcoded path, will grab from the icon theme later, but need to add the local path to the icon theme for testing.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile.am1
-rw-r--r--src/indicator-notifications.c30
2 files changed, 31 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7d3cf35..fc973f4 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1,3 +1,4 @@
+AM_CPPFLAGS = -DICONS_DIR='"$(INDICATORICONSDIR)"'
libexec_PROGRAMS = indicator-notifications-service
diff --git a/src/indicator-notifications.c b/src/indicator-notifications.c
index 32807e4..905bbf2 100644
--- a/src/indicator-notifications.c
+++ b/src/indicator-notifications.c
@@ -32,6 +32,7 @@ with this program. If not, see <http://www.gnu.org/licenses/>.
#include <glib-object.h>
#include <glib/gi18n-lib.h>
#include <gio/gio.h>
+#include <gdk-pixbuf/gdk-pixbuf.h>
/* Indicator Stuff */
#include <libindicator/indicator.h>
@@ -67,6 +68,7 @@ struct _IndicatorNotifications {
};
struct _IndicatorNotificationsPrivate {
+ GtkImage *image;
GtkLabel *label;
IndicatorServiceManager *sm;
@@ -86,6 +88,7 @@ static void indicator_notifications_init(IndicatorNotifications *self);
static void indicator_notifications_dispose(GObject *object);
static void indicator_notifications_finalize(GObject *object);
static GtkLabel *get_label(IndicatorObject *io);
+static GtkImage *get_image(IndicatorObject *io);
static GtkMenu *get_menu(IndicatorObject *io);
static const gchar *get_accessible_desc(IndicatorObject *io);
static void update_label(IndicatorNotifications *io);
@@ -110,6 +113,7 @@ indicator_notifications_class_init(IndicatorNotificationsClass *klass)
IndicatorObjectClass *io_class = INDICATOR_OBJECT_CLASS(klass);
+ io_class->get_image = get_image;
io_class->get_label = get_label;
io_class->get_menu = get_menu;
io_class->get_accessible_desc = get_accessible_desc;
@@ -312,6 +316,32 @@ update_text_gravity(GtkWidget *widget, GdkScreen *previous_screen, gpointer data
pango_context_set_base_gravity(context, PANGO_GRAVITY_AUTO);
}
+static GtkImage *
+get_image(IndicatorObject *io)
+{
+ IndicatorNotifications *self = INDICATOR_NOTIFICATIONS(io);
+
+ if(self->priv->image == NULL) {
+ self->priv->image = GTK_IMAGE(gtk_image_new());
+
+ GError *error = NULL;
+
+ GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale(ICONS_DIR "/notification-read.svg", 22, 22, FALSE, &error);
+
+ if(error != NULL) {
+ g_error("Failed to load icon: %s", error->message);
+ return NULL;
+ }
+
+ gtk_image_set_from_pixbuf(self->priv->image, pixbuf);
+ g_object_unref(pixbuf);
+
+ gtk_widget_show(GTK_WIDGET(self->priv->image));
+ }
+
+ return self->priv->image;
+}
+
/* Grabs the label. Creates it if it doesn't
exist already */
static GtkLabel *