diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | embed/downloader-view.c | 81 | ||||
-rw-r--r-- | lib/widgets/ephy-cell-renderer-progress.c | 2 |
3 files changed, 50 insertions, 43 deletions
@@ -1,3 +1,13 @@ +2003-11-26 Marco Pesenti Gritti <marco@gnome.org> + + * embed/downloader-view.c: (update_download_row), + (download_changed_cb), (downloader_view_add_download), + (downloader_view_build_ui): + * lib/widgets/ephy-cell-renderer-progress.c: + + Try out a different layout for downloads rows. + Make the file column expand. + 2003-11-25 Christian Persch <chpe@cvs.gnome.org> * embed/ephy-cookie-manager.c: (ephy_cookie_manager_base_init): diff --git a/embed/downloader-view.c b/embed/downloader-view.c index 049583670..8bbeafc85 100644 --- a/embed/downloader-view.c +++ b/embed/downloader-view.c @@ -43,8 +43,7 @@ enum { COL_PERCENT, - COL_FILENAME, - COL_SIZE, + COL_FILE, COL_REMAINING, COL_DOWNLOAD_OBJECT }; @@ -232,18 +231,16 @@ get_row_from_download (DownloaderView *dv, EphyDownload *download) } static void -download_changed_cb (EphyDownload *download, DownloaderView *dv) +update_download_row (DownloaderView *dv, EphyDownload *download) { GtkTreeRowReference *row_ref; GtkTreePath *path; GtkTreeIter iter; EphyDownloadState state; - int percent; - long total; - long remaining_secs; - char *remaining; - char *size; + long total, current, remaining_secs; + char *remaining, *file, *cur_progress; struct tm; + int percent; row_ref = get_row_from_download (dv, download); g_return_if_fail (row_ref != NULL); @@ -271,13 +268,25 @@ download_changed_cb (EphyDownload *download, DownloaderView *dv) } total = ephy_download_get_total_progress (download); - if (total == -1) + current = ephy_download_get_current_progress (download); + + cur_progress = gnome_vfs_format_file_size_for_display (current); + + if (total != -1) { - size = g_strdup (_("Unknown")); + char *total_progress; + + total_progress = gnome_vfs_format_file_size_for_display (total); + file = g_strdup_printf ("%s\n%s of %s", + ephy_download_get_name (download), + cur_progress, total_progress); + g_free (total_progress); } else { - size = gnome_vfs_format_file_size_for_display (total); + file = g_strdup_printf ("%s\n%s", + ephy_download_get_name (download), + cur_progress); } if (remaining_secs < 0) @@ -294,15 +303,21 @@ download_changed_cb (EphyDownload *download, DownloaderView *dv) gtk_list_store_set (GTK_LIST_STORE (dv->priv->model), &iter, COL_PERCENT, percent, - COL_SIZE, size, + COL_FILE, file, COL_REMAINING, remaining, -1); gtk_tree_path_free (path); - g_free (size); + g_free (file); g_free (remaining); } +static void +download_changed_cb (EphyDownload *download, DownloaderView *dv) +{ + update_download_row (dv, download); +} + void downloader_view_add_download (DownloaderView *dv, EphyDownload *download) @@ -311,11 +326,11 @@ downloader_view_add_download (DownloaderView *dv, GtkTreeIter iter; GtkTreeSelection *selection; GtkTreePath *path; - char *name; - gtk_list_store_append (GTK_LIST_STORE (dv->priv->model), &iter); + gtk_list_store_set (GTK_LIST_STORE (dv->priv->model), + &iter, COL_DOWNLOAD_OBJECT, download, -1); path = gtk_tree_model_get_path (GTK_TREE_MODEL (dv->priv->model), &iter); row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (dv->priv->model), path); @@ -325,13 +340,7 @@ downloader_view_add_download (DownloaderView *dv, download, row_ref); - name = ephy_download_get_name (download); - gtk_list_store_set (GTK_LIST_STORE (dv->priv->model), - &iter, - COL_FILENAME, name, - COL_DOWNLOAD_OBJECT, download, - -1); - g_free (name); + update_download_row (dv, download); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW(dv->priv->treeview)); @@ -369,11 +378,10 @@ downloader_view_build_ui (DownloaderView *dv) gtk_tree_selection_set_mode (gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->treeview)), GTK_SELECTION_SINGLE); - liststore = gtk_list_store_new (5, + liststore = gtk_list_store_new (4, G_TYPE_INT, G_TYPE_STRING, G_TYPE_STRING, - G_TYPE_STRING, G_TYPE_OBJECT); gtk_tree_view_set_model (GTK_TREE_VIEW(priv->treeview), @@ -389,33 +397,23 @@ downloader_view_build_ui (DownloaderView *dv) "value", 0, NULL); column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), 0); - gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_reorderable (column, TRUE); gtk_tree_view_column_set_sort_column_id (column, COL_PERCENT); renderer = gtk_cell_renderer_text_new (); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview), - COL_FILENAME, _("Filename"), - renderer, - "text", COL_FILENAME, - NULL); - column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), - COL_FILENAME); - gtk_tree_view_column_set_resizable (column, TRUE); - gtk_tree_view_column_set_reorderable (column, TRUE); - gtk_tree_view_column_set_sort_column_id (column, COL_FILENAME); - - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview), - COL_SIZE, _("Size"), + COL_FILE, _("File"), renderer, - "text", COL_SIZE, + "text", COL_FILE, NULL); column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), - COL_SIZE); - gtk_tree_view_column_set_resizable (column, TRUE); + COL_FILE); + gtk_tree_view_column_set_expand (column, TRUE); gtk_tree_view_column_set_reorderable (column, TRUE); - gtk_tree_view_column_set_sort_column_id (column, COL_SIZE); + gtk_tree_view_column_set_sort_column_id (column, COL_FILE); + renderer = gtk_cell_renderer_text_new (); + g_object_set (renderer, "xalign", 0.5, NULL); gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW(priv->treeview), COL_REMAINING, _("Remaining"), renderer, @@ -423,7 +421,6 @@ downloader_view_build_ui (DownloaderView *dv) NULL); column = gtk_tree_view_get_column (GTK_TREE_VIEW(priv->treeview), COL_REMAINING); - gtk_tree_view_column_set_resizable (column, TRUE); gtk_tree_view_column_set_reorderable (column, TRUE); gtk_tree_view_column_set_sort_column_id (column, COL_REMAINING); diff --git a/lib/widgets/ephy-cell-renderer-progress.c b/lib/widgets/ephy-cell-renderer-progress.c index 7e3ceda25..ec4570d16 100644 --- a/lib/widgets/ephy-cell-renderer-progress.c +++ b/lib/widgets/ephy-cell-renderer-progress.c @@ -31,7 +31,7 @@ static void ephy_cell_renderer_progress_class_init (EphyCellRendererProgressClas #define EPHY_CELL_RENDERER_PROGRESS_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), EPHY_TYPE_CELL_RENDERER_PROGRESS, EphyCellRendererProgressPrivate)) #define XPAD 4 -#define YPAD 2 +#define YPAD 8 #define UNKNOWN_STRING _("Unknown") enum |