Przeglądaj źródła

sorted compilation warnings!

Nicole Portas 1 miesiąc temu
rodzic
commit
d4d588e7fc
1 zmienionych plików z 7 dodań i 5 usunięć
  1. 7 5
      src/main.cpp

+ 7 - 5
src/main.cpp

@@ -65,6 +65,7 @@ public:
 
         // Open Button
         Gtk::Image* icon_open = Gtk::manage(new Gtk::Image);
+        // "folder-open" is a standard icon name in almost all Linux themes
         icon_open->set_from_icon_name("folder-open", Gtk::ICON_SIZE_BUTTON);
         m_BtnOpen.set_image(*icon_open);
         m_BtnOpen.set_label("Open Folder");
@@ -114,7 +115,7 @@ public:
         m_IconView.set_column_spacing(10);
         m_IconView.set_row_spacing(10);
         
-        // FIX: Use .index() to prevent compile error
+        // Use .index() to prevent compile error (int expected)
         m_IconView.set_tooltip_column(m_Columns.m_col_orig_name.index());
 
         m_IconView.signal_button_press_event().connect(sigc::mem_fun(*this, &RenamerWindow::on_iconview_button_press), false);
@@ -251,10 +252,9 @@ protected:
         }
     }
 
-    // FIX: Correct logic for getting path at position
     bool on_iconview_button_press(GdkEventButton* event) {
         if (event->type == GDK_BUTTON_PRESS && event->button == 3) { 
-            // FIX: Cast to int to match GTKmm signature
+            // Fix: Cast coordinates to int for get_path_at_pos
             Gtk::TreeModel::Path path = m_IconView.get_path_at_pos((int)event->x, (int)event->y);
             
             if (path) {
@@ -343,6 +343,7 @@ protected:
                     m_ResultQueue.push_back(item);
                 }
                 m_Dispatcher.emit();
+                // Brief sleep to yield CPU, keeping UI responsive
                 std::this_thread::sleep_for(std::chrono::microseconds(500)); 
             } catch (...) {}
         }
@@ -399,7 +400,8 @@ protected:
             std::string new_name;
             if (pad_width > 0) {
                  std::string num = std::to_string(index);
-                 while (num.length() < pad_width) num = "0" + num;
+                 // Fix: cast to size_t to solve sign warning
+                 while (num.length() < (size_t)pad_width) num = "0" + num;
                  std::string pat = pattern;
                  pat.replace(hash_pos, pad_width, num);
                  new_name = pat + item.second;
@@ -420,4 +422,4 @@ int main(int argc, char *argv[]) {
     auto app = Gtk::Application::create(argc, argv, "org.gtkmm.renamer_dropdown");
     RenamerWindow window;
     return app->run(window);
-}
+}