diff --git a/src/swfmoz_dialog.c b/src/swfmoz_dialog.c index 468c9a8..99405b2 100644 --- a/src/swfmoz_dialog.c +++ b/src/swfmoz_dialog.c @@ -191,18 +191,13 @@ swfmoz_dialog_get_media_page (SwfmozDialog *dialog) gtk_tree_view_column_set_sort_column_id (column, SWFMOZ_LOADER_COLUMN_TYPE); gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column); - renderer = gtk_cell_renderer_progress_new (); - column = gtk_tree_view_column_new_with_attributes ("Done", renderer, - "value", SWFMOZ_LOADER_COLUMN_PERCENT_LOADED, NULL); - gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_column_set_sort_column_id (column, SWFMOZ_LOADER_COLUMN_PERCENT_LOADED); - gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column); - - renderer = gtk_cell_renderer_toggle_new (); - column = gtk_tree_view_column_new_with_attributes ("Error", renderer, - "active", SWFMOZ_LOADER_COLUMN_ERROR, NULL); + renderer = gtk_cell_renderer_text_new (); + column = gtk_tree_view_column_new_with_attributes ("Status", renderer, + "text", SWFMOZ_LOADER_COLUMN_STATUS, + "foreground-set", SWFMOZ_LOADER_COLUMN_ERROR, NULL); + g_object_set(renderer, "foreground", "red", NULL); gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_column_set_sort_column_id (column, SWFMOZ_LOADER_COLUMN_ERROR); + gtk_tree_view_column_set_sort_column_id (column, SWFMOZ_LOADER_COLUMN_STATUS); gtk_tree_view_append_column (GTK_TREE_VIEW (widget), column); gtk_tree_selection_set_mode (gtk_tree_view_get_selection diff --git a/src/swfmoz_player.c b/src/swfmoz_player.c index c27fcbe..7ffdbf5 100644 --- a/src/swfmoz_player.c +++ b/src/swfmoz_player.c @@ -443,8 +443,8 @@ swfmoz_player_init (SwfmozPlayer *player) player->context = g_main_context_default (); player->loaders = GTK_TREE_MODEL (gtk_list_store_new (SWFMOZ_LOADER_N_COLUMNS, - SWFMOZ_TYPE_LOADER, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_UINT)); + SWFMOZ_TYPE_LOADER, G_TYPE_STRING, G_TYPE_STRING, + G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_STRING)); } SwfdecPlayer * @@ -470,22 +470,28 @@ swfmoz_player_new (NPP instance, gboolean windowless, gboolean opaque) static void swfmoz_player_loaders_update (GtkListStore *store, GtkTreeIter *iter, SwfdecLoader *loader) { - glong percent; + goffset loaded, size; gboolean eof, error; const SwfdecURL *url; const char *url_string; + gchar *status; + + loaded = swfdec_loader_get_loaded (loader); + size = swfdec_loader_get_size (loader); - percent = swfdec_loader_get_size (loader); - if (percent == 0) { - percent = 100; - } else if (percent < 0) { - percent = 50; - } else { - percent = 100 * swfdec_loader_get_loaded (loader) / percent; - percent = CLAMP (percent, 0, 100); - } /* FIXME: swfdec needs a function for this */ g_object_get (G_OBJECT (loader), "eof", &eof, "error", &error, NULL); + + if (error == TRUE) { + status = g_strdup("error"); + } else if (size == loaded) { + status = g_strdup_printf("%s", g_format_size_for_display(size)); + } else if (size < 0) { + status = g_strdup_printf("%s", g_format_size_for_display(loaded)); + } else { + status = g_strdup_printf("%s of %s", g_format_size_for_display(loaded), g_format_size_for_display(size)); + } + url = swfdec_loader_get_url (loader); if (url) { url_string = swfdec_url_get_url (url); @@ -502,8 +508,10 @@ swfmoz_player_loaders_update (GtkListStore *store, GtkTreeIter *iter, SwfdecLoad SWFMOZ_LOADER_COLUMN_EOF, eof, SWFMOZ_LOADER_COLUMN_ERROR, error, SWFMOZ_LOADER_COLUMN_TYPE, swfmoz_loader_get_data_type_string (loader), - SWFMOZ_LOADER_COLUMN_PERCENT_LOADED, (guint) percent, + SWFMOZ_LOADER_COLUMN_STATUS, status, -1); + + g_free(status); } static gboolean diff --git a/src/swfmoz_player.h b/src/swfmoz_player.h index 1e89995..3b7a253 100644 --- a/src/swfmoz_player.h +++ b/src/swfmoz_player.h @@ -33,7 +33,7 @@ enum { SWFMOZ_LOADER_COLUMN_TYPE, SWFMOZ_LOADER_COLUMN_EOF, SWFMOZ_LOADER_COLUMN_ERROR, - SWFMOZ_LOADER_COLUMN_PERCENT_LOADED, + SWFMOZ_LOADER_COLUMN_STATUS, SWFMOZ_LOADER_N_COLUMNS };