Fix edit button not showing
This commit is contained in:
parent
55668fa93b
commit
f89a108af4
|
@ -59,6 +59,21 @@
|
|||
</child>
|
||||
</object>
|
||||
</child>
|
||||
<child>
|
||||
<object class="GtkButton" id="button2">
|
||||
<property name="vexpand">False</property>
|
||||
<property name="halign">end</property>
|
||||
<property name="valign">end</property>
|
||||
<property name="visible">True</property>
|
||||
<child>
|
||||
<object class="GtkImage" id="button2_icon">
|
||||
<property name="icon-name">go-previous-symbolic-rtl</property>
|
||||
<property name="icon-size">1</property>
|
||||
<property name="visible">True</property>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
</child>
|
||||
</object>
|
||||
|
|
|
@ -18,6 +18,8 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
[GtkChild] private unowned Box message_menu_box;
|
||||
[GtkChild] private unowned Button button1;
|
||||
[GtkChild] private unowned Image button1_icon;
|
||||
[GtkChild] private unowned Button button2;
|
||||
[GtkChild] private unowned Image button2_icon;
|
||||
[GtkChild] private unowned Box notifications;
|
||||
[GtkChild] private unowned Box main;
|
||||
[GtkChild] private unowned EventBox main_event_box;
|
||||
|
@ -78,10 +80,14 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
main_event_box.motion_notify_event.connect(on_motion_notify_event);
|
||||
|
||||
button1.clicked.connect(() => {
|
||||
current_meta_item.get_item_actions(Plugins.WidgetType.GTK)[0].callback(button1, current_meta_item, currently_highlighted.widget);
|
||||
current_meta_item.get_item_actions(Plugins.WidgetType.GTK)[1].callback(button1, current_meta_item, currently_highlighted.widget);
|
||||
update_message_menu();
|
||||
});
|
||||
|
||||
button2.clicked.connect(() => {
|
||||
current_meta_item.get_item_actions(Plugins.WidgetType.GTK)[0].callback(button2, current_meta_item, currently_highlighted.widget);
|
||||
});
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
|
@ -187,9 +193,14 @@ public class ConversationView : Box, Plugins.ConversationItemCollection, Plugins
|
|||
|
||||
var actions = current_meta_item.get_item_actions(Plugins.WidgetType.GTK);
|
||||
message_menu_box.visible = actions != null && actions.size > 0;
|
||||
|
||||
if (actions != null && actions.size == 1) {
|
||||
button1.visible = false;
|
||||
}
|
||||
|
||||
if (actions != null && actions.size == 2) {
|
||||
button1.visible = true;
|
||||
button1_icon.set_from_icon_name(actions[0].icon_name, IconSize.SMALL_TOOLBAR);
|
||||
button1_icon.set_from_icon_name(actions[1].icon_name, IconSize.SMALL_TOOLBAR);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -47,14 +47,6 @@ public class MessageMetaItem : ContentMetaItem {
|
|||
|
||||
bool allowed = stream_interactor.get_module(MessageCorrection.IDENTITY).is_own_correction_allowed(message_item.conversation, message_item.message);
|
||||
Gee.List<Plugins.MessageAction> actions = new ArrayList<Plugins.MessageAction>();
|
||||
if (allowed && !in_edit_mode) {
|
||||
Plugins.MessageAction action1 = new Plugins.MessageAction();
|
||||
action1.icon_name = "document-edit-symbolic";
|
||||
action1.callback = (button, content_meta_item_activated, widget) => {
|
||||
this.in_edit_mode = true;
|
||||
};
|
||||
actions.add(action1);
|
||||
}
|
||||
|
||||
Plugins.MessageAction action2 = new Plugins.MessageAction();
|
||||
action2.icon_name = "go-previous-symbolic-rtl";
|
||||
|
@ -64,6 +56,15 @@ public class MessageMetaItem : ContentMetaItem {
|
|||
};
|
||||
actions.add(action2);
|
||||
|
||||
if (allowed && !in_edit_mode) {
|
||||
Plugins.MessageAction action1 = new Plugins.MessageAction();
|
||||
action1.icon_name = "document-edit-symbolic";
|
||||
action1.callback = (button, content_meta_item_activated, widget) => {
|
||||
this.in_edit_mode = true;
|
||||
};
|
||||
actions.add(action1);
|
||||
}
|
||||
|
||||
return actions;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue