r4265 - in trunk/src/target/OM-2007.2/applications/openmoko-messages2: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Fri Mar 28 16:29:19 CET 2008


Author: thomas
Date: 2008-03-28 16:29:14 +0100 (Fri, 28 Mar 2008)
New Revision: 4265

Modified:
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-compose.c
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-contacts.c
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-main.c
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
   trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h
Log:
2008-03-28  Thomas Wood  <thomas at openedhand.com>

	* src/sms-compose.c: (page_shown), (sms_compose_page_new):
	* src/sms-contacts.c: (contacts_changed_cb), (contacts_removed_cb),
	(contacts_seq_complete_cb), (free_iter_slice),
	(nophoto_filter_func), (contacts_iter_compare_func),
	(contacts_visible_func), (malloc_list_free),
	(selection_changed_cb), (sms_contacts_update_delete_all),
	(sms_contacts_page_new):
	* src/sms-main.c: (notebook_add_page_with_icon), (main):
	* src/sms-notes.c: (page_shown), (page_hidden),
	(sms_notes_page_new):
	* src/sms.h:

	Re-arrange toolbars to add dial button (bug 1306).


Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog	2008-03-28 15:12:05 UTC (rev 4264)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog	2008-03-28 15:29:14 UTC (rev 4265)
@@ -1,3 +1,19 @@
+2008-03-28  Thomas Wood  <thomas at openedhand.com>
+
+	* src/sms-compose.c: (page_shown), (sms_compose_page_new):
+	* src/sms-contacts.c: (contacts_changed_cb), (contacts_removed_cb),
+	(contacts_seq_complete_cb), (free_iter_slice),
+	(nophoto_filter_func), (contacts_iter_compare_func),
+	(contacts_visible_func), (malloc_list_free),
+	(selection_changed_cb), (sms_contacts_update_delete_all),
+	(sms_contacts_page_new):
+	* src/sms-main.c: (notebook_add_page_with_icon), (main):
+	* src/sms-notes.c: (page_shown), (page_hidden),
+	(sms_notes_page_new):
+	* src/sms.h:
+
+	Re-arrange toolbars to add dial button (bug 1306).
+
 2008-03-27  Erin Yueh  <erin_yueh at openmoko.com>
 
 	* src/sms-compose.c: (page_shown):

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-compose.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-compose.c	2008-03-28 15:12:05 UTC (rev 4264)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-compose.c	2008-03-28 15:29:14 UTC (rev 4265)
@@ -31,14 +31,7 @@
 	EContact *contact;
 	GdkPixbuf *photo;
 	gchar *string;
-	
-	/* Make delete(-all) buttons insensitive */
-	/* TODO: Replace these with more useful buttons? */
-	gtk_widget_set_sensitive (GTK_WIDGET (data->delete_button), FALSE);
-	gtk_widget_set_sensitive (GTK_WIDGET (data->delete_all_button), FALSE);
-	
-	if (!data->sms_proxy)
-		gtk_widget_set_sensitive (GTK_WIDGET (data->new_button), FALSE);
+
 	gtk_tool_button_set_stock_id (GTK_TOOL_BUTTON (data->new_button),
 		MOKO_STOCK_MAIL_SEND);
 	gtk_widget_grab_focus (data->sms_textview);
@@ -238,12 +231,22 @@
 GtkWidget *
 sms_compose_page_new (SmsData *data)
 {
-	GtkWidget *vbox, *frame, *contact_table, *align;
+	GtkWidget *vbox, *frame, *contact_table, *align, *toolbar;
 	
 	/* Connect to new/send button clicked */
 	g_signal_connect (data->new_button, "clicked",
 		G_CALLBACK (send_clicked_cb), data);
 	
+	/* Create toolbar */
+	toolbar = gtk_toolbar_new ();
+	
+	/* Send button */
+	data->new_button = gtk_tool_button_new_from_stock (MOKO_STOCK_MAIL_SEND);
+	gtk_tool_item_set_expand (data->new_button, TRUE);
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data->new_button, -1);
+	g_signal_connect (data->new_button, "clicked",
+		G_CALLBACK (send_clicked_cb), &data);
+	
 	/* Create contact info display/number entry */
 	contact_table = gtk_table_new (2, 2, FALSE);
 	gtk_table_set_col_spacings (GTK_TABLE (contact_table), 6);
@@ -287,6 +290,7 @@
 	
 	/* Pack widgets */
 	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), contact_table, FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), align,

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-contacts.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-contacts.c	2008-03-28 15:12:05 UTC (rev 4264)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-contacts.c	2008-03-28 15:29:14 UTC (rev 4265)
@@ -27,60 +27,196 @@
 #include <libmokoui2/moko-search-bar.h>
 #include <string.h>
 
+
+#define PK_NAMESPACE "org.openmoko.PhoneKit"
+#define DIALER_NAMESPACE "org.openmoko.PhoneKit.Dialer"
+#define DIALER_OBJECT "/org/openmoko/PhoneKit/Dialer"
+
+GtkWidget *treeview;
+
+
 static const gchar *clear_numbers_uid;
 
-static gboolean hidden = FALSE;
-
 static void selection_changed_cb (GtkTreeSelection *selection, SmsData *data);
+static void dial_clicked_cb (GtkWidget *button, SmsData *data);
 
 static void
-page_shown (SmsData *data)
+new_clicked_cb (GtkToolButton *button, SmsData *data)
 {
-	GtkTreeSelection *selection;
-	
-	/* Update delete/delete-all buttons */
-	sms_contacts_update_delete_all (data);
-	selection = gtk_tree_view_get_selection (
-		GTK_TREE_VIEW (data->contacts_treeview));
-	selection_changed_cb (selection, data);
+	if (gtk_notebook_get_current_page (GTK_NOTEBOOK (data->notebook)) ==
+	    SMS_PAGE_COMPOSE) return;
+
+	gtk_text_buffer_set_text (gtk_text_view_get_buffer (
+		GTK_TEXT_VIEW (data->sms_textview)), "", -1);
+
+	gtk_notebook_set_current_page (
+		GTK_NOTEBOOK (data->notebook), SMS_PAGE_COMPOSE);
 }
 
-static void
-page_hidden (SmsData *data)
+void 
+openmoko_contacts_util_dial_number (const gchar *number)
 {
+  DBusGConnection *conn;
+  DBusGProxy *proxy;
+  GError *err = NULL;
+
+  conn = dbus_g_bus_get (DBUS_BUS_SESSION, &err);
+  if (conn == NULL)
+  {
+    g_warning ("Failed to make DBus connection: %s", err->message);
+    g_error_free (err);
+    return;
+  }
+
+  proxy = dbus_g_proxy_new_for_name (conn,
+                                     PK_NAMESPACE,
+                                     DIALER_OBJECT,
+                                     DIALER_NAMESPACE);
+  if (proxy == NULL)
+  {
+    g_warning ("Unable to get dialer object");
+    return;
+  }
+
+  err = NULL;
+  dbus_g_proxy_call (proxy, "Dial", &err,
+                     G_TYPE_STRING, number,
+                     G_TYPE_INVALID, G_TYPE_INVALID);
+
+  if (err)
+  {
+    g_warning (err->message);
+    g_error_free (err);
+  }
 }
 
-static void
-notify_visible_cb (GObject *gobject, GParamSpec *arg1, SmsData *data)
+
+/* hito_vcard_attribute_get_type() taken from hito-vcard-util.c
+ * Copyright 2007 OpenedHand Ltd, licensed under GPL */
+gchar*
+hito_vcard_attribute_get_type (EVCardAttribute *attr)
 {
-	if ((!hidden) && (!GTK_WIDGET_VISIBLE (gobject))) {
-		hidden = TRUE;
-		page_hidden (data);
-	}
+  GList *list, *l;
+  gchar *result = NULL;
+  list = e_vcard_attribute_get_param (attr, "TYPE");
+
+  for (l = list; l; l = g_list_next (l))
+  {
+    if (result)
+    {
+      gchar *old_result = result;
+      result = g_strconcat (l->data, ";", old_result, NULL);
+      g_free (old_result);
+    }
+    else
+    {
+      result = g_strdup (l->data);
+    }
+  }
+
+  return result;
 }
 
