~drbob/+junk/diary-main

« back to all changes in this revision

Viewing changes to src/main-window.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:
59
59
        gtk_calendar_get_date (diary->calendar, &year, &month, &day);
60
60
        month++;
61
61
 
62
 
        diary_storage_manager_set_entry (diary->storage_manager, year, month, day, entry_text);
63
 
        gtk_text_buffer_set_modified (diary->entry_buffer, FALSE);
64
 
 
65
 
        /* Mark the day on the calendar if the entry was non-empty
 
62
        /* Mark the day on the calendar if the entry was non-empty (and deleted)
66
63
         * and update the state of the add link button. */
67
 
        if (entry_text == NULL || entry_text[0] == '\0') {
 
64
        if (diary_storage_manager_set_entry (diary->storage_manager, year, month, day, entry_text) == FALSE) {
68
65
                gtk_calendar_unmark_day (diary->calendar, day);
69
66
 
70
67
                gtk_widget_set_sensitive (GTK_WIDGET (diary->add_button), FALSE);
76
73
                gtk_action_set_sensitive (diary->add_action, TRUE);
77
74
        }
78
75
 
 
76
        gtk_text_buffer_set_modified (diary->entry_buffer, FALSE);
79
77
        g_free (entry_text);
80
78
}
81
79
 
91
89
        g_assert (diary->entry_buffer != NULL);
92
90
        g_assert (gtk_text_buffer_get_char_count (diary->entry_buffer) != 0);
93
91
 
 
92
        /* Ensure that something is selected and its widgets displayed */
 
93
        g_signal_emit_by_name (diary->ald_type_combo_box, "changed", NULL, NULL);
94
94
        gtk_widget_show_all (diary->add_link_dialog);
 
95
 
95
96
        if (gtk_dialog_run (GTK_DIALOG (diary->add_link_dialog)) == GTK_RESPONSE_OK) {
96
97
                if (gtk_combo_box_get_active_iter (diary->ald_type_combo_box, &iter) == FALSE)
97
98
                        return;