put original message in edit dialog
This commit is contained in:
@@ -395,7 +395,9 @@ void Abaddon::ActionChatDeleteMessage(Snowflake channel_id, Snowflake id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Abaddon::ActionChatEditMessage(Snowflake channel_id, Snowflake id) {
|
void Abaddon::ActionChatEditMessage(Snowflake channel_id, Snowflake id) {
|
||||||
|
const auto *msg = m_discord.GetMessage(id);
|
||||||
EditMessageDialog dlg(*m_main_window);
|
EditMessageDialog dlg(*m_main_window);
|
||||||
|
dlg.SetContent(msg->Content);
|
||||||
auto response = dlg.run();
|
auto response = dlg.run();
|
||||||
if (response == Gtk::RESPONSE_OK) {
|
if (response == Gtk::RESPONSE_OK) {
|
||||||
auto new_content = dlg.GetContent();
|
auto new_content = dlg.GetContent();
|
||||||
|
@@ -34,6 +34,10 @@ EditMessageDialog::EditMessageDialog(Gtk::Window &parent)
|
|||||||
show_all_children();
|
show_all_children();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string EditMessageDialog::GetContent() {
|
Glib::ustring EditMessageDialog::GetContent() {
|
||||||
return m_content;
|
return m_content;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditMessageDialog::SetContent(const Glib::ustring &str) {
|
||||||
|
m_text.get_buffer()->set_text(str);
|
||||||
|
}
|
||||||
|
@@ -5,7 +5,8 @@
|
|||||||
class EditMessageDialog : public Gtk::Dialog {
|
class EditMessageDialog : public Gtk::Dialog {
|
||||||
public:
|
public:
|
||||||
EditMessageDialog(Gtk::Window &parent);
|
EditMessageDialog(Gtk::Window &parent);
|
||||||
std::string GetContent();
|
Glib::ustring GetContent();
|
||||||
|
void SetContent(const Glib::ustring &str);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Gtk::Box m_layout;
|
Gtk::Box m_layout;
|
||||||
@@ -16,5 +17,5 @@ protected:
|
|||||||
Gtk::TextView m_text;
|
Gtk::TextView m_text;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
std::string m_content;
|
Glib::ustring m_content;
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user