Commits

Ilya Skriblovsky  committed 0643862

applet project added

  • Participants
  • Parent commits b4da252

Comments (0)

Files changed (17)

File applet/LauncherStatusBarApplet.c

+/*
+ *  Copyright (c) 2010 Andry Gunawan <angun33@gmail.com>
+ *
+ *  Parts of this file are based on Telescope which is
+ *  Copyright (c) 2010 Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/* Hildon includes */
+#include <hildon/hildon-note.h>
+#include <hildon/hildon-banner.h>
+#include <hildon/hildon-sound.h>
+#include <hildon/hildon-defines.h>
+#include <libhildondesktop/libhildondesktop.h>
+
+#include <log-functions.h>
+#include <libosso.h>
+#include <osso-log.h>
+
+/* GTK includes */
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkpixbuf.h>
+
+/* Systems includes */
+#include <string.h>
+
+
+#include "LauncherStatusBarApplet.h"
+
+HD_DEFINE_PLUGIN(LauncherStatusBarApplet, launcher_status_bar_applet, STATUSBAR_TYPE_ITEM);
+
+#define LAUNCHER_STATUS_BAR_APPLET_GET_PRIVATE(x)      (G_TYPE_INSTANCE_GET_PRIVATE((x), launcher_status_bar_applet_get_type(), LauncherStatusBarAppletPrivate));
+
+static gboolean applet_icon_pressed(GtkWidget *widget, GdkEventButton *button, gpointer data);
+static void launcher_status_bar_applet_finalize(GObject *object);
+
+static void launcher_status_bar_applet_class_init(LauncherStatusBarAppletClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+    object_class->finalize = launcher_status_bar_applet_finalize;
+    g_type_class_add_private(klass, sizeof(LauncherStatusBarAppletPrivate));
+}
+
+static void set_applet_icon(const gchar *name, LauncherStatusBarAppletPrivate *info)
+{
+    GtkIconTheme *icon_theme;
+    GdkPixbuf    *pixbuf;
+
+    icon_theme = gtk_icon_theme_get_default();
+
+    pixbuf = (name != NULL) ? gtk_icon_theme_load_icon(icon_theme, name,
+                                                       LAUNCHER_STATUS_BAR_APPLET_ICON_SIZE,
+                                                       GTK_ICON_LOOKUP_NO_SVG, NULL) : NULL;
+
+    gtk_image_set_from_pixbuf(GTK_IMAGE(info->icon), pixbuf);
+
+    if (pixbuf != NULL)
+        g_object_unref(pixbuf);
+}
+
+/**
+ * Callback for the button clicked signal
+ *
+ * @param widget the button widget
+ * @param data applet info struct
+ */
+static gboolean applet_icon_pressed(GtkWidget *widget, GdkEventButton *button, gpointer data)
+{
+    LauncherStatusBarAppletPrivate *info;
+
+    g_return_val_if_fail(data, FALSE);
+    info = (LauncherStatusBarAppletPrivate*)data;
+
+    gtk_button_released(GTK_BUTTON(info->button));
+
+    osso_rpc_t retval;
+    osso_return_t result;
+    
+    result = osso_rpc_run(info->osso,
+                 "org.telescope",
+                 "/Launcher",
+                 "org.telescope.Launcher",
+                 "Show", &retval, DBUS_TYPE_INVALID);
+
+    osso_rpc_free_val(&retval);
+
+    (void) button;
+
+    return TRUE;
+}
+
+static void launcher_status_bar_applet_finalize(GObject *object)
+{
+    LauncherStatusBarAppletPrivate *info = LAUNCHER_STATUS_BAR_APPLET_GET_PRIVATE(object);
+
+    osso_deinitialize(info->osso);
+
+    LOG_CLOSE();
+
+    G_OBJECT_CLASS(g_type_class_peek_parent(G_OBJECT_GET_CLASS(object)))->finalize(object);
+}
+
+static void launcher_status_bar_applet_init(LauncherStatusBarApplet *applet)
+{
+    LauncherStatusBarAppletPrivate *info = LAUNCHER_STATUS_BAR_APPLET_GET_PRIVATE(applet);
+
+    ULOG_OPEN("launcher-statusbar-applet");
+
+    g_return_if_fail(info);
+
+    info->icon = gtk_image_new_from_pixbuf(NULL);
+    info->button = gtk_toggle_button_new();
+
+    set_applet_icon("qgn_grid_tasknavigator_others", info);
+
+    gtk_container_add(GTK_CONTAINER(info->button),
+                      GTK_WIDGET(info->icon));
+
+    gtk_container_add(GTK_CONTAINER(applet), info->button);
+
+    /* Signal for icon (button) */
+    g_signal_connect(G_OBJECT(info->button), "button-press-event",
+                     G_CALLBACK(applet_icon_pressed), info);
+
+    /* Initialize osso */
+    info->osso = osso_initialize("org.telescope.LauncherApplet", "0.1", TRUE, NULL);
+    if (!info->osso)
+        ULOG_WARN("%s: error while initializing osso\n", __FUNCTION__);
+
+    gtk_widget_show_all(GTK_WIDGET(applet));
+}

File applet/LauncherStatusBarApplet.h

+/*
+ *  Copyright (c) 2010 Andry Gunawan <angun33@gmail.com>
+ *
+ *  Parts of this file are based on Telescope which is
+ *  Copyright (c) 2010 Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _LAUNCHER_STATUS_BAR_APPLET_H_
+#define _LAUNCHER_STATUS_BAR_APPLET_H_
+
+/* StatusbarItem */
+#include <libhildondesktop/statusbar-item.h>
+
+/* osso_context_t */
+#include <libosso.h>
+
+/* gboolean, gint, G_BEGIN_DECLS/G_END_DECLS */
+#include <glib.h>
+
+/* GtkWidget */
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+/* Every plugin has a constant priority */
+#define LAUNCHER_STATUS_BAR_APPLET_PRIORITY	1
+
+#define LAUNCHER_STATUS_BAR_APPLET_ICON_SIZE	40
+
+typedef struct _LauncherStatusBarApplet LauncherStatusBarApplet;
+typedef struct _LauncherStatusBarAppletClass 
+LauncherStatusBarAppletClass;
+
+#define LAUNCHER_TYPE_STATUS_BAR_APPLET            (launcher_status_bar_applet_get_type ())
+#define LAUNCHER_STATUS_BAR_APPLET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), DUMMY_TYPE_STATUS_BAR_APPLET, LauncherStatusBarApplet))
+#define LAUNCHER_STATUS_BAR_APPLET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  DUMMY_TYPE_STATUS_BAR_APPLET, LauncherStatusBarAppletClass))
+#define LAUNCHER_IS_STATUS_BAR_APPLET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DUMMY_TYPE_STATUS_BAR_APPLET))
+#define LAUNCHER_IS_STATUS_BAR_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  DUMMY_TYPE_STATUS_BAR_APPLET))
+#define LAUNCHER_STATUS_BAR_APPLET_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  DUMMY_TYPE_STATUS_BAR_APPLET, LauncherStatusBarAppletClass))
+
+struct _LauncherStatusBarApplet
+{
+    StatusbarItem parent;
+};
+
+struct _LauncherStatusBarAppletClass
+{
+    StatusbarItemClass parent_class;
+};
+
+GType launcher_status_bar_applet_get_type(void);
+
+typedef struct
+{
+    osso_context_t       *osso;		/* osso */
+    GtkWidget            *icon;		/* icon in button */
+    GtkWidget	         *button;	/* button in StatusBar */
+} LauncherStatusBarAppletPrivate;
+
+G_END_DECLS
+
+#endif /* _LAUNCHER_STATUS_BAR_APPLET_H_ */
+

File applet/LauncherTaskNavigatorApplet.c

+/*
+ *  Copyright (c) 2010 Andry Gunawan <angun33@gmail.com>
+ *
+ *  Parts of this file are based on Telescope which is
+ *  Copyright (c) 2010 Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+/* Hildon includes */
+#include <hildon/hildon-note.h>
+#include <hildon/hildon-banner.h>
+#include <hildon/hildon-sound.h>
+#include <hildon/hildon-defines.h>
+#include <libhildondesktop/libhildondesktop.h>
+
+#include <log-functions.h>
+#include <libosso.h>
+#include <osso-log.h>
+
+/* GTK includes */
+#include <glib.h>
+#include <gtk/gtk.h>
+#include <gdk/gdkpixbuf.h>
+
+/* Systems includes */
+#include <string.h>
+
+
+#include "LauncherTaskNavigatorApplet.h"
+
+HD_DEFINE_PLUGIN(LauncherNavigatorApplet, launcher_navigator_applet, TASKNAVIGATOR_TYPE_ITEM);
+
+#define LAUNCHER_NAVIGATOR_APPLET_GET_PRIVATE(x)      (G_TYPE_INSTANCE_GET_PRIVATE((x), launcher_navigator_applet_get_type(), LauncherNavigatorAppletPrivate));
+
+static gboolean applet_icon_pressed(GtkWidget *widget, GdkEventButton *button, gpointer data);
+static void launcher_navigator_applet_finalize(GObject *object);
+
+static void launcher_navigator_applet_class_init(LauncherNavigatorAppletClass *klass)
+{
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+    object_class->finalize = launcher_navigator_applet_finalize;
+    g_type_class_add_private(klass, sizeof(LauncherNavigatorAppletPrivate));
+}
+
+static void set_applet_icon(const gchar *name, LauncherNavigatorAppletPrivate *info)
+{
+    GtkIconTheme *icon_theme;
+    GdkPixbuf    *pixbuf;
+
+    icon_theme = gtk_icon_theme_get_default();
+
+    pixbuf = (name != NULL) ? gtk_icon_theme_load_icon(icon_theme, name,
+                                                       LAUNCHER_NAVIGATOR_APPLET_ICON_SIZE,
+                                                       GTK_ICON_LOOKUP_NO_SVG, NULL) : NULL;
+
+    gtk_image_set_from_pixbuf(GTK_IMAGE(info->icon), pixbuf);
+
+    if (pixbuf != NULL)
+        g_object_unref(pixbuf);
+}
+
+/**
+ * Callback for the button clicked signal
+ *
+ * @param widget the button widget
+ * @param data applet info struct
+ */
+static gboolean applet_icon_pressed(GtkWidget *widget, GdkEventButton *button, gpointer data)
+{
+    LauncherNavigatorAppletPrivate *info;
+
+    g_return_val_if_fail(data, FALSE);
+    info = (LauncherNavigatorAppletPrivate*)data;
+
+    gtk_button_released(GTK_BUTTON(info->button));
+
+    osso_rpc_t retval;
+    osso_return_t result;
+    
+    result = osso_rpc_run(info->osso,
+                 "org.telescope",
+                 "/Launcher",
+                 "org.telescope.Launcher",
+                 "Show", &retval, DBUS_TYPE_INVALID);
+
+    osso_rpc_free_val(&retval);
+
+    (void) button;
+
+    return TRUE;
+}
+
+static void launcher_navigator_applet_finalize(GObject *object)
+{
+    LauncherNavigatorAppletPrivate *info = LAUNCHER_NAVIGATOR_APPLET_GET_PRIVATE(object);
+
+    osso_deinitialize(info->osso);
+
+    LOG_CLOSE();
+
+    G_OBJECT_CLASS(g_type_class_peek_parent(G_OBJECT_GET_CLASS(object)))->finalize(object);
+}
+
+static void launcher_navigator_applet_init(LauncherNavigatorApplet *applet)
+{
+    LauncherNavigatorAppletPrivate *info = LAUNCHER_NAVIGATOR_APPLET_GET_PRIVATE(applet);
+
+    ULOG_OPEN("launcher-statusbar-applet");
+
+    g_return_if_fail(info);
+
+    info->icon = gtk_image_new_from_pixbuf(NULL);
+    info->button = gtk_toggle_button_new();
+
+    set_applet_icon("qgn_grid_tasknavigator_others", info);
+    
+    gtk_widget_set_name (info->button, "hildon-navigator-button-one");
+
+    gtk_container_add(GTK_CONTAINER(info->button),
+                      GTK_WIDGET(info->icon));
+
+    gtk_container_add(GTK_CONTAINER(applet), info->button);
+
+    /* Signal for icon (button) */
+    g_signal_connect(G_OBJECT(info->button), "button-press-event",
+                     G_CALLBACK(applet_icon_pressed), info);
+
+    /* Initialize osso */
+    info->osso = osso_initialize("org.telescope.LauncherApplet", "0.1", TRUE, NULL);
+    if (!info->osso)
+        ULOG_WARN("%s: error while initializing osso\n", __FUNCTION__);
+
+    gtk_widget_show_all(GTK_WIDGET(applet));
+}

