Skip to content

Commit

Permalink
Added options for autoaccepting ft and a/v; Currently unsaved, ft men…
Browse files Browse the repository at this point in the history
…u made insensitive until code is properly restructured
  • Loading branch information
naxuroqa committed Jul 30, 2014
1 parent 7f43815 commit 5a31fa7
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
4 changes: 4 additions & 0 deletions src/core/Contact.vala
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ namespace Venom {
public string alias { get; set; default = ""; }
public bool is_blocked { get; set; default = false; }
public string group { get; set; default = ""; }
// FIXME update sql save file and save those
public bool auto_files { get; set; default = false; }
public bool auto_audio { get; set; default = false; }
public bool auto_video { get; set; default = false; }
// Not saved
public bool online { get; set; default = false; }
public Gdk.Pixbuf? image { get; set; default = null; }
Expand Down
9 changes: 5 additions & 4 deletions src/ui/ContactListWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -851,9 +851,11 @@ namespace Venom {

private void on_av_invite(Contact c) {
this.set_urgency();
#if DEBUG
session.answer_call(c);
#else
if(c.auto_video && c.video || c.auto_audio && !c.video) {
//Auto accept
session.answer_call(c);
return;
}
Gtk.MessageDialog message_dialog = new Gtk.MessageDialog (this,
Gtk.DialogFlags.MODAL,
Gtk.MessageType.QUESTION,
Expand All @@ -880,7 +882,6 @@ namespace Venom {
} else {
session.reject_call(c);
}
#endif
}

private void on_start_audio_call(Contact c) {
Expand Down
22 changes: 22 additions & 0 deletions src/ui/UITools.vala
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,30 @@ namespace Venom {
item.activate.connect(() => { w.block_contact(c); });
menu.append(item);*/

Gtk.Menu autoaccept_submenu = new Gtk.Menu();

item = new Gtk.CheckMenuItem.with_mnemonic(_("_File transfers"));
c.bind_property("auto-files", item, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
// FIXME make selectable when done with reworking file transfers
item.sensitive = false;
autoaccept_submenu.append(item);

item = new Gtk.CheckMenuItem.with_mnemonic(_("_Audio chat"));
c.bind_property("auto-audio", item, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
autoaccept_submenu.append(item);

item = new Gtk.CheckMenuItem.with_mnemonic(_("_Video chat"));
c.bind_property("auto-video", item, "active", BindingFlags.SYNC_CREATE | BindingFlags.BIDIRECTIONAL);
autoaccept_submenu.append(item);

item = new Gtk.MenuItem.with_mnemonic(_("_Automatically accept ..."));
item.submenu = autoaccept_submenu;
menu.append(item);

GLib.HashTable<int, GroupChat> groupchats = w.get_groupchats();
if(groupchats.size() > 0) {
Gtk.MenuItem groupchat_item = new Gtk.MenuItem.with_mnemonic(_("_Invite to ..."));
c.bind_property("online", groupchat_item, "sensitive", BindingFlags.SYNC_CREATE);
Gtk.Menu groupchat_submenu = new Gtk.Menu();

item = new Gtk.MenuItem.with_mnemonic(_("_New groupchat"));
Expand All @@ -97,6 +118,7 @@ namespace Venom {
menu.append(groupchat_item);
} else {
item = new Gtk.MenuItem.with_mnemonic(_("_Invite to new groupchat"));
c.bind_property("online", item, "sensitive", BindingFlags.SYNC_CREATE);
item.activate.connect(() => { w.invite_to_groupchat(c); });
menu.append(item);
}
Expand Down

0 comments on commit 5a31fa7

Please sign in to comment.