From d736352da2958574c9c7f4e95ac81b242ecbea8f Mon Sep 17 00:00:00 2001
From: Xpl0itR <xpl0itr@outlook.com>
Date: Mon, 17 Feb 2020 21:35:03 +0000
Subject: [PATCH] Add button in settings to open logs folder (#947)

---
 Ryujinx/Ui/SwitchSettings.cs    | 14 +++++++--
 Ryujinx/Ui/SwitchSettings.glade | 52 ++++++++++++---------------------
 2 files changed, 30 insertions(+), 36 deletions(-)

diff --git a/Ryujinx/Ui/SwitchSettings.cs b/Ryujinx/Ui/SwitchSettings.cs
index 72ac49604a..da2d4a74ed 100644
--- a/Ryujinx/Ui/SwitchSettings.cs
+++ b/Ryujinx/Ui/SwitchSettings.cs
@@ -4,6 +4,7 @@ using Ryujinx.Configuration.Hid;
 using Ryujinx.Configuration.System;
 using System;
 using System.Collections.Generic;
+using System.Diagnostics;
 using System.IO;
 using System.Linq;
 using System.Reflection;
@@ -47,7 +48,6 @@ namespace Ryujinx.Ui
         [GUI] ToggleButton _addDir;
         [GUI] ToggleButton _browseDir;
         [GUI] ToggleButton _removeDir;
-        [GUI] Entry        _logPath;
         [GUI] Entry        _graphicsShadersDumpPath;
         [GUI] Image        _controller1Image;
 
@@ -244,8 +244,6 @@ namespace Ryujinx.Ui
                 _browseThemePath.Sensitive    = false;
             }
 
-            _logPath.Buffer.Text = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Ryujinx.log");
-
             _listeningForKeypress = false;
         }
 
@@ -366,6 +364,16 @@ namespace Ryujinx.Ui
             _browseThemePath.SetStateFlags(0, true);
         }
 
+        private void OpenLogsFolder_Pressed(object sender, EventArgs args)
+        {
+            Process.Start(new ProcessStartInfo()
+            {
+                FileName        = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Logs"),
+                UseShellExecute = true,
+                Verb            = "open"
+            });
+        }
+
         private void SaveToggle_Activated(object sender, EventArgs args)
         {
             List<string> gameDirs = new List<string>();
diff --git a/Ryujinx/Ui/SwitchSettings.glade b/Ryujinx/Ui/SwitchSettings.glade
index cd00625c4c..6128a3ce49 100644
--- a/Ryujinx/Ui/SwitchSettings.glade
+++ b/Ryujinx/Ui/SwitchSettings.glade
@@ -1437,55 +1437,42 @@
                                 <property name="margin_left">10</property>
                                 <property name="margin_right">10</property>
                                 <property name="orientation">vertical</property>
-                                <child>
-                                  <object class="GtkCheckButton" id="_fileLogToggle">
-                                    <property name="label" translatable="yes">Enable Logging to File</property>
-                                    <property name="visible">True</property>
-                                    <property name="can_focus">True</property>
-                                    <property name="receives_default">False</property>
-                                    <property name="tooltip_text" translatable="yes">Enables or disables logging to a file on disk</property>
-                                    <property name="halign">start</property>
-                                    <property name="margin_top">5</property>
-                                    <property name="margin_bottom">5</property>
-                                    <property name="draw_indicator">True</property>
-                                  </object>
-                                  <packing>
-                                    <property name="expand">False</property>
-                                    <property name="fill">True</property>
-                                    <property name="position">0</property>
-                                  </packing>
-                                </child>
                                 <child>
                                   <object class="GtkBox">
                                     <property name="visible">True</property>
                                     <property name="can_focus">False</property>
-                                    <property name="margin_left">5</property>
-                                    <property name="margin_bottom">10</property>
                                     <child>
-                                      <object class="GtkLabel">
+                                      <object class="GtkCheckButton" id="_fileLogToggle">
+                                        <property name="label" translatable="yes">Enable Logging to File</property>
                                         <property name="visible">True</property>
-                                        <property name="can_focus">False</property>
-                                        <property name="tooltip_text" translatable="yes">Location of the log file</property>
-                                        <property name="label" translatable="yes">Log File Location:</property>
+                                        <property name="can_focus">True</property>
+                                        <property name="receives_default">False</property>
+                                        <property name="tooltip_text" translatable="yes">Enables or disables logging to a file on disk</property>
+                                        <property name="halign">start</property>
+                                        <property name="margin_top">5</property>
+                                        <property name="margin_bottom">5</property>
+                                        <property name="draw_indicator">True</property>
                                       </object>
                                       <packing>
                                         <property name="expand">False</property>
                                         <property name="fill">True</property>
-                                        <property name="padding">5</property>
                                         <property name="position">0</property>
                                       </packing>
                                     </child>
                                     <child>
-                                      <object class="GtkEntry" id="_logPath">
+                                      <object class="GtkButton" id="_openLogsFolderButton">
+                                        <property name="label" translatable="yes">Open Logs Folder</property>
                                         <property name="visible">True</property>
                                         <property name="can_focus">True</property>
-                                        <property name="tooltip_text" translatable="yes">Location of the log file</property>
-                                        <property name="valign">center</property>
-                                        <property name="editable">False</property>
-                                        <property name="caps_lock_warning">False</property>
+                                        <property name="receives_default">True</property>
+                                        <property name="tooltip_text" translatable="yes">Opens the folder where logs are written to.</property>
+                                        <property name="margin_left">5</property>
+                                        <property name="margin_top">5</property>
+                                        <property name="margin_bottom">5</property>
+                                        <signal name="clicked" handler="OpenLogsFolder_Pressed" swapped="no"/>
                                       </object>
                                       <packing>
-                                        <property name="expand">True</property>
+                                        <property name="expand">False</property>
                                         <property name="fill">True</property>
                                         <property name="position">1</property>
                                       </packing>
@@ -1494,8 +1481,7 @@
                                   <packing>
                                     <property name="expand">False</property>
                                     <property name="fill">True</property>
-                                    <property name="padding">5</property>
-                                    <property name="position">1</property>
+                                    <property name="position">0</property>
                                   </packing>
                                 </child>
                                 <child>