File applet/LauncherTaskNavigatorApplet.h

+/*
+ *  Copyright (c) 2010 Andry Gunawan <angun33@gmail.com>
+ *
+ *  Parts of this file are based on Telescope which is
+ *  Copyright (c) 2010 Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License version 2 as
+ *  published by the Free Software Foundation.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#ifndef _LAUNCHER_NAVIGATOR_APPLET_H_
+#define _LAUNCHER_NAVIGATOR_APPLET_H_
+
+/* TaskNavigatorItem */
+#include <libhildondesktop/tasknavigator-item.h>
+
+/* osso_context_t */
+#include <libosso.h>
+
+/* gboolean, gint, G_BEGIN_DECLS/G_END_DECLS */
+#include <glib.h>
+
+/* GtkWidget */
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+/* Every plugin has a constant priority */
+#define LAUNCHER_NAVIGATOR_APPLET_PRIORITY	1
+#define LAUNCHER_NAVIGATOR_APPLET_ICON_SIZE	64
+
+typedef struct _LauncherNavigatorApplet LauncherNavigatorApplet;
+typedef struct _LauncherNavigatorAppletClass 
+LauncherNavigatorAppletClass;
+
+#define LAUNCHER_TYPE_NAVIGATOR_APPLET            (launcher_status_bar_applet_get_type ())
+#define LAUNCHER_NAVIGATOR_APPLET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), DUMMY_TYPE_NAVIGATOR_APPLET, LauncherNavigatorApplet))
+#define LAUNCHER_NAVIGATOR_APPLET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  DUMMY_TYPE_NAVIGATOR_APPLET, LauncherNavigatorAppletClass))
+#define LAUNCHER_IS_NAVIGATOR_APPLET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), DUMMY_TYPE_NAVIGATOR_APPLET))
+#define LAUNCHER_IS_NAVIGATOR_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  DUMMY_TYPE_NAVIGATOR_APPLET))
+#define LAUNCHER_NAVIGATOR_APPLET_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  DUMMY_TYPE_NAVIGATOR_APPLET, LauncherNavigatorAppletClass))
+
+struct _LauncherNavigatorApplet
+{
+    StatusbarItem parent;
+};
+
+struct _LauncherNavigatorAppletClass
+{
+    StatusbarItemClass parent_class;
+};
+
+GType launcher_status_bar_applet_get_type(void);
+
+typedef struct
+{
+    osso_context_t       *osso;		/* osso */
+    GtkWidget            *icon;		/* icon in button */
+    GtkWidget	         *button;	/* button in Navigator */
+} LauncherNavigatorAppletPrivate;
+
+G_END_DECLS
+
+#endif /* _LAUNCHER_NAVIGATOR_APPLET_H_ */
+

File applet/Makefile

+DEPS = gtk+-2.0 libhildondesktop hildon-1 dbus-1
+
+DEFINES =
+
+SOURCES = TelescopeApplet.cpp 
+
+CFLAGS += -Wall -Werror -O2 $(DEFINES) `pkg-config --cflags $(DEPS)`
+
+
+.c.o:
+	gcc -c $(CFLAGS) $< -o $@
+
+
+
+all: libtelescopeapplet.so liblaunchersbapplet.so liblaunchertnapplet.so
+
+
+libtelescopeapplet.so: TelescopeApplet.o
+	gcc $^ -o $@ -shared `pkg-config --libs $(DEPS)`
+
+liblaunchersbapplet.so: LauncherStatusBarApplet.o
+	gcc $^ -o $@ -shared `pkg-config --libs $(DEPS)`
+
+liblaunchertnapplet.so: LauncherTaskNavigatorApplet.o
+	gcc $^ -o $@ -shared `pkg-config --libs $(DEPS)`
+
+clean:
+	rm -rf libtelescopeapplet.so liblaunchersbapplet.so liblaunchertnapplet.so *.o *~
+
+install: libtelescopeapplet.so liblaunchersbapplet.so liblaunchertnapplet.so
+	cp libtelescopeapplet.so $(DESTDIR)/usr/lib/hildon-desktop/
+	cp liblaunchersbapplet.so $(DESTDIR)/usr/lib/hildon-desktop/
+	cp liblaunchertnapplet.so $(DESTDIR)/usr/lib/hildon-desktop/
+	cp TelescopeApplet.desktop $(DESTDIR)/usr/share/applications/hildon-status-bar/
+	cp launcher-statusbar.desktop $(DESTDIR)/usr/share/applications/hildon-status-bar/
+	cp launcher-navigator.desktop $(DESTDIR)/usr/share/applications/hildon-navigator/
+	cp telescope-applet.png $(DESTDIR)/usr/share/telescope-applet/
+	cp telescope-applet-pressed.png $(DESTDIR)/usr/share/telescope-applet/

File applet/TelescopeApplet.c

