Commit d30cb029 authored by Aline Gondim Santos's avatar Aline Gondim Santos Committed by Sébastien Blin

plugin: create plugin UI

Change-Id: I4b59b9a35d212efcedb2d2a0e69ff28b108eae0d
parent 4703bf11
......@@ -281,6 +281,8 @@ SET( SRC_FILES
src/dialogs.c
src/mediasettingsview.h
src/mediasettingsview.cpp
src/pluginsettingsview.h
src/pluginsettingsview.cpp
src/newaccountsettingsview.h
src/newaccountsettingsview.cpp
src/generalsettingsview.h
......
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="white" width="24px" height="24px">
<path d="M20.5 11H19V7c0-1.1-.9-2-2-2h-4V3.5C13 2.12 11.88 1 10.5 1S8 2.12 8 3.5V5H4c-1.1 0-1.99.9-1.99 2v3.8H3.5c1.49 0 2.7 1.21 2.7 2.7s-1.21 2.7-2.7 2.7H2V20c0 1.1.9 2 2 2h3.8v-1.5c0-1.49 1.21-2.7 2.7-2.7s2.7 1.21 2.7 2.7V22H17c1.1 0 2-.9 2-2v-4h1.5c1.38 0 2.5-1.12 2.5-2.5S21.88 11 20.5 11z"/>
<path d="M0 0h24v24H0V0z" fill="none"/>
</svg>
\ No newline at end of file
......@@ -59,5 +59,6 @@
<file alias="qrcode-white">qrcode-white.png</file>
<file alias="retry">retry.svg</file>
<file alias="retry-white">retry-white.svg</file>
<file alias="plugin_white">extension_white_24dp.svg</file>
</gresource>
</gresources>
This diff is collapsed.
......@@ -2,6 +2,7 @@
* Copyright (C) 2015-2020 Savoir-faire Linux Inc.
* Author: Stepan Salenikovich <stepan.salenikovich@savoirfairelinux.com>
* Author: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
* Author : Aline Gondim Santos <aline.gondimsantos@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
......@@ -32,6 +33,7 @@
// LRC
#include <api/account.h>
#include <api/avmodel.h>
#include <api/pluginmodel.h>
#include <api/behaviorcontroller.h>
#include <api/contact.h>
#include <api/contactmodel.h>
......@@ -53,6 +55,7 @@
#include "currentcallview.h"
#include "dialogs.h"
#include "generalsettingsview.h"
#include "pluginsettingsview.h"
#include "incomingcallview.h"
#include "mediasettingsview.h"
#include "models/gtkqtreemodel.h"
......@@ -103,11 +106,13 @@ struct MainWindowPrivate
GtkWidget *welcome_view;
GtkWidget *button_new_conversation;
GtkWidget *media_settings_view;
GtkWidget *plugin_settings_view;
GtkWidget *new_account_settings_view;
GtkWidget *general_settings_view;
GtkWidget *last_settings_view;
GtkWidget *radiobutton_new_account_settings;
GtkWidget *radiobutton_general_settings;
GtkWidget *radiobutton_plugin_settings;
GtkWidget *radiobutton_media_settings;
GtkWidget *account_creation_wizard;
GtkWidget *account_migration_view;
......@@ -159,6 +164,7 @@ static constexpr const char* ACCOUNT_MIGRATION_VIEW_NAME = "account-migrat
static constexpr const char* GENERAL_SETTINGS_VIEW_NAME = "general";
static constexpr const char* MEDIA_SETTINGS_VIEW_NAME = "media";
static constexpr const char* NEW_ACCOUNT_SETTINGS_VIEW_NAME = "account";
static constexpr const char* PLUGIN_SETTINGS_VIEW_NAME = "plugin";
inline namespace helpers
{
......@@ -678,6 +684,21 @@ on_show_general_settings(GtkToggleButton* navbutton, MainWindow* self)
}
}
static void
on_show_plugin_settings(GtkToggleButton* navbutton, MainWindow* self)
{
g_return_if_fail(IS_MAIN_WINDOW(self));
auto* priv = MAIN_WINDOW_GET_PRIVATE(MAIN_WINDOW(self));
if (gtk_toggle_button_get_active(navbutton)) {
plugin_settings_view_show(PLUGIN_SETTINGS_VIEW(priv->plugin_settings_view), TRUE);
gtk_stack_set_visible_child_name(GTK_STACK(priv->stack_main_view), PLUGIN_SETTINGS_VIEW_NAME);
priv->last_settings_view = priv->plugin_settings_view;
} else {
plugin_settings_view_show(PLUGIN_SETTINGS_VIEW(priv->plugin_settings_view), FALSE);
}
}
static void
on_search_entry_text_changed(GtkSearchEntry* search_entry, MainWindow* self)
{
......@@ -1288,6 +1309,10 @@ CppImpl::init()
gtk_stack_add_named(GTK_STACK(widgets->stack_main_view), widgets->media_settings_view,
MEDIA_SETTINGS_VIEW_NAME);
widgets->plugin_settings_view = plugin_settings_view_new(lrc_->getPluginModel());
gtk_stack_add_named(GTK_STACK(widgets->stack_main_view), widgets->plugin_settings_view,
PLUGIN_SETTINGS_VIEW_NAME);
if (not accountIds.empty()) {
widgets->new_account_settings_view = new_account_settings_view_new(accountInfo_, lrc_->getAVModel());
gtk_stack_add_named(GTK_STACK(widgets->stack_main_view), widgets->new_account_settings_view,
......@@ -1319,6 +1344,7 @@ CppImpl::init()
g_signal_connect(widgets->radiobutton_media_settings, "toggled", G_CALLBACK(on_show_media_settings), self);
g_signal_connect(widgets->radiobutton_general_settings, "toggled", G_CALLBACK(on_show_general_settings), self);
g_signal_connect(widgets->radiobutton_new_account_settings, "toggled", G_CALLBACK(on_show_new_account_settings), self);
g_signal_connect(widgets->radiobutton_plugin_settings, "toggled", G_CALLBACK(on_show_plugin_settings), self);
g_signal_connect(widgets->notebook_contacts, "switch-page", G_CALLBACK(on_tab_changed), self);
/* welcome/default view */
......@@ -1824,6 +1850,9 @@ CppImpl::enterSettingsView()
if (widgets->last_settings_view == widgets->new_account_settings_view)
new_account_settings_view_show(NEW_ACCOUNT_SETTINGS_VIEW(widgets->new_account_settings_view),
TRUE);
/* make sure to start preview if we're showing the video settings */
if (widgets->last_settings_view == widgets->plugin_settings_view)
plugin_settings_view_show(PLUGIN_SETTINGS_VIEW(widgets->plugin_settings_view), TRUE);
gtk_stack_set_visible_child(GTK_STACK(widgets->stack_main_view), widgets->last_settings_view);
}
......@@ -1845,6 +1874,7 @@ CppImpl::leaveSettingsView()
media_settings_view_show_preview(MEDIA_SETTINGS_VIEW(widgets->media_settings_view), FALSE);
new_account_settings_view_show(NEW_ACCOUNT_SETTINGS_VIEW(widgets->new_account_settings_view),
FALSE);
plugin_settings_view_show(PLUGIN_SETTINGS_VIEW(widgets->plugin_settings_view), FALSE);
gtk_stack_set_visible_child_name(GTK_STACK(widgets->stack_main_view), CALL_VIEW_NAME);
......@@ -2873,6 +2903,7 @@ main_window_class_init(MainWindowClass *klass)
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MainWindow, frame_call);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MainWindow, button_new_conversation );
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MainWindow, radiobutton_general_settings);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MainWindow, radiobutton_plugin_settings);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MainWindow, radiobutton_media_settings);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MainWindow, radiobutton_new_account_settings);
gtk_widget_class_bind_template_child_private(GTK_WIDGET_CLASS (klass), MainWindow, combobox_account_selector);
......
This diff is collapsed.
/*
* Copyright (C) 2015-2020 Savoir-faire Linux Inc.
* Author: Aline Gondim Santos <aline.gondimsantos@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 _PLUGINSETTINGSVIEW_H
#define _PLUGINSETTINGSVIEW_H
#include <gtk/gtk.h>
namespace lrc
{
namespace api
{
class PluginModel;
}
}
G_BEGIN_DECLS
#define PLUGIN_SETTINGS_VIEW_TYPE (plugin_settings_view_get_type ())
#define PLUGIN_SETTINGS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUGIN_SETTINGS_VIEW_TYPE, PluginSettingsView))
#define PLUGIN_SETTINGS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUGIN_SETTINGS_VIEW_TYPE, PluginSettingsViewClass))
#define IS_PLUGIN_SETTINGS_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUGIN_SETTINGS_VIEW_TYPE))
#define IS_PLUGIN_SETTINGS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), PLUGIN_SETTINGS_VIEW_TYPE))
typedef struct _PluginSettingsView PluginSettingsView;
typedef struct _PluginSettingsViewClass PluginSettingsViewClass;
GType plugin_settings_view_get_type (void) G_GNUC_CONST;
GtkWidget *plugin_settings_view_new (lrc::api::PluginModel& pluginModel);
void plugin_settings_view_show (PluginSettingsView *view, gboolean show_preview);
G_END_DECLS
#endif /* _PLUGINSETTINGSVIEW_H */
......@@ -397,6 +397,25 @@
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkToggleButton" id="togglebutton_activate_plugin">
<style>
<class name="call-button"/>
</style>
<property name="visible">False</property>
<property name="can_focus">True</property>
<property name="receives_default">True</property>
<property name="width-request">48</property>
<property name="height-request">48</property>
<property name="has_tooltip">True</property>
<!-- <property name="tooltip-text" translatable="yes">Plugin</property> -->
<property name="image">image_activate_plugin</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
</packing>
</child>
<child>
<object class="GtkScaleButton" id="scalebutton_quality">
<style>
......@@ -494,6 +513,15 @@
</object>
</child>
</object>
<object class="GtkImage" id="image_activate_plugin">
<property name="visible">True</property>
<property name="resource">/net/jami/JamiGnome/plugin_white</property>
<child internal-child="accessible">
<object class="AtkObject" id="image_activate_plugin-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Activate Plugin</property>
</object>
</child>
</object>
<object class="GtkImage" id="image_transfer">
<property name="visible">True</property>
<property name="resource">/net/jami/JamiGnome/transfer</property>
......@@ -664,4 +692,40 @@
</object>
</child>
</object>
<object class="GtkPopover" id="activate_plugin_popover">
<property name="can_focus">False</property>
<property name="height_request">200</property>
<property name="width_request">300</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel">
<property name="visible">True</property>
<property name="halign">center</property>
<property name="label" translatable="yes">Choose plugin</property>
</object>
</child>
<child>
<object class="GtkScrolledWindow">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="shadow_type">in</property>
<property name="min_content_height">200</property>
<property name="halign">fill</property>
<child>
<object class="GtkListBox" id="list_media_handlers_available">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</interface>
......@@ -20,6 +20,12 @@
<property name="icon_name">preferences-system-symbolic</property>
<property name="icon_size">2</property>
</object>
<object class="GtkImage" id="image_plugin_settings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="icon_name">application-x-addon-symbolic</property>
<property name="icon_size">2</property>
</object>
<object class="GtkImage" id="image_history">
<property name="visible">True</property>
<property name="can_focus">False</property>
......@@ -108,6 +114,23 @@
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton_plugin_settings">
<property name="label" translatable="yes">Plugin</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">False</property>
<property name="image">image_plugin_settings</property>
<property name="draw_indicator">False</property>
<property name="group">radiobutton_general_settings</property>
<accelerator key="i" signal="activate" modifiers="GDK_CONTROL_MASK"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkRadioButton" id="radiobutton_new_account_settings">
<property name="label" translatable="yes">Account</property>
......@@ -122,7 +145,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">True</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<style>
......
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<requires lib="gtk+" version="3.10"/>
<object class="GtkImage" id="image-folder">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="xpad">5</property>
<property name="stock">gtk-directory</property>
</object>
<object class="GtkImage" id="image-add-device">
<property name="visible">True</property>
<property name="icon_name">list-add-symbolic</property>
<child internal-child="accessible">
<object class="AtkObject" id="image_invite-atkobject">
<property name="AtkObject::accessible-description" translatable="yes">Add device</property>
</object>
</child>
</object>
<template class="PluginSettingsView" parent="GtkScrolledWindow">
<property name="visible">True</property>
<child>
<object class="GtkBox" id="vbox_main_columns">
<property name="visible">True</property>
<property name="spacing">24</property>
<property name="border_width">10</property>
<property name="orientation">vertical</property>
<property name="halign">center</property>
<property name="valign">center</property>
<!-- Plugins settings -->
<child>
<object class="GtkBox" id="box_plugins_settings">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="halign">fill</property>
<property name="spacing">8</property>
<!-- Title -->
<child>
<object class="GtkLabel" id="label_plugins_settings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label" translatable="yes">Plugins</property>
<property name="halign">start</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkFrame">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="label_xalign">0</property>
<property name="shadow_type">out</property>
<child>
<object class="GtkListBox" id="at_startup_plugins_settings">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">fill</property>
<property name="selection_mode">none</property>
<child>
<!-- Plugins Enabled -->
<object class="GtkListBoxRow" id="at_startup_plugins_row">
<property name="visible">True</property>
<property name="can_focus">False</property>
<!-- <property name="halign">fill</property> -->
<child>
<object class="GtkBox" id="at_startup_plugins_box">
<property name="visible">True</property>
<property name="halign">fill</property>
<property name="orientation">horizontal</property>
<property name="margin_left">12</property>
<property name="margin_right">12</property>
<property name="margin_top">12</property>
<property name="margin_bottom">12</property>
<child>
<object class="GtkLabel" id="label_plugins_enabled">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="margin_right">12</property>
<property name="label" translatable="yes">Enable plugins</property>
</object>
</child>
<child>
<object class="GtkSwitch" id="plugins_enabled_button">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
</object>
</child>
<!-- Plugins List -->
<child>
<object class="GtkBox" id="vbox_plugins_list">
<property name="visible">False</property>
<property name="can_focus">False</property>
<property name="orientation">vertical</property>
<property name="spacing">8</property>
<child>
<object class="GtkBox">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="orientation">horizontal</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel" id="plugins_installed">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="halign">start</property>
<property name="label" translatable="yes">Installed Plugins</property>
<attributes>
<attribute name="weight" value="bold"/>
</attributes>
</object>
</child>
<child>
<object class="GtkButton" id="button_choose_jpl_file">
<property name="label" translatable="yes">Install Plugin</property>
<property name="image">image-add-device</property>
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="receives_default">True</property>
<property name="halign">fill</property>
</object>
<packing>
<property name="pack_type">end</property>
</packing>
</child>
</object>
</child>
<child>
<object class="GtkScrolledWindow" id="scrolled_window_installed_plugins">
<property name="visible">True</property>
<property name="can_focus">False</property>
<property name="hscrollbar_policy">never</property>
<property name="shadow_type">in</property>
<property name="min_content_height">200</property>
<property name="halign">fill</property>
<child>
<object class="GtkListBox" id="list_installed_plugins">
<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">0</property>
</packing>
</child>
</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">3</property>
</packing>
</child>
</object>
<packing>
<property name="expand">True</property>
<property name="fill">True</property>
</packing>
</child>
</template>
</interface>
......@@ -9,6 +9,7 @@
<file preprocess="xml-stripblanks">accountmigrationview.ui</file>
<file preprocess="xml-stripblanks">newaccountsettingsview.ui</file>
<file preprocess="xml-stripblanks">mediasettingsview.ui</file>
<file preprocess="xml-stripblanks">pluginsettingsview.ui</file>
<file preprocess="xml-stripblanks">generalsettingsview.ui</file>
<file preprocess="xml-stripblanks">chatview.ui</file>
<file preprocess="xml-stripblanks">messagingwidget.ui</file>
......
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