Commit 3e4055b2 authored by Nicolas Jager's avatar Nicolas Jager

edit tabs

- hide the tabs if there is no contact request.

Change-Id: Id1b06bfb6e286b670f2f284bc6616f6324de1583
parent abc26c3b
......@@ -183,7 +183,7 @@ public:
void leaveFullScreen();
void toggleFullScreen();
void resetToWelcome();
void setPendingContactRequestTabIcon();
void setPendingContactRequestTabIcon(RingMainWindow *win);
void showAccountSelectorWidget(bool show = true);
void changeAccountSelection(const std::string& id);
void onAccountSelectionChange(const std::string& id);
......@@ -291,6 +291,8 @@ on_account_changed(RingMainWindow* self)
gchar* accountId;
gtk_tree_model_get(model, &iter, 0 /* col# */, &accountId /* data */, -1);
priv->cpp->onAccountSelectionChange(accountId);
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(priv->notebook_contacts),
priv->cpp->accountContainer_->info.contactModel->hasPendingRequests());
g_free(accountId);
}
}
......@@ -719,7 +721,7 @@ CppImpl::init()
g_signal_connect_swapped(widgets->combobox_account_selector, "changed", G_CALLBACK(on_account_changed), self);
// initialize the pending contact request icon.
setPendingContactRequestTabIcon();
setPendingContactRequestTabIcon(self);
if (isInitialized) {
auto& conversationModel = accountContainer_->info.conversationModel;
......@@ -769,6 +771,15 @@ CppImpl::changeView(GType type, lrc::api::conversation::Info conversation)
} else {
// TODO select first conversation?
new_view = widgets->welcome_view;
// refresh the tabs
auto hasPendingRequests = accountContainer_->info.contactModel->hasPendingRequests();
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(widgets->notebook_contacts), hasPendingRequests);
if (not hasPendingRequests) {
gtk_notebook_prev_page(GTK_NOTEBOOK(widgets->notebook_contacts));
}
}
gtk_container_add(GTK_CONTAINER(widgets->frame_call), new_view);
......@@ -870,9 +881,11 @@ CppImpl::resetToWelcome()
}
void
CppImpl::setPendingContactRequestTabIcon()
CppImpl::setPendingContactRequestTabIcon(RingMainWindow *win)
{
if (not accountContainer_)
auto* priv = RING_MAIN_WINDOW_GET_PRIVATE(win);
if (not accountContainer_ or not priv->cpp->accountContainer_->info.contactModel->hasPendingRequests())
return;
auto isRingAccount = accountContainer_->info.profileInfo.type == lrc::api::profile::Type::RING;
......@@ -881,6 +894,8 @@ CppImpl::setPendingContactRequestTabIcon()
if (not isRingAccount)
return;
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(priv->notebook_contacts), true);
gtk_image_set_from_resource(GTK_IMAGE(widgets->image_contact_requests_list),
(accountContainer_->info.contactModel->hasPendingRequests())
? "/cx/ring/RingGnome/contact_requests_list_with_notification"
......@@ -1263,7 +1278,7 @@ CppImpl::slotModelSorted()
else if (IS_INCOMING_CALL_VIEW(old_view))
current_item = incoming_call_view_get_conversation(INCOMING_CALL_VIEW(old_view));
conversations_view_select_conversation(CONVERSATIONS_VIEW(widgets->treeview_conversations), current_item.uid);
setPendingContactRequestTabIcon();
setPendingContactRequestTabIcon(self);
}
void
......
......@@ -250,6 +250,7 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="show_border">False</property>
<property name="show_tabs">False</property>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_smartview">
<property name="visible">True</property>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment