r2754 - in trunk/src/target/OM-2007.2/applications/openmoko-dialer2: . src

njp at sita.openmoko.org njp at sita.openmoko.org
Tue Aug 21 13:58:24 CEST 2007


Author: njp
Date: 2007-08-21 13:58:22 +0200 (Tue, 21 Aug 2007)
New Revision: 2754

Added:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h
Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h
   trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c
Log:
2007-08-21  Neil J. Patel  <njp at o-hand.com>

	* src/Makefile.am:
	* src/moko-contacts.c: (new_digit), (add_number),
	(moko_contacts_fuzzy_lookup), (moko_contacts_get_photo),
	(moko_contacts_add_contact), (free_digit),
	(moko_contacts_finalize), (moko_contacts_init):
	* src/moko-contacts.h:
	* src/moko-keypad.c: (on_tip_selected), (on_delete_event),
	(on_panel_user_input), (moko_keypad_init), (moko_keypad_new):
	* src/moko-tips.c: (moko_tips_set_matches), (on_tip_selected),
	(moko_tips_dispose), (moko_tips_finalize), (moko_tips_class_init),
	(moko_tips_init), (moko_tips_new):
	* src/moko-tips.h:
	Merge autocompletion work.
	Fix segfault while loading photo for contact.

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-21 11:51:50 UTC (rev 2753)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/ChangeLog	2007-08-21 11:58:22 UTC (rev 2754)
@@ -1,3 +1,20 @@
+2007-08-21  Neil J. Patel  <njp at o-hand.com>
+
+	* src/Makefile.am:
+	* src/moko-contacts.c: (new_digit), (add_number),
+	(moko_contacts_fuzzy_lookup), (moko_contacts_get_photo),
+	(moko_contacts_add_contact), (free_digit),
+	(moko_contacts_finalize), (moko_contacts_init):
+	* src/moko-contacts.h:
+	* src/moko-keypad.c: (on_tip_selected), (on_delete_event),
+	(on_panel_user_input), (moko_keypad_init), (moko_keypad_new):
+	* src/moko-tips.c: (moko_tips_set_matches), (on_tip_selected),
+	(moko_tips_dispose), (moko_tips_finalize), (moko_tips_class_init),
+	(moko_tips_init), (moko_tips_new):
+	* src/moko-tips.h:
+	Merge autocompletion work.
+	Fix segfault while loading photo for contact.
+
 2007-08-19  Daniel Willmann  <daniel at totalueberwachung.de>
 	* src/moko-sound.{c,h}: Created functions to switch the audio profiles
 	* src/Makefile.am, src/moko-talking.c: Switch audio profiles when

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-08-21 11:51:50 UTC (rev 2753)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/Makefile.am	2007-08-21 11:58:22 UTC (rev 2754)
@@ -26,6 +26,8 @@
 	moko-notify.h			\
 	moko-talking.c			\
 	moko-talking.h			\
+	moko-tips.c			\
+	moko-tips.h			\
 	moko-sound.c			\
 	moko-sound.h
 

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c	2007-08-21 11:51:50 UTC (rev 2753)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.c	2007-08-21 11:58:22 UTC (rev 2754)
@@ -32,7 +32,16 @@
 
 #define MOKO_CONTACTS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
         MOKO_TYPE_CONTACTS, MokoContactsPrivate))
+typedef struct _Digit Digit;
 
+struct _Digit
+{
+  Digit *digits[11];
+  Digit *parent;
+  GList *results;
+
+};
+
 struct _MokoContactsPrivate
 {
   EBook      *book;
@@ -40,9 +49,101 @@
   GList      *contacts;
   GList      *entries;
   GHashTable *prefixes;
+
+  Digit *start;
 };
 
+static Digit*
+new_digit (Digit *parent)
+{
+  Digit *ret;
+  gint i;
+  
+  ret = g_slice_new0 (Digit);
+  ret->parent = parent;
+  ret->results = NULL;
+
+  for (i = 0; i <11; i++)
+    ret->digits[i] = NULL;
+  
+  return ret;
+}
+
+/* Auto-complete data type */
 static void
