Commits

Andreas Tscharner  committed 0aa075d

gui: Use simple text comboboxed in edit dialog and set them up

* Compression combobox contains all possible compression types
* Encryption combobox contains all possible encryption types

  • Participants
  • Parent commits 234bffc

Comments (0)

Files changed (3)

File src/gui/ButtonHandlers.cxx

 #include <gtkmm/stock.h>
 #include <gtkmm/treeview.h>
 #include "ButtonHandlers.hxx"
+#include "../include/CompressDecompress.hxx"
+#include "../include/EncryptDecrypt.hxx"
 
 
 void ButtonHandlers::on_add_button_clicked(void)
 
 	p_refBuilder->get_widget("dlgEdit", m_editDialog);
 
+	p_refBuilder->get_widget("cbxCompression", m_compSelect);
+	for (unsigned int iter = lrc::NoneCompression; iter < lrc::lastCompression; iter++) {
+		m_compSelect->append(lrc::CompressionTypeNames[iter]);
+	};
+	m_compSelect->set_active(0);
+
+	p_refBuilder->get_widget("cbxEncryption", m_encSelect);
+	for (unsigned int iter = lrc::NoneEncryption; iter < lrc::lastEncryption; iter++) {
+		m_encSelect->append(lrc::EncryptionTypeNames[iter]);
+	};
+	m_encSelect->set_active(0);
+
 	m_listHandler = nullptr;
 }
 
 ButtonHandlers::~ButtonHandlers(void)
 {
+	delete m_encSelect;
+	delete m_compSelect;
 	delete m_editDialog;
 	delete m_addFilesDlg;
 	delete m_editButton;

File src/gui/ButtonHandlers.hxx

 #include <gtkmm/button.h>
 #include <gtkmm/builder.h>
 #include <gtkmm/filechooserdialog.h>
+#include <gtkmm/dialog.h>
+#include <gtkmm/comboboxtext.h>
 #include "ListHandler.hxx"
 
 
 		Gtk::Button *m_editButton;     //!< Reference to "Edit" button
 		Gtk::FileChooserDialog *m_addFilesDlg;   //!< Reference to "Add Files" dialog
 		Gtk::Dialog *m_editDialog;     //!< Reference to dialog for editing the selected resource
+		Gtk::ComboBoxText *m_compSelect;    //!< Reference to compression combobox
+		Gtk::ComboBoxText *m_encSelect;     //!< Reference to encryption combobox
 		ListHandler *m_listHandler;    //!< Reference to (global) list handler class
 
 	protected:

File src/gui/ResourceEditor.glade

               </packing>
             </child>
             <child>
-              <object class="GtkComboBox" id="cbxCompression">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">2</property>
-                <property name="width">2</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
-              <object class="GtkComboBox" id="cbxEncryption">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-              </object>
-              <packing>
-                <property name="left_attach">1</property>
-                <property name="top_attach">3</property>
-                <property name="width">2</property>
-                <property name="height">1</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkEntry" id="edPassword">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="height">1</property>
               </packing>
             </child>
+            <child>
+              <object class="GtkComboBoxText" id="cbxCompression">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="entry_text_column">0</property>
+                <property name="id_column">1</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">2</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
+            <child>
+              <object class="GtkComboBoxText" id="cbxEncryption">
+                <property name="visible">True</property>
+                <property name="can_focus">False</property>
+                <property name="entry_text_column">0</property>
+                <property name="id_column">1</property>
+              </object>
+              <packing>
+                <property name="left_attach">1</property>
+                <property name="top_attach">3</property>
+                <property name="width">2</property>
+                <property name="height">1</property>
+              </packing>
+            </child>
           </object>
           <packing>
             <property name="expand">False</property>