From 458de1758aa94953140c5acb387dbb87b4ee539f Mon Sep 17 00:00:00 2001
From: Matt Borgerson <contact@mborgerson.com>
Date: Sat, 3 Jun 2023 22:22:24 -0700
Subject: [PATCH] ui: Unify snapshot filter and title name search box

---
 ui/xui/main-menu.cc | 12 +++++-------
 ui/xui/main-menu.hh |  1 -
 2 files changed, 5 insertions(+), 8 deletions(-)

diff --git a/ui/xui/main-menu.cc b/ui/xui/main-menu.cc
index 6ee37a1a39..238649d3e4 100644
--- a/ui/xui/main-menu.cc
+++ b/ui/xui/main-menu.cc
@@ -930,14 +930,12 @@ void MainMenuSnapshotsView::Draw()
     Load();
     SectionTitle("Snapshots");
     ImGui::Checkbox("Filter by current title", &g_config.general.snapshots.filter_current_game);
-    ImGui::InputTextWithHint("##search", "Filter by name...", &m_search_buf, ImGuiInputTextFlags_CallbackEdit,
+    ImGui::InputTextWithHint("##search", "Search...", &m_search_buf, ImGuiInputTextFlags_CallbackEdit,
                              &MainMenuSnapshotsViewUpdateSearchBox, this);
 
-    ImGui::InputTextWithHint("##create", "Create new snapshot", &m_create_buf);
-
     bool snapshot_with_create_name_exists = false;
     for (int i = 0; i < m_snapshots_len; ++i) {
-        if (g_strcmp0(m_create_buf.c_str(), m_snapshots[i].name) == 0) {
+        if (g_strcmp0(m_search_buf.c_str(), m_snapshots[i].name) == 0) {
             snapshot_with_create_name_exists = true;
             break;
         }
@@ -945,12 +943,12 @@ void MainMenuSnapshotsView::Draw()
 
     ImGui::SameLine();
     if (ImGui::Button(snapshot_with_create_name_exists ? "Replace" : "Create")) {
-        xemu_snapshots_save(m_create_buf.empty() ? NULL : m_create_buf.c_str(), NULL);
-        m_create_buf.clear();
+        xemu_snapshots_save(m_search_buf.empty() ? NULL : m_search_buf.c_str(), NULL);
+        m_search_buf.clear();
     }
 
     if (snapshot_with_create_name_exists && ImGui::IsItemHovered()) {
-        ImGui::SetTooltip("A snapshot with the name \"%s\" already exists. This button will overwrite the existing snapshot.", m_create_buf.c_str());
+        ImGui::SetTooltip("A snapshot with the name \"%s\" already exists. This button will overwrite the existing snapshot.", m_search_buf.c_str());
     }
 
     for (int i = m_snapshots_len - 1; i >= 0; i--) {
diff --git a/ui/xui/main-menu.hh b/ui/xui/main-menu.hh
index 2b469c1112..df5e85973f 100644
--- a/ui/xui/main-menu.hh
+++ b/ui/xui/main-menu.hh
@@ -110,7 +110,6 @@ protected:
     uint32_t m_current_title_id;
     char *m_current_title_name;
     std::string m_search_buf;
-    std::string m_create_buf;
     bool m_load_failed;
 
 private: