set as default type, add icon. going to assume the icon was installed already. should happen in most packaging out there.
authornemo
Mon, 01 Nov 2010 19:13:00 -0400 (2010-11-01)
changeset 4091 f89b8d0afbe1
parent 4090 4b165832d232
child 4092 bf13068194b3
set as default type, add icon. going to assume the icon was installed already. should happen in most packaging out there.
QTfrontend/hwform.cpp
share/hedgewars/Data/misc/hedgewars-mimeinfo.xml
--- a/QTfrontend/hwform.cpp	Mon Nov 01 23:30:33 2010 +0100
+++ b/QTfrontend/hwform.cpp	Mon Nov 01 19:13:00 2010 -0400
@@ -1135,6 +1135,7 @@
     success = false;
     // TODO; also reenable button in pages.cpp
 #else
+    // this is a little silly due to all the system commands below anyway - just use mkdir -p ?  Does have the advantage of the alert I guess
     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local");
     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share");
     if (success) success = checkForDir(QDir::home().absolutePath() + "/.local/share/mime");
@@ -1145,6 +1146,8 @@
     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hedgewars-mimeinfo.xml "+QDir::home().absolutePath()+"/.local/share/mime/packages").toLocal8Bit().constData())==0;
     if (success) success = system(("cp "+datadir->absolutePath()+"/misc/hwengine.desktop "+QDir::home().absolutePath()+"/.local/share/applications").toLocal8Bit().constData())==0;
     if (success) success = system(("update-mime-database "+QDir::home().absolutePath()+"/.local/share/mime").toLocal8Bit().constData())==0;
+    if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-demo")==0;
+    if (success) success = system("xdg-mime default hwengine.desktop application/x-hedgewars-save")==0;
 #endif
     if (success) QMessageBox::information(0, "", QMessageBox::tr("All file associations have been set."));
     else QMessageBox::information(0, "", QMessageBox::tr("File association failed."));
--- a/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml	Mon Nov 01 23:30:33 2010 +0100
+++ b/share/hedgewars/Data/misc/hedgewars-mimeinfo.xml	Mon Nov 01 19:13:00 2010 -0400
@@ -1,6 +1,11 @@
 <?xml version="1.0"?>
 <mime-info xmlns='http://www.freedesktop.org/standards/shared-mime-info'>
   <mime-type type="application/x-hedgewars-demo">
+    <icon name="hedgewars" />
+    <!--
+    https://bugs.launchpad.net/ubuntu/+source/nautilus/+bug/217997
+    <generic-icon name="applications-games"/>
+    -->
     <comment>Hedgewars Demo</comment>
     <comment xml:lang="fr">Hedgewars Démonstration</comment>
     <magic priority="50">
@@ -10,6 +15,8 @@
     <glob weight="60" pattern="*.hwd"/>
   </mime-type>
   <mime-type type="application/x-hedgewars-save">
+    <icon name="hedgewars" />
+    <!--<generic-icon name="applications-games"/>-->
     <comment>Hedgewars Save</comment>
     <magic priority="50">
       <match required="yes" type="byte" offset="0" value="2"/>