-static gboolean
-visibility_notify_event_cb (GtkWidget *widget, GdkEventVisibility *event,
-			    SmsData *data)
+
+static void
+on_dial_number_clicked (GtkWidget *eb, GdkEventButton *event, GtkDialog *dialog)
 {
-	if (((event->state == GDK_VISIBILITY_PARTIAL) ||
-	     (event->state == GDK_VISIBILITY_UNOBSCURED)) && (hidden)) {
-		hidden = FALSE;
-		page_shown (data);
-	}
-	
-	return FALSE;
+  EVCardAttribute *att;
+  const gchar *number;
+
+  att = g_object_get_data (G_OBJECT (eb), "contact");
+  number = hito_vcard_attribute_get_value_string (att);
+  openmoko_contacts_util_dial_number (number);
+
+  gtk_dialog_response (dialog, GTK_RESPONSE_CANCEL);
 }
 
 static void
-unmap_cb (GtkWidget *widget, SmsData *data)
+dial_clicked_cb (GtkWidget *button, SmsData *data)
 {
-	if (!hidden) {
-		hidden = TRUE;
-		page_hidden (data);
+	GList *numbers;
+	GList *n;
+	gint num_tels = 0;
+	GError *err = NULL;
+	EContact *contact;
+	
+	g_return_if_fail (GTK_IS_TREE_VIEW (treeview));
+	
+	contact = sms_get_selected_contact (data);
+	
+	if (err)
+	{
+		g_warning ("Could not find contact");
+		return;
 	}
+	
+	numbers = hito_vcard_get_named_attributes (E_VCARD (contact), EVC_TEL);
+	num_tels = g_list_length (numbers);
+	
+	if (num_tels < 1)
+	{
+		g_print ("Dial: This contact does not have any numbers\n");
+		return;
+	}
+	else if (num_tels == 1)
+	{
+		/* dial */
+		openmoko_contacts_util_dial_number (
+		        hito_vcard_attribute_get_value_string (numbers->data));
+	}
+	else
+	{
+		/* Make a dialog with a list of numbers, which are one-click dialling */
+		/* dial on click, and then close the window */
+		GtkWidget *dialog, *vbox, *hbox, *image, *label;
+
+		dialog = gtk_dialog_new_with_buttons ("Please choose a number to call",
+		                                      GTK_WINDOW (data->window),
+		                                      GTK_DIALOG_DESTROY_WITH_PARENT,
+		                                      GTK_STOCK_CANCEL,
+		                                      GTK_RESPONSE_CANCEL,
+		                                      NULL);
+		gtk_container_set_border_width (GTK_CONTAINER (dialog), 12);
+		vbox = gtk_vbox_new (FALSE, 8);
+		gtk_box_pack_start (GTK_BOX (GTK_DIALOG(dialog)->vbox), vbox, 
+		                    FALSE, FALSE, 12);
+
+		GtkSizeGroup *size_group;
+		size_group = gtk_size_group_new (GTK_SIZE_GROUP_BOTH);
+		for (n = numbers; n; n = n->next)
+		{
+			GtkWidget *button = gtk_event_box_new ();
+			gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 8);
+
+			hbox = gtk_hbox_new (FALSE, 6);
+			gtk_container_add (GTK_CONTAINER (button), hbox);
+		  
+			label = gtk_label_new (hito_vcard_attribute_get_type (n->data));
+			gtk_size_group_add_widget (size_group, label);
+			gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5);
+			gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+			image = gtk_image_new_from_stock (MOKO_STOCK_CONTACT_PHONE, 
+		                                    GTK_ICON_SIZE_BUTTON);
+			gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+
+			label = gtk_label_new (hito_vcard_attribute_get_value_string (n->data));
+			gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
+
+			g_signal_connect (button, "button-release-event",
+		                    G_CALLBACK (on_dial_number_clicked), (gpointer)dialog);
+			g_object_set_data (G_OBJECT (button), "contact", n->data);
+		}
+		g_object_unref (size_group);
+		gtk_widget_show_all (dialog);
+		gint res = gtk_dialog_run (GTK_DIALOG (dialog));
+		res++;
+		gtk_widget_destroy (dialog);
+	}
 }
 
+
+
 static void
 clear_numbers_cb (gchar *number, gchar *uid, GList **list)
 {
@@ -375,65 +511,8 @@
 	return result;
 }
 
-static void
-delete_clicked_cb (GtkToolButton *button, SmsData *data)
-{
-	if (hidden) return;
-	
-	if (sms_delete_selected_contact_messages (data)) {
-		gtk_widget_set_sensitive (GTK_WIDGET (data->delete_button),
-			FALSE);
-	}
-}
 
 static void
