Fixed 64-bit transfers in the applet.
[doldaconnect.git] / clients / gnome-trans-applet / dolcon-trans-applet.c
index b73b46e..6b4a6e9 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Dolda Connect - Modular multiuser Direct Connect-style client
- *  Copyright (C) 2005 Fredrik Tolf (fredrik@dolda2000.com)
+ *  Copyright (C) 2005 Fredrik Tolf <fredrik@dolda2000.com>
  *  
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ static void cancel_transfer(BonoboUIComponent *uic, struct appletdata *data, con
 static BonoboUIVerb ctxtmenuverbs[] =
 {
     BONOBO_UI_VERB("dca_pref", run_pref_dialog),
-    BONOBO_UI_VERB("dca_cancel", cancel_transfer),
+    BONOBO_UI_VERB("dca_cancel", (void (*)(BonoboUIComponent*, gpointer, const char *))cancel_transfer),
     BONOBO_UI_VERB_END
 };
 
@@ -75,8 +75,10 @@ static gboolean updatetip(struct appletdata *data)
     time_t now;
     char buf[256];
     
-    if(data->curdisplay == NULL)
+    if(data->curdisplay == NULL) {
+       gtk_tooltips_set_tip(data->tips, GTK_WIDGET(data->applet), _("No transfer selected"), NULL);
        return(TRUE);
+    }
     now = time(NULL);
     if(data->curdisplay->cmptime == 0)
     {
@@ -99,6 +101,7 @@ static gboolean updatetip(struct appletdata *data)
 static void update(struct appletdata *data)
 {
     char buf[256];
+    size_t l;
     
     switch(data->conduit->state)
     {
@@ -123,14 +126,22 @@ static void update(struct appletdata *data)
        } else {
            if((data->curdisplay->pos > 0) && (data->curdisplay->size > 0))
            {
-               sprintf(buf, "%'i/%'i", data->curdisplay->pos, data->curdisplay->size);
+               sprintf(buf, "%'ji/%'ji", (intmax_t)data->curdisplay->pos, (intmax_t)data->curdisplay->size);
                gtk_progress_bar_set_fraction(data->pbar, (double)data->curdisplay->pos / (double)data->curdisplay->size);
                gtk_progress_bar_set_text(data->pbar, buf);
            } else {
                gtk_progress_bar_set_fraction(data->pbar, 0);
                gtk_progress_bar_set_text(data->pbar, _("Initializing"));
            }
-           gtk_label_set_text(data->label, data->curdisplay->tag);
+           if((l = strlen(data->curdisplay->tag)) > 50) {
+               memcpy(buf, data->curdisplay->tag, 20);
+               memcpy(buf + 20, "...", 3);
+               memcpy(buf + 23 , data->curdisplay->tag + l - 20, 20);
+               buf[43] = 0;
+               gtk_label_set_text(data->label, buf);
+           } else {
+               gtk_label_set_text(data->label, data->curdisplay->tag);
+           }
        }
        break;
     }