Windows compatibility Tweaks

This commit is contained in:
LAGonauta 2020-05-02 12:47:40 -03:00
parent cd3a119eff
commit 057a72cd9f
3 changed files with 26 additions and 3 deletions

View file

@ -63,7 +63,7 @@ public class FileManager : StreamInteractionModule, Object {
try {
FileInfo file_info = file.query_info("*", FileQueryInfoFlags.NONE);
file_transfer.file_name = file_info.get_display_name();
file_transfer.mime_type = file_info.get_content_type();
file_transfer.mime_type = Util.get_content_type(file_info);
file_transfer.size = (int)file_info.get_size();
file_transfer.input_stream = yield file.read_async();
@ -285,7 +285,7 @@ public class FileManager : StreamInteractionModule, Object {
file_transfer.input_stream = yield file.read_async();
FileInfo file_info = file_transfer.get_file().query_info("*", FileQueryInfoFlags.NONE);
file_transfer.mime_type = file_info.get_content_type();
file_transfer.mime_type = Util.get_content_type(file_info);
file_transfer.state = FileTransfer.State.COMPLETE;
} catch (Error e) {

View file

@ -26,6 +26,25 @@ public class Util {
}
assert_not_reached();
}
}
public static string get_content_type(FileInfo fileInfo)
{
//#if WIN32
string fileName = fileInfo.get_name();
int fileNameLength = fileName.length;
int extIndex = fileName.index_of(".");
if (extIndex < fileNameLength)
{
string extension = fileName.substring(extIndex, fileNameLength - extIndex);
string mime_type = ContentType.get_mime_type(extension);
if (mime_type != null && mime_type.length != 0)
{
return mime_type;
}
}
//#endif
return fileInfo.get_content_type();
}
}
}

View file

@ -55,6 +55,10 @@ public class MainWindow : Gtk.Window {
}
private void setup_unified() {
new Dino.Ui.ConversationSelector();
new Dino.Ui.ConversationSummary.ConversationView();
new Dino.Ui.ChatInput.View();
new Dino.Ui.GlobalSearch();
Builder builder = new Builder.from_resource("/im/dino/Dino/unified_main_content.ui");
paned = (Paned) builder.get_object("paned");
box.add(paned);