-delete_all_added_cb (JanaStoreView *store_view, GList *components,
-		     SmsData *data)
-{
-	for (; components; components = components->next) {
-		JanaComponent *comp = JANA_COMPONENT (components->data);
-		jana_store_remove_component (
-			jana_store_view_get_store (store_view), comp);
-	}
-}
-
-static void
-delete_all_progress_cb (JanaStoreView *store_view, gint percent,
-			SmsData *data)
-{
-	if (percent == 100) g_object_unref (store_view);
-}
-
-static void
-delete_all_clicked_cb (GtkToolButton *button, SmsData *data)
-{
-	JanaStoreView *notes_view;
-	GtkWidget *dialog;
-	gint response;
-
-	if (hidden) return;
-	
-	dialog = gtk_message_dialog_new_with_markup (GTK_WINDOW (data->window),
-		GTK_DIALOG_MODAL,
-		GTK_MESSAGE_QUESTION, GTK_BUTTONS_NONE,
-		"Delete <b>all</b> messages?");
-	gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_CANCEL,
-		GTK_RESPONSE_CANCEL, GTK_STOCK_DELETE, GTK_RESPONSE_YES, NULL);
-	
-	response = gtk_dialog_run (GTK_DIALOG (dialog));
-	gtk_widget_destroy (dialog);
-	if (response != GTK_RESPONSE_YES) return;
-	
-	/* Delete all messages */
-	notes_view = jana_store_get_view (data->notes);
-	g_signal_connect (notes_view, "added",
-		G_CALLBACK (delete_all_added_cb), data);
-	g_signal_connect (notes_view, "progress",
-		G_CALLBACK (delete_all_progress_cb), data);
-	jana_store_view_start (notes_view);
-}
-
-static void
 search_toggled_cb (MokoSearchBar *bar, gboolean search_visible, SmsData *data)
 {
 	gtk_tree_model_filter_refilter (
@@ -578,6 +657,7 @@
 void
 sms_contacts_update_delete_all (SmsData *data)
 {
+
 	if (gtk_notebook_get_current_page (GTK_NOTEBOOK (data->notebook)) ==
 	    SMS_PAGE_CONTACTS) {
 		if (g_hash_table_size (data->note_count) > 0) {
@@ -594,7 +674,7 @@
 sms_contacts_page_new (SmsData *data)
 {
 	EBookQuery *qrys[(E_CONTACT_LAST_PHONE_ID-E_CONTACT_FIRST_PHONE_ID)+1];
-	GtkWidget *contacts_combo, *vbox;
+	GtkWidget *contacts_combo, *vbox, *toolbar;
 	GtkTreeSelection *selection;
 	GtkCellRenderer *renderer;
 	EBookQuery *tel_query;
@@ -703,7 +783,7 @@
 	update_categories (data);
 	
 	/* Create tree view */
-	data->contacts_treeview = gtk_tree_view_new_with_model (
+	treeview = data->contacts_treeview = gtk_tree_view_new_with_model (
 		data->contacts_filter);
 	gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (
 		data->contacts_treeview), TRUE);
@@ -734,8 +814,27 @@
 	gtk_container_add (GTK_CONTAINER (data->contacts_scroll),
 		data->contacts_treeview);
 	
+	/* Create toolbar */
+	toolbar = gtk_toolbar_new ();
+	
+	/* New button */
+	data->new_button = gtk_tool_button_new_from_stock (MOKO_STOCK_SMS_NEW);
+	gtk_tool_item_set_expand (data->new_button, TRUE);
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data->new_button, -1);
+	g_signal_connect (data->new_button, "clicked",
+		G_CALLBACK (new_clicked_cb), data);
+	
+	/* Dial button */
+	data->dial_button = gtk_tool_button_new_from_stock (MOKO_STOCK_CALL_DIAL);
+	gtk_tool_item_set_expand (data->dial_button, TRUE);
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data->dial_button, -1);
+	g_signal_connect (data->dial_button, "clicked",
+		G_CALLBACK (dial_clicked_cb), data);
+	
 	/* Pack widgets into vbox and return */
 	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), toolbar,
+		FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), data->contacts_search,
 		FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), data->contacts_scroll,
@@ -753,22 +852,6 @@
 		G_CALLBACK (contacts_seq_complete_cb), data);
 	e_book_view_start (view);
 	