+//
+// Telescope Applet - status bar applet for calling Telescope task switcher
+//
+// (c) Ilya Skriblovsky, 2010
+// <Ilya.Skriblovsky@gmail.com>
+//
+
+// $Id: TelescopeApplet.c 156 2010-10-14 10:24:05Z mitrandir $
+
+#include "TelescopeApplet.h"
+
+#include <stdio.h>
+
+#include <dbus/dbus.h>
+
+#include <libhildondesktop/libhildondesktop.h>
+
+void mylog(const char *msg)
+{
+#ifdef ENABLE_LOG
+    FILE *f = fopen("/tmp/telescope-applet.log", "a");
+    fprintf(f, "%s\n", msg);
+    fclose(f);
+#endif
+}
+
+#define TELESCOPE_APPLET_GET_PRIVATE(x) \
+    (G_TYPE_INSTANCE_GET_PRIVATE ((x), TELESCOPE_APPLET_TYPE, TelescopeAppletPriv))
+
+HD_DEFINE_PLUGIN (TelescopeApplet,
+                  telescope_applet,
+                  STATUSBAR_TYPE_ITEM);
+
+
+struct _TelescopeAppletPriv
+{
+    GtkEventBox *event_box;
+    GdkPixbuf *icon;
+
+    DBusConnection *conn;
+};
+
+void telescope_applet_dispose(GObject *self);
+
+gboolean telescope_applet_on_press(GtkWidget *widget, GdkEventButton *event, TelescopeApplet *self);
+gboolean telescope_applet_on_expose(GtkWidget *widget, GdkEventExpose *event, TelescopeApplet *self);
+
+
+void telescope_applet_class_init (TelescopeAppletClass *klass)
+{
+mylog("d");
+    GObjectClass *object_class = G_OBJECT_CLASS(klass);
+    object_class->dispose = telescope_applet_dispose;
+//    GtkWidgetClass *widget_class = GTK_WIDGET_CLASS(klass);
+    g_type_class_add_private(klass, sizeof(TelescopeAppletPriv));
+}
+
+
+void telescope_applet_init(TelescopeApplet *self)
+{
+mylog("c");
+    self->priv = TELESCOPE_APPLET_GET_PRIVATE (self);
+
+    self->priv->event_box = GTK_EVENT_BOX(gtk_event_box_new());
+    self->priv->icon = gdk_pixbuf_new_from_file("/usr/share/telescope-applet/telescope-applet.png", 0);
+
+    gtk_container_add(GTK_CONTAINER(self), GTK_WIDGET(self->priv->event_box));
+    g_signal_connect(G_OBJECT(self->priv->event_box), "button-press-event", G_CALLBACK(telescope_applet_on_press), self);
+    g_signal_connect(G_OBJECT(self), "expose-event", G_CALLBACK(telescope_applet_on_expose), self);
+    gtk_widget_set_app_paintable(GTK_WIDGET(self->priv->event_box), TRUE);
+    gtk_event_box_set_visible_window(self->priv->event_box, FALSE);
+
+    gtk_widget_show_all(GTK_WIDGET(self));
+
+    DBusError error;
+    dbus_error_init(&error);
+
+    self->priv->conn = dbus_bus_get(DBUS_BUS_SESSION, &error);
+    if (dbus_error_is_set(&error) || self->priv->conn == 0)
+    {
+      fprintf(stderr, "D-Bus connection error: %s\n", error.message);
+      return;
+    }
+}
+
+void telescope_applet_dispose(GObject *gobject)
+{
+    TelescopeApplet *self = TELESCOPE_APPLET(gobject);
+
+
+    if (self->priv->icon)
+    {
+        g_object_unref(self->priv->icon);
+        self->priv->icon = 0;
+    }
+
+
+    if (self->priv->conn)
+    {
+      dbus_connection_unref(self->priv->conn);
+
+      self->priv->conn = 0;
+    }
+
+    G_OBJECT_CLASS(g_type_class_peek_parent(G_OBJECT_GET_CLASS(gobject)))->dispose(gobject);
+}
+
+
+gboolean telescope_applet_on_press(GtkWidget *widget, GdkEventButton *event, TelescopeApplet *self)
+{
+mylog("a");
+    DBusMessage *call = dbus_message_new_method_call(
+      "org.telescope",
+      "/Telescope",
+      "org.telescope.Telescope",
+      "Show"
+    );
+
+    dbus_connection_send(self->priv->conn, call, 0);
+    dbus_connection_flush(self->priv->conn);
+
+    dbus_message_unref(call);
+
+    return TRUE;
+}
+
+
+gboolean telescope_applet_on_expose(GtkWidget *widget, GdkEventExpose *event, TelescopeApplet *self)
+{
+    GdkGC *gc = gdk_gc_new(widget->window);
+
+    int x = widget->allocation.x + (widget->allocation.width  - gdk_pixbuf_get_width(self->priv->icon)) / 2;
+    int y = widget->allocation.y + (widget->allocation.height - gdk_pixbuf_get_height(self->priv->icon)) / 2;
+
+    gdk_draw_pixbuf(widget->window, gc,
+        self->priv->icon,
+        0, 0, x, y, -1, -1,
+        GDK_RGB_DITHER_NORMAL, 0, 0);
+
+    g_object_unref(gc);
+
+    return TRUE;
+}

File applet/TelescopeApplet.desktop

+[Desktop Entry]
+Name=Telescope Applet
+Icon=telescope
+Category=permanent
+Type=default
+X-Path=libtelescopeapplet.so

File applet/TelescopeApplet.h

