refactor: remove unused code
New models from the LRC made a lot of code useless. This code should be
removed.
Change-Id: Ice3d67b65ee19d43cb604eb2bd6d72b1c082cfae
Reviewed-by: Olivier Soldano <olivier.soldano@savoirfairelinux.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 20e68d9..7a4e426 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -289,12 +289,8 @@
src/utils/files.h
src/utils/files.cpp
${GIT_REVISION_OUTPUT_FILE}
- src/utils/menus.h
- src/utils/menus.cpp
src/utils/accounts.h
src/utils/accounts.cpp
- src/contactpopover.h
- src/contactpopover.cpp
src/choosecontactview.h
src/choosecontactview.cpp
src/editcontactview.h
@@ -303,8 +299,6 @@
src/native/dbuserrorhandler.cpp
src/ringwelcomeview.h
src/ringwelcomeview.cpp
- src/recentcontactsview.h
- src/recentcontactsview.cpp
src/webkitchatcontainer.h
src/webkitchatcontainer.cpp
src/chatview.h
@@ -313,25 +307,19 @@
src/avatarmanipulation.cpp
src/accountimportexportview.h
src/accountimportexportview.cpp
- src/contactpopupmenu.h
- src/contactpopupmenu.cpp
src/cc-crop-area.h
src/cc-crop-area.c
src/models/namenumberfilterproxymodel.h
src/models/namenumberfilterproxymodel.cpp
- src/pendingcontactrequests.h
- src/pendingcontactrequests.cpp
- src/contactrequestcontentview.h
- src/contactrequestcontentview.cpp
src/accountbanstab.h
src/accountbanstab.cpp
src/bannedcontactsview.h
src/bannedcontactsview.cpp
- src/accountcontainer.h
- src/conversationpopupmenu.h
- src/conversationpopupmenu.cpp
src/conversationsview.h
src/conversationsview.cpp
+ src/conversationpopupmenu.h
+ src/conversationpopupmenu.cpp
+ src/accountcontainer.h
)
# compile glib resource files to c code
diff --git a/src/contactpopover.cpp b/src/contactpopover.cpp
deleted file mode 100644
index c2ff0c8..0000000
--- a/src/contactpopover.cpp
+++ /dev/null
@@ -1,218 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "contactpopover.h"
-
-#include <contactmethod.h>
-#include "choosecontactview.h"
-#include "editcontactview.h"
-
-struct _ContactPopover
-{
-#if GTK_CHECK_VERSION(3,12,0)
- GtkPopover parent;
-#else
- GtkWindow parent;
-#endif
-};
-
-struct _ContactPopoverClass
-{
-#if GTK_CHECK_VERSION(3,12,0)
- GtkPopoverClass parent_class;
-#else
- GtkWindowClass parent_class;
-#endif
-};
-
-typedef struct _ContactPopoverPrivate ContactPopoverPrivate;
-
-struct _ContactPopoverPrivate
-{
- GtkWidget *choosecontactview;
- GtkWidget *editcontactview;
-
- ContactMethod *cm;
-};
-
-#if GTK_CHECK_VERSION(3,12,0)
- G_DEFINE_TYPE_WITH_PRIVATE(ContactPopover, contact_popover, GTK_TYPE_POPOVER);
-#else
- G_DEFINE_TYPE_WITH_PRIVATE(ContactPopover, contact_popover, GTK_TYPE_WINDOW);
-#endif
-
-
-#define CONTACT_POPOVER_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CONTACT_POPOVER_TYPE, ContactPopoverPrivate))
-
-#if !GTK_CHECK_VERSION(3,12,0)
-static gboolean
-contact_popover_button_release(GtkWidget *self, GdkEventButton *event)
-{
- auto child = gtk_bin_get_child(GTK_BIN(self));
-
- auto event_widget = gtk_get_event_widget((GdkEvent *) event);
-
- GtkAllocation child_alloc;
-
- gtk_widget_get_allocation(child, &child_alloc);
-
- if (event->x < child_alloc.x ||
- event->x > child_alloc.x + child_alloc.width ||
- event->y < child_alloc.y ||
- event->y > child_alloc.y + child_alloc.height)
- gtk_widget_destroy(self);
- else if (!gtk_widget_is_ancestor(event_widget, self))
- gtk_widget_destroy(self);
-
- return GDK_EVENT_PROPAGATE;
-}
-
-static gboolean
-contact_popover_key_press(GtkWidget *self, GdkEventKey *event)
-{
- if (event->keyval == GDK_KEY_Escape) {
- gtk_widget_destroy(self);
- return GDK_EVENT_STOP;
- }
-
- return GDK_EVENT_PROPAGATE;
-}
-#endif
-
-static void
-contact_popover_init(ContactPopover *self)
-{
-#if GTK_CHECK_VERSION(3,12,0)
- /* for now, destroy the popover on close, as we will construct a new one
- * each time we need it */
- g_signal_connect(self, "closed", G_CALLBACK(gtk_widget_destroy), NULL);
-#else
- /* destroy the window on ESC, or when the user clicks outside of it */
- g_signal_connect(self, "button_release_event", G_CALLBACK(contact_popover_button_release), NULL);
- g_signal_connect(self, "key_press_event", G_CALLBACK(contact_popover_key_press), NULL);
-#endif
-}
-
-static void
-contact_popover_dispose(GObject *object)
-{
- G_OBJECT_CLASS(contact_popover_parent_class)->dispose(object);
-}
-
-static void
-contact_popover_finalize(GObject *object)
-{
- G_OBJECT_CLASS(contact_popover_parent_class)->finalize(object);
-}
-static void
-contact_popover_class_init(ContactPopoverClass *klass)
-{
- G_OBJECT_CLASS(klass)->finalize = contact_popover_finalize;
- G_OBJECT_CLASS(klass)->dispose = contact_popover_dispose;
-}
-
-static void
-construct_edit_contact_view(ContactPopover *self, Person *p)
-{
- g_return_if_fail(IS_CONTACT_POPOVER(self));
- ContactPopoverPrivate *priv = CONTACT_POPOVER_GET_PRIVATE(self);
-
- priv->editcontactview = edit_contact_view_new(priv->cm, p);
- g_object_add_weak_pointer(G_OBJECT(priv->editcontactview), (gpointer *)&priv->editcontactview);
-
- gtk_container_remove(GTK_CONTAINER(self), priv->choosecontactview);
- gtk_container_add(GTK_CONTAINER(self), priv->editcontactview);
-
-#if !GTK_CHECK_VERSION(3,12,0)
- /* resize the window to shrink to the new view */
- gtk_window_resize(GTK_WINDOW(self), 1, 1);
-#endif
-
- /* destroy this popover when the contact is saved */
- g_signal_connect_swapped(priv->editcontactview, "person-saved", G_CALLBACK(gtk_widget_destroy), self);
-}
-
-static void
-new_person_clicked(ContactPopover *self)
-{
- g_return_if_fail(IS_CONTACT_POPOVER(self));
- construct_edit_contact_view(self, NULL);
-}
-
-static void
-person_selected(ContactPopover *self, Person *p)
-{
- g_return_if_fail(IS_CONTACT_POPOVER(self));
- construct_edit_contact_view(self, p);
-}
-
-/**
- * For gtk+ >= 3.12 this will create a GtkPopover pointing to the parent and if
- * given, the GdkRectangle. Otherwise, this will create an undecorated GtkWindow
- * which will be centered on the toplevel window of the given parent.
- * This is to ensure cmpatibility with gtk+3.10.
- */
-GtkWidget *
-contact_popover_new(ContactMethod *cm, GtkWidget *parent,
-#if !GTK_CHECK_VERSION(3,12,0)
- G_GNUC_UNUSED
-#endif
- GdkRectangle *rect)
-{
- g_return_val_if_fail(cm, NULL);
-
-#if GTK_CHECK_VERSION(3,12,0)
- gpointer self = g_object_new(CONTACT_POPOVER_TYPE,
- "relative-to", parent,
- "position", GTK_POS_RIGHT,
- NULL);
-
- if (rect)
- gtk_popover_set_pointing_to(GTK_POPOVER(self), rect);
-#else
- /* get the toplevel parent and try to center on it */
- if (parent && GTK_IS_WIDGET(parent)) {
- parent = gtk_widget_get_toplevel(GTK_WIDGET(parent));
- if (!gtk_widget_is_toplevel(parent)) {
- parent = NULL;
- g_debug("could not get top level parent");
- }
- }
-
- gpointer self = g_object_new(CONTACT_POPOVER_TYPE,
- "modal", TRUE,
- "transient-for", parent,
- "window-position", GTK_WIN_POS_CENTER_ON_PARENT,
- "decorated", FALSE,
- "resizable", FALSE,
- NULL);
-#endif
-
- ContactPopoverPrivate *priv = CONTACT_POPOVER_GET_PRIVATE(self);
- priv->cm = cm;
-
- priv->choosecontactview = choose_contact_view_new(cm);
- gtk_container_add(GTK_CONTAINER(self), priv->choosecontactview);
- g_object_add_weak_pointer(G_OBJECT(priv->choosecontactview), (gpointer *)&priv->choosecontactview);
-
- g_signal_connect_swapped(priv->choosecontactview, "new-person-clicked", G_CALLBACK(new_person_clicked), self);
- g_signal_connect_swapped(priv->choosecontactview, "person-selected", G_CALLBACK(person_selected), self);
-
- return (GtkWidget *)self;
-}
diff --git a/src/contactpopover.h b/src/contactpopover.h
deleted file mode 100644
index 28c17b1..0000000
--- a/src/contactpopover.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef _CONTACTPOPOVER_H
-#define _CONTACTPOPOVER_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-class ContactMethod;
-
-#define CONTACT_POPOVER_TYPE (contact_popover_get_type ())
-#define CONTACT_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACT_POPOVER_TYPE, ContactPopover))
-#define CONTACT_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), CONTACT_POPOVER_TYPE, ContactPopoverClass))
-#define IS_CONTACT_POPOVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CONTACT_POPOVER_TYPE))
-#define IS_CONTACT_POPOVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CONTACT_POPOVER_TYPE))
-
-typedef struct _ContactPopover ContactPopover;
-typedef struct _ContactPopoverClass ContactPopoverClass;
-
-GType contact_popover_get_type (void) G_GNUC_CONST;
-
-/**
- * For gtk+ >= 3.12 this will create a GtkPopover pointing to the parent and if
- * given, the GdkRectangle. Otherwise, this will create an undecorated GtkWindow
- * which will be centered on the toplevel window of the given parent.
- * This is to ensure cmpatibility with gtk+3.10.
- */
-GtkWidget *contact_popover_new (ContactMethod *cm, GtkWidget *parent, GdkRectangle *rect);
-
-G_END_DECLS
-
-#endif /* _CONTACTPOPOVER_H */
diff --git a/src/contactpopupmenu.cpp b/src/contactpopupmenu.cpp
deleted file mode 100644
index 7dc4a7c..0000000
--- a/src/contactpopupmenu.cpp
+++ /dev/null
@@ -1,482 +0,0 @@
-/*
- * Copyright (C) 2016-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "contactpopupmenu.h"
-#include "utils/accounts.h"
-
-// GTK+ related
-#include <glib/gi18n.h>
-
-// LRC
-#include <contactmethod.h>
-#include <person.h>
-#include <personmodel.h>
-#include <numbercategory.h>
-#include <call.h>
-#include <account.h>
-
-// Ring client
-#include "utils/calling.h"
-#include "models/gtkqtreemodel.h"
-#include "utils/menus.h"
-
-static constexpr const char* COPY_DATA_KEY = "copy_data";
-
-struct _ContactPopupMenu
-{
- GtkMenu parent;
-};
-
-struct _ContactPopupMenuClass
-{
- GtkMenuClass parent_class;
-};
-
-typedef struct _ContactPopupMenuPrivate ContactPopupMenuPrivate;
-
-struct _ContactPopupMenuPrivate
-{
- GtkTreeView *treeview;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE(ContactPopupMenu, contact_popup_menu, GTK_TYPE_MENU);
-
-#define CONTACT_POPUP_MENU_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CONTACT_POPUP_MENU_TYPE, ContactPopupMenuPrivate))
-
-static void
-copy_contact_info(GtkWidget *item, G_GNUC_UNUSED gpointer user_data)
-{
- gpointer data = g_object_get_data(G_OBJECT(item), COPY_DATA_KEY);
- g_return_if_fail(data);
- gchar* text = (gchar *)data;
- GtkClipboard* clip = gtk_clipboard_get(GDK_SELECTION_CLIPBOARD);
- gtk_clipboard_set_text(clip, text, -1);
-}
-
-static void
-call_contactmethod(G_GNUC_UNUSED GtkWidget *item, ContactMethod *cm)
-{
- g_return_if_fail(cm);
- place_new_call(cm);
-}
-
-static void
-add_daemon_contact(G_GNUC_UNUSED GtkWidget *item, ContactMethod *cm)
-{
- // get the choosen account
- auto account = cm->account();
- if (not account) {
- account = get_active_ring_account();
-
- if (not account) {
- g_warning("invalid account, cannot send invitation!");
- return;
- }
- }
-
- // Send a request to the new contact
- if (not account->sendContactRequest(cm))
- g_warning("contact request not forwarded, cannot send invitation!");
-}
-
-static void
-add_contact(G_GNUC_UNUSED GtkWidget *item, ContactMethod *cm)
-{
- const auto& collections = PersonModel::instance().enabledCollections();
- CollectionInterface* collection = nullptr;
- for (const auto c : collections) {
- if (c->id() == QByteArray("ppc")) {
- collection = c;
- }
- }
-
- if (collection) {
- // Create a new Person in PeerProfileCollection
- auto person = new Person(collection);
- person->setFormattedName(cm->bestName());
-
- Person::ContactMethods numbers;
- numbers << cm;
- person->setContactMethods(numbers);
-
- PersonModel::instance().addPeerProfile(person);
- person->save();
- } else {
- g_warning("Can't find PeerProfileCollection");
- }
-
- // And add it in Daemon Contacts
- add_daemon_contact(item, cm);
-}
-
-static void
-rm_daemon_contact(G_GNUC_UNUSED GtkWidget *item, ContactMethod *cm)
-{
- // get the choosen account
- auto account = cm->account();
- if (not account) {
-
- account = get_active_ring_account();
-
- if (not account) {
- g_warning("invalid account, cannot send invitation!");
- return;
- }
- }
-
- if (not account->removeContact(cm))
- g_warning("contact request not forwarded, cannot send invitation!");
-}
-
-static void
-remove_contact(GtkWidget *item, Person *person)
-{
- // Remove the Person from PeerProfileCollection
- person->remove();
- // And the cm from Daemon Contacts
- for ( const auto cm : person->phoneNumbers() ) {
- rm_daemon_contact(item, cm);
- }
-}
-
-/**
- * Update the menu when the selected item in the treeview changes.
- */
-static void
-update(GtkTreeSelection *selection, ContactPopupMenu *self)
-{
- ContactPopupMenuPrivate *priv = CONTACT_POPUP_MENU_GET_PRIVATE(self);
-
- /* clear the current menu */
- gtk_container_forall(GTK_CONTAINER(self), (GtkCallback)gtk_widget_destroy, nullptr);
-
- /* we always build a menu, however in some cases some or all of the items will be deactivated;
- * we prefer this to having an empty menu because GTK+ behaves weird in the empty menu case
- */
- auto call_item = gtk_menu_item_new_with_mnemonic(_("_Call"));
- gtk_widget_set_sensitive(GTK_WIDGET(call_item), FALSE);
- gtk_menu_shell_append(GTK_MENU_SHELL(self), call_item);
- auto copy_name_item = gtk_menu_item_new_with_mnemonic(_("_Copy name"));
- gtk_widget_set_sensitive(GTK_WIDGET(copy_name_item), FALSE);
- gtk_menu_shell_append(GTK_MENU_SHELL(self), copy_name_item);
- auto copy_number_item = gtk_menu_item_new_with_mnemonic(_("_Copy number"));
- gtk_widget_set_sensitive(GTK_WIDGET(copy_number_item), FALSE);
- gtk_menu_shell_append(GTK_MENU_SHELL(self), copy_number_item);
- auto add_to_contact_item = gtk_menu_item_new_with_mnemonic(_("_Add to contact"));
- gtk_widget_set_sensitive(GTK_WIDGET(add_to_contact_item), FALSE);
- gtk_menu_shell_append(GTK_MENU_SHELL(self), add_to_contact_item);
- auto remove_contact_item = gtk_menu_item_new_with_mnemonic(_("_Remove contact"));
- gtk_widget_set_sensitive(GTK_WIDGET(remove_contact_item), FALSE);
- gtk_menu_shell_append(GTK_MENU_SHELL(self), remove_contact_item);
-
- /* show all items */
- gtk_widget_show_all(GTK_WIDGET(self));
-
- GtkTreeIter iter;
- GtkTreeModel *model;
- if (!gtk_tree_selection_get_selected(selection, &model, &iter))
- return;
-
- QModelIndex idx = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), &iter);
-
- auto type = idx.data(static_cast<int>(Ring::Role::ObjectType));
- auto object = idx.data(static_cast<int>(Ring::Role::Object));
- if (!type.isValid() || !object.isValid())
- return; // not a valid Ring::Role::Object, so nothing to do
-
- /* call */
- switch (type.value<Ring::ObjectType>()) {
- case Ring::ObjectType::Person:
- {
- /* possiblity for multiple numbers */
- auto cms = object.value<Person *>()->phoneNumbers();
- if (cms.size() == 1) {
- gtk_widget_set_sensitive(GTK_WIDGET(call_item), TRUE);
- g_signal_connect(call_item,
- "activate",
- G_CALLBACK(call_contactmethod),
- cms.at(0));
- } else if (cms.size() > 1) {
- gtk_widget_set_sensitive(GTK_WIDGET(call_item), TRUE);
- auto call_menu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(call_item), call_menu);
- for (int i = 0; i < cms.size(); ++i) {
- gchar *number = nullptr;
- if (cms.at(i)->category()) {
- // try to get the number category, eg: "home"
- number = g_strdup_printf("(%s) %s", cms.at(i)->category()->name().toUtf8().constData(),
- cms.at(i)->uri().toUtf8().constData());
- } else {
- number = g_strdup_printf("%s", cms.at(i)->uri().toUtf8().constData());
- }
- auto item = gtk_menu_item_new_with_label(number);
- g_free(number);
- gtk_menu_shell_append(GTK_MENU_SHELL(call_menu), item);
- g_signal_connect(item,
- "activate",
- G_CALLBACK(call_contactmethod),
- cms.at(i));
- }
- }
- }
- break;
- case Ring::ObjectType::ContactMethod:
- {
- gtk_widget_set_sensitive(GTK_WIDGET(call_item), TRUE);
- auto cm = object.value<ContactMethod *>();
- g_signal_connect(call_item,
- "activate",
- G_CALLBACK(call_contactmethod),
- cm);
- }
- break;
- case Ring::ObjectType::Call:
- {
- gtk_widget_set_sensitive(GTK_WIDGET(call_item), TRUE);
- auto call = object.value<Call *>();
- g_signal_connect(call_item,
- "activate",
- G_CALLBACK(call_contactmethod),
- call->peerContactMethod());
- }
- break;
- case Ring::ObjectType::Media:
- case Ring::ObjectType::Certificate:
- case Ring::ObjectType::ContactRequest:
- // nothing to do for now
- case Ring::ObjectType::COUNT__:
- break;
- }
-
- /* copy name */
- QVariant name_var = idx.data(static_cast<int>(Ring::Role::Name));
- if (name_var.isValid()) {
- gtk_widget_set_sensitive(GTK_WIDGET(copy_name_item), TRUE);
- gchar *name = g_strdup_printf("%s", name_var.value<QString>().toUtf8().constData());
- g_object_set_data_full(G_OBJECT(copy_name_item), COPY_DATA_KEY, name, (GDestroyNotify)g_free);
- g_signal_connect(copy_name_item,
- "activate",
- G_CALLBACK(copy_contact_info),
- NULL);
- }
-
- /* copy number(s) */
- switch (type.value<Ring::ObjectType>()) {
- case Ring::ObjectType::Person:
- {
- /* possiblity for multiple numbers */
- auto cms = object.value<Person *>()->phoneNumbers();
- if (cms.size() == 1) {
- gtk_widget_set_sensitive(GTK_WIDGET(copy_number_item), TRUE);
- gchar *number = g_strdup_printf("%s",cms.at(0)->uri().toUtf8().constData());
- g_object_set_data_full(G_OBJECT(copy_number_item), COPY_DATA_KEY, number, (GDestroyNotify)g_free);
- g_signal_connect(copy_number_item,
- "activate",
- G_CALLBACK(copy_contact_info),
- NULL);
- } else if (cms.size() > 1) {
- gtk_widget_set_sensitive(GTK_WIDGET(copy_number_item), TRUE);
- auto copy_menu = gtk_menu_new();
- gtk_menu_item_set_submenu(GTK_MENU_ITEM(copy_number_item), copy_menu);
- for (int i = 0; i < cms.size(); ++i) {
- auto number = g_strdup_printf("%s",cms.at(i)->uri().toUtf8().constData());
- gchar *category_number = nullptr;
- if (cms.at(i)->category()) {
- // try to get the number category, eg: "home"
- category_number = g_strdup_printf("(%s) %s",
- cms.at(i)->category()->name().toUtf8().constData(),
- number);
- } else {
- category_number = g_strdup_printf("%s", number);
- }
- auto item = gtk_menu_item_new_with_label(category_number);
- g_free(category_number);
- gtk_menu_shell_append(GTK_MENU_SHELL(copy_menu), item);
- g_object_set_data_full(G_OBJECT(item), COPY_DATA_KEY, number, (GDestroyNotify)g_free);
- g_signal_connect(item,
- "activate",
- G_CALLBACK(copy_contact_info),
- NULL);
- }
- }
- }
- break;
- case Ring::ObjectType::ContactMethod:
- case Ring::ObjectType::Call:
- {
- QVariant number_var = idx.data(static_cast<int>(Ring::Role::Number));
- if (number_var.isValid()) {
- gtk_widget_set_sensitive(GTK_WIDGET(copy_number_item), TRUE);
- gchar *number = g_strdup_printf("%s", number_var.value<QString>().toUtf8().constData());
- g_object_set_data_full(G_OBJECT(copy_number_item), COPY_DATA_KEY, number, (GDestroyNotify)g_free);
- g_signal_connect(copy_number_item,
- "activate",
- G_CALLBACK(copy_contact_info),
- NULL);
- }
- }
- break;
- case Ring::ObjectType::Media:
- case Ring::ObjectType::Certificate:
- case Ring::ObjectType::ContactRequest:
- // nothing to do
- case Ring::ObjectType::COUNT__:
- break;
- }
-
- /* get rectangle to know where to draw the add to contact popup */
- GdkRectangle rect;
- auto path = gtk_tree_model_get_path(model, &iter);
- auto column = gtk_tree_view_get_column(priv->treeview, 0);
- gtk_tree_view_get_cell_area(priv->treeview, path, column, &rect);
- gtk_tree_view_convert_bin_window_to_widget_coords(priv->treeview, rect.x, rect.y, &rect.x, &rect.y);
- gtk_tree_path_free(path);
-
- // Get the current cm
- ContactMethod* cm = nullptr;
- switch (type.value<Ring::ObjectType>()) {
- case Ring::ObjectType::Person:
- {
- auto cms = object.value<Person *>()->phoneNumbers();
- if (cms.size() > 0)
- cm = cms.at(0);
- }
- break;
- case Ring::ObjectType::ContactMethod:
- cm = object.value<ContactMethod *>();
- break;
- case Ring::ObjectType::Call:
- cm = object.value<Call *>()->peerContactMethod();
- break;
- case Ring::ObjectType::Media:
- case Ring::ObjectType::Certificate:
- case Ring::ObjectType::ContactRequest:
- case Ring::ObjectType::COUNT__:
- // nothing to do
- break;
- }
-
- auto account = cm->account();
- if (not account) {
- account = get_active_ring_account();
- }
-
- switch (type.value<Ring::ObjectType>()) {
- case Ring::ObjectType::Person:
- {
- auto person = object.value<Person *>();
- gtk_widget_set_sensitive(GTK_WIDGET(remove_contact_item), true);
- // Remove to PeerProfileCollection and Daemon Contacts
- g_signal_connect(remove_contact_item,
- "activate",
- G_CALLBACK(remove_contact),
- person);
- }
- break;
- case Ring::ObjectType::ContactMethod:
- case Ring::ObjectType::Call:
- {
- // Check if it's a daemon contact
- auto isADaemonContact = false;
- if (account) {
- auto contacts = account->getContacts();
- isADaemonContact = contacts.indexOf(cm) != -1;
- }
- gtk_widget_set_sensitive(GTK_WIDGET(add_to_contact_item), !isADaemonContact);
- gtk_widget_set_sensitive(GTK_WIDGET(remove_contact_item), isADaemonContact);
- // Add to PeerProfileCollection and Daemon Contacts
- g_signal_connect(add_to_contact_item,
- "activate",
- G_CALLBACK(add_contact),
- cm);
- // Remove from Daemon Contacts (it's not in PeerProfileCollection)
- g_signal_connect(remove_contact_item,
- "activate",
- G_CALLBACK(rm_daemon_contact),
- cm);
- }
- break;
- case Ring::ObjectType::Media:
- case Ring::ObjectType::Certificate:
- case Ring::ObjectType::ContactRequest:
- case Ring::ObjectType::COUNT__:
- {
- // No CM to add or remove
- gtk_widget_set_sensitive(GTK_WIDGET(add_to_contact_item), false);
- gtk_widget_set_sensitive(GTK_WIDGET(remove_contact_item), false);
- }
- break;
- }
-
- /* show all items */
- gtk_widget_show_all(GTK_WIDGET(self));
-}
-
-static void
-contact_popup_menu_init(G_GNUC_UNUSED ContactPopupMenu *self)
-{
- // nothing to do
-}
-
-static void
-contact_popup_menu_dispose(GObject *object)
-{
- G_OBJECT_CLASS(contact_popup_menu_parent_class)->dispose(object);
-}
-
-static void
-contact_popup_menu_finalize(GObject *object)
-{
- G_OBJECT_CLASS(contact_popup_menu_parent_class)->finalize(object);
-}
-
-static void
-contact_popup_menu_class_init(ContactPopupMenuClass *klass)
-{
- G_OBJECT_CLASS(klass)->finalize = contact_popup_menu_finalize;
- G_OBJECT_CLASS(klass)->dispose = contact_popup_menu_dispose;
-}
-
-GtkWidget *
-contact_popup_menu_new(GtkTreeView *treeview)
-{
- gpointer self = g_object_new(CONTACT_POPUP_MENU_TYPE, NULL);
- ContactPopupMenuPrivate *priv = CONTACT_POPUP_MENU_GET_PRIVATE(self);
-
- priv->treeview = treeview;
- GtkTreeSelection *selection = gtk_tree_view_get_selection(priv->treeview);
- g_signal_connect(selection, "changed", G_CALLBACK(update), self);
-
- // build the menu for the first time
- update(selection, CONTACT_POPUP_MENU(self));
-
- return (GtkWidget *)self;
-}
-
-gboolean
-contact_popup_menu_show(ContactPopupMenu *self, GdkEventButton *event)
-{
- /* check for right click */
- if (event->type == GDK_BUTTON_PRESS && event->button == GDK_BUTTON_SECONDARY ) {
- /* the menu will automatically get updated when the selection changes */
- gtk_menu_popup(GTK_MENU(self), NULL, NULL, NULL, NULL, event->button, event->time);
- }
-
- return GDK_EVENT_PROPAGATE; /* so that the item selection changes */
-}
diff --git a/src/contactpopupmenu.h b/src/contactpopupmenu.h
deleted file mode 100644
index d525db7..0000000
--- a/src/contactpopupmenu.h
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * Copyright (C) 2016-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#pragma once
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define CONTACT_POPUP_MENU_TYPE (contact_popup_menu_get_type ())
-#define CONTACT_POPUP_MENU(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACT_POPUP_MENU_TYPE, ContactPopupMenu))
-#define CONTACT_POPUP_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), CONTACT_POPUP_MENU_TYPE, ContactPopupMenuClass))
-#define IS_CONTACT_POPUP_MENU(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CONTACT_POPUP_MENU_TYPE))
-#define IS_CONTACT_POPUP_MENU_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CONTACT_POPUP_MENU_TYPE))
-
-typedef struct _ContactPopupMenu ContactPopupMenu;
-typedef struct _ContactPopupMenuClass ContactPopupMenuClass;
-
-GType contact_popup_menu_get_type (void) G_GNUC_CONST;
-GtkWidget *contact_popup_menu_new (GtkTreeView *treeview);
-gboolean contact_popup_menu_show (ContactPopupMenu *self, GdkEventButton *event);
-
-G_END_DECLS
diff --git a/src/contactrequestcontentview.cpp b/src/contactrequestcontentview.cpp
deleted file mode 100644
index 530b0d9..0000000
--- a/src/contactrequestcontentview.cpp
+++ /dev/null
@@ -1,236 +0,0 @@
-/*
- * Copyright (C) 2017 Savoir-faire Linux Inc.
- * Author: Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-// Client
-#include "contactrequestcontentview.h"
-#include "native/pixbufmanipulator.h"
-
-// System
-#include <gtk/gtk.h>
-
-// LRC
-#include <accountmodel.h>
-#include <certificate.h>
-#include <contactmethod.h>
-#include <contactrequest.h>
-#include <globalinstances.h>
-#include <pendingcontactrequestmodel.h>
-#include <person.h>
-
-/**
- * gtk structure
- */
-struct _ContactRequestContentView
-{
- GtkBox parent;
-};
-
-/**
- * signals
- */
-
-enum {
- HIDE_VIEW_CLICKED,
- LAST_SIGNAL
-};
-
-guint contact_request_content_view_signals[LAST_SIGNAL];
-
-/**
- * gtk class structure
- */
-struct _ContactRequestContentViewClass
-{
- GtkBoxClass parent_class;
-};
-
-typedef struct _ContactRequestContentViewPrivate ContactRequestContentViewPrivate;
-
-/**
- * gtk private structure
- */
-struct _ContactRequestContentViewPrivate
-{
- ContactRequest* contactRequest;
- Account* account;
-
- GtkWidget* label_peer;
- GtkWidget* button_ignore_contact_request;
- GtkWidget* button_accept_contact_request;
- GtkWidget* button_close_contact_request_content_view;
- GtkWidget* button_block_contact_request;
- GtkWidget* image_peer;
- GtkWidget* label_bestId;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE(ContactRequestContentView, contact_request_content_view, GTK_TYPE_BOX);
-
-#define CONTACT_REQUEST_CONTENT_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), CONTACT_REQUEST_CONTENT_VIEW_TYPE, ContactRequestContentViewPrivate))
-
-/**
- * gtk dispose function
- */
-static void
-contact_request_content_view_dispose(GObject *object)
-{
- G_OBJECT_CLASS(contact_request_content_view_parent_class)->dispose(object);
-}
-
-/**
- * gtk clicked callback to ignore contact request
- */
-static void
-button_ignore_contact_request_clicked(G_GNUC_UNUSED GtkWidget *widget, ContactRequestContentView *self)
-{
- auto priv = CONTACT_REQUEST_CONTENT_VIEW_GET_PRIVATE(self);
-
- priv->contactRequest->discard();
-
-}
-
-/**
- * gtk clicked callback to accept contact request
- */
-static void
-button_accept_contact_request_clicked(G_GNUC_UNUSED GtkWidget *widget, ContactRequestContentView *self)
-{
- auto priv = CONTACT_REQUEST_CONTENT_VIEW_GET_PRIVATE(self);
-
- priv->contactRequest->accept();
-}
-
-/**
- * gtk clicked callback to close the view
- */
-static void
-button_close_contact_request_content_view_clicked(G_GNUC_UNUSED GtkWidget *widget, ContactRequestContentView *self)
-{
- g_signal_emit(G_OBJECT(self), contact_request_content_view_signals[HIDE_VIEW_CLICKED], 0);
-}
-
-/**
- * gtk clicked callback to block contact request
- */
-static void
-button_block_contact_request_clicked(G_GNUC_UNUSED GtkWidget *widget, ContactRequestContentView *self)
-{
- auto priv = CONTACT_REQUEST_CONTENT_VIEW_GET_PRIVATE(self);
-
- priv->contactRequest->block();
-}
-
-/**
- * gtk init function
- */
-static void
-contact_request_content_view_init(ContactRequestContentView *self)
-{
- gtk_widget_init_template(GTK_WIDGET(self));
-
- auto priv = CONTACT_REQUEST_CONTENT_VIEW_GET_PRIVATE(self);
-
-
- // CSS styles
- auto provider = gtk_css_provider_new();
- gtk_css_provider_load_from_data(provider,
- ".flat-button { border: 0; border-radius: 5px; transition: all 0.3s ease; color: white; padding: 10px 20px 10px 20px; vertical-align: middle; } \
- .button-green { background: #27ae60; } \
- .button-green:hover { background: #219d55; } \
- .button-red {background: #dc3a37; } \
- .button-red:hover { background: #dc2719; } \
- ",
- -1, nullptr
- );
- gtk_style_context_add_provider_for_screen(gdk_display_get_default_screen(gdk_display_get_default()),
- GTK_STYLE_PROVIDER(provider),
- GTK_STYLE_PROVIDER_PRIORITY_APPLICATION);
-
- g_signal_connect(priv->button_ignore_contact_request, "clicked", G_CALLBACK(button_ignore_contact_request_clicked), self);
- g_signal_connect(priv->button_accept_contact_request, "clicked", G_CALLBACK(button_accept_contact_request_clicked), self);
- g_signal_connect(priv->button_block_contact_request, "clicked", G_CALLBACK(button_block_contact_request_clicked), self);
- g_signal_connect(priv->button_close_contact_request_content_view, "clicked", G_CALLBACK(button_close_contact_request_content_view_clicked), self);
-}
-
-static void
-contact_request_content_view_class_init(ContactRequestContentViewClass *klass)
-{
- G_OBJECT_CLASS(klass)->dispose = contact_request_content_view_dispose;
-
- gtk_widget_class_set_template_from_resource(GTK_WIDGET_CLASS (klass),
- "/cx/ring/RingGnome/contactrequestcontentview.ui");
-
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), ContactRequestContentView, label_peer);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), ContactRequestContentView, button_ignore_contact_request);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), ContactRequestContentView, button_accept_contact_request);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), ContactRequestContentView, button_block_contact_request);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), ContactRequestContentView, button_close_contact_request_content_view);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), ContactRequestContentView, image_peer);
- gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), ContactRequestContentView, label_bestId);
-
- contact_request_content_view_signals[HIDE_VIEW_CLICKED] = g_signal_new (
- "hide-view-clicked",
- G_TYPE_FROM_CLASS(klass),
- (GSignalFlags) (G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION),
- 0,
- nullptr,
- nullptr,
- g_cclosure_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
-
-}
-
-/**
- * gtk build function
- */
-void
-build_contact_request_content(ContactRequestContentView *self, ContactRequest *contact_request)
-{
- auto priv = CONTACT_REQUEST_CONTENT_VIEW_GET_PRIVATE(self);
- priv->contactRequest = contact_request;
- auto person = contact_request->peer();
-
- /* get photo */
- QVariant photo = GlobalInstances::pixmapManipulator().contactPhoto(person, QSize(110, 110), false);
- std::shared_ptr<GdkPixbuf> image = photo.value<std::shared_ptr<GdkPixbuf>>();
- gtk_image_set_from_pixbuf(GTK_IMAGE(priv->image_peer), image.get());
-
- /* get name */
- auto name_std = person->formattedName().toStdString();
- gtk_label_set_text(GTK_LABEL(priv->label_peer), name_std.c_str());
-
- /* get contact best id, if different from name */
- auto contactId_std = person->phoneNumbers()[0]->bestId().toStdString();
- if (name_std != contactId_std) {
- gtk_label_set_text(GTK_LABEL(priv->label_bestId), contactId_std.c_str());
- gtk_widget_show(priv->label_bestId);
- }
-}
-
-/**
- * gtk new function
- */
-GtkWidget*
-contact_request_content_view_new(ContactRequest *contact_request)
-{
- auto self = GTK_WIDGET(g_object_new(CONTACT_REQUEST_CONTENT_VIEW_TYPE, nullptr));
-
- build_contact_request_content(CONTACT_REQUEST_CONTENT_VIEW(self), contact_request);
-
- return self;
-}
diff --git a/src/contactrequestcontentview.h b/src/contactrequestcontentview.h
deleted file mode 100644
index 41433f8..0000000
--- a/src/contactrequestcontentview.h
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright (C) 2017 Savoir-faire Linux Inc.
- * Author: Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#pragma once
-
-#include <gtk/gtk.h>
-
-class ContactRequest;
-
-G_BEGIN_DECLS
-
-#define CONTACT_REQUEST_CONTENT_VIEW_TYPE (contact_request_content_view_get_type ())
-#define CONTACT_REQUEST_CONTENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CONTACT_REQUEST_CONTENT_VIEW_TYPE, ContactRequestContentView))
-#define CONTACT_REQUEST_CONTENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), CONTACT_REQUEST_CONTENT_VIEW_TYPE, ContactRequestContentViewClass))
-#define IS_CONTACT_REQUEST_CONTENT_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), CONTACT_REQUEST_CONTENT_VIEW_TYPE))
-#define IS_CONTACT_REQUEST_CONTENT_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), CONTACT_REQUEST_CONTENT_VIEW_TYPE))
-
-typedef struct _ContactRequestContentView ContactRequestContentView;
-typedef struct _ContactRequestContentViewClass ContactRequestContentViewClass;
-
-
-GType contact_request_content_view_get_type (void) G_GNUC_CONST;
-GtkWidget* contact_request_content_view_new (ContactRequest* contact_request);
-
-G_END_DECLS
diff --git a/src/pendingcontactrequests.cpp b/src/pendingcontactrequests.cpp
deleted file mode 100644
index b625813..0000000
--- a/src/pendingcontactrequests.cpp
+++ /dev/null
@@ -1,277 +0,0 @@
-/*
- * Copyright (C) 2017 Savoir-faire Linux Inc.
- * Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-// Client
-#include "pendingcontactrequests.h"
-#include "models/gtkqtreemodel.h"
-#include "native/pixbufmanipulator.h"
-#include "utils/accounts.h"
-
-// LRC
-#include <recentmodel.h>
-#include <accountmodel.h>
-#include <pendingcontactrequestmodel.h>
-#include <account.h>
-#include <availableaccountmodel.h>
-#include <globalinstances.h>
-#include <contactrequest.h>
-
-// Gtk
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-
-// Qt
-#include <QtCore/QDateTime>
-#include <QtCore/QSize>
-#include <QtCore/QLocale>
-
-/**
- * gtk structure
- */
-struct _PendingContactRequestsView
-{
- GtkTreeView parent;
-};
-
-/**
- * gtk class structure
- */
-struct _PendingContactRequestsViewClass
-{
- GtkTreeViewClass parent_class;
-};
-
-typedef struct _PendingContactRequestsViewPrivate PendingContactRequestsViewPrivate;
-
-/**
- * gtk private structure
- */
-struct _PendingContactRequestsViewPrivate
-{
- GtkWidget *treeview_pending_contact_request_list;
- QSortFilterProxyModel* myProxy;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE(PendingContactRequestsView, pending_contact_requests_view, GTK_TYPE_TREE_VIEW);
-
-#define PENDING_CONTACT_REQUESTS_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), PENDING_CONTACT_REQUESTS_VIEW_TYPE, PendingContactRequestsViewPrivate))
-
-/**
- * callback function for rendering the contact photo
- */
-static void
-render_contact_photo(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- G_GNUC_UNUSED gpointer data)
-{
- QModelIndex idx = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), iter);
-
- std::shared_ptr<GdkPixbuf> image;
- QVariant object = idx.data(static_cast<int>(Ring::Role::Object));
-
- if (idx.isValid() && object.isValid()) {
- QVariant var_photo;
- if (auto cr = object.value<ContactRequest *>()) {
- if (cr->peer())
- var_photo = GlobalInstances::pixmapManipulator().contactPhoto(cr->peer(), QSize(50, 50), false);
- }
- if (var_photo.isValid())
- image = var_photo.value<std::shared_ptr<GdkPixbuf>>();
-
- g_object_set(G_OBJECT(cell), "height", 50, NULL);
- g_object_set(G_OBJECT(cell), "width", 50, NULL);
- g_object_set(G_OBJECT(cell), "pixbuf", image.get(), NULL);
- }
-}
-
-/**
- * callback function for rendering the best id of the peer and the date.
- */
-static void
-render_name_and_info(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeView *treeview)
-{
- auto idx = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), iter);
-
- if (not idx.isValid()) {
- g_warning("could not get index for contact request");
- return;
- }
-
- // check if this iter is selected
- gboolean is_selected = FALSE;
- if (GTK_IS_TREE_VIEW(treeview)) {
- auto selection = gtk_tree_view_get_selection(treeview);
- is_selected = gtk_tree_selection_iter_is_selected(selection, iter);
- }
-
- /* best id */
- auto uri_qstring = idx.data(static_cast<int>(Qt::DisplayRole)).value<QString>();
- auto uri_std = uri_qstring.toStdString();
-
- /* profile name */
- auto qt_model = idx.model();
- auto idx_formatted_name = qt_model->index(idx.row(), static_cast<int>(PendingContactRequestModel::Columns::FORMATTED_NAME));
- auto formatted_name_qstring = idx_formatted_name.data(static_cast<int>(Qt::DisplayRole)).value<QString>();
- auto formatted_name_std = formatted_name_qstring.toStdString();
-
- /* date */
- auto idx_date = qt_model->index(idx.row(), static_cast<int>(PendingContactRequestModel::Columns::TIME));
- auto date_q_date_time = idx_date.data(static_cast<int>(Qt::DisplayRole)).value<QDateTime>();
- auto date_q_string = QLocale::system().toString(date_q_date_time.time(), QLocale::ShortFormat);
- auto date_std = date_q_string.toStdString();
-
- gchar *text = nullptr;
-
- if(is_selected) // print in default color
- text = g_markup_printf_escaped("<span font_weight=\"bold\">%s</span>\n%s\n"
- "<span size=\"smaller\">%s</span>", formatted_name_std.c_str(),
- uri_std.c_str(),
- date_std.c_str());
- else // use our colors
- text = g_markup_printf_escaped("<span font_weight=\"bold\">%s</span>\n<span color=\"gray\">%s\n"
- "<span size=\"smaller\">%s</span></span>", formatted_name_std.c_str(),
- uri_std.c_str(),
- date_std.c_str());
-
- g_object_set(G_OBJECT(cell), "markup", text, nullptr);
- g_free(text);
-}
-
-/**
- * bind Account::pendingContactRequestModel() to pending_contact_requests_model
- */
-static void
-bind_models(PendingContactRequestsView *self, Account* account)
-{
- if (not account) {
- g_warning("invalid account, cannot bind models.");
- return;
- }
-
- auto pending_contact_requests_model = gtk_q_tree_model_new(account->pendingContactRequestModel(),
- 1/*nmbr. of cols.*/,
- 0,
- Qt::DisplayRole,
- G_TYPE_STRING);
-
- gtk_tree_view_set_model(GTK_TREE_VIEW(self), GTK_TREE_MODEL(pending_contact_requests_model));
-}
-
-/**
- * gtk init function
- */
-static void
-pending_contact_requests_view_init(PendingContactRequestsView *self)
-{
- gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(self), FALSE);
- gtk_tree_view_set_show_expanders(GTK_TREE_VIEW(self), FALSE);
- gtk_tree_view_set_enable_search(GTK_TREE_VIEW(self), FALSE);
-
- // the next signal is used to set the model in function of the selection of the account
- QObject::connect(
- AvailableAccountModel::instance().selectionModel(),
- &QItemSelectionModel::currentChanged,
- [self] (const QModelIndex& idx) {
- bind_models(self, idx.data(static_cast<int>(Account::Role::Object)).value<Account*>());
- }
- );
-
- /* photo and name/contact method column */
- GtkCellArea *area = gtk_cell_area_box_new();
- GtkTreeViewColumn *column = gtk_tree_view_column_new_with_area(area);
-
- /* photo renderer */
- GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
- gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(area), renderer, FALSE, FALSE, FALSE);
-
- /* get the photo */
- gtk_tree_view_column_set_cell_data_func(
- column,
- renderer,
- (GtkTreeCellDataFunc)render_contact_photo,
- NULL,
- NULL);
-
- /* name and info renderer */
- renderer = gtk_cell_renderer_text_new();
- g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(area), renderer, FALSE, FALSE, FALSE);
-
- gtk_tree_view_column_set_cell_data_func(
- column,
- renderer,
- (GtkTreeCellDataFunc)render_name_and_info,
- self,
- NULL);
-
- gtk_tree_view_append_column(GTK_TREE_VIEW(self), column);
- gtk_tree_view_column_set_resizable(column, TRUE);
- gtk_tree_view_column_set_expand(column, TRUE);
- gtk_tree_view_expand_all(GTK_TREE_VIEW(self));
-
- /* init the model */
- bind_models(self, get_active_ring_account());
-
- gtk_widget_show_all(GTK_WIDGET(self));
-}
-
-/**
- * gtk dispose function
- */
-static void
-pending_contact_requests_view_dispose(GObject *object)
-{
- G_OBJECT_CLASS(pending_contact_requests_view_parent_class)->dispose(object);
-}
-
-/**
- * gtk finalize function
- */
-static void
-pending_contact_requests_view_finalize(GObject *object)
-{
- G_OBJECT_CLASS(pending_contact_requests_view_parent_class)->finalize(object);
-}
-
-/**
- * gtk class init function
- */
-static void
-pending_contact_requests_view_class_init(PendingContactRequestsViewClass *klass)
-{
- G_OBJECT_CLASS(klass)->finalize = pending_contact_requests_view_finalize;
- G_OBJECT_CLASS(klass)->dispose = pending_contact_requests_view_dispose;
-}
-
-/**
- * gtk new function
- */
-GtkWidget *
-pending_contact_requests_view_new()
-{
- gpointer self = g_object_new(PENDING_CONTACT_REQUESTS_VIEW_TYPE, NULL);
-
- return (GtkWidget *)self;
-}
diff --git a/src/pendingcontactrequests.h b/src/pendingcontactrequests.h
deleted file mode 100644
index 585b4cc..0000000
--- a/src/pendingcontactrequests.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2017 Savoir-faire Linux Inc.
- * Author: Nicolas Jäger <nicolas.jager@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#pragma once
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define PENDING_CONTACT_REQUESTS_VIEW_TYPE (pending_contact_requests_view_get_type ())
-#define PENDING_CONTACT_REQUESTS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PENDING_CONTACT_REQUESTS_VIEW_TYPE, PendingContactRequestsView))
-#define PENDING_CONTACT_REQUESTS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PENDING_CONTACT_REQUESTS_VIEW_TYPE, PendingContactRequestsViewClass))
-#define IS_PENDING_CONTACT_REQUESTS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PENDING_CONTACT_REQUESTS_VIEW_TYPE))
-#define IS_PENDING_CONTACT_REQUESTS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PENDING_CONTACT_REQUESTS_VIEW_TYPE))
-
-typedef struct _PendingContactRequestsView PendingContactRequestsView;
-typedef struct _PendingContactRequestsViewClass PendingContactRequestsViewClass;
-
-GType pending_contact_requests_view_get_type (void) G_GNUC_CONST;
-GtkWidget *pending_contact_requests_view_new (void);
-
-G_END_DECLS
diff --git a/src/recentcontactsview.cpp b/src/recentcontactsview.cpp
deleted file mode 100644
index b620f69..0000000
--- a/src/recentcontactsview.cpp
+++ /dev/null
@@ -1,774 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "recentcontactsview.h"
-
-#include <gtk/gtk.h>
-#include <glib/gi18n.h>
-#include "models/gtkqtreemodel.h"
-#include "utils/calling.h"
-#include <memory>
-#include <globalinstances.h>
-#include "native/pixbufmanipulator.h"
-#include <contactmethod.h>
-#include "defines.h"
-#include "utils/models.h"
-#include <recentmodel.h>
-#include <call.h>
-#include "utils/menus.h"
-#include <itemdataroles.h>
-#include <callmodel.h>
-#include <QtCore/QItemSelectionModel>
-#include <historytimecategorymodel.h>
-#include <QtCore/QDateTime>
-#include <QtCore/QMimeData>
-#include "utils/drawing.h"
-#include <numbercategory.h>
-#include "contactpopupmenu.h"
-
-static constexpr const char* CALL_TARGET = "CALL_TARGET";
-static constexpr int CALL_TARGET_ID = 0;
-
-struct _RecentContactsView
-{
- GtkTreeView parent;
-};
-
-struct _RecentContactsViewClass
-{
- GtkTreeViewClass parent_class;
-};
-
-typedef struct _RecentContactsViewPrivate RecentContactsViewPrivate;
-
-struct _RecentContactsViewPrivate
-{
- GtkWidget *popup_menu;
-
- QMetaObject::Connection selection_updated;
- QMetaObject::Connection layout_changed;
-};
-
-G_DEFINE_TYPE_WITH_PRIVATE(RecentContactsView, recent_contacts_view, GTK_TYPE_TREE_VIEW);
-
-#define RECENT_CONTACTS_VIEW_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE ((obj), RECENT_CONTACTS_VIEW_TYPE, RecentContactsViewPrivate))
-
-static void
-update_selection(GtkTreeSelection *selection)
-{
- if (gtk_q_tree_model_ignore_selection_change(selection)) return;
-
- auto current_proxy = get_index_from_selection(selection);
- auto current = RecentModel::instance().peopleProxy()->mapToSource(current_proxy);
-
- RecentModel::instance().selectionModel()->setCurrentIndex(current, QItemSelectionModel::ClearAndSelect);
-
- // update the CallModel selection since we rely on the UserActionModel
- if (auto call_to_select = RecentModel::instance().getActiveCall(current)) {
- CallModel::instance().selectCall(call_to_select);
- } else {
- CallModel::instance().selectionModel()->clearCurrentIndex();
- }
-}
-
-static void
-render_contact_photo(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- G_GNUC_UNUSED gpointer data)
-{
- QModelIndex idx = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), iter);
-
- std::shared_ptr<GdkPixbuf> image;
- /* we only want to render a photo for the top nodes: Person, ContactMethod (, later Conference) */
- QVariant object = idx.data(static_cast<int>(Ring::Role::Object));
- if (idx.isValid() && object.isValid()) {
- QVariant var_photo;
- if (auto person = object.value<Person *>()) {
- var_photo = GlobalInstances::pixmapManipulator().contactPhoto(person, QSize(50, 50), true);
- } else if (auto cm = object.value<ContactMethod *>()) {
- /* get photo, note that this should in all cases be the fallback avatar, since there
- * shouldn't be a person associated with this contact method */
- var_photo = GlobalInstances::pixmapManipulator().callPhoto(cm, QSize(50, 50), true);
- } else if (auto call = object.value<Call *>()) {
- if (call->type() == Call::Type::CONFERENCE) {
- var_photo = GlobalInstances::pixmapManipulator().callPhoto(call, QSize(50, 50), true);
- }
- }
- image = var_photo.value<std::shared_ptr<GdkPixbuf>>();
- }
-
- // set the width of the cell rendered to the width of the photo
- // so that the other renderers are shifted to the right
- g_object_set(G_OBJECT(cell), "width", 50, NULL);
- g_object_set(G_OBJECT(cell), "pixbuf", image.get(), NULL);
-}
-
-/**
- * This is the 2nd column in the treeview; for Person and ContactMethod items we want to DisplayRole
- * the name in the first row and the number (Ring registered name or URI) in the second row. for
- * Conferences we simply display the name, and for calls we simply display the Call status (note:
- * that if the item is a Call, it is not a top level item)
- */
-static void
-render_name_and_number(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeView *treeview)
-{
- gchar *text = nullptr;
-
- QModelIndex idx = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), iter);
-
- // check if this iter is selected
- gboolean is_selected = FALSE;
- if (GTK_IS_TREE_VIEW(treeview)) {
- auto selection = gtk_tree_view_get_selection(treeview);
- is_selected = gtk_tree_selection_iter_is_selected(selection, iter);
- }
-
- auto type = idx.data(static_cast<int>(Ring::Role::ObjectType));
- if (idx.isValid() && type.isValid()) {
- switch (type.value<Ring::ObjectType>()) {
- case Ring::ObjectType::Person:
- case Ring::ObjectType::ContactMethod:
- {
- auto name = idx.data(static_cast<int>(Ring::Role::Name)).toString();
- auto number = idx.data(static_cast<int>(Ring::Role::Number)).toString();
-
- /* we want the color of the status text to be the default color if this iter is
- * selected so that the treeview is able to invert it against the selection color */
- if (is_selected) {
- text = g_markup_printf_escaped(
- "<span font_weight=\"bold\">%s</span>\n<span size=\"smaller\">%s</span>",
- // "%s\n<span size=\"smaller\">%s</span>",
- name.toUtf8().constData(),
- number.toUtf8().constData()
- );
- } else {
- text = g_markup_printf_escaped(
- "<span font_weight=\"bold\">%s</span>\n<span color=\"gray\" size=\"smaller\">%s</span>",
- // "%s\n<span color=\"gray\" size=\"smaller\">%s</span>",
- name.toUtf8().constData(),
- number.toUtf8().constData()
- );
- }
- }
- break;
- case Ring::ObjectType::Call:
- {
- // check if it is a conference
- auto idx_source = RecentModel::instance().peopleProxy()->mapToSource(idx);
- auto is_conference = RecentModel::instance().isConference(idx_source);
-
- if (is_conference) {
- auto var_name = idx.data(static_cast<int>(Ring::Role::Name));
- text = g_markup_escape_text(var_name.value<QString>().toUtf8().constData(), -1);
- } else {
- auto parent_source = RecentModel::instance().peopleProxy()->mapToSource(idx.parent());
- if (RecentModel::instance().isConference(parent_source)) {
- // part of conference, simply display the name
- auto var_name = idx.data(static_cast<int>(Ring::Role::Name));
-
- /* we want the color of the name text to be the default color if this iter is
- * selected so that the treeview is able to invert it against the selection color */
- if (is_selected) {
- text = g_markup_printf_escaped("<span size=\"smaller\">%s</span>",
- var_name.value<QString>().toUtf8().constData());
- } else {
- text = g_markup_printf_escaped("<span size=\"smaller\" color=\"gray\">%s</span>",
- var_name.value<QString>().toUtf8().constData());
- }
- } else {
- // just a call, so display the state
- auto var_status = idx.data(static_cast<int>(Ring::Role::FormattedState));
-
- QString status;
-
- if (var_status.isValid())
- status += var_status.value<QString>();
-
- /* we want the color of the status text to be the default color if this iter is
- * selected so that the treeview is able to invert it against the selection color */
- if (is_selected) {
- text = g_markup_printf_escaped("<span size=\"smaller\">%s</span>",
- status.toUtf8().constData());
- } else {
- text = g_markup_printf_escaped("<span size=\"smaller\" color=\"gray\">%s</span>",
- status.toUtf8().constData());
- }
- }
- }
- }
- break;
- case Ring::ObjectType::Media:
- case Ring::ObjectType::Certificate:
- case Ring::ObjectType::ContactRequest:
- // nothing to do for now
- case Ring::ObjectType::COUNT__:
- break;
- }
- }
-
- g_object_set(G_OBJECT(cell), "markup", text, NULL);
- g_free(text);
-}
-
-/**
- * This is the 3rd column in the treeview. For Person and ContactMethod items we want to display
- * in the first row the call status or else the last used date. In the second row we want to display
- * either the call duration or else the number of unread messages. In the case of a Call item we
- * simply display the call duration.
- */
-static void
-render_info(G_GNUC_UNUSED GtkTreeViewColumn *tree_column,
- GtkCellRenderer *cell,
- GtkTreeModel *model,
- GtkTreeIter *iter,
- GtkTreeView *treeview)
-{
- gchar *text = nullptr;
-
- QModelIndex idx = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), iter);
-
- // check if this iter is selected
- gboolean is_selected = FALSE;
- if (GTK_IS_TREE_VIEW(treeview)) {
- auto selection = gtk_tree_view_get_selection(treeview);
- is_selected = gtk_tree_selection_iter_is_selected(selection, iter);
- }
-
- auto type = idx.data(static_cast<int>(Ring::Role::ObjectType));
- if (idx.isValid() && type.isValid()) {
- switch (type.value<Ring::ObjectType>()) {
- case Ring::ObjectType::Person:
- case Ring::ObjectType::ContactMethod:
- {
- gchar *row0 = nullptr; // either call status or last used
- gchar *row1 = nullptr; // either call duration or unread msg count
-
- QString status;
- auto var_status = idx.data(static_cast<int>(Ring::Role::FormattedState));
- auto var_lastused = idx.data(static_cast<int>(Ring::Role::LastUsed));
-
- // show the status if there is a call, otherwise the last used date/time
- if (var_status.isValid()) {
- status = var_status.value<QString>();
- } else if (var_lastused.isValid()) {
- auto date_time = var_lastused.value<QDateTime>();
- auto category = HistoryTimeCategoryModel::timeToHistoryConst(date_time.toTime_t());
-
- /* If it is 'today', then we show the time; otherwise we will show date category
- * (the day or long ago it was). The day and the time together take up too much
- * space */
- if (category == HistoryTimeCategoryModel::HistoryConst::Today) {
- status = QLocale::system().toString(date_time.time(), QLocale::ShortFormat);
- } else {
- status = HistoryTimeCategoryModel::timeToHistoryCategory(date_time.toTime_t());
- }
- }
-
- if (is_selected) {
- row0 = g_markup_printf_escaped(
- "<span size=\"smaller\">%s</span>",
- status.toUtf8().constData()
- );
- } else {
- row0 = g_markup_printf_escaped(
- "<span size=\"smaller\" color=\"gray\">%s</span>",
- status.toUtf8().constData()
- );
- }
-
- // check if there are any children (calls); we need to convert to source model in
- // case there is only one
- auto idx_source = RecentModel::instance().peopleProxy()->mapToSource(idx);
- auto duration = idx.data(static_cast<int>(Ring::Role::Length));
- if (idx_source.isValid()
- && (idx_source.model()->rowCount(idx_source) == 1)
- && duration.isValid())
- {
- row1 = g_markup_printf_escaped("%s", duration.toString().toUtf8().constData());
- }
- else
- {
- auto unread = idx.data(static_cast<int>(Ring::Role::UnreadTextMessageCount)).toInt();
- if (unread > 0) {
- if (is_selected) {
- row1 = g_markup_printf_escaped(
- "<span font_weight=\"bold\">%d</span>",
- unread
- );
- } else {
- row1 = g_markup_printf_escaped(
- "<span color=\"red\" font_weight=\"bold\">%d</span>",
- unread
- );
- }
- }
- }
-
- text = g_strconcat(row0, "\n", row1, nullptr);
- g_free(row0);
- g_free(row1);
- }
- break;
- case Ring::ObjectType::Call:
- {
- // do not display the duration if the call is part of a conference
- auto parent_source = RecentModel::instance().peopleProxy()->mapToSource(idx.parent());
- auto in_conference = RecentModel::instance().isConference(parent_source);
-
- if (!in_conference) {
- auto duration = idx.data(static_cast<int>(Ring::Role::Length));
-
- if (duration.isValid())
- text = g_markup_escape_text(duration.value<QString>().toUtf8().constData(), -1);
- }
- }
- break;
- case Ring::ObjectType::Media:
- case Ring::ObjectType::Certificate:
- case Ring::ObjectType::ContactRequest:
- // nothing to do for now
- case Ring::ObjectType::COUNT__:
- break;
- }
- }
-
- g_object_set(G_OBJECT(cell), "markup", text, NULL);
- g_free(text);
-}
-
-static void
-activate_item(GtkTreeView *tree_view,
- GtkTreePath *path,
- G_GNUC_UNUSED GtkTreeViewColumn *column,
- G_GNUC_UNUSED gpointer user_data)
-{
- auto model = gtk_tree_view_get_model(tree_view);
- GtkTreeIter iter;
- if (gtk_tree_model_get_iter(model, &iter, path)) {
- QModelIndex idx = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), &iter);
- auto type = idx.data(static_cast<int>(Ring::Role::ObjectType));
- if (idx.isValid() && type.isValid()) {
- switch (type.value<Ring::ObjectType>()) {
- case Ring::ObjectType::Person:
- {
- // call the last used contact method
- // TODO: if no contact methods have been used, offer a popup to Choose
- auto p_var = idx.data(static_cast<int>(Ring::Role::Object));
- if (p_var.isValid()) {
- auto person = p_var.value<Person *>();
- auto cms = person->phoneNumbers();
-
- if (!cms.isEmpty()) {
- auto last_used_cm = cms.at(0);
- for (int i = 1; i < cms.size(); ++i) {
- auto new_cm = cms.at(i);
- if (difftime(new_cm->lastUsed(), last_used_cm->lastUsed()) > 0)
- last_used_cm = new_cm;
- }
-
- place_new_call(last_used_cm);
- }
- }
- }
- break;
- case Ring::ObjectType::ContactMethod:
- {
- // call the contact method
- auto cm = idx.data(static_cast<int>(Ring::Role::Object));
- if (cm.isValid())
- place_new_call(cm.value<ContactMethod *>());
- }
- break;
- case Ring::ObjectType::Call:
- case Ring::ObjectType::Media:
- case Ring::ObjectType::Certificate:
- case Ring::ObjectType::ContactRequest:
- // nothing to do for now
- case Ring::ObjectType::COUNT__:
- break;
- }
- }
- }
-}
-
-static void
-expand_if_child(G_GNUC_UNUSED GtkTreeModel *tree_model,
- GtkTreePath *path,
- G_GNUC_UNUSED GtkTreeIter *iter,
- GtkTreeView *treeview)
-{
- if (gtk_tree_path_get_depth(path) > 1)
- gtk_tree_view_expand_to_path(treeview, path);
-}
-
-static void
-scroll_to_selection(GtkTreeSelection *selection)
-{
- auto treeview = gtk_tree_selection_get_tree_view(selection);
- auto model = gtk_tree_view_get_model(treeview);
- if (gtk_q_tree_model_is_layout_changing(GTK_Q_TREE_MODEL(model))) {
- /* during a layout change, the GtkTreeModel items will be removed, so the GTK selection will
- * be empty, we want to ignore this */
- return;
- }
-
- GtkTreeIter iter;
- if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
- auto path = gtk_tree_model_get_path(model, &iter);
- auto treeview = gtk_tree_selection_get_tree_view(selection);
- gtk_tree_view_scroll_to_cell(treeview, path, nullptr, FALSE, 0.0, 0.0);
- }
-}
-
-static void
-on_drag_data_get(GtkWidget *treeview,
- G_GNUC_UNUSED GdkDragContext *context,
- GtkSelectionData *data,
- G_GNUC_UNUSED guint info,
- G_GNUC_UNUSED guint time,
- G_GNUC_UNUSED gpointer user_data)
-{
- g_return_if_fail(IS_RECENT_CONTACTS_VIEW(treeview));
-
- /* we always drag the selected row */
- auto selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(treeview));
- GtkTreeModel *model = NULL;
- GtkTreeIter iter;
-
- if (gtk_tree_selection_get_selected(selection, &model, &iter)) {
- auto path_str = gtk_tree_model_get_string_from_iter(model, &iter);
-
- gtk_selection_data_set(data,
- gdk_atom_intern_static_string(CALL_TARGET),
- 8, /* bytes */
- (guchar *)path_str,
- strlen(path_str) + 1);
-
- g_free(path_str);
- } else {
- g_warning("drag selection not valid");
- }
-}
-
-static gboolean
-on_drag_drop(GtkWidget *treeview,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- G_GNUC_UNUSED gpointer user_data)
-{
- g_return_val_if_fail(IS_RECENT_CONTACTS_VIEW(treeview), FALSE);
-
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition drop_pos;
-
- if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(treeview),
- x, y, &path, &drop_pos)) {
-
- GdkAtom target_type = gtk_drag_dest_find_target(treeview, context, NULL);
-
- if (target_type != GDK_NONE) {
- g_debug("can drop");
- gtk_drag_get_data(treeview, context, target_type, time);
- return TRUE;
- }
-
- gtk_tree_path_free(path);
- }
-
- return FALSE;
-}
-
-static gboolean
-on_drag_motion(GtkWidget *treeview,
- GdkDragContext *context,
- gint x,
- gint y,
- guint time,
- G_GNUC_UNUSED gpointer user_data)
-{
- g_return_val_if_fail(IS_RECENT_CONTACTS_VIEW(treeview), FALSE);
-
- GtkTreePath *path = NULL;
- GtkTreeViewDropPosition drop_pos;
-
- if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(treeview),
- x, y, &path, &drop_pos)) {
- // we only want to drop on a row, not before or after
- if (drop_pos == GTK_TREE_VIEW_DROP_BEFORE) {
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW(treeview), path, GTK_TREE_VIEW_DROP_INTO_OR_BEFORE);
- } else if (drop_pos == GTK_TREE_VIEW_DROP_AFTER) {
- gtk_tree_view_set_drag_dest_row(GTK_TREE_VIEW(treeview), path, GTK_TREE_VIEW_DROP_INTO_OR_AFTER);
- }
- gdk_drag_status(context, gdk_drag_context_get_suggested_action(context), time);
- return TRUE;
- } else {
- // not a row in the treeview, so we cannot drop
- return FALSE;
- }
-}
-
-static void
-on_drag_data_received(GtkWidget *treeview,
- GdkDragContext *context,
- gint x,
- gint y,
- GtkSelectionData *data,
- G_GNUC_UNUSED guint info,
- guint time,
- G_GNUC_UNUSED gpointer user_data)
-{
- g_return_if_fail(IS_RECENT_CONTACTS_VIEW(treeview));
-
- gboolean success = FALSE;
-
- /* get the source and destination calls */
- auto path_str_source = (gchar *)gtk_selection_data_get_data(data);
- auto type = gtk_selection_data_get_data_type(data);
- g_debug("data type: %s", gdk_atom_name(type));
- if (path_str_source && strlen(path_str_source) > 0) {
- g_debug("source path: %s", path_str_source);
-
- /* get the destination path */
- GtkTreePath *dest_path = NULL;
- if (gtk_tree_view_get_dest_row_at_pos(GTK_TREE_VIEW(treeview), x, y, &dest_path, NULL)) {
- auto model = gtk_tree_view_get_model(GTK_TREE_VIEW(treeview));
-
- GtkTreeIter source;
- gtk_tree_model_get_iter_from_string(model, &source, path_str_source);
- auto idx_source_proxy = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), &source);
-
- GtkTreeIter dest;
- gtk_tree_model_get_iter(model, &dest, dest_path);
- auto idx_dest_proxy = gtk_q_tree_model_get_source_idx(GTK_Q_TREE_MODEL(model), &dest);
-
- // get call objects and indeces from RecentModel indeces being drag and dropped
- auto idx_source = RecentModel::instance().peopleProxy()->mapToSource(idx_source_proxy);
- auto idx_dest = RecentModel::instance().peopleProxy()->mapToSource(idx_dest_proxy);
- auto call_source = RecentModel::instance().getActiveCall(idx_source);
- auto call_dest = RecentModel::instance().getActiveCall(idx_dest);
- auto idx_call_source = CallModel::instance().getIndex(call_source);
- auto idx_call_dest = CallModel::instance().getIndex(call_dest);
-
- if (idx_call_source.isValid() && idx_call_dest.isValid()) {
- QModelIndexList source_list;
- source_list << idx_call_source;
- auto mimeData = CallModel::instance().mimeData(source_list);
- auto action = Call::DropAction::Conference;
- mimeData->setProperty("dropAction", action);
-
- if (CallModel::instance().dropMimeData(mimeData, Qt::MoveAction, idx_call_dest.row(), idx_call_dest.column(), idx_call_dest.parent())) {
- success = TRUE;
- } else {
- g_warning("could not drop mime data");
- }
- } else {
- g_warning("source or dest call not valid");
- }
-
- gtk_tree_path_free(dest_path);
- }
- }
-
- gtk_drag_finish(context, success, FALSE, time);
-}
-
-static gboolean
-synchronize_selection(RecentContactsView *self)
-{
- auto idx = RecentModel::instance().selectionModel()->currentIndex();
- auto selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
- auto model = gtk_tree_view_get_model(GTK_TREE_VIEW(self));
-
- if (gtk_q_tree_model_is_layout_changing(GTK_Q_TREE_MODEL(model))) {
- /* during a layout change, the GtkTreeModel items will be removed, so the GTK selection will
- * be empty, we want to avoid trying to sync during this time, and reschedule it to try
- * again later */
- return G_SOURCE_CONTINUE;
- }
-
- auto idx_proxy = RecentModel::instance().peopleProxy()->mapFromSource(idx);
-
- if (idx_proxy.isValid()) {
- /* select the current */
- GtkTreeIter iter;
- if (gtk_q_tree_model_source_index_to_iter(GTK_Q_TREE_MODEL(model), idx_proxy, &iter)) {
- gtk_tree_selection_select_iter(selection, &iter);
- }
- } else {
- gtk_tree_selection_unselect_all(selection);
- }
-
- return G_SOURCE_REMOVE;
-}
-
-static void
-recent_contacts_view_init(RecentContactsView *self)
-{
- RecentContactsViewPrivate *priv = RECENT_CONTACTS_VIEW_GET_PRIVATE(self);
-
- gtk_tree_view_set_headers_visible(GTK_TREE_VIEW(self), FALSE);
- /* no need to show the expander since it will always be expanded */
- gtk_tree_view_set_show_expanders(GTK_TREE_VIEW(self), FALSE);
- /* disable default search, we will handle it ourselves via LRC;
- * otherwise the search steals input focus on key presses */
- gtk_tree_view_set_enable_search(GTK_TREE_VIEW(self), FALSE);
-
- GtkQTreeModel *recent_model = gtk_q_tree_model_new(
- RecentModel::instance().peopleProxy(),
- 1,
- 0, Qt::DisplayRole, G_TYPE_STRING);
-
- gtk_tree_view_set_model(GTK_TREE_VIEW(self),
- GTK_TREE_MODEL(recent_model));
-
- /* photo and name/contact method column */
- GtkCellArea *area = gtk_cell_area_box_new();
- GtkTreeViewColumn *column = gtk_tree_view_column_new_with_area(area);
-
- /* photo renderer */
- GtkCellRenderer *renderer = gtk_cell_renderer_pixbuf_new();
- gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(area), renderer, FALSE, FALSE, FALSE);
-
- /* get the photo */
- gtk_tree_view_column_set_cell_data_func(
- column,
- renderer,
- (GtkTreeCellDataFunc)render_contact_photo,
- NULL,
- NULL);
-
- /* name/cm and status renderer */
- renderer = gtk_cell_renderer_text_new();
- g_object_set(G_OBJECT(renderer), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
- gtk_cell_area_box_pack_start(GTK_CELL_AREA_BOX(area), renderer, FALSE, FALSE, FALSE);
-
- gtk_tree_view_column_set_cell_data_func(
- column,
- renderer,
- (GtkTreeCellDataFunc)render_name_and_number,
- self,
- NULL);
-
- /* call duration or unread messages */
- renderer = gtk_cell_renderer_text_new();
- g_object_set(G_OBJECT(renderer), "xalign", 1.0, NULL);
- gtk_cell_area_box_pack_end(GTK_CELL_AREA_BOX(area), renderer, FALSE, FALSE, FALSE);
- gtk_tree_view_column_set_cell_data_func(
- column,
- renderer,
- (GtkTreeCellDataFunc)render_info,
- self,
- NULL);
-
- gtk_tree_view_append_column(GTK_TREE_VIEW(self), column);
- gtk_tree_view_column_set_resizable(column, TRUE);
- gtk_tree_view_column_set_expand(column, TRUE);
- gtk_tree_view_expand_all(GTK_TREE_VIEW(self));
-
- g_signal_connect(self, "row-activated", G_CALLBACK(activate_item), NULL);
- g_signal_connect(recent_model, "row-inserted", G_CALLBACK(expand_if_child), self);
-
- GtkTreeSelection *selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(self));
- g_signal_connect(selection, "changed", G_CALLBACK(update_selection), NULL);
- g_signal_connect(selection, "changed", G_CALLBACK(scroll_to_selection), NULL);
- g_signal_connect_swapped(recent_model, "rows-reordered", G_CALLBACK(scroll_to_selection), selection);
-
- /* sync initial selection */
- g_idle_add((GSourceFunc)synchronize_selection, self);
-
- auto synchronize_selection_idle = [self] () { g_idle_add((GSourceFunc)synchronize_selection, self); };
-
- /* update the selection based on the RecentModel */
- priv->selection_updated = QObject::connect(
- RecentModel::instance().selectionModel(),
- &QItemSelectionModel::currentChanged,
- synchronize_selection_idle
- );
-
- /* we may need to update the selection when the layout changes */
- priv->layout_changed = QObject::connect(
- RecentModel::instance().peopleProxy(),
- &QAbstractItemModel::layoutChanged,
- synchronize_selection_idle
- );
-
- /* drag and drop */
- static GtkTargetEntry targetentries[] = {
- { (gchar *)CALL_TARGET, GTK_TARGET_SAME_WIDGET, CALL_TARGET_ID },
- };
-
- gtk_tree_view_enable_model_drag_source(GTK_TREE_VIEW(self),
- GDK_BUTTON1_MASK, targetentries, 1, (GdkDragAction)(GDK_ACTION_DEFAULT | GDK_ACTION_MOVE));
-
- gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(self),
- targetentries, 1, GDK_ACTION_DEFAULT);
-
- g_signal_connect(self, "drag-data-get", G_CALLBACK(on_drag_data_get), nullptr);
- g_signal_connect(self, "drag-drop", G_CALLBACK(on_drag_drop), nullptr);
- g_signal_connect(self, "drag-motion", G_CALLBACK(on_drag_motion), nullptr);
- g_signal_connect(self, "drag_data_received", G_CALLBACK(on_drag_data_received), nullptr);
-
- /* init popup menu */
- priv->popup_menu = contact_popup_menu_new(GTK_TREE_VIEW(self));
- g_signal_connect_swapped(self, "button-press-event", G_CALLBACK(contact_popup_menu_show), priv->popup_menu);
-
- gtk_widget_show_all(GTK_WIDGET(self));
-}
-
-static void
-recent_contacts_view_dispose(GObject *object)
-{
- RecentContactsView *self = RECENT_CONTACTS_VIEW(object);
- RecentContactsViewPrivate *priv = RECENT_CONTACTS_VIEW_GET_PRIVATE(self);
-
- QObject::disconnect(priv->selection_updated);
- QObject::disconnect(priv->layout_changed);
- gtk_widget_destroy(priv->popup_menu);
-
- G_OBJECT_CLASS(recent_contacts_view_parent_class)->dispose(object);
-}
-
-static void
-recent_contacts_view_finalize(GObject *object)
-{
- G_OBJECT_CLASS(recent_contacts_view_parent_class)->finalize(object);
-}
-
-static void
-recent_contacts_view_class_init(RecentContactsViewClass *klass)
-{
- G_OBJECT_CLASS(klass)->finalize = recent_contacts_view_finalize;
- G_OBJECT_CLASS(klass)->dispose = recent_contacts_view_dispose;
-}
-
-GtkWidget *
-recent_contacts_view_new()
-{
- gpointer self = g_object_new(RECENT_CONTACTS_VIEW_TYPE, NULL);
-
- return (GtkWidget *)self;
-}
diff --git a/src/recentcontactsview.h b/src/recentcontactsview.h
deleted file mode 100644
index 956cb59..0000000
--- a/src/recentcontactsview.h
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#pragma once
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-#define RECENT_CONTACTS_VIEW_TYPE (recent_contacts_view_get_type ())
-#define RECENT_CONTACTS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RECENT_CONTACTS_VIEW_TYPE, RecentContactsView))
-#define RECENT_CONTACTS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), RECENT_CONTACTS_VIEW_TYPE, RecentContactsViewClass))
-#define IS_RECENT_CONTACTS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), RECENT_CONTACTS_VIEW_TYPE))
-#define IS_RECENT_CONTACTS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), RECENT_CONTACTS_VIEW_TYPE))
-
-typedef struct _RecentContactsView RecentContactsView;
-typedef struct _RecentContactsViewClass RecentContactsViewClass;
-
-GType recent_contacts_view_get_type (void) G_GNUC_CONST;
-GtkWidget *recent_contacts_view_new (void);
-
-G_END_DECLS
diff --git a/src/utils/menus.cpp b/src/utils/menus.cpp
deleted file mode 100644
index bc59eee..0000000
--- a/src/utils/menus.cpp
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#include "menus.h"
-
-#include <glib/gi18n.h>
-#include <contactmethod.h>
-#include "../contactpopover.h"
-
-/**
- * checks if the given contact method is already associated with a contact
- */
-gboolean
-contact_method_has_contact(ContactMethod *cm)
-{
- g_return_val_if_fail(cm, FALSE);
-
- return cm->contact() != NULL;
-}
-
-static void
-choose_contact(GtkWidget *item, ContactMethod *contactmethod)
-{
- // we get the parent widget which should be stored in the item object
- auto parent = g_object_get_data(G_OBJECT(item), "parent-widget");
- auto rect = g_object_get_data(G_OBJECT(item), "parent-rectangle");
-
- auto popover = contact_popover_new(contactmethod, GTK_WIDGET(parent), (GdkRectangle *)rect);
-
- gtk_widget_show(popover);
-}
-
-/**
- * Takes a GtkMenuItem and connects its activate signal to a popup which adds the given
- * ContactMethod to a Person
- */
-GtkMenuItem*
-menu_item_add_to_contact(GtkMenuItem *item, ContactMethod *cm, GtkWidget *parent, const GdkRectangle *rect)
-{
- g_return_val_if_fail(item && cm, NULL);
-
- /* save the parent widget in the item object, so we can retrieve
- * it in the callback */
- g_object_set_data(G_OBJECT(item), "parent-widget", parent);
-
- GdkRectangle *copy_rect = NULL;
- if (rect) {
- copy_rect = g_new0(GdkRectangle, 1);
- memcpy(copy_rect, rect, sizeof(GdkRectangle));
- }
- g_object_set_data_full(G_OBJECT(item), "parent-rectangle", copy_rect, (GDestroyNotify)g_free);
-
- g_signal_connect(item, "activate", G_CALLBACK(choose_contact), cm);
-
- return item;
-}
diff --git a/src/utils/menus.h b/src/utils/menus.h
deleted file mode 100644
index adc0bb4..0000000
--- a/src/utils/menus.h
+++ /dev/null
@@ -1,42 +0,0 @@
-/*
- * Copyright (C) 2015-2017 Savoir-faire Linux Inc.
- * Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
- */
-
-#ifndef _MENUS_H
-#define _MENUS_H
-
-#include <gtk/gtk.h>
-
-G_BEGIN_DECLS
-
-class ContactMethod;
-
-/**
- * checks if the given contact method is already associated with a contact
- */
-gboolean contact_method_has_contact(ContactMethod *cm);
-
-/**
- * Takes a GtkMenuItem and connects its activate signal to a popup which adds the given
- * ContactMethod to a Person
- */
-GtkMenuItem* menu_item_add_to_contact(GtkMenuItem *item, ContactMethod *cm, GtkWidget *parent, const GdkRectangle *rect);
-
-G_END_DECLS
-
-#endif /* _MENUS_H */
diff --git a/ui/contactrequestcontentview.ui b/ui/contactrequestcontentview.ui
deleted file mode 100644
index f39ac7e..0000000
--- a/ui/contactrequestcontentview.ui
+++ /dev/null
@@ -1,242 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.20.0 -->
-<interface>
- <requires lib="gtk+" version="3.10"/>
- <object class="GtkImage" id="image_accept">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="resource">/cx/ring/RingGnome/add</property>
- </object>
- <object class="GtkImage" id="image_back_arrow">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="icon_name">go-previous-symbolic</property>
- </object>
- <object class="GtkImage" id="image_block">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="resource">/cx/ring/RingGnome/block</property>
- </object>
- <object class="GtkImage" id="image_reject">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="resource">/cx/ring/RingGnome/reject</property>
- </object>
- <template class="ContactRequestContentView" parent="GtkBox">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <child>
- <object class="GtkBox" id="hbox_contact_request_info">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="no_show_all">True</property>
- <property name="orientation">vertical</property>
- <property name="spacing">5</property>
- <child>
- <object class="GtkButton" id="button_close_contact_request_content_view">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="receives_default">False</property>
- <property name="tooltip_text" translatable="yes">Close contact invitation view</property>
- <property name="image">image_back_arrow</property>
- <property name="relief">none</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkFrame" id="frame_call">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label_xalign">0</property>
- <property name="shadow_type">none</property>
- <child>
- <object class="GtkBox" id="vbox_call">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="orientation">vertical</property>
- <property name="valign">center</property>
- <child>
- <object class="GtkLabel" id="page_label">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="label" translatable="yes">Invitation from</property>
- <attributes>
- <attribute name="scale" value="1.5"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="padding">5</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="vbox_incoming_info">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">center</property>
- <property name="border_width">15</property>
- <property name="orientation">vertical</property>
- <property name="spacing">15</property>
- <child>
- <object class="GtkImage" id="image_peer">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_peer">
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="halign">center</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- <attributes>
- <attribute name="scale" value="1.5"/>
- </attributes>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="label_bestId">
- <property name="can_focus">True</property>
- <property name="halign">center</property>
- <property name="selectable">True</property>
- <property name="ellipsize">end</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- <child>
- <object class="GtkLabel" id="placeholder">
- <property name="height_request">25</property>
- <property name="can_focus">False</property>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkBox" id="hbox_action_bar">
- <property name="visible">True</property>
- <property name="can_focus">False</property>
- <property name="valign">center</property>
- <property name="halign">center</property>
- <property name="border_width">20</property>
- <property name="spacing">20</property>
- <child>
- <object class="GtkButton" id="button_accept_contact_request">
- <style>
- <class name="flat-button"/>
- <class name="button-green"/>
- </style>
- <property name="image">image_accept</property>
- <property name="label" translatable="yes">Accept</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">0</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_ignore_contact_request">
- <style>
- <class name="flat-button"/>
- <class name="button-red"/>
- </style>
- <property name="image">image_reject</property>
- <property name="label" translatable="yes">Reject</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">1</property>
- </packing>
- </child>
- <child>
- <object class="GtkButton" id="button_block_contact_request">
- <style>
- <class name="flat-button"/>
- <class name="button-red"/>
- </style>
- <property name="image">image_block</property>
- <property name="label" translatable="yes">Block</property>
- <property name="visible">True</property>
- <property name="can_focus">True</property>
- <property name="receives_default">False</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- <packing>
- <property name="expand">False</property>
- <property name="fill">True</property>
- <property name="position">2</property>
- </packing>
- </child>
- </object>
- </child>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- <property name="position">3</property>
- </packing>
- </child>
- </template>
-</interface>
diff --git a/ui/incomingcallview.ui b/ui/incomingcallview.ui
index 7867383..439d7f4 100644
--- a/ui/incomingcallview.ui
+++ b/ui/incomingcallview.ui
@@ -90,13 +90,6 @@
<property name="height-request">25</property>
</object>
</child>
- <child>
- <object class="GtkLabel" id="placeholder">
- <property name="visible">False</property>
- <property name="can_focus">False</property>
- <property name="height-request">25</property>
- </object>
- </child>
<!-- end of call initialization progress -->
<!-- call state info -->
<child>
@@ -171,28 +164,6 @@
</packing>
</child>
<!-- end reject button -->
- <!-- end button -->
- <child>
- <object class="GtkButton" id="button_end_call">
- <style>
- <class name="red-button"/>
- <class name="flat-button"/>
- </style>
- <property name="width-request">48</property>
- <property name="height-request">48</property>
- <property name="visible">False</property>
- <property name="can_focus">True</property>
- <property name="has_tooltip">True</property>
- <property name="tooltip-text" translatable="yes">Hang up</property>
- <property name="image">image_hangup</property>
- <property name="action-name">app.hangup</property>
- </object>
- <packing>
- <property name="expand">True</property>
- <property name="fill">True</property>
- </packing>
- </child>
- <!-- end end button -->
</object>
<packing>
<property name="expand">False</property>
diff --git a/ui/ui.gresource.xml b/ui/ui.gresource.xml
index a2aba9f..9f550bf 100644
--- a/ui/ui.gresource.xml
+++ b/ui/ui.gresource.xml
@@ -23,7 +23,6 @@
<file preprocess="xml-stripblanks">accountimportexportview.ui</file>
<file preprocess="xml-stripblanks">webkitchatcontainer.ui</file>
<file preprocess="xml-stripblanks">usernameregistrationbox.ui</file>
- <file preprocess="xml-stripblanks">contactrequestcontentview.ui</file>
<file preprocess="xml-stripblanks">accountbanstab.ui</file>
</gresource>
</gresources>