forked from OpenGamers/abaddon
hide browse icon when not in channel with perms
This commit is contained in:
parent
53ac853367
commit
955b9239b9
@ -122,7 +122,12 @@
|
||||
color: #b9bbbe;
|
||||
}
|
||||
|
||||
.message-input {
|
||||
/* i dont think theres a way to circumvent having to do this to adjust around the browse icon */
|
||||
.message-input:not(.with-browser-icon) {
|
||||
padding: 0px 0px 0px 5px;
|
||||
}
|
||||
|
||||
.message-input.with-browse-icon {
|
||||
padding: 0px 0px 0px 30px;
|
||||
}
|
||||
|
||||
|
@ -149,6 +149,14 @@ ChatInputText &ChatInputTextContainer::Get() {
|
||||
return m_input;
|
||||
}
|
||||
|
||||
void ChatInputTextContainer::ShowChooserIcon() {
|
||||
m_upload_ev.show();
|
||||
}
|
||||
|
||||
void ChatInputTextContainer::HideChooserIcon() {
|
||||
m_upload_ev.hide();
|
||||
}
|
||||
|
||||
bool ChatInputTextContainer::GetChildPosition(Gtk::Widget *child, Gdk::Rectangle &pos) {
|
||||
Gtk::Allocation main_alloc;
|
||||
{
|
||||
@ -470,6 +478,8 @@ ChatInput::ChatInput()
|
||||
m_attachments.signal_emptied().connect([this] {
|
||||
m_attachments_revealer.set_reveal_child(false);
|
||||
});
|
||||
|
||||
SetActiveChannel(Snowflake::Invalid);
|
||||
}
|
||||
|
||||
void ChatInput::InsertText(const Glib::ustring &text) {
|
||||
@ -526,6 +536,13 @@ void ChatInput::IndicateTooLarge() {
|
||||
|
||||
void ChatInput::SetActiveChannel(Snowflake id) {
|
||||
m_active_channel = id;
|
||||
if (CanAttachFiles()) {
|
||||
m_input.Get().get_style_context()->add_class("with-browse-icon");
|
||||
m_input.ShowChooserIcon();
|
||||
} else {
|
||||
m_input.Get().get_style_context()->remove_class("with-browse-icon");
|
||||
m_input.HideChooserIcon();
|
||||
}
|
||||
}
|
||||
|
||||
void ChatInput::StartReplying() {
|
||||
|
@ -103,6 +103,9 @@ public:
|
||||
// not proxying everythign lol!!
|
||||
ChatInputText &Get();
|
||||
|
||||
void ShowChooserIcon();
|
||||
void HideChooserIcon();
|
||||
|
||||
private:
|
||||
void ShowFileChooser();
|
||||
bool GetChildPosition(Gtk::Widget *child, Gdk::Rectangle &pos);
|
||||
|
Loading…
Reference in New Issue
Block a user