-	/* Connect to toolbar delete buttons */
-	g_signal_connect (data->delete_button, "clicked",
-		G_CALLBACK (delete_clicked_cb), data);
-	g_signal_connect (data->delete_all_button, "clicked",
-		G_CALLBACK (delete_all_clicked_cb), data);
-
-	/* Add events for detecting whether the page has been hidden/shown */
-	gtk_widget_add_events (data->contacts_treeview,
-		GDK_VISIBILITY_NOTIFY_MASK);
-	g_signal_connect (data->contacts_treeview, "visibility-notify-event",
-		G_CALLBACK (visibility_notify_event_cb), data);
-	g_signal_connect (data->contacts_treeview, "notify::visible",
-		G_CALLBACK (notify_visible_cb), data);
-	g_signal_connect (vbox, "unmap",
-		G_CALLBACK (unmap_cb), data);
-
 	return vbox;
 }
 

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-main.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-main.c	2008-03-28 15:12:05 UTC (rev 4264)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-main.c	2008-03-28 15:29:14 UTC (rev 4265)
@@ -46,19 +46,6 @@
 		"tab-expand", TRUE, NULL);
 }
 
-static void
-new_clicked_cb (GtkToolButton *button, SmsData *data)
-{
-	if (gtk_notebook_get_current_page (GTK_NOTEBOOK (data->notebook)) ==
-	    SMS_PAGE_COMPOSE) return;
-
-	gtk_text_buffer_set_text (gtk_text_view_get_buffer (
-		GTK_TEXT_VIEW (data->sms_textview)), "", -1);
-
-	gtk_notebook_set_current_page (
-		GTK_NOTEBOOK (data->notebook), SMS_PAGE_COMPOSE);
-}
-
 int
 main (int argc, char **argv)
 {
@@ -103,37 +90,8 @@
 	gtk_window_set_title (GTK_WINDOW (data.window), "Messages");
 	g_signal_connect (data.window, "delete-event",
 		G_CALLBACK (gtk_main_quit), NULL);
+
 	
-	/* Create toolbar */
-	toolbar = gtk_toolbar_new ();
-	
-	/* New button */
-	data.new_button = gtk_tool_button_new_from_stock (MOKO_STOCK_SMS_NEW);
-	gtk_tool_item_set_expand (data.new_button, TRUE);
-	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data.new_button, 0);
-	g_signal_connect (data.new_button, "clicked",
-		G_CALLBACK (new_clicked_cb), &data);
-	
-	/* Forward button */
-	data.forward_button = gtk_tool_button_new_from_stock (
-		MOKO_STOCK_MAIL_FORWARD);
-	gtk_tool_item_set_expand (data.forward_button, TRUE);
-	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data.forward_button, 1);
-	
-	/* Delete all button */
-	data.delete_all_button = gtk_tool_button_new_from_stock (
-		MOKO_STOCK_FOLDER_DELETE);
-	gtk_tool_item_set_expand (data.delete_all_button, TRUE);
-	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data.delete_all_button, 2);
-	gtk_widget_set_sensitive (GTK_WIDGET (data.delete_all_button), FALSE);
-	
-	/* Delete button */
-	data.delete_button = gtk_tool_button_new_from_stock (
-		GTK_STOCK_DELETE);
-	gtk_tool_item_set_expand (data.delete_button, TRUE);
-	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data.delete_button, 3);
-	gtk_widget_set_sensitive (GTK_WIDGET (data.delete_button), FALSE);
-	
 	/* Create notebook */
 	data.notebook = gtk_notebook_new ();
 	gtk_notebook_set_tab_pos (GTK_NOTEBOOK (data.notebook), GTK_POS_BOTTOM);
@@ -152,7 +110,6 @@
 	
 	/* Pack and show */
 	vbox = gtk_vbox_new (FALSE, 0);
-	gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), data.notebook, TRUE, TRUE, 0);
 	gtk_container_add (GTK_CONTAINER (data.window), vbox);
 	
@@ -168,7 +125,6 @@
 	gtk_window_set_default_size (GTK_WINDOW (data.window), 480, 600);
 
 	gtk_widget_show_all (data.window);
-	gtk_widget_hide (GTK_WIDGET (data.forward_button));
 	
 	gtk_main ();
 	

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c	2008-03-28 15:12:05 UTC (rev 4264)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c	2008-03-28 15:29:14 UTC (rev 4265)
@@ -178,13 +178,7 @@
 
 	gboolean found_match = FALSE;
 	EContact *contact = NULL;
-	
-	/* Show forward button */
-	gtk_widget_show (GTK_WIDGET (data->forward_button));
 
-	gtk_widget_set_sensitive (GTK_WIDGET (data->delete_button), FALSE);
-	gtk_widget_set_sensitive (GTK_WIDGET (data->forward_button), FALSE);
-	
 	if (!open) return;
 	
 	/* Attach to scrolling signals so we can mark messages as read */
@@ -283,9 +277,6 @@
 {
 	GtkAdjustment *hadjust, *vadjust;
 
-	/* Hide forward button */
-	gtk_widget_hide (GTK_WIDGET (data->forward_button));
-
 	if (data->notes_scroll_idle) g_source_remove (data->notes_scroll_idle);
 	g_object_get (G_OBJECT (data->notes_treeview),
 		"hadjustment", &hadjust, "vadjustment", &vadjust, NULL);
@@ -811,7 +802,7 @@
 GtkWidget *
 sms_notes_page_new (SmsData *data)
 {
-	GtkWidget *scroll, *vbox, *notes_combo;
+	GtkWidget *scroll, *vbox, *notes_combo, *toolbar;
 	GtkCellRenderer *renderer;
 	GHashTable *colours_hash;
 	GtkIconTheme *icon_theme;
@@ -878,6 +869,29 @@
 		data->notes_treeview)), "changed",
 		G_CALLBACK (selection_changed_cb), data);
 	
+	/* create toolbar */
+	toolbar = gtk_toolbar_new ();
+	
+	/* Forward button */
+	data->forward_button = gtk_tool_button_new_from_stock (
+		MOKO_STOCK_MAIL_FORWARD);
+	gtk_tool_item_set_expand (data->forward_button, TRUE);
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data->forward_button, -1);
+	
+	/* Delete all button */
+	data->delete_all_button = gtk_tool_button_new_from_stock (
+		MOKO_STOCK_FOLDER_DELETE);
+	gtk_tool_item_set_expand (data->delete_all_button, TRUE);
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data->delete_all_button, -1);
+	gtk_widget_set_sensitive (GTK_WIDGET (data->delete_all_button), FALSE);
+	
+	/* Delete button */
+	data->delete_button = gtk_tool_button_new_from_stock (
+		GTK_STOCK_DELETE);
+	gtk_tool_item_set_expand (data->delete_button, TRUE);
+	gtk_toolbar_insert (GTK_TOOLBAR (toolbar), data->delete_button, -1);
+	gtk_widget_set_sensitive (GTK_WIDGET (data->delete_button), FALSE);
+	
 	/* Create search bar */
 	notes_combo = gtk_combo_box_new_text ();
 	gtk_combo_box_append_text (GTK_COMBO_BOX (notes_combo), "All");
@@ -899,6 +913,7 @@
 	gtk_container_add (GTK_CONTAINER (scroll), data->notes_treeview);
 	
 	vbox = gtk_vbox_new (FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), data->notes_search, FALSE, TRUE, 0);
 	gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0);
 	gtk_widget_show_all (vbox);

Modified: trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h
===================================================================
--- trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h	2008-03-28 15:12:05 UTC (rev 4264)
+++ trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h	2008-03-28 15:29:14 UTC (rev 4265)
@@ -26,6 +26,7 @@
 #include <dbus/dbus-glib.h>
 #include <dbus/dbus-glib-bindings.h>
 #include <libebook/e-book.h>
+#include <libmokoui2/moko-stock.h>
 
 typedef struct {
 	GList *unread;	/* List of JanaNote uids for unread messages */
@@ -57,6 +58,7 @@
 	GtkWidget *window;
 	GtkWidget *notebook;
 	GtkToolItem *new_button;
+	GtkToolItem *dial_button;
 	GtkToolItem *forward_button;
 	GtkToolItem *delete_all_button;
 	GtkToolItem *delete_button;





More information about the commitlog mailing list