Changeset 12 for trunk/gtk


Ignore:
Timestamp:
Jan 12, 2006, 6:48:53 PM (16 years ago)
Author:
root
Message:

Update 2005-12-07

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gtk/main.c

    r11 r12  
    234234  GList *ii;
    235235  struct cf_torrentstate *ts;
     236  gint height;
    236237
    237238  data->tr = tr;
     
    244245  data->buttons = NULL;
    245246
     247  gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), GTK_POLICY_NEVER,
     248                                 GTK_POLICY_AUTOMATIC);
     249
    246250  gtk_box_pack_start(GTK_BOX(vbox), makewind_toolbar(data), FALSE, FALSE, 0);
    247251
    248252  list = makewind_list(data);
    249   gtk_widget_size_request(list, &req);
    250253  gtk_container_add(GTK_CONTAINER(scroll), list);
    251254  gtk_box_pack_start(GTK_BOX(vbox), scroll, TRUE, TRUE, 0);
     
    255258
    256259  gtk_container_add(GTK_CONTAINER(wind), vbox);
    257   gtk_window_set_default_size(GTK_WINDOW(wind), req.width, req.height);
    258260  g_signal_connect(G_OBJECT(wind), "delete_event", G_CALLBACK(winclose), data);
    259   gtk_widget_show_all(wind);
    260261
    261262  for(ii = g_list_first(saved); NULL != ii; ii = ii->next) {
     
    269270  data->timer = g_timeout_add(500, updatemodel, data);
    270271  updatemodel(data);
     272
     273  gtk_widget_show_all(vbox);
     274  gtk_widget_realize(wind);
     275
     276  gtk_widget_size_request(wind, &req);
     277  height = req.height;
     278  gtk_widget_size_request(scroll, &req);
     279  height -= req.height;
     280  gtk_widget_size_request(list, &req);
     281  height += req.height;
     282  gtk_window_set_default_size(GTK_WINDOW(wind), -1, MAX(height, 100));
     283
     284  gtk_widget_show(wind);
    271285}
    272286
     
    288302  for(ii = tr_torrentStat(data->tr, &st); 0 < ii; ii--) {
    289303    if(TR_TORRENT_NEEDS_STOP(st[ii-1].status)) {
    290       fprintf(stderr, "quit: stopping %i %s\n", ii, st[ii-1].info.name);
     304      /*fprintf(stderr, "quit: stopping %i %s\n", ii, st[ii-1].info.name);*/
    291305      tr_torrentStop(data->tr, ii - 1);
    292306    } else {
    293       fprintf(stderr, "quit: closing %i %s\n", ii, st[ii-1].info.name);
     307      /*fprintf(stderr, "quit: closing %i %s\n", ii, st[ii-1].info.name);*/
    294308      tr_torrentClose(data->tr, ii - 1);
    295309    }
     
    305319  edata->timer = g_timeout_add(500, exitcheck, edata);
    306320
    307   fprintf(stderr, "quit: starting timeout at %i\n", edata->started);
     321  /*fprintf(stderr, "quit: starting timeout at %i\n", edata->started);*/
    308322
    309323  /* returning FALSE means to destroy the window */
     
    319333  for(ii = tr_torrentStat(data->cbdata->tr, &st); 0 < ii; ii--) {
    320334    if(TR_STATUS_PAUSE == st[ii-1].status) {
    321       fprintf(stderr, "quit: closing %i %s\n", ii, st[ii-1].info.name);
     335      /*fprintf(stderr, "quit: closing %i %s\n", ii, st[ii-1].info.name);*/
    322336      tr_torrentClose(data->cbdata->tr, ii - 1);
    323337    }
     
    325339  free(st);
    326340
    327   fprintf(stderr, "quit: %i torrents left at %i\n",
    328           tr_torrentCount(data->cbdata->tr), time(NULL));
     341  /*fprintf(stderr, "quit: %i torrents left at %i\n",
     342    tr_torrentCount(data->cbdata->tr), time(NULL));*/
    329343  /* keep going if we still have torrents and haven't hit the exit timeout */
    330344  if(0 < tr_torrentCount(data->cbdata->tr) &&
     
    334348  }
    335349
    336   fprintf(stderr, "quit: giving up on %i torrents\n",
    337           tr_torrentCount(data->cbdata->tr));
     350  /*fprintf(stderr, "quit: giving up on %i torrents\n",
     351    tr_torrentCount(data->cbdata->tr));*/
    338352
    339353  for(ii = tr_torrentCount(data->cbdata->tr); 0 < ii; ii--)
     
    362376
    363377  gtk_toolbar_set_tooltips(GTK_TOOLBAR(bar), TRUE);
     378  gtk_toolbar_set_show_arrow(GTK_TOOLBAR(bar), FALSE);
    364379  gtk_toolbar_set_style(GTK_TOOLBAR(bar), GTK_TOOLBAR_BOTH);
    365380
     
    571586
    572587  /* remove any excess rows */
    573   if(gtk_tree_model_iter_next(GTK_TREE_MODEL(data->model), &iter))
     588  if(ii ? gtk_tree_model_iter_next(GTK_TREE_MODEL(data->model), &iter) :
     589     gtk_tree_model_get_iter_first(GTK_TREE_MODEL(data->model), &iter))
    574590    while(gtk_list_store_remove(data->model, &iter))
    575591      ;
Note: See TracChangeset for help on using the changeset viewer.