Skip to content

Commit

Permalink
fixed callstates, added colors to buttons according to callstates
Browse files Browse the repository at this point in the history
  • Loading branch information
naxuroqa committed Jul 21, 2014
1 parent 7bd10e3 commit 5069bcb
Show file tree
Hide file tree
Showing 7 changed files with 101 additions and 22 deletions.
7 changes: 4 additions & 3 deletions src/core/Contact.vala
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@
namespace Venom {

public enum AudioCallState {
RINGING,
STARTED,
ENDED
RINGING, // outgoing call
CALLING, // incoming call
STARTED, // call commencing
ENDED // call ended
}

public interface IContact : GLib.Object {
Expand Down
1 change: 1 addition & 0 deletions src/core/ToxSession.vala
Original file line number Diff line number Diff line change
Expand Up @@ -896,6 +896,7 @@ namespace Venom {

public void cancel_call(Contact c) {
_toxav_handle.cancel(c.call_index, 0, "do not want");
c.audio_call_state = AudioCallState.ENDED;
}

// TOXAV callbacks
Expand Down
3 changes: 3 additions & 0 deletions src/ui/ContactListWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,9 @@ namespace Venom {
case AudioCallState.RINGING:
session.cancel_call(c);
break;
case AudioCallState.CALLING:
session.reject_call(c);
break;
case AudioCallState.STARTED:
session.hangup_call(c);
break;
Expand Down
27 changes: 25 additions & 2 deletions src/ui/ConversationWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,8 @@ namespace Venom {
box_user_info.remove(label_contact_name_);
label_contact_name = new EditableLabel.with_label(label_contact_name_);
box_user_info.pack_start(label_contact_name, false);
label_contact_name.button_cancel.get_style_context().add_class("callbutton");
label_contact_name.button_ok.get_style_context().add_class("callbutton");
label_contact_name.button_cancel.get_style_context().add_class("sendbutton");
label_contact_name.button_ok.get_style_context().add_class("sendbutton");
label_contact_name.show_all();
label_contact_name.show_entry.connect_after(() => {
label_contact_name.entry.text = contact.alias;
Expand All @@ -117,6 +117,29 @@ namespace Venom {
button_call.clicked.connect(button_call_clicked);
button_call_video.clicked.connect(button_call_video_clicked);
button_call_video.sensitive = false;
contact.notify["audio-call-state"].connect(() => {
Logger.log(LogLevel.DEBUG, "Changing call state to " + contact.audio_call_state.to_string());
unowned Gtk.StyleContext ctx = button_call.get_style_context();
switch(contact.audio_call_state) {
case AudioCallState.RINGING:
case AudioCallState.CALLING:
ctx.remove_class("callbutton");
ctx.remove_class("callbutton-started");
ctx.add_class("callbutton-ringing");
break;
case AudioCallState.STARTED:
ctx.remove_class("callbutton");
ctx.remove_class("callbutton-ringing");
ctx.add_class("callbutton-started");
break;
default:
ctx.add_class("callbutton");
ctx.remove_class("callbutton-ringing");
ctx.remove_class("callbutton-started");
break;
}
});

button_send = builder.get_object("button_send") as Gtk.Button;
button_send_file = builder.get_object("button_send_file") as Gtk.Button;

Expand Down
4 changes: 2 additions & 2 deletions src/ui/GroupConversationWidget.vala
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ namespace Venom {
box_user_info.remove(label_groupchat_name_);
label_groupchat_name = new EditableLabel.with_label(label_groupchat_name_);
box_user_info.pack_start(label_groupchat_name, false);
label_groupchat_name.button_cancel.get_style_context().add_class("callbutton");
label_groupchat_name.button_ok.get_style_context().add_class("callbutton");
label_groupchat_name.button_cancel.get_style_context().add_class("sendbutton");
label_groupchat_name.button_ok.get_style_context().add_class("sendbutton");
label_groupchat_name.show_all();
label_groupchat_name.show_entry.connect_after(() => {
label_groupchat_name.entry.text = groupchat.local_name;
Expand Down
4 changes: 2 additions & 2 deletions src/ui/conversation_window.ui
Original file line number Diff line number Diff line change
Expand Up @@ -151,8 +151,8 @@
<object class="GtkButton" id="button_call">
<property name="width_request">64</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="no_show_all">True</property>
<property name="can_focus">True</property>
<property name="tooltip_text" translatable="yes">Call contact</property>
<property name="image">image_call</property>
<style>
Expand Down Expand Up @@ -341,7 +341,7 @@
<property name="tooltip_text" translatable="yes">Send message</property>
<property name="image">image_send</property>
<style>
<class name="callbutton"/>
<class name="sendbutton"/>
</style>
</object>
<packing>
Expand Down
77 changes: 64 additions & 13 deletions theme/default.css
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@
background-image: none;
border-image: none;
border-style: none;
border-radius: 7px;
border-radius: 5px;
}

.contact_list .userbutton:active,
Expand All @@ -175,7 +175,7 @@
border-image: none;
padding: 0;
border: none;
border-radius: 7px;
border-radius: 5px;
}

.contact_list .cell {
Expand Down Expand Up @@ -228,7 +228,7 @@
background-color: @background;
background-image: none;
border: 0px solid black;
border-radius: 7px;
border-radius: 5px;
}

GtkPaned,
Expand Down Expand Up @@ -260,32 +260,83 @@ GtkEventBox,
border-color: @separator-color;
}


.conversation_widget .callbutton:active,
.conversation_widget .callbutton:hover:active,
.conversation_widget .callbutton:focus:active,
.conversation_widget .callbutton:insensitive,
.conversation_widget .callbutton:insensitive:insensitive {
.conversation_widget .callbutton:selected,
.conversation_widget .callbutton:hover {
background-color: @callbutton-selected;
background-image: none;
border-image: none;
}

.conversation_widget .callbutton:active,
.conversation_widget .callbutton:hover:active,
.conversation_widget .callbutton:focus:active {
.conversation_widget .callbutton {
background-color: @callbutton-color;
background-image: none;
border-image: none;
border-radius: 5px;
border: none;
}

.conversation_widget .callbutton-ringing:active,
.conversation_widget .callbutton-ringing:hover:active,
.conversation_widget .callbutton-ringing:focus:active,
.conversation_widget .callbutton-ringing:insensitive,
.conversation_widget .callbutton-ringing:selected,
.conversation_widget .callbutton-ringing:hover {
background-color: lighter(gold);
background-image: none;
border-image: none;
}

.conversation_widget .callbutton-ringing {
background-color: gold;
background-image: none;
border-image: none;
border-radius: 5px;
border: none;
}

.conversation_widget .callbutton-started:active,
.conversation_widget .callbutton-started:hover:active,
.conversation_widget .callbutton-started:focus:active,
.conversation_widget .callbutton-started:insensitive,
.conversation_widget .callbutton-started:selected,
.conversation_widget .callbutton-started:hover {
background-color: lighter(red);
background-image: none;
border-image: none;
}

.conversation_widget .callbutton-started {
background-color: red;
background-image: none;
border-image: none;
border-radius: 5px;
border: none;
}

.conversation_widget .sendbutton:active,
.conversation_widget .sendbutton:hover:active,
.conversation_widget .sendbutton:focus:active {
background-color: lighter (@callbutton-selected);
background-image: none;
}

.conversation_widget .callbutton:selected,
.conversation_widget .callbutton:hover {
.conversation_widget .sendbutton:insensitive,
.conversation_widget .sendbutton:selected,
.conversation_widget .sendbutton:hover {
background-color: @callbutton-selected;
background-image: none;
border-image: none;
}

.conversation_widget .callbutton {
.conversation_widget .sendbutton {
background-color: @callbutton-color;
background-image: none;
border-image: none;
border-radius: 7px;
border-radius: 5px;
border: none;
}

Expand Down Expand Up @@ -349,7 +400,7 @@ GtkEventBox,
background-color: #d1d1d1;
background-image: none;
border: 0px solid black;
border-radius: 7px;
border-radius: 5px;
}

.message_entry .own_name {
Expand Down

0 comments on commit 5069bcb

Please sign in to comment.