~ubuntu-branches/ubuntu/quantal/gtkpod-aac/quantal

« back to all changes in this revision

Viewing changes to src/ipod_init.c

  • Committer: Bazaar Package Importer
  • Author(s): Steve Kowalik
  • Date: 2007-07-17 18:25:25 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070717182525-rhl5w4pk8lbk6pna
Tags: 0.99.10-2ubuntu1
* Resynchronise with gtkpod 0.9.10-2.
* Hack in dpatch support, since it was removed.
* Rename debian/patches/03-configure.dpatch to
  debian/patches/aac-configure.dpatch.
* Update debian/gtkpod-aac.diff.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* Time-stamp: <2006-09-17 16:11:25 jcs>
 
1
/* Time-stamp: <2007-06-19 22:52:52 jcs>
2
2
|
3
3
|  Copyright (C) 2002-2005 Jorg Schuler <jcsjcs at users sourceforge net>
4
4
|  Part of the gtkpod project.
24
24
25
25
|  This product is not supported/written/published by Apple!
26
26
|
27
 
|  $Id: ipod_init.c,v 1.7 2006/09/17 07:14:07 jcsjcs Exp $
 
27
|  $Id: ipod_init.c 1564 2007-06-19 13:54:47Z jcsjcs $
28
28
*/
29
29
 
30
30
/* This file provides functions to initialize a new iPod */
277
277
 
278
278
    /* If available set current model number, otherwise indicate that
279
279
       none is available */
280
 
    info = itdb_device_get_ipod_info (ii->itdb->device);
 
280
    /* If available set current model number, otherwise indicate that
 
281
       none is available */
 
282
    info = itdb_device_get_ipod_info (itdb->device);
281
283
    if (info && (info->ipod_generation != ITDB_IPOD_GENERATION_UNKNOWN))
282
284
    {
283
285
        g_snprintf (buf, PATH_MAX, "x%s", info->model_number);
284
286
    }
285
287
    else
286
288
    {
287
 
        g_snprintf (buf, PATH_MAX, "%s", gettext (SELECT_OR_ENTER_YOUR_MODEL));
 
289
        model = get_itdb_prefs_string (itdb, KEY_IPOD_MODEL);
 
290
        if (model && (strlen (g_strstrip (model)) != 0))
 
291
        {
 
292
            g_snprintf (buf, PATH_MAX, "%s", model);
 
293
            g_free (model);
 
294
        }
 
295
        else
 
296
        {
 
297
            g_snprintf (buf, PATH_MAX, "%s", gettext (SELECT_OR_ENTER_YOUR_MODEL));
 
298
        }
288
299
    }
289
300
    entry = GTK_ENTRY (gtk_bin_get_child(GTK_BIN (cb)));
290
301
    gtk_entry_set_text (entry, buf);
291
302
 
292
 
 
293
303
    response = gtk_dialog_run (GTK_DIALOG (ii->window));
294
304
 
295
305
    switch (response)
330
340
        }
331
341
        model = gtk_combo_box_get_active_text (
332
342
            GTK_COMBO_BOX (GET_WIDGET (MODEL_COMBO)));
333
 
        if (strcmp (model, gettext(SELECT_OR_ENTER_YOUR_MODEL)) == 0)
 
343
        if ((strcmp (model, gettext(SELECT_OR_ENTER_YOUR_MODEL)) == 0) ||
 
344
            (strlen (model) == 0))
334
345
        {   /* User didn't choose a model */
335
346
            g_free (model);
336
347
            model = NULL;
425
436
    }
426
437
    else
427
438
    {
428
 
        g_snprintf (buf, PATH_MAX, "%s", gettext (SELECT_OR_ENTER_YOUR_MODEL));
 
439
        model = get_itdb_prefs_string (itdb, KEY_IPOD_MODEL);
 
440
        if (model && (strlen (g_strstrip (model)) != 0))
 
441
        {
 
442
            g_snprintf (buf, PATH_MAX, "%s", model);
 
443
            g_free (model);
 
444
        }
 
445
        else
 
446
        {
 
447
            g_snprintf (buf, PATH_MAX, "%s", gettext (SELECT_OR_ENTER_YOUR_MODEL));
 
448
        }
429
449
    }
 
450
 
430
451
    entry = GTK_ENTRY (gtk_bin_get_child(GTK_BIN (cb)));
431
452
    gtk_entry_set_text (entry, buf);
432
453
 
433
 
 
434
454
    response = gtk_dialog_run (GTK_DIALOG (window));
435
455
 
436
456
    switch (response)
438
458
    case GTK_RESPONSE_OK:
439
459
        model = gtk_combo_box_get_active_text (
440
460
            GTK_COMBO_BOX (GET_WIDGET (MODEL_COMBO)));
441
 
        if (strcmp (model, gettext(SELECT_OR_ENTER_YOUR_MODEL)) == 0)
 
461
        if (!model)
 
462
        {
 
463
            gtkpod_warning (_("Could not determine the model you selected -- this could be a bug or incompatibilty in the GTK+ or glade library.\n\n"));
 
464
        }
 
465
        else if (strcmp (model, gettext(SELECT_OR_ENTER_YOUR_MODEL)) == 0)
442
466
        {   /* User didn't choose a model */
443
467
            g_free (model);
444
468
            model = NULL;