#include <libosso-abook/osso-abook-contact.h>
#include <libosso-abook/osso-abook-waitable.h>
#include <libosso-abook/osso-abook-contact.h>
+#include <libosso-abook/osso-abook-touch-contact-starter.h>
#define EL_HOME_APPLET_GET_PRIVATE(obj) ( \
G_TYPE_INSTANCE_GET_PRIVATE (obj, \
gchar *message;
gint event_id;
- gboolean active;
+ gboolean active_body;
+ gboolean active_header;
guint unread_count;
cairo_close_path (cr);
- cairo_set_source_rgba (cr, 0.2f, 0.2f, 0.2f, 0.8f);
+ if (priv->active_header)
+ cairo_set_source_rgba (cr,
+ priv->active_color.red,
+ priv->active_color.green,
+ priv->active_color.blue,
+ 0.8f);
+ else
+ cairo_set_source_rgba (cr, 0.2f, 0.2f, 0.2f, 0.8f);
cairo_fill (cr);
cairo_move_to (cr, 0, HEADER_HEIGHT);
grad = cairo_pattern_create_linear (0, HEADER_HEIGHT,
0, C_HEIGHT);
- if (priv->active) {
+ if (priv->active_body) {
cairo_pattern_add_color_stop_rgba (grad,
0.5f,
priv->active_color.red,
ELHomeAppletPrivate *priv = self->priv;
if (priv->event_id > 0) {
- priv->active = TRUE;
+ if (event->y < C_Y + HEADER_HEIGHT)
+ priv->active_header = TRUE;
+ else
+ priv->active_body = TRUE;
gtk_widget_queue_draw (widget);
}
}
static gboolean
+start_starter (OssoABookAggregator *aggregator, const gchar *contact_id)
+{
+ GList *contacts = osso_abook_aggregator_lookup (aggregator, contact_id);
+ if (contacts && contacts->data) {
+ GtkWidget *starter =
+ osso_abook_touch_contact_starter_new_with_contact
+ (NULL,
+ OSSO_ABOOK_CONTACT (contacts->data));
+ GtkWidget *dlg = osso_abook_touch_contact_starter_dialog_new
+ (NULL,
+ OSSO_ABOOK_TOUCH_CONTACT_STARTER (starter));
+ gtk_widget_show_all (starter);
+ gtk_widget_show (dlg);
+
+ return TRUE;
+ }
+ return FALSE;
+}
+static gboolean
button_release_event_cb (GtkWidget *widget,
GdkEventButton *event,
ELHomeApplet *self)
{
ELHomeAppletPrivate *priv = self->priv;
- if (priv->active) {
- priv->active = FALSE;
+ if (priv->active_body) {
+ priv->active_body = FALSE;
stop_scroll_anim (priv);
if (priv->scroll_on_click) {
priv->scroll_on_click = FALSE;
gtk_widget_queue_draw (widget);
}
+ if (priv->active_header) {
+ priv->active_header = FALSE;
+ if (!start_starter (OSSO_ABOOK_AGGREGATOR (priv->aggregator),
+ priv->contact_id)) {
+ /* TODO: start temp contact dlg */
+ }
+ gtk_widget_queue_draw (widget);
+ }
return TRUE;
}
{
ELHomeAppletPrivate *priv = self->priv;
- if (priv->active) {
- priv->active = FALSE;
+ if (priv->active_body) {
+ priv->active_body = FALSE;
+ priv->active_header = FALSE;
stop_scroll_anim (priv);
gtk_widget_queue_draw (widget);
}
+ if (priv->active_header) {
+ priv->active_header = FALSE;
+ gtk_widget_queue_draw (widget);
+ }
return FALSE;
}