[gnome-commander] Show GIO default application and content type name in file props dialog



commit bf433de2c2e2dfc36595596448692e92fc1928e3
Author: Uwe Scholz <u scholz83 gmx de>
Date:   Mon Jan 11 22:43:17 2021 +0100

    Show GIO default application and content type name in file props dialog
    
    Remove gnome-vfs methods to show MIME type in file props dialog

 src/dialogs/gnome-cmd-file-props-dialog.cc | 22 ++++++++--------------
 src/gnome-cmd-file.h                       | 20 --------------------
 2 files changed, 8 insertions(+), 34 deletions(-)
---
diff --git a/src/dialogs/gnome-cmd-file-props-dialog.cc b/src/dialogs/gnome-cmd-file-props-dialog.cc
index e8ace149..8a80ba1e 100644
--- a/src/dialogs/gnome-cmd-file-props-dialog.cc
+++ b/src/dialogs/gnome-cmd-file-props-dialog.cc
@@ -417,19 +417,13 @@ static GtkWidget *create_properties_tab (GnomeCmdFilePropsDialogPrivate *data)
         add_sep (table, y++);
     }
 
-    label = create_bold_label (dialog, _("Type:"));
+    label = create_bold_label (dialog, _("Content Type:"));
     table_add (table, label, 0, y, GTK_FILL);
 
-    label = create_label (dialog, data->f->get_mime_type_desc());
+    auto contentTypeString = data->f->GetGfileAttributeString(G_FILE_ATTRIBUTE_STANDARD_CONTENT_TYPE);
+    label = create_label (dialog, contentTypeString);
     table_add (table, label, 1, y++, GTK_FILL);
-
-
-    label = create_bold_label (dialog, _("MIME Type:"));
-    table_add (table, label, 0, y, GTK_FILL);
-
-    label = create_label (dialog, data->f->get_mime_type());
-    table_add (table, label, 1, y++, GTK_FILL);
-
+    g_free(contentTypeString);
 
     if (data->f->info->type != GNOME_VFS_FILE_TYPE_DIRECTORY)
     {
@@ -438,12 +432,12 @@ static GtkWidget *create_properties_tab (GnomeCmdFilePropsDialogPrivate *data)
         label = create_bold_label (dialog, _("Opens with:"));
         table_add (table, label, 0, y, GTK_FILL);
 
-        GnomeVFSMimeApplication *vfs_app = data->f->get_default_application();
+        auto default_application_string = data->f->get_default_application_name_string();
 
-        if (vfs_app)
+        if (default_application_string)
         {
-            data->app_label = label = create_label (dialog, vfs_app->name);
-            gnome_vfs_mime_application_free (vfs_app);
+            data->app_label = label = create_label (dialog, default_application_string);
+            g_free (default_application_string);
         }
         else
             label = create_label (dialog, _("No default application registered"));
diff --git a/src/gnome-cmd-file.h b/src/gnome-cmd-file.h
index adcec49d..73a527b2 100644
--- a/src/gnome-cmd-file.h
+++ b/src/gnome-cmd-file.h
@@ -78,8 +78,6 @@ struct GnomeCmdFile
     GnomeVFSFileSize get_tree_size();
     const gchar *get_tree_size_as_str();
     const gchar *get_perm();
-    const gchar *get_mime_type();
-    const gchar *get_mime_type_desc();
     gboolean has_mime_type(const gchar *mime_type);
     gboolean mime_begins_with(const gchar *mime_type_start);
 
@@ -103,7 +101,6 @@ struct GnomeCmdFile
     void invalidate_tree_size();
     gboolean has_tree_size();
 
-    GnomeVFSMimeApplication *get_default_application();
     gchar *GetGfileAttributeString(const char *attribute);
     gchar *get_default_application_name_string();
     gchar *get_default_application_action_label(GAppInfo *gAppInfo);
@@ -189,20 +186,3 @@ inline void gnome_cmd_file_list_unref (GList *files)
 {
     g_list_foreach (files, (GFunc) gnome_cmd_file_unref, NULL);
 }
-
-inline const gchar *GnomeCmdFile::get_mime_type()
-{
-    g_return_val_if_fail (info != NULL, NULL);
-    return gnome_vfs_file_info_get_mime_type (info);
-}
-
-inline const gchar *GnomeCmdFile::get_mime_type_desc()
-{
-    g_return_val_if_fail (info != NULL, NULL);
-    return info->mime_type ? gnome_vfs_mime_get_description (info->mime_type) : NULL;
-}
-
-inline GnomeVFSMimeApplication *GnomeCmdFile::get_default_application()
-{
-    return info->mime_type ? gnome_vfs_mime_get_default_application (info->mime_type) : NULL;
-}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]