summaryrefslogtreecommitdiff
path: root/src/nautilus-x-content-bar.c
diff options
context:
space:
mode:
authorCarlos Soriano <csoriano@gnome.org>2016-03-04 16:48:49 +0100
committerCarlos Soriano <csoriano@gnome.org>2016-03-07 12:37:00 +0100
commit0bfae7052961487d531b26273684fc1956ab211d (patch)
tree46207103f884ea0cf5ae5670f3d338490333bb18 /src/nautilus-x-content-bar.c
parent400acdd90402385a0701dde3a16dd1e2f1dd4551 (diff)
downloadnautilus-0bfae7052961487d531b26273684fc1956ab211d.tar.gz
content-bar: move content type handling to nautilus-file
All the other content type functions are there, and we will need it anyway in an upcoming patch. https://bugzilla.gnome.org/show_bug.cgi?id=762703
Diffstat (limited to 'src/nautilus-x-content-bar.c')
-rw-r--r--src/nautilus-x-content-bar.c79
1 files changed, 3 insertions, 76 deletions
diff --git a/src/nautilus-x-content-bar.c b/src/nautilus-x-content-bar.c
index d2933eb6b..e783dc94b 100644
--- a/src/nautilus-x-content-bar.c
+++ b/src/nautilus-x-content-bar.c
@@ -29,6 +29,7 @@
#include "nautilus-x-content-bar.h"
#include <libnautilus-private/nautilus-icon-info.h>
+#include <libnautilus-private/nautilus-file-utilities.h>
#include <libnautilus-private/nautilus-program-choosing.h>
#define NAUTILUS_X_CONTENT_BAR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), NAUTILUS_TYPE_X_CONTENT_BAR, NautilusXContentBarPrivate))
@@ -78,80 +79,6 @@ content_bar_response_cb (GtkInfoBar *infobar,
}
}
-static char *
-get_message_for_x_content_type (const char *x_content_type)
-{
- char *message;
- char *description;
-
- description = g_content_type_get_description (x_content_type);
-
- /* Customize greeting for well-known x-content types */
- /* translators: these describe the contents of removable media */
- if (strcmp (x_content_type, "x-content/audio-cdda") == 0) {
- message = g_strdup (_("Audio CD"));
- } else if (strcmp (x_content_type, "x-content/audio-dvd") == 0) {
- message = g_strdup (_("Audio DVD"));
- } else if (strcmp (x_content_type, "x-content/video-dvd") == 0) {
- message = g_strdup (_("Video DVD"));
- } else if (strcmp (x_content_type, "x-content/video-vcd") == 0) {
- message = g_strdup (_("Video CD"));
- } else if (strcmp (x_content_type, "x-content/video-svcd") == 0) {
- message = g_strdup (_("Super Video CD"));
- } else if (strcmp (x_content_type, "x-content/image-photocd") == 0) {
- message = g_strdup (_("Photo CD"));
- } else if (strcmp (x_content_type, "x-content/image-picturecd") == 0) {
- message = g_strdup (_("Picture CD"));
- } else if (strcmp (x_content_type, "x-content/image-dcf") == 0) {
- message = g_strdup (_("Contains digital photos"));
- } else if (strcmp (x_content_type, "x-content/audio-player") == 0) {
- message = g_strdup (_("Contains music"));
- } else if (strcmp (x_content_type, "x-content/unix-software") == 0) {
- message = g_strdup (_("Contains software"));
- } else {
- /* fallback to generic greeting */
- message = g_strdup_printf (_("Detected as ā€œ%sā€"), description);
- }
-
- g_free (description);
-
- return message;
-}
-
-static char *
-get_message_for_two_x_content_types (char **x_content_types)
-{
- char *message;
-
- g_assert (x_content_types[0] != NULL);
- g_assert (x_content_types[1] != NULL);
-
- /* few combinations make sense */
- if (strcmp (x_content_types[0], "x-content/image-dcf") == 0
- || strcmp (x_content_types[1], "x-content/image-dcf") == 0) {
-
- /* translators: these describe the contents of removable media */
- if (strcmp (x_content_types[0], "x-content/audio-player") == 0) {
- message = g_strdup (_("Contains music and photos"));
- } else if (strcmp (x_content_types[1], "x-content/audio-player") == 0) {
- message = g_strdup (_("Contains photos and music"));
- } else {
- message = g_strdup (_("Contains digital photos"));
- }
- } else if ((strcmp (x_content_types[0], "x-content/video-vcd") == 0
- || strcmp (x_content_types[1], "x-content/video-vcd") == 0)
- && (strcmp (x_content_types[0], "x-content/video-dvd") == 0
- || strcmp (x_content_types[1], "x-content/video-dvd") == 0)) {
- message = g_strdup_printf ("%s/%s",
- get_message_for_x_content_type (x_content_types[0]),
- get_message_for_x_content_type (x_content_types[1]));
- } else {
- message = get_message_for_x_content_type (x_content_types[0]);
- }
-
- return message;
-}
-
static void
nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar, const char **x_content_types)
{
@@ -192,10 +119,10 @@ nautilus_x_content_bar_set_x_content_types (NautilusXContentBar *bar, const char
message = NULL;
break;
case 1:
- message = get_message_for_x_content_type (bar->priv->x_content_types[0]);
+ message = get_message_for_content_type (bar->priv->x_content_types[0]);
break;
case 2:
- message = get_message_for_two_x_content_types (bar->priv->x_content_types);
+ message = get_message_for_two_content_types (bar->priv->x_content_types);
break;
default:
message = g_strdup (_("Open with:"));