+add_number (Digit **start, MokoContactEntry *entry)
+{
+  gint len, i;
+  Digit *cur;
+
+  if (*start == NULL)
+    *start = new_digit (NULL);
+
+  cur = *start;
+
+  len = strlen  (entry->number);
+  for (i = 0; i < len; i++)
+  {
+    gchar c = entry->number[i];
+    gint n = c - '0';
+
+    if (n < 0 || n > 9)
+      n = 11;
+
+    if (cur->digits[n])
+    {
+      cur = cur->digits[n];
+      if (g_list_length (cur->results) < 3)
+        cur->results = g_list_append (cur->results, entry);
+      continue;
+    }
+    else
+    {
+      cur->digits[n] = new_digit (cur);
+      cur = cur->digits[n];
+      cur->results = g_list_append (cur->results, entry);
+    }
+  }
+}
+
+GList*
+moko_contacts_fuzzy_lookup (MokoContacts *contacts, const gchar *number)
+{
+  MokoContactsPrivate *priv;
+  gint len, i;
+  Digit *cur;
+  
+  g_return_val_if_fail (MOKO_IS_CONTACTS (contacts), NULL);
+  priv = contacts->priv;
+
+  cur = priv->start;
+
+  if (!cur)
+    g_print ("error\n");
+
+  if (!number)
+    return NULL;
+
+  len = strlen (number);
+
+  for (i = 0; i < len; i++)
+  {
+    gchar c = number[i];
+    gint n = c - '0';
+
+    if (!cur->digits[n])
+      return NULL;
+
+    cur = cur->digits[n];
+    if ((i+1) == len)
+      return cur->results;
+  }
+
+  return NULL;
+}
+
+
+void
 moko_contacts_get_photo (MokoContacts *contacts, MokoContact *m_contact)
 {
   MokoContactsPrivate *priv;
@@ -52,6 +153,7 @@
   GdkPixbufLoader *loader;
   
   g_return_if_fail (MOKO_IS_CONTACTS (contacts));
+  g_return_if_fail (m_contact);
   priv = contacts->priv;
   
   if (!e_book_get_contact (priv->book, m_contact->uid, &e_contact, &err))
@@ -61,20 +163,32 @@
     g_object_ref (m_contact->photo);
     return;
   }
-
+  
   photo = e_contact_get (e_contact, E_CONTACT_PHOTO);
-
+  if (!photo)
+  {
+    m_contact->photo = gdk_pixbuf_new_from_file (PKGDATADIR"/person.png", NULL);
+    g_object_ref (m_contact->photo);
+    return;
+ 
+  }
+  
   loader = gdk_pixbuf_loader_new ();
   gdk_pixbuf_loader_write (loader, 
                            photo->data.inlined.data,
                            photo->data.inlined.length,
                            NULL);
   gdk_pixbuf_loader_close (loader, NULL);
+  m_contact->photo = gdk_pixbuf_loader_get_pixbuf (loader);
 
-  m_contact->photo = gdk_pixbuf_loader_get_pixbuf (loader);
   if (GDK_IS_PIXBUF (m_contact->photo))
     g_object_ref (m_contact->photo);
-
+  else 
+  {
+    m_contact->photo = gdk_pixbuf_new_from_file (PKGDATADIR"/person.png", NULL);
+    g_object_ref (m_contact->photo); 
+  }  
+  
   g_object_unref (loader);
 }
 
@@ -95,12 +209,8 @@
   return entry;
 }
 
-GList*
-moko_contacts_fuzzy_lookup (MokoContacts *contacts, const gchar *number)
-{
-  return NULL;
-}
 
