~ubuntu-branches/ubuntu/wily/asunder/wily

« back to all changes in this revision

Viewing changes to src/callbacks.c

  • Committer: Bazaar Package Importer
  • Author(s): Jens Peter Secher
  • Date: 2011-02-01 20:46:03 UTC
  • mto: This revision was merged to the branch mainline in revision 8.
  • Revision ID: james.westby@ubuntu.com-20110201204603-ucmfdf4gq39ql2p3
Tags: upstream-2.1
ImportĀ upstreamĀ versionĀ 2.1

Show diffs side-by-side

added added

removed removed

Lines of Context:
104
104
}
105
105
 
106
106
gboolean
 
107
on_year_focus_out_event        (GtkWidget       *widget,
 
108
                                        GdkEventFocus   *event,
 
109
                                        gpointer         user_data)
 
110
{
 
111
    const gchar * ctext = gtk_entry_get_text(GTK_ENTRY(widget));
 
112
    gchar * text = malloc(5);
 
113
    if (text == NULL)
 
114
        fatalError("malloc(5) failed. Out of memory.");
 
115
    strncpy(text, ctext, 5);
 
116
    text[4] = '\0';
 
117
    
 
118
    if((text[0] != '1' && text[0] != '2') || text[1] < '0' || text[1] > '9' ||
 
119
        text[2] < '0' || text[2] > '9' || text[3] < '0' || text[3] > '9')
 
120
    {
 
121
        sprintf(text, "1900");
 
122
    }
 
123
    
 
124
    gtk_entry_set_text(GTK_ENTRY(widget), text);
 
125
    
 
126
    free(text);
 
127
    return FALSE;
 
128
}
 
129
 
 
130
gboolean
107
131
on_album_title_focus_out_event         (GtkWidget       *widget,
108
132
                                        GdkEventFocus   *event,
109
133
                                        gpointer         user_data)