Windows compatibility Tweaks
This commit is contained in:
parent
cd3a119eff
commit
057a72cd9f
|
@ -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) {
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue