Changeset 89


Ignore:
Timestamp:
Feb 5, 2006, 5:33:57 PM (15 years ago)
Author:
joshe
Message:

Rewrite error messages to be less unnecessarily verbose.
Only allow one instance of the preference window at a time.
Beat the dialogs with the GNOME HiG stick.
Handle missing .torrent files on startup better.

Location:
trunk/gtk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/conf.c

    r88 r89  
    7171  if(0 > (fd = open(file, O_RDWR | O_CREAT, 0666))) {
    7272    savederr = errno;
    73     *errstr = g_strdup_printf(
    74       _("An error occurred while opening the file %s for writing:\n%s"),
     73    *errstr = g_strdup_printf(_("Failed to open the file %s for writing:\n%s"),
    7574      file, strerror(errno));
    7675    errno = savederr;
     
    8988                                g_get_application_name());
    9089    else
    91       *errstr = g_strdup_printf(
    92         _("An error occurred while locking the file %s:\n%s"),
     90      *errstr = g_strdup_printf(_("Failed to lock the file %s:\n%s"),
    9391        file, strerror(errno));
    9492    close(fd);
     
    109107  if(0 > stat(dir, &sb)) {
    110108    if(ENOENT != errno)
    111       *errstr = g_strdup_printf(
    112         _("An error occurred while checking the directory %s:\n%s"),
     109      *errstr = g_strdup_printf(_("Failed to check the directory %s:\n%s"),
    113110        dir, strerror(errno));
    114111    else {
     
    116113        return TRUE;
    117114      else
    118         *errstr = g_strdup_printf(
    119           _("An error occurred while creating the directory %s:\n%s"),
     115        *errstr = g_strdup_printf(_("Failed to create the directory %s:\n%s"),
    120116          dir, strerror(errno));
    121117    }
     
    161157    if(!g_error_matches(err, G_FILE_ERROR, G_FILE_ERROR_NOENT))
    162158      *errstr = g_strdup_printf(
    163         _("An error occurred while opening the file %s for reading:\n%s"),
    164         path, err->message);
     159        _("Failed to open the file %s for reading:\n%s"), path, err->message);
    165160    goto done;
    166161  }
     
    173168      case G_IO_STATUS_ERROR:
    174169        *errstr = g_strdup_printf(
    175           _("An error occurred while reading from the file %s:\n%s"),
    176           path, err->message);
     170          _("Error while reading from the file %s:\n%s"), path, err->message);
    177171        goto done;
    178172      case G_IO_STATUS_NORMAL:
     
    237231  if(0 > (fd = lockfile(tmpfile, errstr))) {
    238232    g_free(errstr);
    239     *errstr = g_strdup_printf(
    240       _("An error occurred while opening or locking the file %s:\n%s"),
    241       tmpfile, strerror(errno));
     233    *errstr = g_strdup_printf(_("Failed to open or lock the file %s:\n%s"),
     234                              tmpfile, strerror(errno));
    242235    goto done;
    243236  }
     
    258251  if(NULL != info.err ||
    259252     G_IO_STATUS_ERROR == g_io_channel_shutdown(io, TRUE, &info.err)) {
    260     *errstr = g_strdup_printf(
    261       _("An error occurred while writing to the file %s:\n%s"),
    262       tmpfile, info.err->message);
     253    *errstr = g_strdup_printf(_("Error while writing to the file %s:\n%s"),
     254                              tmpfile, info.err->message);
    263255    g_error_free(info.err);
    264256    goto done;
     
    266258
    267259  if(0 > rename(tmpfile, file)) {
    268     *errstr = g_strdup_printf(
    269       _("An error occurred while renaming the file %s to %s:\n%s"),
    270       tmpfile, file, strerror(errno));
     260    *errstr = g_strdup_printf(_("Failed to rename the file %s to %s:\n%s"),
     261                              tmpfile, file, strerror(errno));
    271262    goto done;
    272263  }
     
    329320    if(!g_error_matches(err, G_FILE_ERROR, G_FILE_ERROR_NOENT))
    330321      *errstr = g_strdup_printf(
    331         _("An error occurred while opening the file %s for reading:\n%s"),
    332         path, err->message);
     322        _("Failed to open the file %s for reading:\n%s"), path, err->message);
    333323    goto done;
    334324  }
     
    341331      case G_IO_STATUS_ERROR:
    342332        *errstr = g_strdup_printf(
    343           _("An error occurred while reading from the file %s:\n%s"),
    344           path, err->message);
     333          _("Error while reading from the file %s:\n%s"), path, err->message);
    345334        goto done;
    346335      case G_IO_STATUS_NORMAL:
     
    440429  if(0 > (fd = lockfile(tmpfile, errstr))) {
    441430    g_free(errstr);
    442     *errstr = g_strdup_printf(
    443       _("An error occurred while opening or locking the file %s:\n%s"),
    444       tmpfile, strerror(errno));
     431    *errstr = g_strdup_printf(_("Failed to open or lock the file %s:\n%s"),
     432                              tmpfile, strerror(errno));
    445433    goto done;
    446434  }
     
    481469  if(NULL != err ||
    482470     G_IO_STATUS_ERROR == g_io_channel_shutdown(io, TRUE, &err)) {
    483     *errstr = g_strdup_printf(
    484       _("An error occurred while writing to the file %s:\n%s"),
    485       tmpfile, err->message);
     471    *errstr = g_strdup_printf(_("Error while writing to the file %s:\n%s"),
     472                              tmpfile, err->message);
    486473    g_error_free(err);
    487474    goto done;
     
    489476
    490477  if(0 > rename(tmpfile, file)) {
    491     *errstr = g_strdup_printf(
    492       _("An error occurred while renaming the file %s to %s:\n%s"),
    493       tmpfile, file, strerror(errno));
     478    *errstr = g_strdup_printf(_("Failed to rename the file %s to %s:\n%s"),
     479                              tmpfile, file, strerror(errno));
    494480    goto done;
    495481  }
  • trunk/gtk/dialogs.c

    r86 r89  
    6060
    6161static void
     62windclosed(GtkWidget *widget SHUTUP, gpointer gdata);
     63static void
    6264clicklimitbox(GtkWidget *widget, gpointer gdata);
    6365static void
     
    7173
    7274void
    73 makeprefwindow(GtkWindow *parent, tr_handle_t *tr) {
     75makeprefwindow(GtkWindow *parent, tr_handle_t *tr, gboolean *opened) {
    7476  char *title = g_strdup_printf(_("%s Preferences"), g_get_application_name());
    7577  GtkWidget *wind = gtk_dialog_new_with_buttons(title, parent,
     
    7981  GtkWidget *table = gtk_table_new(4, 2, FALSE);
    8082  GtkWidget *portnum = gtk_spin_button_new_with_range(1, 0xffff, 1);
    81   GtkWidget *limitbox = gtk_check_button_new_with_label(_("Limit upload speed"));
     83  GtkWidget *limitbox = gtk_check_button_new_with_mnemonic(
     84    _("_Limit upload speed"));
    8285  GtkWidget *limitnum = gtk_spin_button_new_with_range(0, G_MAXLONG, 1);
    83   GtkWidget *dirstr = gtk_file_chooser_button_new(_("Choose download directory"),
     86  GtkWidget *dirstr = gtk_file_chooser_button_new(
     87    _("Choose download directory"),
    8488    GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
    8589  GtkWidget *label;
     
    8892  struct prefdata *data = g_new0(struct prefdata, 1);
    8993
     94  *opened = TRUE;
     95
    9096  g_free(title);
     97  gtk_widget_set_name(wind, "TransmissionDialog");
    9198  gtk_table_set_col_spacings(GTK_TABLE(table), 12);
    9299  gtk_table_set_row_spacings(GTK_TABLE(table), 12);
    93100  gtk_dialog_set_default_response(GTK_DIALOG(wind), GTK_RESPONSE_OK);
    94   gtk_container_set_border_width(GTK_CONTAINER(table), 12);
     101  gtk_container_set_border_width(GTK_CONTAINER(table), 6);
     102  gtk_window_set_resizable(GTK_WINDOW(wind), FALSE);
    95103
    96104  data->port = GTK_SPIN_BUTTON(portnum);
     
    100108  data->parent = parent;
    101109  data->tr = tr;
    102 
    103   /* port label and entry */
    104   label = gtk_label_new(_("Listening port:"));
    105   gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
    106   pref = cf_getpref(PREF_PORT);
    107   gtk_spin_button_set_value(GTK_SPIN_BUTTON(portnum),
    108     (NULL == pref ? TR_DEFAULT_PORT : strtol(pref, NULL, 10)));
    109   gtk_table_attach_defaults(GTK_TABLE(table), label,            0, 1, 0, 1);
    110   gtk_table_attach_defaults(GTK_TABLE(table), portnum,          1, 2, 0, 1);
    111110
    112111  /* limit checkbox */
     
    117116  g_signal_connect_data(limitbox, "clicked", G_CALLBACK(clicklimitbox),
    118117                        array, (GClosureNotify)g_free, 0);
    119   gtk_table_attach_defaults(GTK_TABLE(table), limitbox,         0, 2, 1, 2);
     118  gtk_table_attach_defaults(GTK_TABLE(table), limitbox,         0, 2, 0, 1);
    120119
    121120  /* limit label and entry */
    122   label = gtk_label_new(_("Maximum upload speed:"));
    123   gtk_misc_set_alignment(GTK_MISC(label), 0, 1.0/3.0);
     121  label = gtk_label_new_with_mnemonic(_("Maximum _upload speed:"));
     122  gtk_label_set_mnemonic_widget(GTK_LABEL(label), limitnum);
     123  gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
    124124  pref = cf_getpref(PREF_LIMIT);
     125  gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(limitnum), TRUE);
    125126  gtk_spin_button_set_value(GTK_SPIN_BUTTON(limitnum),
    126127    (NULL == pref ? DEFAULT_UPLIMIT : strtol(pref,NULL,10)));
    127   gtk_table_attach_defaults(GTK_TABLE(table), label,            0, 1, 2, 3);
    128   gtk_table_attach_defaults(GTK_TABLE(table), limitnum,         1, 2, 2, 3);
     128  gtk_table_attach_defaults(GTK_TABLE(table), label,            0, 1, 1, 2);
     129  gtk_table_attach_defaults(GTK_TABLE(table), limitnum,         1, 2, 1, 2);
    129130  array[0] = label;
    130131  array[1] = limitnum;
     
    132133
    133134  /* directory label and chooser */
    134   label = gtk_label_new(_("Download Directory:"));
     135  label = gtk_label_new_with_mnemonic(_("_Download directory:"));
     136  gtk_label_set_mnemonic_widget(GTK_LABEL(label), dirstr);
    135137  gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
    136138  if(NULL != (pref = cf_getpref(PREF_DIR)))
    137139    gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(dirstr), pref);
     140  gtk_table_attach_defaults(GTK_TABLE(table), label,            0, 1, 2, 3);
     141  gtk_table_attach_defaults(GTK_TABLE(table), dirstr,           1, 2, 2, 3);
     142
     143  /* port label and entry */
     144  label = gtk_label_new_with_mnemonic(_("Listening _port:"));
     145  gtk_label_set_mnemonic_widget(GTK_LABEL(label), portnum);
     146  gtk_misc_set_alignment(GTK_MISC(label), 0, .5);
     147  pref = cf_getpref(PREF_PORT);
     148  gtk_spin_button_set_numeric(GTK_SPIN_BUTTON(portnum), TRUE);
     149  gtk_spin_button_set_value(GTK_SPIN_BUTTON(portnum),
     150    (NULL == pref ? TR_DEFAULT_PORT : strtol(pref, NULL, 10)));
    138151  gtk_table_attach_defaults(GTK_TABLE(table), label,            0, 1, 3, 4);
    139   gtk_table_attach_defaults(GTK_TABLE(table), dirstr,           1, 2, 3, 4);
     152  gtk_table_attach_defaults(GTK_TABLE(table), portnum,          1, 2, 3, 4);
    140153
    141154  gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(wind)->vbox), table);
    142155  g_signal_connect_data(wind, "response", G_CALLBACK(clickdialog),
    143156                        data, (GClosureNotify)g_free, 0);
     157  g_signal_connect(wind, "destroy", G_CALLBACK(windclosed), opened);
    144158  gtk_widget_show_all(wind);
     159}
     160
     161static void
     162windclosed(GtkWidget *widget SHUTUP, gpointer gdata) {
     163  gboolean *preachy_gcc = gdata;
     164 
     165  *preachy_gcc = FALSE;
    145166}
    146167
     
    163184  gboolean boolval;
    164185
    165   if(GTK_RESPONSE_OK == resp) {
     186  if(GTK_RESPONSE_APPLY == resp || GTK_RESPONSE_OK == resp) {
    166187    /* check directory */
    167188    if(NULL != (strval = gtk_file_chooser_get_current_folder(data->dir))) {
    168189      if(!mkdir_p(strval, 0777)) {
    169190        errmsg(data->parent,
    170                _("An error occurred while creating the directory %s:\n%s"),
     191               _("Failed to create the directory %s:\n%s"),
    171192               strval, strerror(errno));
    172193        return;
     
    203224  }
    204225
    205   gtk_widget_destroy(widget);
     226  if(GTK_RESPONSE_APPLY != resp)
     227    gtk_widget_destroy(widget);
    206228}
    207229
     
    227249  GtkWidget *vbox = gtk_vbox_new(FALSE, 3);
    228250  GtkWidget *bbox = gtk_hbutton_box_new();
    229   GtkWidget *autocheck = gtk_check_button_new_with_label(
    230     _("Automatically start torrent"));
    231   GtkWidget *dircheck = gtk_check_button_new_with_label(
    232     _("Use alternate download directory"));
     251  GtkWidget *autocheck = gtk_check_button_new_with_mnemonic(
     252    _("Automatically _start torrent"));
     253  GtkWidget *dircheck = gtk_check_button_new_with_mnemonic(
     254    _("Use alternate _download directory"));
    233255  GtkFileFilter *filter = gtk_file_filter_new();
    234256  GtkFileFilter *unfilter = gtk_file_filter_new();
     
    247269  data->altbox = GTK_BUTTON_BOX(bbox);
    248270
    249   gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_START);
     271  gtk_button_box_set_layout(GTK_BUTTON_BOX(bbox), GTK_BUTTONBOX_EDGE);
    250272  gtk_box_pack_start_defaults(GTK_BOX(bbox), dircheck);
    251273  gtk_box_pack_start_defaults(GTK_BOX(bbox), getdir);
     
    259281
    260282  gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dircheck), FALSE);
     283  gtk_widget_set_sensitive(getdir, FALSE);
    261284
    262285  gtk_file_filter_set_name(filter, _("Torrent files"));
     
    275298
    276299  gtk_widget_show_all(wind);
    277   gtk_widget_hide(getdir);
    278300}
    279301
     
    290312
    291313  data->usingaltdir = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
    292   gtk_button_box_set_layout(data->altbox,
    293     (data->usingaltdir ? GTK_BUTTONBOX_EDGE : GTK_BUTTONBOX_START));
    294   if(data->usingaltdir)
    295     gtk_widget_show(GTK_WIDGET(data->altdir));
    296   else
    297     gtk_widget_hide(GTK_WIDGET(data->altdir));
     314  gtk_widget_set_sensitive(GTK_WIDGET(data->altdir), data->usingaltdir);
    298315}
    299316
     
    311328    for(ii = files; NULL != ii; ii = ii->next)
    312329      if(data->addfunc(data->tr, data->parent, ii->data, dir,
    313                        !data->autostart))
     330                       !data->autostart, NULL))
    314331        added = TRUE;
    315332    if(added)
     
    330347    gtk_table_attach_defaults(GTK_TABLE(tab), wid, 0, 1, ii, ii + 1); \
    331348    wid = gtk_label_new(val); \
     349    gtk_label_set_selectable(GTK_LABEL(wid), TRUE); \
    332350    gtk_misc_set_alignment(GTK_MISC(wid), 0, .5); \
    333351    gtk_table_attach_defaults(GTK_TABLE(tab), wid, 1, 2, ii, ii + 1); \
    334352    ii++; \
    335353    g_free(txt); \
    336   } while(0);
     354  } while(0)
    337355
    338356#define INFOLINEF(tab, ii, fmt, nam, val) \
     
    341359    INFOLINE(tab, ii, nam, buf); \
    342360    g_free(buf); \
    343   } while(0);
     361  } while(0)
    344362
    345363#define INFOLINEA(tab, ii, nam, val) \
     
    348366    INFOLINE(tab, ii, nam, buf); \
    349367    g_free(buf); \
    350   } while(0);
     368  } while(0)
    351369
    352370#define INFOSEP(tab, ii) \
     
    355373    gtk_table_attach_defaults(GTK_TABLE(tab), wid, 0, 2, ii, ii + 1); \
    356374    ii++; \
    357   } while(0);
     375  } while(0)
    358376
    359377void
    360378makeinfowind(GtkWindow *parent, tr_handle_t *tr, int id) {
    361379  tr_stat_t *sb;
    362   GtkWidget *wind, *table, *label;
     380  GtkWidget *wind, *label;
    363381  int ii;
    364382  char *str;
    365383  const int rowcount = 12;
     384  GtkWidget *table = gtk_table_new(rowcount, 2, FALSE);
    366385
    367386  /* XXX would be nice to be able to stat just one */
     
    374393  g_free(str);
    375394
    376   table = gtk_table_new(rowcount, 2, FALSE);
     395  gtk_widget_set_name(wind, "TransmissionDialog");
    377396  gtk_table_set_col_spacings(GTK_TABLE(table), 12);
    378397  gtk_table_set_row_spacings(GTK_TABLE(table), 12);
     398  gtk_dialog_set_default_response(GTK_DIALOG(wind), GTK_RESPONSE_ACCEPT);
     399  gtk_container_set_border_width(GTK_CONTAINER(table), 6);
     400  gtk_window_set_resizable(GTK_WINDOW(wind), FALSE);
    379401
    380402  label = gtk_label_new(NULL);
     403  gtk_label_set_selectable(GTK_LABEL(label), TRUE);
    381404  str = g_markup_printf_escaped("<big>%s</big>", sb[id].info.name);
    382405  gtk_label_set_markup(GTK_LABEL(label), str);
     
    388411  INFOSEP(table, ii);
    389412
    390   INFOLINEA(table, ii, _("Tracker:"), g_strdup_printf("http://%s:%i",
    391             sb[id].info.trackerAddress, sb[id].info.trackerPort));
     413  if(80 == sb[id].info.trackerPort)
     414    INFOLINEA(table, ii, _("Tracker:"), g_strdup_printf("http://%s",
     415              sb[id].info.trackerAddress));
     416  else
     417    INFOLINEA(table, ii, _("Tracker:"), g_strdup_printf("http://%s:%i",
     418              sb[id].info.trackerAddress, sb[id].info.trackerPort));
    392419  INFOLINE(table, ii, _("Announce:"), sb[id].info.trackerAnnounce);
    393420  INFOLINEA(table, ii, _("Piece Size:"), readablesize(sb[id].info.pieceSize, 1));
     
    405432  assert(rowcount == ii);
    406433
    407   gtk_container_set_border_width(GTK_CONTAINER(table), 12);
    408434  gtk_box_pack_start_defaults(GTK_BOX(GTK_DIALOG(wind)->vbox), table);
    409435  g_signal_connect(G_OBJECT(wind), "response",
  • trunk/gtk/dialogs.h

    r70 r89  
    3838#define DEFAULT_UPLIMIT         20
    3939
    40 typedef gboolean (*add_torrent_func_t)(tr_handle_t*, GtkWindow*, const char*, const char *, gboolean);
     40typedef gboolean (*add_torrent_func_t)(tr_handle_t*, GtkWindow*, const char*, const char *, gboolean, GList **);
    4141typedef void (*torrents_added_func_t)(void *);
    4242
    4343void
    44 makeprefwindow(GtkWindow *parent, tr_handle_t *tr);
     44makeprefwindow(GtkWindow *parent, tr_handle_t *tr, gboolean *opened);
    4545
    4646/* set the upload limit based on saved prefs */
  • trunk/gtk/main.c

    r86 r89  
    5555  GtkWidget **buttons;
    5656  guint timer;
     57  gboolean prefsopen;
    5758};
    5859
     
    118119gboolean
    119120addtorrent(tr_handle_t *tr, GtkWindow *parentwind, const char *torrent,
    120            const char *dir, gboolean paused);
     121           const char *dir, gboolean paused, GList **errs);
    121122void
    122123addedtorrents(void *vdata);
     
    183184  setuphandlers(stoptransmission, tr);
    184185
     186  gtk_rc_parse_string(
     187    "style \"transmission-standard\" {\n"
     188    " GtkDialog::action-area-border = 6\n"
     189    " GtkDialog::button-spacing = 12\n"
     190    " GtkDialog::content-area-border = 6\n"
     191    "}\n"
     192    "widget \"TransmissionDialog\" style \"transmission-standard\"\n");
     193
    185194  if(cf_init(tr_getPrefsDirectory(), &err)) {
    186195    if(cf_lock(&err)) {
     
    255264  GtkWidget *list;
    256265  GtkRequisition req;
    257   GList *ii;
     266  GList *loaderrs, *ii;
    258267  struct cf_torrentstate *ts;
    259268  gint height;
     269  char *str;
    260270
    261271  data->tr = tr;
     
    267277  data->bar = GTK_STATUSBAR(status);
    268278  data->buttons = NULL;
     279  data->prefsopen = FALSE;
    269280
    270281  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER,
     
    284295  g_signal_connect(G_OBJECT(wind), "delete_event", G_CALLBACK(winclose), data);
    285296
     297  loaderrs = NULL;
    286298  for(ii = g_list_first(saved); NULL != ii; ii = ii->next) {
    287299    ts = ii->data;
    288     addtorrent(tr, GTK_WINDOW(wind),
    289                ts->ts_torrent, ts->ts_directory, ts->ts_paused);
     300    addtorrent(tr, GTK_WINDOW(wind), ts->ts_torrent, ts->ts_directory,
     301               ts->ts_paused, &loaderrs);
    290302    cf_freestate(ts);
    291303  }
    292304  g_list_free(saved);
     305
     306  if(NULL != loaderrs) {
     307    str = joinstrlist(loaderrs, "\n");
     308    errmsg(GTK_WINDOW(wind), ngettext("Failed to load the torrent file %s",
     309                                      "Failed to load the torrent files:\n%s",
     310                                      g_list_length(loaderrs)), str);
     311    g_list_foreach(loaderrs, (GFunc)g_free, NULL);
     312    g_list_free(loaderrs);
     313    g_free(str);
     314    savetorrents(tr, GTK_WINDOW(wind), -1, NULL);
     315  }
    293316
    294317  data->timer = g_timeout_add(500, updatemodel, data);
     
    808831      return;
    809832    case ACT_PREF:
    810       makeprefwindow(data->wind, data->tr);
     833      if(!data->prefsopen)
     834        makeprefwindow(data->wind, data->tr, &data->prefsopen);
    811835      return;
    812836    default:
     
    916940gboolean
    917941addtorrent(tr_handle_t *tr, GtkWindow *parentwind, const char *torrent,
    918            const char *dir, gboolean paused) {
     942           const char *dir, gboolean paused, GList **errs) {
    919943  char *wd;
    920944
    921945  if(NULL == dir && NULL != (dir = cf_getpref(PREF_DIR))) {
    922946    if(!mkdir_p(dir, 0777)) {
    923       errmsg(parentwind,
    924              _("An error occurred while creating directory %s:\n%s"),
     947      errmsg(parentwind, _("Failed to create the directory %s:\n%s"),
    925948             dir, strerror(errno));
    926949      return FALSE;
     
    933956    unblocksigs();
    934957    /* XXX would be nice to have errno strings, are they printed to stdout? */
    935     errmsg(parentwind,
    936            _("An error occurred while opening the torrent file %s"), torrent);
     958    if(NULL == errs)
     959      errmsg(parentwind, _("Failed to load the torrent file %s"), torrent);
     960    else
     961      *errs = g_list_append(*errs, g_strdup(torrent));
    937962    return FALSE;
    938963  }
  • trunk/gtk/po/transmission-gtk.pot

    r86 r89  
    99"Project-Id-Version: PACKAGE VERSION\n"
    1010"Report-Msgid-Bugs-To: \n"
    11 "POT-Creation-Date: 2006-02-04 11:17-0500\n"
     11"POT-Creation-Date: 2006-02-05 12:27-0500\n"
    1212"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1313"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
     
    1818"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
    1919
    20 #: conf.c:74
    21 #, c-format
    22 msgid ""
    23 "An error occurred while opening the file %s for writing:\n"
    24 "%s"
    25 msgstr ""
    26 
    27 #: conf.c:88
     20#: conf.c:73
     21#, c-format
     22msgid ""
     23"Failed to open the file %s for writing:\n"
     24"%s"
     25msgstr ""
     26
     27#: conf.c:87
    2828#, c-format
    2929msgid "Another copy of %s is already running."
    3030msgstr ""
    3131
    32 #: conf.c:92
    33 #, c-format
    34 msgid ""
    35 "An error occurred while locking the file %s:\n"
    36 "%s"
    37 msgstr ""
    38 
    39 #: conf.c:112
    40 #, c-format
    41 msgid ""
    42 "An error occurred while checking the directory %s:\n"
    43 "%s"
    44 msgstr ""
    45 
    46 #: conf.c:119 dialogs.c:170
    47 #, c-format
    48 msgid ""
    49 "An error occurred while creating the directory %s:\n"
    50 "%s"
    51 msgstr ""
    52 
    53 #: conf.c:128
     32#: conf.c:90
     33#, c-format
     34msgid ""
     35"Failed to lock the file %s:\n"
     36"%s"
     37msgstr ""
     38
     39#: conf.c:109
     40#, c-format
     41msgid ""
     42"Failed to check the directory %s:\n"
     43"%s"
     44msgstr ""
     45
     46#: conf.c:115 dialogs.c:191 main.c:947
     47#, c-format
     48msgid ""
     49"Failed to create the directory %s:\n"
     50"%s"
     51msgstr ""
     52
     53#: conf.c:124
    5454#, c-format
    5555msgid "%s is not a directory"
    5656msgstr ""
    5757
    58 #: conf.c:163 conf.c:331
    59 #, c-format
    60 msgid ""
    61 "An error occurred while opening the file %s for reading:\n"
    62 "%s"
    63 msgstr ""
    64 
    65 #: conf.c:175 conf.c:343
    66 #, c-format
    67 msgid ""
    68 "An error occurred while reading from the file %s:\n"
    69 "%s"
    70 msgstr ""
    71 
    72 #: conf.c:240 conf.c:443
    73 #, c-format
    74 msgid ""
    75 "An error occurred while opening or locking the file %s:\n"
    76 "%s"
    77 msgstr ""
    78 
    79 #: conf.c:261 conf.c:484
    80 #, c-format
    81 msgid ""
    82 "An error occurred while writing to the file %s:\n"
    83 "%s"
    84 msgstr ""
    85 
    86 #: conf.c:269 conf.c:492
    87 #, c-format
    88 msgid ""
    89 "An error occurred while renaming the file %s to %s:\n"
    90 "%s"
    91 msgstr ""
    92 
    93 #: dialogs.c:74
     58#: conf.c:159 conf.c:322
     59#, c-format
     60msgid ""
     61"Failed to open the file %s for reading:\n"
     62"%s"
     63msgstr ""
     64
     65#: conf.c:170 conf.c:333
     66#, c-format
     67msgid ""
     68"Error while reading from the file %s:\n"
     69"%s"
     70msgstr ""
     71
     72#: conf.c:233 conf.c:431
     73#, c-format
     74msgid ""
     75"Failed to open or lock the file %s:\n"
     76"%s"
     77msgstr ""
     78
     79#: conf.c:253 conf.c:471
     80#, c-format
     81msgid ""
     82"Error while writing to the file %s:\n"
     83"%s"
     84msgstr ""
     85
     86#: conf.c:260 conf.c:478
     87#, c-format
     88msgid ""
     89"Failed to rename the file %s to %s:\n"
     90"%s"
     91msgstr ""
     92
     93#: dialogs.c:76
    9494#, c-format
    9595msgid "%s Preferences"
    9696msgstr ""
    9797
    98 #: dialogs.c:81
    99 msgid "Limit upload speed"
    100 msgstr ""
    101 
    102 #: dialogs.c:83
     98#: dialogs.c:84
     99msgid "_Limit upload speed"
     100msgstr ""
     101
     102#: dialogs.c:87
    103103msgid "Choose download directory"
    104104msgstr ""
    105105
     106#. limit label and entry
     107#: dialogs.c:121
     108msgid "Maximum _upload speed:"
     109msgstr ""
     110
     111#. directory label and chooser
     112#: dialogs.c:135
     113msgid "_Download directory:"
     114msgstr ""
     115
    106116#. port label and entry
    107 #: dialogs.c:104
    108 msgid "Listening port:"
    109 msgstr ""
    110 
    111 #. limit label and entry
    112 #: dialogs.c:122
    113 msgid "Maximum upload speed:"
    114 msgstr ""
    115 
    116 #. directory label and chooser
    117 #: dialogs.c:134
    118 msgid "Download Directory:"
    119 msgstr ""
    120 
    121 #: dialogs.c:223
     117#: dialogs.c:144
     118msgid "Listening _port:"
     119msgstr ""
     120
     121#: dialogs.c:245
    122122msgid "Add a Torrent"
    123123msgstr ""
    124124
    125 #: dialogs.c:230
    126 msgid "Automatically start torrent"
    127 msgstr ""
    128 
    129 #: dialogs.c:232
    130 msgid "Use alternate download directory"
    131 msgstr ""
    132 
    133 #: dialogs.c:236
     125#: dialogs.c:252
     126msgid "Automatically _start torrent"
     127msgstr ""
     128
     129#: dialogs.c:254
     130msgid "Use alternate _download directory"
     131msgstr ""
     132
     133#: dialogs.c:258
    134134msgid "Choose a download directory"
    135135msgstr ""
    136136
    137 #: dialogs.c:262
     137#: dialogs.c:285
    138138msgid "Torrent files"
    139139msgstr ""
    140140
    141 #: dialogs.c:264
     141#: dialogs.c:287
    142142msgid "All files"
    143143msgstr ""
    144144
    145 #: dialogs.c:370
     145#: dialogs.c:389
    146146#, c-format
    147147msgid "%s Properties"
    148148msgstr ""
    149149
    150 #: dialogs.c:390
     150#: dialogs.c:414 dialogs.c:417
    151151msgid "Tracker:"
    152152msgstr ""
    153153
    154 #: dialogs.c:392
     154#: dialogs.c:419
    155155msgid "Announce:"
    156156msgstr ""
    157157
    158 #: dialogs.c:393
     158#: dialogs.c:420
    159159msgid "Piece Size:"
    160160msgstr ""
    161161
    162 #: dialogs.c:394
     162#: dialogs.c:421
    163163msgid "Pieces:"
    164164msgstr ""
    165165
    166 #: dialogs.c:395
     166#: dialogs.c:422
    167167msgid "Total Size:"
    168168msgstr ""
    169169
    170 #: dialogs.c:399
     170#: dialogs.c:426
    171171msgid "Directory:"
    172172msgstr ""
    173173
    174 #: dialogs.c:400
     174#: dialogs.c:427
    175175msgid "Downloaded:"
    176176msgstr ""
    177177
    178 #: dialogs.c:401
     178#: dialogs.c:428
    179179msgid "Uploaded:"
    180180msgstr ""
    181181
    182 #: main.c:148
     182#: main.c:149
    183183msgid "Add"
    184184msgstr ""
    185185
    186 #: main.c:149
     186#: main.c:150
    187187msgid "Add a new torrent"
    188188msgstr ""
    189189
    190 #: main.c:150
     190#: main.c:151
    191191msgid "Start"
    192192msgstr ""
    193193
    194 #: main.c:152
     194#: main.c:153
    195195msgid "Start a torrent that is not running"
    196196msgstr ""
    197197
    198 #: main.c:153
     198#: main.c:154
    199199msgid "Stop"
    200200msgstr ""
    201201
    202 #: main.c:155
     202#: main.c:156
    203203msgid "Stop a torrent that is running"
    204204msgstr ""
    205205
    206 #: main.c:156
     206#: main.c:157
    207207msgid "Remove"
    208208msgstr ""
    209209
    210 #: main.c:157
     210#: main.c:158
    211211msgid "Remove a torrent"
    212212msgstr ""
    213213
    214 #: main.c:158
     214#: main.c:159
    215215msgid "Properties"
    216216msgstr ""
    217217
    218 #: main.c:159
     218#: main.c:160
    219219msgid "Show additional information about a torrent"
    220220msgstr ""
    221221
    222 #: main.c:160
     222#: main.c:161
    223223msgid "Preferences"
    224224msgstr ""
    225225
    226 #: main.c:161
     226#: main.c:162
    227227msgid "Customize application behavior"
    228228msgstr ""
    229229
    230 #: main.c:179
     230#: main.c:180
    231231msgid "Transmission"
    232232msgstr ""
    233233
    234 #: main.c:471
     234#: main.c:308 main.c:959
     235#, c-format
     236msgid "Failed to load the torrent file %s"
     237msgid_plural ""
     238"Failed to load the torrent files:\n"
     239"%s"
     240msgstr[0] ""
     241msgstr[1] ""
     242
     243#: main.c:494
    235244msgid "Name"
    236245msgstr ""
    237246
    238247#. this string is only used to determing the size of the progress bar
    239 #: main.c:478
     248#: main.c:501
    240249msgid "  fnord    fnord  "
    241250msgstr ""
    242251
    243 #: main.c:481
     252#: main.c:504
    244253msgid "Progress"
    245254msgstr ""
    246255
    247 #: main.c:556
     256#: main.c:579
    248257#, c-format
    249258msgid "Checking existing files (%.1f%%)"
    250259msgstr ""
    251260
    252 #: main.c:558
     261#: main.c:581
    253262#, c-format
    254263msgid "Finishing in %02i:%02i:%02i (%.1f%%)"
    255264msgstr ""
    256265
    257 #: main.c:561
     266#: main.c:584
    258267#, c-format
    259268msgid "Seeding, uploading to %d of %d peer"
     
    262271msgstr[1] ""
    263272
    264 #: main.c:565
     273#: main.c:588
    265274msgid "Stopping..."
    266275msgstr ""
    267276
    268 #: main.c:567
     277#: main.c:590
    269278#, c-format
    270279msgid "Stopped (%.1f%%)"
    271280msgstr ""
    272281
    273 #: main.c:575
     282#: main.c:598
    274283msgid "Error: "
    275284msgstr ""
    276285
    277 #: main.c:579
     286#: main.c:602
    278287#, c-format
    279288msgid "Downloading from %i of %i peer"
     
    282291msgstr[1] ""
    283292
    284 #: main.c:611
     293#: main.c:634
    285294#, c-format
    286295msgid ""
     
    289298msgstr ""
    290299
    291 #: main.c:658
     300#: main.c:681
    292301#, c-format
    293302msgid "     Total DL: %s/s     Total UL: %s/s"
    294303msgstr ""
    295304
    296 #: main.c:924
    297 #, c-format
    298 msgid ""
    299 "An error occurred while creating directory %s:\n"
    300 "%s"
    301 msgstr ""
    302 
    303 #: main.c:936
    304 #, c-format
    305 msgid "An error occurred while opening the torrent file %s"
    306 msgstr ""
    307 
    308305#: util.c:63
    309306msgid "B"
  • trunk/gtk/util.c

    r86 r89  
    106106}
    107107
     108char *
     109joinstrlist(GList *list, char *sep) {
     110  GList *ii;
     111  int len;
     112  char *ret, *dest;
     113
     114  if(0 > (len = strlen(sep) * (g_list_length(list) - 1)))
     115    return NULL;
     116
     117  for(ii = g_list_first(list); NULL != ii; ii = ii->next)
     118    len += strlen(ii->data);
     119
     120  dest = ret = g_new(char, len + 1);
     121
     122  for(ii = g_list_first(list); NULL != ii; ii = ii->next) {
     123    dest = g_stpcpy(dest, ii->data);
     124    if(NULL != ii->next)
     125      dest = g_stpcpy(dest, sep);
     126  }
     127
     128  return ret;
     129}
     130
    108131static int exit_sigs[] = {SIGHUP, SIGINT, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2};
    109132static callbackfunc_t exit_func = NULL;
  • trunk/gtk/util.h

    r86 r89  
    5858mkdir_p(const char *name, mode_t mode);
    5959
     60/* joins a GList of strings into one string using an optional separator */
     61char *
     62joinstrlist(GList *list, char *sep);
     63
    6064/* set up a handler for various fatal signals */
    6165void
Note: See TracChangeset for help on using the changeset viewer.