+
 /* This takes the raw number from econtact, and spits out a 'normalised' 
  * version which does not contain any ' ' or '-' charecters. The reason for
  * this is that when inputing numbers into the dialer, you cannot add these
@@ -173,6 +283,7 @@
       g_hash_table_insert (priv->prefixes, 
                            g_strdup (entry->number), 
                            (gpointer)entry);
+      add_number (&priv->start, entry);
     }
   }
 }
@@ -216,6 +327,20 @@
 }
 
 static void
+free_digit (Digit *digit)
+{
+  gint i;
+
+  for (i = 0; i < 11; i++)
+  {
+    if (digit->digits[i])
+      free_digit (digit->digits[i]);
+  }
+  g_list_free (digit->results);
+  g_slice_free (Digit, digit);
+}
+
+static void
 moko_contacts_finalize (GObject *contacts)
 {
   MokoContactsPrivate *priv;
@@ -251,6 +376,11 @@
   }
   g_list_free (priv->entries);
 
+  if (priv->start)
+  {
+    free_digit (priv->start);
+  } 
+
   G_OBJECT_CLASS (moko_contacts_parent_class)->finalize (contacts);
 }
 
@@ -307,30 +437,6 @@
     moko_contacts_add_contact (contacts, E_CONTACT (c->data));
   }
 
-    /* We now have a list of entries that we can organise by the first 
-   * AUTOCOMPLETE_N_CHARS digits 
-   */
-  /*for (e = priv->entries; e != NULL; e = e->next)
-  {
-    MokoContactEntry *entry = (MokoContactEntry*)e->data;
-    gchar buf[AUTOCOMPLETE_N_CHARS+1];
-    gint i;
-    gint len = strlen (entry->number);
-    GList *list = NULL;
-  
-    if (len > AUTOCOMPLETE_N_CHARS)
-      len = AUTOCOMPLETE_N_CHARS;
-    
-    for (i =0; i < len; i++)
-      buf[i] = entry->number[i];
-    buf[len+1] = '\0';
-
-    list = g_hash_table_lookup (priv->prefixes, buf);
-    list = g_list_append (list, entry);
-    
-    g_hash_table_insert (priv->prefixes, g_strdup (buf), (gpointer)list);
-  }
-*/
   /* Connect to the ebookviews signals */
   if (e_book_get_book_view (book, query, NULL, 0, &view, NULL))
   {

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h	2007-08-21 11:51:50 UTC (rev 2753)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-contacts.h	2007-08-21 11:58:22 UTC (rev 2754)
@@ -94,6 +94,9 @@
 GList*
 moko_contacts_fuzzy_lookup (MokoContacts *contacts, const gchar *number);
 
+void
+moko_contacts_get_photo (MokoContacts *contacts, MokoContact *m_contact);
+
 G_END_DECLS
 
 #endif /* _HAVE_MOKO_CONTACTS_H */

Modified: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c	2007-08-21 11:51:50 UTC (rev 2753)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-keypad.c	2007-08-21 11:58:22 UTC (rev 2754)
@@ -24,8 +24,10 @@
 
 #include "moko-keypad.h"
 
+#include "moko-contacts.h"
 #include "moko-dialer-textview.h"
 #include "moko-dialer-panel.h"
+#include "moko-tips.h"
 
 G_DEFINE_TYPE (MokoKeypad, moko_keypad, GTK_TYPE_VBOX)
 
@@ -36,6 +38,7 @@
 {
   gboolean      pin_mode;
 
+  GtkWidget     *tips;
   GtkWidget     *textview;
   GtkWidget     *panel;
   GtkWidget     *delete;
@@ -120,6 +123,24 @@
 
 /* Callbacks */
 static void
+on_tip_selected (MokoTips *tips, MokoContactEntry *entry, MokoKeypad *keypad)
+{
+  MokoKeypadPrivate *priv;
+
+  g_return_if_fail (MOKO_IS_KEYPAD (keypad));
+  g_return_if_fail (entry);
+  priv = keypad->priv;
+
+  moko_dialer_textview_empty (MOKO_DIALER_TEXTVIEW (priv->textview));
+  moko_dialer_textview_insert (MOKO_DIALER_TEXTVIEW (priv->textview),
+                               entry->number);
+
+  g_print ("%s\n", entry->number);
+  g_signal_emit (G_OBJECT (keypad), keypad_signals[DIAL_NUMBER], 
+                 0, entry->number);
+}
+
+static void
 on_dial_clicked (GtkWidget *button, MokoKeypad *keypad)
 {
   MokoKeypadPrivate *priv;
@@ -146,6 +167,7 @@
   MokoKeypadPrivate *priv;
   MokoDialerTextview *textview;
   static guint32 last_event = 0;
+  GList *matches;
   
   g_return_val_if_fail (MOKO_IS_KEYPAD (keypad), FALSE);
   priv = keypad->priv;
@@ -155,6 +177,7 @@
   if (event->type == GDK_BUTTON_PRESS)
   {
     last_event = event->time;
+    return FALSE;
   }
   else if (event->type == GDK_BUTTON_RELEASE)
   {
@@ -171,6 +194,17 @@
       moko_dialer_textview_empty (textview);
    }
   }
+  
+  if (!priv->pin_mode)
+  {
+    /* Some autocomplete stuff */
+    matches = moko_contacts_fuzzy_lookup (moko_contacts_get_default (),
+                                          moko_dialer_textview_get_input (
+                                          MOKO_DIALER_TEXTVIEW (priv->textview),
+                                          TRUE));
+    moko_tips_set_matches (MOKO_TIPS (priv->tips), matches);
+  }
+  
   return FALSE;
 }
 
@@ -181,6 +215,7 @@
 {
   MokoKeypadPrivate *priv;
   gchar buf[2];
+  GList *matches = NULL;
 
   g_return_if_fail (MOKO_IS_KEYPAD (keypad));
   priv = keypad->priv;
@@ -197,6 +232,13 @@
   buf[1] = '\0';
 
   moko_dialer_textview_insert (MOKO_DIALER_TEXTVIEW (priv->textview), buf);
+
+  /* Some autocomplete stuff */
+  matches = moko_contacts_fuzzy_lookup (moko_contacts_get_default (),
+                                        moko_dialer_textview_get_input (
+                                        MOKO_DIALER_TEXTVIEW (priv->textview), 
+                                        TRUE));
+  moko_tips_set_matches (MOKO_TIPS (priv->tips), matches);
 }
 
 static void
@@ -272,6 +314,12 @@
 
   priv = keypad->priv = MOKO_KEYPAD_GET_PRIVATE (keypad);
 
+  /* The autocomplete tips */
+  priv->tips = moko_tips_new ();
+  g_signal_connect (priv->tips, "selected", 
+                    G_CALLBACK (on_tip_selected), (gpointer)keypad);
+  gtk_box_pack_start (GTK_BOX (keypad), priv->tips, FALSE, FALSE, 0);
+
   /* The textview */
   priv->textview = moko_dialer_textview_new ();
   gtk_box_pack_start (GTK_BOX (keypad), priv->textview, FALSE, FALSE, 0);
@@ -338,7 +386,7 @@
   
   keypad = g_object_new (MOKO_TYPE_KEYPAD, 
                          "homogeneous", FALSE,
-                         "spacing", 12,
+                         "spacing", 0,
                          NULL);
 
   return GTK_WIDGET (keypad);

Added: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c	2007-08-21 11:51:50 UTC (rev 2753)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.c	2007-08-21 11:58:22 UTC (rev 2754)
@@ -0,0 +1,194 @@
+/*
+ *  moko-tips; The autocomplete tips
+ *  
+ *  Authored by OpenedHand Ltd <info at openedhand.com>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Lesser Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#include <gtk/gtk.h>
+#include <moko-stock.h>
+
+#include "moko-tips.h"
+
+#include <gtk/gtk.h>
+#include "moko-contacts.h"
+
+G_DEFINE_TYPE (MokoTips, moko_tips, GTK_TYPE_HBOX)
+
+#define MOKO_TIPS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE(obj, \
+        MOKO_TYPE_TIPS, MokoTipsPrivate))
+
+#define N_TIPS 3
+
+struct _MokoTipsPrivate
+{
+  GtkWidget     *image;
+  GtkWidget     *tips[N_TIPS];
+};
+
+enum
+{
+  SELECTED = 1,
+
+  LAST_SIGNAL
+};
+
+static guint tips_signals[LAST_SIGNAL] = {0, };
+
+void
+moko_tips_set_matches (MokoTips *tips, GList *list)
+{
+  MokoTipsPrivate *priv;
+  gint i;
+
+  g_return_if_fail (MOKO_IS_TIPS (tips));
+  priv = tips->priv;
+
+  for (i = 0; i < N_TIPS; i++)
+  {
+    MokoContactEntry *entry = NULL;
+    GtkWidget *label = gtk_bin_get_child (GTK_BIN (priv->tips[i]));
+
+    entry = (MokoContactEntry*)g_list_nth_data (list, i);
+
+    if (entry && entry->contact)
+    {
+      gtk_label_set_text (GTK_LABEL (label), entry->contact->name);
+      if (i == 0)
+      {
+        GdkPixbuf *scaled = NULL;
+
+        if (!entry->contact->photo)
+          moko_contacts_get_photo (moko_contacts_get_default (), 
+                                   entry->contact);
+        
+        scaled = gdk_pixbuf_scale_simple (entry->contact->photo,
+                                          36, 36,
+                                          GDK_INTERP_BILINEAR);
+        
+        gtk_image_set_from_pixbuf (GTK_IMAGE (priv->image), scaled);
+      }
+      gtk_widget_show (label);
+    }
+    else
+    {
+      gtk_widget_hide (label);
+      gtk_label_set_text (GTK_LABEL (label), "");
+      if (i == 0)
+      {
+        gtk_image_clear (GTK_IMAGE (priv->image));
+        gtk_widget_show (label);
+      }
+
+    }
+    g_object_set_data (G_OBJECT (priv->tips[i]), "entry", entry);
+  }
+}
+
+/* Callbacks */
+static gboolean
+on_tip_selected (GtkWidget *eb, GdkEventButton *event, MokoTips *tips)
+{
+  MokoTipsPrivate *priv;
+  MokoContactEntry *entry;
+
+  g_return_val_if_fail (MOKO_IS_TIPS (tips), FALSE);
+  priv = tips->priv;
+  
+  entry = (MokoContactEntry*)g_object_get_data (G_OBJECT (eb), "entry");
+
+  if (entry && entry->contact)
+   g_signal_emit ((gpointer) tips, tips_signals[SELECTED], 0, entry);
+
+  return FALSE;
+}
+
+/* GObject functions */
+static void
+moko_tips_dispose (GObject *object)
+{
+  G_OBJECT_CLASS (moko_tips_parent_class)->dispose (object);
+}
+
+static void
+moko_tips_finalize (GObject *tips)
+{
+  G_OBJECT_CLASS (moko_tips_parent_class)->finalize (tips);
+}
+
+
+static void
+moko_tips_class_init (MokoTipsClass *klass)
+{
+  GObjectClass *obj_class = G_OBJECT_CLASS (klass);
+
+  obj_class->finalize = moko_tips_finalize;
+  obj_class->dispose = moko_tips_dispose;
+
+  tips_signals[SELECTED] =
+    g_signal_new ("selected", 
+                  G_TYPE_FROM_CLASS (obj_class),
+                  G_SIGNAL_RUN_LAST,
+                  G_STRUCT_OFFSET (MokoTipsClass, selected),
+                  NULL, NULL,
+                  g_cclosure_marshal_VOID__POINTER,
+                  G_TYPE_NONE,
+                  1, G_TYPE_POINTER);
+  g_type_class_add_private (obj_class, sizeof (MokoTipsPrivate)); 
+}
+
+static void
+moko_tips_init (MokoTips *tips)
+{
+  MokoTipsPrivate *priv;
+  GtkWidget *hbox;
+  gint i = 0;
+  
+  priv = tips->priv = MOKO_TIPS_GET_PRIVATE (tips);
+
+  priv->image = gtk_image_new_from_stock (GTK_STOCK_ADD, 
+                                          GTK_ICON_SIZE_LARGE_TOOLBAR);
+  gtk_box_pack_start (GTK_BOX (tips), priv->image, FALSE, FALSE, 0);
+
+  hbox = gtk_hbox_new (TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (tips), hbox, TRUE, TRUE, 0);
+
+  for (i = 0; i < N_TIPS; i++)
+  {
+    GtkWidget *eb, *label;
+    priv->tips[i] = eb = gtk_event_box_new ();
+    g_signal_connect (eb, "button-release-event",
+                      G_CALLBACK (on_tip_selected), (gpointer)tips);
+    gtk_box_pack_start (GTK_BOX (hbox), eb, TRUE, TRUE, 0);   
+
+    label = gtk_label_new ("");
+    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+    //gtk_label_set_ellipsize (GTK_LABEL (label), PANGO_ELLIPSIZE_END);
+    gtk_container_add (GTK_CONTAINER (eb), label);
+  }
+}
+
+GtkWidget*
+moko_tips_new (void)
+{
+  MokoTips *tips = NULL;
+  
+  tips = g_object_new (MOKO_TYPE_TIPS, 
+                         "homogeneous", FALSE,
+                         "spacing", 0,
+                         NULL);
+
+  return GTK_WIDGET (tips);
+}

Added: trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h	2007-08-21 11:51:50 UTC (rev 2753)
+++ trunk/src/target/OM-2007.2/applications/openmoko-dialer2/src/moko-tips.h	2007-08-21 11:58:22 UTC (rev 2754)
@@ -0,0 +1,84 @@
+/*
+ *  moko-tips; The autocomplete tips.
+ *
+ *  Authored by OpenedHand Ltd <info at openedhand.com>
+ *
+ *  Copyright (C) 2006-2007 OpenMoko Inc.
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU Lesser Public License as published by
+ *  the Free Software Foundation; version 2 of the license.
+ *
+ *  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 Lesser Public License for more details.
+ *
+ *  Current Version: $Rev$ ($Date$) [$Author$]
+ */
+
+#ifndef _HAVE_MOKO_TIPS_H
+#define _HAVE_MOKO_TIPS_H
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include "moko-contacts.h"
+
+G_BEGIN_DECLS
+
+#define MOKO_TYPE_TIPS (moko_tips_get_type ())
+
+#define MOKO_TIPS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), \
+        MOKO_TYPE_TIPS, MokoTips))
+
+#define MOKO_TIPS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), \
+        MOKO_TYPE_TIPS, MokoTipsClass))
+
+#define MOKO_IS_TIPS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), \
+        MOKO_TYPE_TIPS))
+
+#define MOKO_IS_TIPS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), \
+        MOKO_TYPE_TIPS))
+
+#define MOKO_TIPS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), \
+        MOKO_TYPE_TIPS, MokoTipsClass))
+
+typedef struct _MokoTips MokoTips;
+typedef struct _MokoTipsClass MokoTipsClass;
+typedef struct _MokoTipsPrivate MokoTipsPrivate;
+
+struct _MokoTips
+{
+  GtkHBox         parent;
+
+  /*< private >*/
+  MokoTipsPrivate   *priv;
+};
+
+struct _MokoTipsClass 
+{
+  /*< private >*/
+  GtkHBoxClass    parent_class;
+  
+  /* signals */
+  void (*selected) (MokoTips *tips, MokoContactEntry *entry);
+
+  /* future padding */
+  void (*_moko_tips_1) (void);
+  void (*_moko_tips_2) (void);
+  void (*_moko_tips_3) (void);
+  void (*_moko_tips_4) (void);
+}; 
+
+GType moko_tips_get_type (void) G_GNUC_CONST;
+
+GtkWidget*        
+moko_tips_new (void);
+
+void
+moko_tips_set_matches (MokoTips *tips, GList *list);
+
+G_END_DECLS
+
+#endif /* _HAVE_MOKO_TIPS_H */





More information about the commitlog mailing list