~drbob/+junk/diary-main

« back to all changes in this revision

Viewing changes to src/storage-manager.c

  • Committer: Philip Withnall
  • Date: 2008-04-19 22:45:18 UTC
  • Revision ID: philip@tecnocode.co.uk-20080419224518-25lzquwhgpbwyjbi
2008-04-19  Philip Withnall  <philip@tecnocode.co.uk>

        * src/main-window.c:
        * src/storage-manager.c: Make deletion of entries more robust, 
and
        fix display of the "Add Link" dialogue when opened for a second 
time.

Show diffs side-by-side

added added

removed removed

Lines of Context:
612
612
        return content;
613
613
}
614
614
 
 
615
/**
 
616
 * diary_storage_manager_set_entry:
 
617
 * @self: a #DiaryStorageManager
 
618
 * @year: the entry's year
 
619
 * @month: the entry's month
 
620
 * @day: the entry's day
 
621
 * @content: the content for the entry
 
622
 *
 
623
 * Saves the @content for the specified entry in the database. If
 
624
 * @content is empty or %NULL, it will ask if the user wants to delete
 
625
 * the entry for that date. It will return %TRUE if the content is
 
626
 * non-empty, and %FALSE otherwise.
 
627
 *
 
628
 * Return value: %TRUE if the entry non-empty
 
629
 **/
615
630
gboolean
616
631
diary_storage_manager_set_entry (DiaryStorageManager *self, GDateYear year, GDateMonth month, GDateDay day, const gchar *content)
617
632
{
643
658
                gtk_widget_show_all (dialog);
644
659
                if (gtk_dialog_run (GTK_DIALOG (dialog)) != GTK_RESPONSE_ACCEPT) {
645
660
                        gtk_widget_destroy (dialog);
646
 
                        return TRUE;
 
661
                        return FALSE;
647
662
                }
648
663
 
649
664
                diary_storage_manager_query_async (self, "DELETE FROM entries WHERE year = %u AND month = %u AND day = %u", NULL, NULL, year, month, day);
650
665
                gtk_widget_destroy (dialog);
 
666
 
 
667
                return FALSE;
651
668
        }
652
669
 
653
670
        diary_storage_manager_query_async (self, "REPLACE INTO entries (year, month, day, content) VALUES (%u, %u, %u, '%q')", NULL, NULL, year, month, day, content);