+//
+// Telescope Applet - status bar applet for calling Telescope task switcher
+//
+// (c) Ilya Skriblovsky, 2010
+// <Ilya.Skriblovsky@gmail.com>
+//
+
+// $Id: TelescopeApplet.h 110 2010-07-08 08:32:28Z mitrandir $
+
+#ifndef __TELESCOPE_APPLET_H
+#define __TELESCOPE_APPLET_H
+
+#include <glib-object.h>
+#include <libhildondesktop/statusbar-item.h>
+
+G_BEGIN_DECLS
+
+/* Common struct types declarations */
+typedef struct _TelescopeApplet      TelescopeApplet;
+typedef struct _TelescopeAppletClass TelescopeAppletClass;
+typedef struct _TelescopeAppletPriv  TelescopeAppletPriv;
+
+/* Common macros */
+#define TELESCOPE_APPLET_TYPE            (telescope_applet_get_type ())
+#define TELESCOPE_APPLET(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), TELESCOPE_APPLET_TYPE, TelescopeApplet))
+#define TELESCOPE_APPLET_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass),  TELESCOPE_APPLET_TYPE, TelescopeAppletClass))
+#define IS_TELESCOPE_APPLET(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TELESCOPE_APPLET_TYPE))
+#define IS_TELESCOPE_APPLET_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),  TELESCOPE_APPLET_TYPE))
+#define TELESCOPE_APPLET_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj),  TELESCOPE_APPLET_TYPE, TelescopeAppletClass))
+
+/* Instance struct */
+struct _TelescopeApplet
+{
+    StatusbarItem parent;
+
+    TelescopeAppletPriv *priv;
+};
+
+/* Class struct */
+struct _TelescopeAppletClass
+{
+    StatusbarItemClass parent_class;
+};
+
+GType  telescope_applet_get_type  (void);
+
+G_END_DECLS
+
+#endif
+

File applet/debian/changelog

+telescope-applet (0.2.1) unstable; urgency=low
+
+  * Minor fixed
+
+ -- Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>  14 Oct 2010 14:20:00 +0400
+
+telescope-applet (0.2) unstable; urgency=low
+
+  * Added statusbar & navigator applets for Launcher
+
+ -- Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>  18 Aug 2010 08:40:00 +0300
+
+telescope-applet (0.1) unstable; urgency=low
+
+  * Initial build of telescope-applet
+
+ -- Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>  27 Jul 2010 12:20:00 +0300

File applet/debian/compat

+5

File applet/debian/control

+Source: telescope-applet
+Section: user/utilities
+Priority: extra
+Maintainer: Ilya Skriblovsky <Ilya.Skriblovsky@gmail.com>
+Build-Depends: debhelper (>= 5), libgtk2.0-dev, libhildondesktop-dev, libhildon1-dev, libdbus-1-dev, libosso-dev
+Standards-Version: 2.0
+
+Package: telescope-applet
+Section: user/utilities
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, telescope
+Description: Statusbar and navigator applets for calling Telescope
+XB-Maemo-Display-Name: Telescope Statusbar Applet
+XB-Maemo-Upgrade-Description: Minor fixes

File applet/debian/dirs

+usr/lib/hildon-desktop
+usr/share/applications/hildon-status-bar
+usr/share/applications/hildon-navigator
+usr/share/telescope-applet

File applet/debian/rules

+#!/usr/bin/make -f
+
+clean:
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	make clean
+
+	dh_clean
+
+
+build:
+	dh_testdir
+
+	make
+
+
+install:
+	dh_testdir
+	dh_testroot
+	dh_clean -k
+	dh_installdirs
+
+	make DESTDIR=$(CURDIR)/debian/telescope-applet install
+
+
+binary-indep:
+
+binary-arch: build install
+	dh_testdir
+	dh_testroot
+	dh_installchangelogs
+	dh_installdocs
+	dh_install
+	dh_installman
+	dh_link
+	dh_strip
+	dh_compress
+	dh_fixperms
+	dh_makeshlibs
+	dh_installdeb
+	dh_shlibdeps
+	dh_gencontrol
+	dh_md5sums
+	dh_builddeb
+
+
+binary: binary-indep binary-arch
+
+.PHONY: clean build install binary-indep binary-arch binary

File applet/launcher-navigator.desktop

+[Desktop Entry]
+Name=Telescope launcher
+Icon=qgn_grid_tasknavigator_others
+X-Path=liblaunchertnapplet.so
+X-Settings=/usr/lib/hildon-desktop/libhd-applications-menu-settings.so
+Type=default
+

File applet/launcher-statusbar.desktop

+[Desktop Entry]
+Name=Telescope Launcher
+Icon=qgn_grid_tasknavigator_others
+X-Path=liblaunchersbapplet.so
+X-Settings=/usr/lib/hildon-desktop/libhd-applications-menu-settings.so
+Type=default
+Category=permanent

File applet/telescope-applet-pressed.png

Added
New image

File applet/telescope-applet.png

Added
New image