Changeset 3661
- Timestamp:
- 12/17/07 15:56:09 (5 years ago)
- Location:
- trunk/src/target/OM-2007.2/applications/openmoko-messages2
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
configure.ac (modified) (1 diff)
-
src/sms-contacts.c (modified) (2 diffs)
-
src/sms-notes.c (modified) (5 diffs)
-
src/sms.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/target/OM-2007.2/applications/openmoko-messages2/ChangeLog
r3660 r3661 1 2007-12-17 Chris Lord <chris@openedhand.com> 2 3 * configure.ac: 4 Add AC_GNU_SOURCE for strcasestr 5 6 * src/sms-contacts.c: 7 Include config.h first 8 9 * src/sms-notes.c: (search_toggled_cb), (search_text_changed_cb), 10 (search_combo_changed_cb), (notes_visible_func), 11 (sms_notes_page_new): 12 * src/sms.h: 13 Add notes filtering via search string 14 1 15 2007-12-17 Chris Lord <chris@openedhand.com> 2 16 -
trunk/src/target/OM-2007.2/applications/openmoko-messages2/configure.ac
r3475 r3661 10 10 AC_STDC_HEADERS 11 11 AC_PROG_LIBTOOL 12 AC_GNU_SOURCE 12 13 13 14 PKG_CHECK_MODULES(EBOOK, libebook-1.2) -
trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-contacts.c
r3660 r3661 18 18 */ 19 19 20 #ifdef HAVE_CONFIG_H 21 # include <config.h> 22 #endif 23 20 24 #include "sms-contacts.h" 21 25 #include "sms-utils.h" … … 23 27 #include <libmokoui2/moko-search-bar.h> 24 28 #include <string.h> 25 #ifdef HAVE_CONFIG_H26 # include <config.h>27 #endif28 29 29 30 static const gchar *clear_numbers_uid; -
trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms-notes.c
r3659 r3661 17 17 * Current Version: $Rev$ ($Date$) [$Author$] 18 18 */ 19 20 #ifdef HAVE_CONFIG_H 21 # include <config.h> 22 #endif 19 23 20 24 #include "sms-notes.h" … … 539 543 } 540 544 545 static void 546 search_toggled_cb (MokoSearchBar *bar, gboolean search_visible, SmsData *data) 547 { 548 gtk_tree_model_filter_refilter ( 549 GTK_TREE_MODEL_FILTER (data->note_filter)); 550 } 551 552 static void 553 search_text_changed_cb (MokoSearchBar *bar, GtkEditable *editable, 554 SmsData *data) 555 { 556 gtk_tree_model_filter_refilter ( 557 GTK_TREE_MODEL_FILTER (data->note_filter)); 558 } 559 560 static void 561 search_combo_changed_cb (MokoSearchBar *bar, GtkComboBox *combo_box, 562 SmsData *data) 563 { 564 gtk_tree_model_filter_refilter ( 565 GTK_TREE_MODEL_FILTER (data->note_filter)); 566 } 567 568 static 569 gboolean notes_visible_func (GtkTreeModel *model, GtkTreeIter *iter, 570 SmsData *data) 571 { 572 if (moko_search_bar_search_visible ( 573 MOKO_SEARCH_BAR (data->notes_search))) { 574 const gchar *search; 575 gboolean result; 576 gchar *body; 577 578 search = gtk_entry_get_text (moko_search_bar_get_entry ( 579 MOKO_SEARCH_BAR (data->notes_search))); 580 581 if ((!search) || (search[0] == '\0')) return TRUE; 582 583 /* Filter on search query */ 584 gtk_tree_model_get (model, iter, JANA_GTK_NOTE_STORE_COL_BODY, 585 &body, -1); 586 if (!body) return FALSE; 587 588 /* FIXME: Use a proper UTF-8 casefold comparison here */ 589 result = strcasestr (body, search) ? TRUE : FALSE; 590 g_free (body); 591 592 return result; 593 } else { 594 /* Filter on selected category */ 595 return TRUE; 596 } 597 } 598 541 599 GtkWidget * 542 600 sms_notes_page_new (SmsData *data) 543 601 { 544 GtkWidget *scroll, *vbox, * searchbar;602 GtkWidget *scroll, *vbox, *notes_combo; 545 603 GtkCellRenderer *renderer; 546 604 GHashTable *colours_hash; … … 564 622 data->note_store = jana_gtk_note_store_new (); 565 623 data->note_filter = gtk_tree_model_filter_new (data->note_store, NULL); 624 gtk_tree_model_filter_set_visible_func ((GtkTreeModelFilter *) 625 data->note_filter, (GtkTreeModelFilterVisibleFunc) 626 notes_visible_func, data, NULL); 566 627 567 628 /* Create a category-colour hash for the cell renderer */ … … 581 642 582 643 /* Create search bar */ 583 data->notes_combo = gtk_combo_box_new_text (); 584 searchbar = moko_search_bar_new_with_combo ( 585 GTK_COMBO_BOX (data->notes_combo)); 644 notes_combo = gtk_combo_box_new_text (); 645 data->notes_search = moko_search_bar_new_with_combo ( 646 GTK_COMBO_BOX (notes_combo)); 647 g_signal_connect (data->notes_search, "toggled", 648 G_CALLBACK (search_toggled_cb), data); 649 g_signal_connect (data->notes_search, "text_changed", 650 G_CALLBACK (search_text_changed_cb), data); 651 g_signal_connect (data->notes_search, "combo_changed", 652 G_CALLBACK (search_combo_changed_cb), data); 586 653 587 654 /* Pack widgets */ … … 590 657 591 658 vbox = gtk_vbox_new (FALSE, 0); 592 gtk_box_pack_start (GTK_BOX (vbox), searchbar, FALSE, TRUE, 0);659 gtk_box_pack_start (GTK_BOX (vbox), data->notes_search, FALSE, TRUE, 0); 593 660 gtk_box_pack_start (GTK_BOX (vbox), scroll, TRUE, TRUE, 0); 594 661 gtk_widget_show_all (vbox); -
trunk/src/target/OM-2007.2/applications/openmoko-messages2/src/sms.h
r3660 r3661 54 54 GtkToolItem *delete_button; 55 55 56 GtkWidget *notes_ combo;56 GtkWidget *notes_search; 57 57 GdkPixbuf *author_icon; 58 58 GdkPixbuf *recipient_icon;
Note: See TracChangeset
for help on using the changeset viewer.
