diff options
author | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2008-06-09 11:37:13 +0000 |
---|---|---|
committer | Moon <moon@140774ce-b5e7-0310-ab8b-a85725594a96> | 2008-06-09 11:37:13 +0000 |
commit | d85d3de6c965ce9041b06f926658f767a37bae82 (patch) | |
tree | ab32f7efae10ea9c06b002754cff7648f3cae0d2 | |
parent | 419728885e356d6737c7d9deb27b04733bced228 (diff) | |
download | gnunet-gtk-d85d3de6c965ce9041b06f926658f767a37bae82.tar.gz gnunet-gtk-d85d3de6c965ce9041b06f926658f767a37bae82.zip |
replace 'Status' column with an icon
merge 'Name' and 'Type' (à la Nautilus)
-rw-r--r-- | src/plugins/fs/download.c | 20 | ||||
-rw-r--r-- | src/plugins/fs/fs.h | 3 | ||||
-rw-r--r-- | src/plugins/fs/search.c | 83 | ||||
-rw-r--r-- | src/plugins/fs/status.c | 24 | ||||
-rw-r--r-- | src/plugins/fs/status.h | 2 |
5 files changed, 64 insertions, 68 deletions
diff --git a/src/plugins/fs/download.c b/src/plugins/fs/download.c index b60578bb..415c3e74 100644 --- a/src/plugins/fs/download.c +++ b/src/plugins/fs/download.c | |||
@@ -286,13 +286,13 @@ fs_download_started (struct GNUNET_FSUI_DownloadList *fsui_dl, | |||
286 | = gtk_tree_row_reference_new (model, path); | 286 | = gtk_tree_row_reference_new (model, path); |
287 | gtk_tree_path_free (path); | 287 | gtk_tree_path_free (path); |
288 | gtk_tree_store_set (sl_parent->tree, | 288 | gtk_tree_store_set (sl_parent->tree, |
289 | &iter, | 289 | &iter, SEARCH_STATUS, |
290 | SEARCH_CELL_BG_COLOR, | ||
291 | getColorCode | ||
292 | (GNUNET_URITRACK_DOWNLOAD_STARTED), | ||
293 | SEARCH_STATUS, | ||
294 | getStatusName | 290 | getStatusName |
295 | (GNUNET_URITRACK_DOWNLOAD_STARTED), -1); | 291 | (GNUNET_URITRACK_DOWNLOAD_STARTED), |
292 | SEARCH_STATUS_LOGO, | ||
293 | getStatusLogo | ||
294 | (GNUNET_URITRACK_DOWNLOAD_STARTED), | ||
295 | -1); | ||
296 | break; | 296 | break; |
297 | } | 297 | } |
298 | valid = gtk_tree_model_iter_next (model, &iter); | 298 | valid = gtk_tree_model_iter_next (model, &iter); |
@@ -378,10 +378,10 @@ fs_download_completed (DownloadList * downloadContext) | |||
378 | gtk_tree_path_free (path); | 378 | gtk_tree_path_free (path); |
379 | gtk_tree_store_set (downloadContext->searchList->tree, | 379 | gtk_tree_store_set (downloadContext->searchList->tree, |
380 | &iter, | 380 | &iter, |
381 | SEARCH_CELL_BG_COLOR, | ||
382 | getColorCode (GNUNET_URITRACK_DOWNLOAD_COMPLETED), | ||
383 | SEARCH_STATUS, | 381 | SEARCH_STATUS, |
384 | getStatusName (GNUNET_URITRACK_DOWNLOAD_COMPLETED), | 382 | getStatusName (GNUNET_URITRACK_DOWNLOAD_COMPLETED), |
383 | SEARCH_STATUS_LOGO, | ||
384 | getStatusLogo (GNUNET_URITRACK_DOWNLOAD_COMPLETED), | ||
385 | -1); | 385 | -1); |
386 | } | 386 | } |
387 | downloadContext->has_terminated = GNUNET_YES; | 387 | downloadContext->has_terminated = GNUNET_YES; |
@@ -409,10 +409,10 @@ fs_download_aborted (DownloadList * downloadContext) | |||
409 | gtk_tree_path_free (path); | 409 | gtk_tree_path_free (path); |
410 | gtk_tree_store_set (downloadContext->searchList->tree, | 410 | gtk_tree_store_set (downloadContext->searchList->tree, |
411 | &iter, | 411 | &iter, |
412 | SEARCH_CELL_BG_COLOR, | ||
413 | getColorCode (GNUNET_URITRACK_DOWNLOAD_ABORTED), | ||
414 | SEARCH_STATUS, | 412 | SEARCH_STATUS, |
415 | getStatusName (GNUNET_URITRACK_DOWNLOAD_ABORTED), | 413 | getStatusName (GNUNET_URITRACK_DOWNLOAD_ABORTED), |
414 | SEARCH_STATUS_LOGO, | ||
415 | getStatusLogo (GNUNET_URITRACK_DOWNLOAD_ABORTED), | ||
416 | -1); | 416 | -1); |
417 | } | 417 | } |
418 | downloadContext->has_terminated = GNUNET_YES; | 418 | downloadContext->has_terminated = GNUNET_YES; |
diff --git a/src/plugins/fs/fs.h b/src/plugins/fs/fs.h index 3c978ff3..fc321480 100644 --- a/src/plugins/fs/fs.h +++ b/src/plugins/fs/fs.h | |||
@@ -61,11 +61,10 @@ enum | |||
61 | SEARCH_PIXBUF, | 61 | SEARCH_PIXBUF, |
62 | SEARCH_URI, | 62 | SEARCH_URI, |
63 | SEARCH_META, | 63 | SEARCH_META, |
64 | SEARCH_CELL_BG_COLOR, | ||
65 | SEARCH_CELL_FG_COLOR, | ||
66 | SEARCH_INTERNAL, | 64 | SEARCH_INTERNAL, |
67 | SEARCH_INTERNAL_PARENT, | 65 | SEARCH_INTERNAL_PARENT, |
68 | SEARCH_STATUS, | 66 | SEARCH_STATUS, |
67 | SEARCH_STATUS_LOGO, | ||
69 | SEARCH_AVAILABILITY_RANK, | 68 | SEARCH_AVAILABILITY_RANK, |
70 | SEARCH_AVAILABILITY_CERTAINTY, | 69 | SEARCH_AVAILABILITY_CERTAINTY, |
71 | SEARCH_APPLICABILITY_RANK, | 70 | SEARCH_APPLICABILITY_RANK, |
diff --git a/src/plugins/fs/search.c b/src/plugins/fs/search.c index f733a66e..f1d7e325 100644 --- a/src/plugins/fs/search.c +++ b/src/plugins/fs/search.c | |||
@@ -235,7 +235,8 @@ addEntryToSearchTree (SearchList * searchContext, | |||
235 | { | 235 | { |
236 | mime = GNUNET_strdup (_("Directory")); | 236 | mime = GNUNET_strdup (_("Directory")); |
237 | icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), | 237 | icon = gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), |
238 | "folder", 16, 0, (GError **) NULL); | 238 | GTK_STOCK_DIRECTORY, 16, 0, |
239 | (GError **) NULL); | ||
239 | } | 240 | } |
240 | else | 241 | else |
241 | { | 242 | { |
@@ -266,10 +267,10 @@ addEntryToSearchTree (SearchList * searchContext, | |||
266 | SEARCH_PIXBUF, pixbuf, SEARCH_URI, | 267 | SEARCH_PIXBUF, pixbuf, SEARCH_URI, |
267 | GNUNET_ECRS_uri_duplicate (info->uri), SEARCH_META, | 268 | GNUNET_ECRS_uri_duplicate (info->uri), SEARCH_META, |
268 | GNUNET_meta_data_duplicate (info->meta), | 269 | GNUNET_meta_data_duplicate (info->meta), |
269 | SEARCH_CELL_BG_COLOR, getColorCode (state), | 270 | SEARCH_INTERNAL,searchContext, |
270 | SEARCH_CELL_FG_COLOR, "black", SEARCH_INTERNAL, | 271 | SEARCH_INTERNAL_PARENT, downloadParent, |
271 | searchContext, SEARCH_INTERNAL_PARENT, downloadParent, | ||
272 | SEARCH_STATUS, getStatusName (state), | 272 | SEARCH_STATUS, getStatusName (state), |
273 | SEARCH_STATUS_LOGO, getStatusLogo (state), | ||
273 | SEARCH_APPLICABILITY_RANK, 1, SEARCH_RANK_SORT, | 274 | SEARCH_APPLICABILITY_RANK, 1, SEARCH_RANK_SORT, |
274 | (long long) 1, SEARCH_RANK_PIXBUF, rankbuf, | 275 | (long long) 1, SEARCH_RANK_PIXBUF, rankbuf, |
275 | #ifdef HAVE_GIO | 276 | #ifdef HAVE_GIO |
@@ -728,11 +729,10 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list, | |||
728 | GDK_TYPE_PIXBUF, /* preview */ | 729 | GDK_TYPE_PIXBUF, /* preview */ |
729 | G_TYPE_POINTER, /* url */ | 730 | G_TYPE_POINTER, /* url */ |
730 | G_TYPE_POINTER, /* meta */ | 731 | G_TYPE_POINTER, /* meta */ |
731 | G_TYPE_STRING, /* bg-color */ | ||
732 | G_TYPE_STRING, /* fg-color */ | ||
733 | G_TYPE_POINTER, /* internal: search list */ | 732 | G_TYPE_POINTER, /* internal: search list */ |
734 | G_TYPE_POINTER, /* internal: download parent list */ | 733 | G_TYPE_POINTER, /* internal: download parent list */ |
735 | G_TYPE_STRING, /* status */ | 734 | G_TYPE_STRING, /* status */ |
735 | GDK_TYPE_PIXBUF, /* status (icon) */ | ||
736 | G_TYPE_INT, /* availability rank */ | 736 | G_TYPE_INT, /* availability rank */ |
737 | G_TYPE_UINT, /* availability certainty */ | 737 | G_TYPE_UINT, /* availability certainty */ |
738 | G_TYPE_UINT, /* applicability rank */ | 738 | G_TYPE_UINT, /* applicability rank */ |
@@ -751,84 +751,55 @@ fs_search_started (struct GNUNET_FSUI_SearchList * fsui_list, | |||
751 | "changed", | 751 | "changed", |
752 | G_CALLBACK (&on_fssearchSelectionChanged), | 752 | G_CALLBACK (&on_fssearchSelectionChanged), |
753 | list, NULL, 0); | 753 | list, NULL, 0); |
754 | renderer = gtk_cell_renderer_text_new (); | ||
755 | col = gtk_tree_view_insert_column_with_attributes (list->treeview, | ||
756 | -1, | ||
757 | _("Status"), | ||
758 | renderer, | ||
759 | "text", SEARCH_STATUS, | ||
760 | "cell-background", | ||
761 | SEARCH_CELL_BG_COLOR, | ||
762 | "foreground", | ||
763 | SEARCH_CELL_FG_COLOR, | ||
764 | NULL); | ||
765 | column = gtk_tree_view_get_column (list->treeview, col - 1); | ||
766 | gtk_tree_view_column_set_resizable (column, TRUE); | ||
767 | gtk_tree_view_column_set_clickable (column, TRUE); | ||
768 | gtk_tree_view_column_set_reorderable (column, TRUE); | ||
769 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_STATUS); | ||
770 | gtk_tree_view_column_set_min_width (column, 0); | ||
771 | 754 | ||
755 | column = gtk_tree_view_column_new (); | ||
756 | gtk_tree_view_column_set_title (column, _("Name")); | ||
757 | #ifdef HAVE_GIO | ||
758 | renderer = gtk_cell_renderer_pixbuf_new (); | ||
759 | gtk_tree_view_column_pack_start (column, renderer, FALSE); | ||
760 | gtk_tree_view_column_set_attributes (column, renderer, "pixbuf", | ||
761 | SEARCH_ICON, NULL); | ||
762 | #endif | ||
772 | renderer = gtk_cell_renderer_text_new (); | 763 | renderer = gtk_cell_renderer_text_new (); |
773 | col = gtk_tree_view_insert_column_with_attributes (list->treeview, | 764 | gtk_tree_view_column_pack_start (column, renderer, TRUE); |
774 | -1, | ||
775 | _("Name"), | ||
776 | renderer, | ||
777 | "text", SEARCH_NAME, | ||
778 | NULL); | ||
779 | g_object_set (G_OBJECT (renderer), | 765 | g_object_set (G_OBJECT (renderer), |
780 | "wrap-width", 45, | 766 | "wrap-width", 45, |
781 | "width-chars", 45, "ellipsize", PANGO_ELLIPSIZE_END, NULL); | 767 | "width-chars", 45, "ellipsize", PANGO_ELLIPSIZE_END, NULL); |
782 | column = gtk_tree_view_get_column (list->treeview, col - 1); | 768 | gtk_tree_view_column_set_attributes (column, renderer, "text", |
769 | SEARCH_NAME, NULL); | ||
770 | col = gtk_tree_view_insert_column (list->treeview, column, 0); | ||
783 | gtk_tree_view_column_set_resizable (column, TRUE); | 771 | gtk_tree_view_column_set_resizable (column, TRUE); |
784 | gtk_tree_view_column_set_clickable (column, TRUE); | 772 | gtk_tree_view_column_set_clickable (column, TRUE); |
785 | gtk_tree_view_column_set_reorderable (column, TRUE); | 773 | gtk_tree_view_column_set_reorderable (column, TRUE); |
786 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_NAME); | 774 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_NAME); |
787 | 775 | ||
788 | renderer = gtk_cell_renderer_text_new (); | 776 | renderer = gtk_cell_renderer_pixbuf_new (); |
789 | g_object_set (renderer, "xalign", 1.00, NULL); | ||
790 | col = gtk_tree_view_insert_column_with_attributes (list->treeview, | 777 | col = gtk_tree_view_insert_column_with_attributes (list->treeview, |
791 | -1, | 778 | -1, |
792 | _("Size"), | 779 | _("Status"), |
793 | renderer, | 780 | renderer, |
794 | "text", SEARCH_HSIZE, | 781 | "pixbuf", SEARCH_STATUS_LOGO, |
795 | NULL); | 782 | NULL); |
796 | column = gtk_tree_view_get_column (list->treeview, col - 1); | 783 | column = gtk_tree_view_get_column (list->treeview, col - 1); |
797 | gtk_tree_view_column_set_resizable (column, TRUE); | 784 | gtk_tree_view_column_set_resizable (column, TRUE); |
798 | gtk_tree_view_column_set_clickable (column, TRUE); | 785 | gtk_tree_view_column_set_clickable (column, TRUE); |
799 | gtk_tree_view_column_set_reorderable (column, TRUE); | 786 | gtk_tree_view_column_set_reorderable (column, TRUE); |
800 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_SIZE); | 787 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_STATUS); |
801 | |||
802 | #ifdef HAVE_GIO | ||
803 | renderer = gtk_cell_renderer_pixbuf_new (); | ||
804 | col = gtk_tree_view_insert_column_with_attributes (list->treeview, | ||
805 | -1, | ||
806 | _("Type"), | ||
807 | renderer, | ||
808 | "pixbuf", | ||
809 | SEARCH_ICON, NULL); | ||
810 | column = gtk_tree_view_get_column (list->treeview, col - 1); | ||
811 | gtk_tree_view_column_set_resizable (column, TRUE); | ||
812 | gtk_tree_view_column_set_reorderable (column, TRUE); | ||
813 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_RAW_MIME); | ||
814 | gtk_tree_view_column_set_min_width (column, 20); | 788 | gtk_tree_view_column_set_min_width (column, 20); |
815 | #else | 789 | |
816 | renderer = gtk_cell_renderer_text_new (); | 790 | renderer = gtk_cell_renderer_text_new (); |
791 | g_object_set (renderer, "xalign", 1.00, NULL); | ||
817 | col = gtk_tree_view_insert_column_with_attributes (list->treeview, | 792 | col = gtk_tree_view_insert_column_with_attributes (list->treeview, |
818 | -1, | 793 | -1, |
819 | _("Type"), | 794 | _("Size"), |
820 | renderer, | 795 | renderer, |
821 | "text", SEARCH_MIME, | 796 | "text", SEARCH_HSIZE, |
822 | NULL); | 797 | NULL); |
823 | g_object_set (G_OBJECT (renderer), | ||
824 | "wrap-width", 30, | ||
825 | "width-chars", 30, "ellipsize", PANGO_ELLIPSIZE_END, NULL); | ||
826 | column = gtk_tree_view_get_column (list->treeview, col - 1); | 798 | column = gtk_tree_view_get_column (list->treeview, col - 1); |
827 | gtk_tree_view_column_set_resizable (column, TRUE); | 799 | gtk_tree_view_column_set_resizable (column, TRUE); |
828 | gtk_tree_view_column_set_clickable (column, TRUE); | 800 | gtk_tree_view_column_set_clickable (column, TRUE); |
829 | gtk_tree_view_column_set_reorderable (column, TRUE); | 801 | gtk_tree_view_column_set_reorderable (column, TRUE); |
830 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_RAW_MIME); | 802 | gtk_tree_view_column_set_sort_column_id (column, SEARCH_SIZE); |
831 | #endif | ||
832 | 803 | ||
833 | #if 0 | 804 | #if 0 |
834 | /* colums for data visualized graphically */ | 805 | /* colums for data visualized graphically */ |
diff --git a/src/plugins/fs/status.c b/src/plugins/fs/status.c index 1ce858d3..47f383e3 100644 --- a/src/plugins/fs/status.c +++ b/src/plugins/fs/status.c | |||
@@ -75,5 +75,29 @@ getStatusName (enum GNUNET_URITRACK_STATE state) | |||
75 | return ""; | 75 | return ""; |
76 | } | 76 | } |
77 | 77 | ||
78 | const GdkPixbuf * | ||
79 | getStatusLogo (enum GNUNET_URITRACK_STATE state) | ||
80 | { | ||
81 | if (state & (GNUNET_URITRACK_DIRECTORY_ADDED)) | ||
82 | return gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), | ||
83 | GTK_STOCK_ADD, 16, 0, (GError **)NULL); | ||
84 | if (state & (GNUNET_URITRACK_INSERTED || GNUNET_URITRACK_INDEXED)) | ||
85 | return gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), | ||
86 | GTK_STOCK_HOME, 16, 0, (GError **)NULL); | ||
87 | if ((state & GNUNET_URITRACK_DOWNLOAD_STARTED) && | ||
88 | (0 == (state & | ||
89 | (GNUNET_URITRACK_DOWNLOAD_COMPLETED | | ||
90 | GNUNET_URITRACK_DOWNLOAD_ABORTED)))) | ||
91 | return gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), | ||
92 | GTK_STOCK_GO_DOWN, 16, 0, (GError **)NULL); | ||
93 | if (state & GNUNET_URITRACK_DOWNLOAD_COMPLETED) | ||
94 | return gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), | ||
95 | GTK_STOCK_APPLY, 16, 0, (GError **)NULL); | ||
96 | if (state & GNUNET_URITRACK_DOWNLOAD_ABORTED) | ||
97 | return gtk_icon_theme_load_icon (gtk_icon_theme_get_default (), | ||
98 | GTK_STOCK_CANCEL, 16, 0, (GError **)NULL); | ||
99 | return NULL; | ||
100 | } | ||
101 | |||
78 | 102 | ||
79 | /* end of status.c */ | 103 | /* end of status.c */ |
diff --git a/src/plugins/fs/status.h b/src/plugins/fs/status.h index b2db5f4f..60f4ea6e 100644 --- a/src/plugins/fs/status.h +++ b/src/plugins/fs/status.h | |||
@@ -35,4 +35,6 @@ const char *getColorCode (enum GNUNET_URITRACK_STATE state); | |||
35 | 35 | ||
36 | const char *getStatusName (enum GNUNET_URITRACK_STATE state); | 36 | const char *getStatusName (enum GNUNET_URITRACK_STATE state); |
37 | 37 | ||
38 | const GdkPixbuf *getStatusLogo (enum GNUNET_URITRACK_STATE state); | ||
39 | |||
38 | #endif | 40 | #endif |