Commit 004fb6f5 authored by Emmanuel Lepage's avatar Emmanuel Lepage
Browse files

[ #13500 ] Partially remove webkit

parent 25928a8a
......@@ -21,7 +21,6 @@ libsflphone_client_la_SOURCES = \
uimanager.c \
sflnotify.c \
mainwindow.c \
imwindow.c \
dialpad.c \
callable_obj.c \
conference_obj.c \
......@@ -50,7 +49,6 @@ libsflphone_client_la_SOURCES = \
shortcuts.h \
eel-gconf-extensions.h \
logger.h \
imwindow.h \
unused.h \
str_utils.h \
gtk2_wrappers.h \
......
......@@ -66,10 +66,8 @@
#include "contacts/searchbar.h"
#include "contacts/addrbookfactory.h"
#include "icons/icon_factory.h"
#include "imwindow.h"
#include "statusicon.h"
#include "unused.h"
#include "widget/imwidget.h"
#include "sliders.h"
static GHashTable * ip2ip_profile;
......@@ -181,19 +179,13 @@ void
sflphone_hung_up(callable_obj_t * c)
{
DEBUG("%s", __PRETTY_FUNCTION__);
/*TODO elepage(2012) disable IM new text message here*/
calllist_remove_call(current_calls_tab, c->_callID);
calltree_remove_call(current_calls_tab, c->_callID);
c->_state = CALL_STATE_DIALING;
call_remove_all_errors(c);
update_actions();
// test whether the widget contains text, if not remove it
if ((im_window_get_nb_tabs() > 1) && c->_im_widget && !(IM_WIDGET(c->_im_widget)->containText))
im_window_remove_tab(c->_im_widget);
else
im_widget_update_state(IM_WIDGET(c->_im_widget), FALSE);
status_tray_icon_blink(FALSE);
statusbar_update_clock("");
......@@ -296,7 +288,7 @@ sflphone_hang_up()
DEBUG("%s", __PRETTY_FUNCTION__);
if (selectedConf) {
im_widget_update_state(IM_WIDGET(selectedConf->_im_widget), FALSE);
/*TODO elepage(2012) disable IM text message here*/
dbus_hang_up_conference(selectedConf);
} else if (selectedCall) {
switch (selectedCall->_state) {
......@@ -317,8 +309,6 @@ sflphone_hang_up()
selectedCall->_state = CALL_STATE_DIALING;
time(&selectedCall->_time_stop);
im_widget_update_state(IM_WIDGET(selectedCall->_im_widget), FALSE);
break;
case CALL_STATE_FAILURE:
dbus_hang_up(selectedCall);
......@@ -371,21 +361,11 @@ sflphone_pick_up()
case CALL_STATE_DIALING:
sflphone_place_call(selectedCall);
// if instant messaging window is visible, create new tab (deleted automatically if not used)
if (im_window_is_visible())
if (!selectedCall->_im_widget)
selectedCall->_im_widget = im_widget_display(selectedCall->_callID);
break;
case CALL_STATE_INCOMING:
selectedCall->_history_state = g_strdup(INCOMING_STRING);
calltree_update_call(history_tab, selectedCall);
// if instant messaging window is visible, create new tab (deleted automatically if not used)
if (im_window_is_visible())
if (!selectedCall->_im_widget)
selectedCall->_im_widget = im_widget_display(selectedCall->_callID);
dbus_accept(selectedCall);
break;
case CALL_STATE_TRANSFER:
......@@ -803,7 +783,7 @@ sflphone_detach_participant(const gchar* callID)
DEBUG("Detach participant %s", selectedCall->_callID);
im_widget_update_state(IM_WIDGET(selectedCall->_im_widget), TRUE);
/*TODO elepage(2012) correct IM conversation*/
calltree_remove_call(current_calls_tab, selectedCall->_callID);
calltree_add_call(current_calls_tab, selectedCall, NULL);
dbus_detach_participant(selectedCall->_callID);
......
......@@ -50,7 +50,6 @@
#include "calltree.h"
#include "uimanager.h"
#include "actions.h"
#include "imwindow.h"
#include "searchbar.h"
#if !GLIB_CHECK_VERSION(2, 30, 0)
......
......@@ -56,8 +56,6 @@
#include "actions.h"
#include "unused.h"
#include "widget/imwidget.h"
#ifdef SFL_VIDEO
#include "config/videoconf.h"
#include "video/video_callbacks.h"
......@@ -156,12 +154,10 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar *callID UNUSED,
!eel_gconf_get_integer(INSTANT_MESSAGING_ENABLED))
return;
GtkWidget **widget;
gchar *id;
callable_obj_t *call = calllist_get_call(current_calls_tab, callID);
if (call) {
widget = &call->_im_widget;
id = call->_callID;
new_text_message(call,msg);
} else {
......@@ -171,16 +167,9 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar *callID UNUSED,
return;
}
widget = &conf->_im_widget;
id = conf->_confID;
new_text_message(conf,msg);
}
if (!*widget)
*widget = im_widget_display(id);
im_widget_add_message(IM_WIDGET(*widget), from, msg, 0);
}
/**
......@@ -271,8 +260,7 @@ toggle_im(conference_obj_t *conf, gboolean activate)
for (GSList *p = conf->participant_list; p; p = g_slist_next(p)) {
callable_obj_t *call = calllist_get_call(current_calls_tab, p->data);
if (call)
im_widget_update_state(IM_WIDGET(call->_im_widget), activate);
/*TODO elepage(2012) Implement IM messaging toggle here*/
}
}
......@@ -335,7 +323,7 @@ conference_created_cb(DBusGProxy *proxy UNUSED, const gchar *confID, void *foo U
for (gchar **part = participants; part && *part; ++part) {
callable_obj_t *call = calllist_get_call(current_calls_tab, *part);
im_widget_update_state(IM_WIDGET(call->_im_widget), FALSE);
/*TODO elepage (2012) implement merging IM conversation here*/
// if one of these participants is currently recording, the whole conference will be recorded
if (dbus_get_is_recording(call))
......@@ -365,15 +353,11 @@ conference_removed_cb(DBusGProxy *proxy UNUSED, const gchar *confID,
calltree_remove_conference(current_calls_tab, c);
im_widget_update_state(IM_WIDGET(c->_im_widget), FALSE);
/*TODO elepage(2012) implement unmerging of IM here*/
// remove all participants for this conference
for (GSList *p = c->participant_list; p; p = g_slist_next(p)) {
callable_obj_t *call = calllist_get_call(current_calls_tab, p->data);
if (call) {
im_widget_update_state(IM_WIDGET(call->_im_widget), TRUE);
}
}
conferencelist_remove(current_calls_tab, c->_confID);
......
/*
* Copyright (C) 2004, 2005, 2006, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
* Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.com>
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
* Author: Pierre-Luc Bacon <pierre-luc.bacon@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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gtk2_wrappers.h"
#include "eel-gconf-extensions.h"
#include "logger.h"
#include "imwindow.h"
#include "unused.h"
#include "contacts/calltab.h"
#include "contacts/calltab.h"
#include "sflphone_const.h"
#include <sys/stat.h>
/** Local variables */
static GtkWidget *im_window;
static GtkWidget *im_notebook;
static void im_window_init();
static GtkWidget *im_window_get()
{
if (im_window == NULL)
im_window_init();
return im_window;
}
static gboolean window_configure_cb(GtkWidget *wini UNUSED, GdkEventConfigure *event)
{
int pos_x, pos_y;
eel_gconf_set_integer(CONF_IM_WINDOW_WIDTH, event->width);
eel_gconf_set_integer(CONF_IM_WINDOW_HEIGHT, event->height);
gtk_window_get_position(GTK_WINDOW(im_window_get()), &pos_x, &pos_y);
eel_gconf_set_integer(CONF_IM_WINDOW_POSITION_X, pos_x);
eel_gconf_set_integer(CONF_IM_WINDOW_POSITION_Y, pos_y);
return FALSE;
}
/**
* Minimize the main window.
*/
static gboolean
on_delete(GtkWidget * widget UNUSED, gpointer data UNUSED)
{
/* Only hide the main window that contains all the instant messaging instances */
gtk_widget_hide(im_window_get());
return TRUE;
}
static void
on_switch_page(GtkNotebook *notebook, gpointer page UNUSED, guint page_num, gpointer userdata UNUSED)
{
GtkWidget *tab = gtk_notebook_get_nth_page(GTK_NOTEBOOK(notebook), page_num);
// show the current widget
gtk_widget_grab_focus(tab);
gtk_widget_show_now(tab);
}
static void
im_window_init()
{
const char *window_title = "SFLphone IM Client";
int width, height, position_x, position_y;
// Get configuration stored in gconf
width = eel_gconf_get_integer(CONF_IM_WINDOW_WIDTH);
if (width <= 0)
width = 400;
height = eel_gconf_get_integer(CONF_IM_WINDOW_HEIGHT);
if (height <= 0)
height = 500;
position_x = eel_gconf_get_integer(CONF_IM_WINDOW_POSITION_X);
position_y = eel_gconf_get_integer(CONF_IM_WINDOW_POSITION_Y);
im_window = gtk_window_new(GTK_WINDOW_TOPLEVEL);
gtk_container_set_border_width(GTK_CONTAINER(im_window), 0);
gtk_window_set_title(GTK_WINDOW(im_window), window_title);
gtk_window_set_default_size(GTK_WINDOW(im_window), width, height);
struct stat st;
if (!stat(LOGO, &st))
gtk_window_set_default_icon_from_file(LOGO, NULL);
gtk_window_set_position(GTK_WINDOW(im_window), GTK_WIN_POS_MOUSE);
gtk_widget_set_name(im_window, "imwindow");
GtkWidget *im_box = gtk_box_new(GTK_ORIENTATION_VERTICAL, 0 /*spacing*/);
im_notebook = gtk_notebook_new();
gtk_container_add(GTK_CONTAINER(im_window), im_box);
gtk_box_pack_start(GTK_BOX(im_box), im_notebook, TRUE, TRUE, 0);
gtk_widget_show(im_notebook);
g_signal_connect(G_OBJECT(im_window), "delete-event", G_CALLBACK(on_delete), NULL);
g_signal_connect_object(G_OBJECT(im_window), "configure-event", G_CALLBACK(window_configure_cb), NULL, 0);
g_signal_connect(G_OBJECT(im_notebook), "switch-page", G_CALLBACK(on_switch_page), NULL);
/* make sure that everything is visible */
gtk_widget_show_all(im_window);
// Restore position according to the configuration stored in gconf
gtk_window_move(GTK_WINDOW(im_window), position_x, position_y);
gtk_widget_set_visible(im_window, FALSE);
}
gboolean
im_window_is_active()
{
if (!im_window)
return FALSE;
else
return gtk_window_is_active(GTK_WINDOW(im_window));
}
gboolean
im_window_is_visible()
{
return gtk_widget_get_visible(im_window_get());
}
void
im_window_add(IMWidget *widget)
{
if (im_window_get()) {
im_window_add_tab(widget);
gtk_widget_show_all(im_window_get());
}
}
gint
im_window_get_nb_tabs()
{
if (im_notebook != NULL)
return gtk_notebook_get_n_pages(GTK_NOTEBOOK(im_notebook));
else
return 0;
}
static void
close_tab_cb(GtkButton *button UNUSED, gpointer userdata)
{
/* We want here to close the current tab */
im_window_remove_tab(GTK_WIDGET(userdata));
/* If no tabs are opened anymore, close the IM window */
// gtk_widget_destroy (im_window);
}
static void
im_window_hide_show_tabs()
{
/* If only one tab is open, do not display the tab, only the content */
gtk_notebook_set_show_tabs(GTK_NOTEBOOK(im_notebook),
gtk_notebook_get_n_pages(GTK_NOTEBOOK(im_notebook)) != 1);
}
void
im_window_add_tab(IMWidget *im)
{
/* Fetch the call */
callable_obj_t *im_widget_call = calllist_get_call(current_calls_tab, im->call_id);
conference_obj_t *im_widget_conf = conferencelist_get(current_calls_tab, im->call_id);
/* A container to include the tab label and the close button */
GtkWidget *tab_container = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 3);
GtkWidget *tab_label;
im->tab = tab_container;
if (im_widget_call)
tab_label = gtk_label_new(*im_widget_call->_display_name ? im_widget_call->_display_name : im_widget_call->_peer_number);
else if (im_widget_conf)
tab_label = gtk_label_new("Conferencing");
else
tab_label = gtk_label_new("");
GtkWidget *tab_close_button = gtk_button_new();
/* Pack it all */
gtk_button_set_relief(GTK_BUTTON(tab_close_button), GTK_RELIEF_NONE);
gtk_box_pack_start(GTK_BOX(tab_container), tab_label, TRUE, TRUE, 0);
gtk_box_pack_start(GTK_BOX(tab_container), tab_close_button, FALSE, FALSE, 0);
gtk_container_add(GTK_CONTAINER(tab_close_button), gtk_image_new_from_stock(GTK_STOCK_CLOSE, GTK_ICON_SIZE_MENU));
/* Connect a signal to the close button on each tab, to be able to close the tabs individually */
g_signal_connect(tab_close_button, "clicked", G_CALLBACK(close_tab_cb), im);
/* Show it */
gtk_widget_show_all(im_notebook);
gtk_widget_show_all(tab_container);
/* Add the page to the notebook */
guint tab_index = gtk_notebook_append_page(GTK_NOTEBOOK(im_notebook), GTK_WIDGET(im), tab_container);
/* TODO Switch to the newly opened tab. Still not working */
DEBUG("InstantMessaging: Switch to tab: %i", tab_index);
gtk_notebook_set_current_page(GTK_NOTEBOOK(im_notebook), -1);
/* Decide whether or not displaying the tabs of the notebook */
im_window_hide_show_tabs();
}
void
im_window_show_tab(GtkWidget *widget)
{
int pageIndex = gtk_notebook_page_num(GTK_NOTEBOOK(im_notebook), widget);
if (pageIndex != -1)
gtk_notebook_set_current_page(GTK_NOTEBOOK(im_notebook), pageIndex);
}
void
im_window_remove_tab(GtkWidget *widget)
{
// Remove the widget from the window
/* We want here to close the current tab */
guint page_index = gtk_notebook_page_num(GTK_NOTEBOOK(im_notebook), GTK_WIDGET(widget));
gtk_notebook_remove_page(GTK_NOTEBOOK(im_notebook), page_index);
/* Need to do some memory clean up, so that we could re-open an Im widget for this call later. */
IMWidget *im = IM_WIDGET(widget);
callable_obj_t *call = calllist_get_call(current_calls_tab, im->call_id);
conference_obj_t *conf = conferencelist_get(current_calls_tab, im->call_id);
if (call)
call->_im_widget = NULL;
if (conf)
conf->_im_widget = NULL;
/* Decide whether or not displaying the tabs of the notebook */
im_window_hide_show_tabs();
}
/*
* Copyright (C) 2010 Savoir-Faire Linux Inc.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#ifndef __IMWINDOW_H__
#define __IMWINDOW_H__
#include <gtk/gtk.h>
#include "widget/imwidget.h"
/** @file imwindow.h
* @brief The IM window of the client.
*/
/*! @function
@abstract Add IM widget to the IM window
*/
void im_window_add (IMWidget *widget);
/*! @function
@abstract Remove IM widget from the IM window
*/
void im_window_remove_tab (GtkWidget *widget);
/**
* Return wether the instant messaging window have been created or not
*/
gboolean im_window_is_active (void);
/**
* Return wether the instant messaging window is visible
*/
gboolean im_window_is_visible (void);
/**
* Return the number of tabs already open in instant messaging window
*/
gint im_window_get_nb_tabs (void);
/*! @function
@abstract Add a new tab in the notebook. Each tab is an IM Widget
@param The IM widget
*/
void im_window_add_tab (IMWidget *widget);
/*! @function
@abstract Select the specified tab as current in instant messaging window
@param The tab to be set as current
*/
void im_window_show_tab (GtkWidget *widget);
#endif
......@@ -46,7 +46,6 @@
#include "uimanager.h"
#include "statusicon.h"
#include "widget/imwidget.h"
#include "eel-gconf-extensions.h"
#include "config/audioconf.h"
......@@ -111,7 +110,7 @@ remove_from_toolbar(GtkWidget *widget)
gtk_container_remove(GTK_CONTAINER(toolbar_), widget);
}
static bool
static gboolean
is_non_empty(const char *str)
{
return str && strlen(str) > 0;
......@@ -650,15 +649,11 @@ call_im(void* foo UNUSED)
if (calltab_get_selected_type(current_calls_tab) == A_CALL) {
if (selectedCall) {
if (!selectedCall->_im_widget)
selectedCall->_im_widget = im_widget_display(selectedCall->_callID);
create_messaging_tab(selectedCall,"test");
} else
WARN("Sorry. Instant messaging is not allowed outside a call\n");
} else {
if (selectedConf) {
if (!selectedConf->_im_widget)
selectedConf->_im_widget = im_widget_display(selectedConf->_confID);
create_messaging_tab(selectedConf,"test");
} else
WARN("Sorry. Instant messaging is not allowed outside a call\n");
......
......@@ -2,13 +2,13 @@ include ../../globals.mak
noinst_LTLIBRARIES = libwidget.la
libwidget_la_SOURCES = minidialog.h minidialog.c imwidget.c imwidget.h
libwidget_la_SOURCES = minidialog.h minidialog.c
libwidget_la_LDFLAGS = $(DBUSGLIB_LDFLAGS) $(LIBNOTIFY_LDFLAGS) \
$(GTK_LDFLAGS) $(GLIB_LDFLAGS) $(WEBKIT_LDFLAGS)
$(GTK_LDFLAGS) $(GLIB_LDFLAGS)
libwidget_la_LIBADD = $(DBUSGLIB_LIBS) $(LIBNOTIFY_LIBS) \
$(GTK_LIBS) $(GLIB_LIBS) $(WEBKIT_LIBS)
$(GTK_LIBS) $(GLIB_LIBS)
libwidget_la_CFLAGS = $(DBUSGLIB_CFLAGS) $(LIBNOTIFY_CFLAGS) \
$(GTK_CFLAGS) $(GLIB_CFLAGS) $(WEBKIT_CFLAGS)
$(GTK_CFLAGS) $(GLIB_CFLAGS)
/*
* Copyright (C) 2010 Savoir-Faire Linux Inc.
*
* 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., 675 Mass Ave, Cambridge, MA 02139, USA.
*
* Additional permission under GNU GPL version 3 section 7:
*
* If you modify this program, or any covered work, by linking or
* combining it with the OpenSSL project's OpenSSL library (or a
* modified version of that library), containing parts covered by the
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
* grants you additional permission to convey the resulting work.
* Corresponding Source for a non-source form of such a combination
* shall include the source code for the parts of OpenSSL used as well
* as that of the covered work.
*/
#include "imwindow.h"
#include "logger.h"
#include "gtk2_wrappers.h"
#include "imwidget.h"
#include "dbus.h"
#include "unused.h"
#include "icons/icon_factory.h"
#include "contacts/calltab.h"
#include "contacts/conferencelist.h"
#include <string.h>
#include <JavaScriptCore/JavaScript.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
static void
on_frame_loading_done(GObject *gobject UNUSED, GParamSpec *pspec UNUSED, gpointer user_data)
{
IMWidget *im = IM_WIDGET(user_data);