Skip to content

Commit

Permalink
VENOM-359: Add option to choose conference type
Browse files Browse the repository at this point in the history
  • Loading branch information
naxuroqa committed May 6, 2018
1 parent a31ed48 commit cac6478
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 15 deletions.
Empty file removed data/im.tox.venom.service.in
Empty file.
23 changes: 12 additions & 11 deletions src/ui/create_groupchat_widget.ui
Expand Up @@ -182,13 +182,14 @@
<property name="can_focus">False</property>
<property name="homogeneous">True</property>
<child>
<object class="GtkRadioButton" id="type_text">
<property name="label" translatable="yes">Text</property>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="active">True</property>
<property name="draw_indicator">False</property>
<property name="action_name">widget.conference-type</property>
<property name="action_target">'text'</property>
<property name="text" translatable="yes">Text</property>
<property name="iconic">True</property>
<property name="centered">True</property>
</object>
<packing>
<property name="expand">False</property>
Expand All @@ -197,14 +198,14 @@
</packing>
</child>
<child>
<object class="GtkRadioButton" id="type_av">
<property name="label" translatable="yes">Speech</property>
<object class="GtkModelButton">
<property name="visible">True</property>
<property name="sensitive">False</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="draw_indicator">False</property>
<property name="group">type_text</property>
<property name="action_name">widget.conference-type</property>
<property name="action_target">'speech'</property>
<property name="text" translatable="yes">Speech</property>
<property name="iconic">True</property>
<property name="centered">True</property>
</object>
<packing>
<property name="expand">False</property>
Expand Down
8 changes: 7 additions & 1 deletion src/view/CreateGroupchatWidget.vala
Expand Up @@ -41,15 +41,21 @@ namespace Venom {
logger.d("CreateGroupChatWidget created.");
this.logger = logger;
this.view_model = new CreateGroupchatViewModel(logger, conference_invites_model, listener);
stack_binding = new ContainerChildBooleanBinding(stack, conference_invite_item, "needs-attention");
this.stack_binding = new ContainerChildBooleanBinding(stack, conference_invite_item, "needs-attention");

app_window.reset_header_bar();
app_window.header_bar.custom_title = custom_title;

var conference_type_action = new GLib.SimpleAction.stateful("conference-type", view_model.conference_type.get_type(), view_model.conference_type);
var action_group = new SimpleActionGroup();
action_group.add_action(conference_type_action);
insert_action_group("widget", action_group);

title.bind_property("text", view_model, "title", GLib.BindingFlags.SYNC_CREATE | GLib.BindingFlags.BIDIRECTIONAL);
view_model.bind_property("title-error", title_error, "label", GLib.BindingFlags.SYNC_CREATE);
view_model.bind_property("title-error-visible", title_error_content, "reveal-child", GLib.BindingFlags.SYNC_CREATE);
view_model.bind_property("new-conference-invite", stack_binding, "active", BindingFlags.SYNC_CREATE);
view_model.bind_property("conference-type", conference_type_action, "state", GLib.BindingFlags.SYNC_CREATE | GLib.BindingFlags.BIDIRECTIONAL);

create.clicked.connect(view_model.on_create);

Expand Down
9 changes: 6 additions & 3 deletions src/viewmodel/CreateGroupchatViewModel.vala
Expand Up @@ -22,7 +22,7 @@
namespace Venom {
public class CreateGroupchatViewModel : GLib.Object {
public string title { get; set; }
public ConferenceType conference_type { get; set; }
public Variant conference_type { get; set; }
public bool title_error_visible { get; set; }
public string title_error { get; set; }
public bool new_conference_invite { get; set; }
Expand All @@ -39,7 +39,7 @@ namespace Venom {
this.listener = listener;
this.conference_invites = conference_invites;

conference_type = ConferenceType.TEXT;
conference_type = new GLib.Variant("s", "text");
notify["title"].connect(() => { title_error_visible = false; });

conference_invites.changed.connect(update_content);
Expand All @@ -65,7 +65,10 @@ namespace Venom {
return;
}
try {
listener.on_create_groupchat(title, conference_type);
var type = conference_type.get_string() == "speech"
? ConferenceType.AV
: ConferenceType.TEXT;
listener.on_create_groupchat(title, type);
} catch (Error e) {
show_error("Could not create conference: " + e.message);
return;
Expand Down

0 comments on commit cac6478

Please sign in to comment.