r1779 - in trunk/src/target/OM-2007/applications/openmoko-contacts: . src

thomas at sita.openmoko.org thomas at sita.openmoko.org
Mon Apr 16 14:23:51 CEST 2007


Author: thomas
Date: 2007-04-16 14:23:49 +0200 (Mon, 16 Apr 2007)
New Revision: 1779

Modified:
   trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
   trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c
   trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c
Log:
* src/contacts-groups-editor.c:
(contacts_groups_pane_update_selection), (contacts_groups_new_cb):
* src/contacts-omoko.c: (add_menu_item),
(contacts_ui_update_groups_list):

Add a "No Groups" message to the details pane when there are no groups defined


Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog	2007-04-15 22:02:23 UTC (rev 1778)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/ChangeLog	2007-04-16 12:23:49 UTC (rev 1779)
@@ -1,3 +1,12 @@
+2007-04-16  Thomas Wood  <thomas at openedhand.com>
+
+	* src/contacts-groups-editor.c:
+	(contacts_groups_pane_update_selection), (contacts_groups_new_cb):
+	* src/contacts-omoko.c: (add_menu_item),
+	(contacts_ui_update_groups_list):
+
+	Add a "No Groups" message to the details pane when there are no groups defined
+
 2007-04-13  Thomas Wood  <thomas at openedhand.com>
 
 	* src/contacts-callbacks-ui.c: (contacts_selection_cb): Don't try to commit a

Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c	2007-04-15 22:02:23 UTC (rev 1778)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-groups-editor.c	2007-04-16 12:23:49 UTC (rev 1779)
@@ -85,6 +85,12 @@
 
 }
 
+static void
+container_remove (GtkWidget *child, GtkWidget *container)
+{
+	gtk_container_remove (GTK_CONTAINER (container), child);
+}
+
 void
 contacts_groups_new_cb (GtkWidget *button, ContactsData *data)
 {
@@ -116,6 +122,10 @@
 	if (!text || !strcmp (text, ""))
 		return;
 
+	/* if there were no previous groups, remove the "no groups" label */
+	if (g_list_length (data->contacts_groups) == 0)
+		gtk_container_foreach (GTK_CONTAINER (data->ui->groups_vbox), (GtkCallback) container_remove, data->ui->groups_vbox);
+
 	/* add the group to the list of groups */
 	if (!g_list_find_custom (data->contacts_groups, text, (GCompareFunc) strcmp))
 		data->contacts_groups = g_list_append (data->contacts_groups, text);

Modified: trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c
===================================================================
--- trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c	2007-04-15 22:02:23 UTC (rev 1778)
+++ trunk/src/target/OM-2007/applications/openmoko-contacts/src/contacts-omoko.c	2007-04-16 12:23:49 UTC (rev 1779)
@@ -269,6 +269,12 @@
 	gtk_menu_shell_append (GTK_MENU_SHELL (menu), gtk_menu_item_new_with_label (group));
 }
 
+static void
+container_remove (GtkWidget *child, GtkWidget *container)
+{
+	gtk_container_remove (GTK_CONTAINER (container), child);
+}
+
 void
 contacts_ui_update_groups_list (ContactsData *data)
 {
@@ -292,6 +298,14 @@
 	/* add group editor checkboxes */
 	GtkWidget *widget;
 	GList *cur;
+
+	if (g_list_length (data->contacts_groups) == 0)
+		gtk_box_pack_start (GTK_BOX (data->ui->groups_vbox), gtk_label_new (_("No Groups")), TRUE, TRUE, 0);
+	else if (g_hash_table_size (data->groups_widgets_hash) == 0)
+		/* there are groups defined, but no checkboxes yet, so make sure the pane is
+		 * empty */
+		gtk_container_foreach (GTK_CONTAINER (data->ui->groups_vbox), (GtkCallback) container_remove, data->ui->groups_vbox);
+
 	for (cur = data->contacts_groups; cur; cur = g_list_next (cur))
 	{
 		if (g_hash_table_lookup (data->groups_widgets_hash, cur->data))





More information about the commitlog mailing list