Commit 8782663b authored by smorlat's avatar smorlat
Browse files

remove gnome directory.

git-svn-id: svn+ssh://svn.savannah.nongnu.org/linphone/trunk@532 3f6dc0c8-ddfe-455d-9043-3cd528dc4637
parent 540715f9
.deps
.libs
Makefile
Makefile.in
linphone
linphone_applet
GNOME_LinphoneApplet.server
GNOME_LinphoneApplet.server.in
<oaf_info>
<oaf_server iid="OAFIID:GNOME_LinphoneApplet_Factory"
type="exe"
location="@LIBEXECDIR@/linphone_applet">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:Bonobo/GenericFactory:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" value="Linphone Applet Factory"/>
<oaf_attribute name="description" type="string" value="Linphone Applet Factory"/>
</oaf_server>
<oaf_server iid="OAFIID:GNOME_LinphoneApplet"
type="factory"
location="OAFIID:GNOME_LinphoneApplet_Factory">
<oaf_attribute name="repo_ids" type="stringv">
<item value="IDL:GNOME/Vertigo/PanelAppletShell:1.0"/>
<item value="IDL:Bonobo/Control:1.0"/>
<item value="IDL:Bonobo/Unknown:1.0"/>
</oaf_attribute>
<oaf_attribute name="name" type="string" _value="Linphone"/>
<oaf_attribute name="description" type="string" _value="Linphone"/>
<oaf_attribute name="panel:category" type="string" _value="Internet"/>
<oaf_attribute name="panel:icon" type="string" value="linphone/linphone2.png"/>
</oaf_server>
</oaf_info>
<Root>
<popups>
<popup name="button3">
<menuitem name="About" verb="About" _label="_About..." pixtype="stock" pixname="gnome-stock-about"/>
</popup>
</popups>
</Root>
## Process this file with automake to produce Makefile.in
linphone_common_sources=\
linphone.c linphone.h \
gui_utils.c gui_utils.h \
support.c support.h \
interface.c interface.h \
callbacks.c callbacks.h \
presence.c presence.h \
propertybox.c propertybox.h \
addressbook.c addressbook.h \
friends.c friends.h
if BUILD_GNOME
INCLUDES = \
-I$(top_srcdir)\
-I$(top_srcdir)/intl \
$(ORTP_CFLAGS) \
-I$(top_srcdir)/coreapi \
-I$(top_srcdir)/mediastreamer2/include \
$(OSIP_CFLAGS)
bin_PROGRAMS = linphone
linphone_SOURCES = \
main.c \
$(linphone_common_sources)
linphone_LDADD = $(LIBGNOMEUI_LIBS) $(INTLLIBS) \
$(LIBGNOME_LIBS) \
$(top_builddir)/coreapi/liblinphone.la \
$(OSIP_LIBS)
endif
AM_CFLAGS=$(STRICT_OPTIONS) $(LIBGNOMEUI_CFLAGS) $(LIBGNOME_CFLAGS) $(GNOME_APPLETS_CFLAGS) $(IPV6_CFLAGS)
@INTLTOOL_SERVER_RULE@
if BUILD_GNOME_APPLET
gnome_appletdir=$(libexecdir)
gnome_applet_PROGRAMS = linphone_applet
linphone_applet_SOURCES = \
$(linphone_common_sources)\
applet.c
linphone_applet_CFLAGS=$(AM_CFLAGS) -DLINPHONE_APPLET
linphone_applet_LDADD = \
$(GNOME_APPLETS_LIBS) \
$(top_builddir)/coreapi/liblinphone.la \
$(OSIP_LIBS)
serverdir = $(libdir)/bonobo/servers
server_in_files = GNOME_LinphoneApplet.server.in
server_DATA = $(server_in_files:.server.in=.server)
$(server_in_files): $(server_in_files:.server.in=.server.in.in)
sed -e "s|\@LIBEXECDIR\@|$(libexecdir)|" $< > $@
uidir = $(datadir)/gnome-2.0/ui
ui_DATA = GNOME_LinphoneApplet.xml
endif
EXTRA_DIST = \
GNOME_LinphoneApplet.server.in.in \
applet.c \
$(ui_DATA)
DISTCLEANFILES=GNOME_LinphoneApplet.server.in GNOME_LinphoneApplet.server
/***************************************************************************
addressbook.c -
-------------------
begin : Wed Jan 30 2002
copyright : (C) 2002 by Simon Morlat
email : simon.morlat@linphone.org
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "linphone.h"
#define get_address_book() (&uiobj->addressbook)
#define get_main_window() (&uiobj->main_window)
#define get_core() (uiobj->core)
#define get_uiobj() (uiobj)
void fill_address_book(GtkWidget *address_list);
void ab_destroyed(){
get_uiobj()->ab=NULL;
}
void show_address_book(){
if (get_uiobj()->ab!=NULL){
gtk_window_present(GTK_WINDOW(get_uiobj()->ab));
}else{
get_uiobj()->ab=create_and_fill_address_book();
g_signal_connect(G_OBJECT(get_uiobj()->ab),"destroy",G_CALLBACK(ab_destroyed),NULL);
gtk_widget_show(get_uiobj()->ab);
}
}
#define GLADE_HOOKUP_OBJECT(component,widget,name) \
g_object_set_data_full (G_OBJECT (component), name, \
gtk_widget_ref (widget), (GDestroyNotify) gtk_widget_unref)
void contact_draw(GtkWidget *w, LinphoneProxyConfig *cfg){
GtkWidget *table=lookup_widget(w,"table10");
GtkWidget *combo;
combo=proxy_combo_box_new(cfg);
gtk_widget_show(combo);
gtk_table_attach(GTK_TABLE(table),combo,1,2,2,3, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
GLADE_HOOKUP_OBJECT(w,combo,"proxy");
combo=gtk_combo_box_new_text();
gtk_combo_box_append_text(GTK_COMBO_BOX(combo),_("Wait"));
gtk_combo_box_append_text(GTK_COMBO_BOX(combo),_("Deny"));
gtk_combo_box_append_text(GTK_COMBO_BOX(combo),_("Accept"));
gtk_widget_show(combo);
gtk_table_attach(GTK_TABLE(table),combo,1,2,3,4, (GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
(GtkAttachOptions) (GTK_EXPAND | GTK_FILL), 0, 0);
GLADE_HOOKUP_OBJECT(w,combo,"pol");
}
GtkWidget * contact_new(LinphoneFriend *lf, GtkWidget *ab){
GtkWidget *w=create_contact_box();
contact_draw(w,NULL);
gtk_widget_show(w);
g_object_set_data(G_OBJECT(w),"friend_ref",(gpointer)lf);
g_object_set_data(G_OBJECT(w),"address_book",(gpointer)ab);
g_object_set_data(G_OBJECT(w),"add",GINT_TO_POINTER(TRUE));
gtk_combo_box_set_active(GTK_COMBO_BOX(lookup_widget(w,"pol")),lf->pol);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(w,"send_subscribe")),lf->subscribe);
return w;
}
GtkWidget * contact_edit(LinphoneFriend *lf, GtkWidget *ab){
GtkWidget *w=create_contact_box();
gchar *tmpstr;
contact_draw(w,lf->proxy);
g_object_set_data(G_OBJECT(w),"friend_ref",(gpointer)lf);
linphone_friend_edit(lf);
tmpstr=linphone_friend_get_name(lf);
if (tmpstr!=NULL) {
gtk_entry_set_text(GTK_ENTRY(lookup_widget(w,"name")),tmpstr);
g_free(tmpstr);
}
tmpstr=linphone_friend_get_addr(lf);
gtk_entry_set_text(GTK_ENTRY(lookup_widget(w,"sipaddr")),tmpstr);
g_free(tmpstr);
gtk_combo_box_set_active(GTK_COMBO_BOX(lookup_widget(w,"pol")),lf->pol);
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(lookup_widget(w,"send_subscribe")),lf->subscribe);
gtk_widget_show(w);
if (ab!=NULL) g_object_set_data(G_OBJECT(w),"address_book",(gpointer)ab);
return w;
}
GtkWidget * subscriber_edit(LinphoneFriend *lf){
GtkWidget *w=contact_edit(lf,NULL);
g_object_set_data(G_OBJECT(w),"add",GINT_TO_POINTER(TRUE));
return w;
}
gint contact_ok(GtkWidget *dialog){
gchar *name,*sipaddr;
gchar *url;
gboolean add=FALSE;
GtkWidget *ab;
LinphoneFriend *lf;
int err;
lf=(LinphoneFriend*)g_object_get_data(G_OBJECT(dialog),"friend_ref");
add=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(dialog),"add"));
name=gtk_editable_get_chars(GTK_EDITABLE(lookup_widget(dialog,"name")),0,-1);
sipaddr=gtk_editable_get_chars(GTK_EDITABLE(lookup_widget(dialog,"sipaddr")),0,-1);
url=g_strdup_printf("%s <%s>",name,sipaddr);
/* workaround a bug in osip ? */
/* something doesn't like addresses like "machin <<sip:truc@bidule>>" */
if (strchr(sipaddr,'<')==NULL){
err=linphone_friend_set_sip_addr(lf,url);
}else err=-1;
if (err<0){
linphone_gnome_ui_display_something(get_uiobj(),GTK_MESSAGE_WARNING,_("Bad sip address: a sip address looks like sip:user@domain"));
linphone_friend_destroy(lf);
g_free(name);
g_free(sipaddr);
g_free(url);
return -1;
}
g_free(name);
g_free(sipaddr);
g_free(url);
linphone_friend_set_proxy(lf,proxy_combo_box_get_selected(lookup_widget(dialog,"proxy")));
linphone_friend_set_inc_subscribe_policy(lf,gtk_combo_box_get_active(GTK_COMBO_BOX(lookup_widget(dialog,"pol"))));
linphone_friend_send_subscribe(lf,gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(lookup_widget(dialog,"send_subscribe"))));
if (add){
linphone_core_add_friend(get_core(),lf);
}
else linphone_friend_done(lf);
/* ask the address book to redraw itself */
ab=g_object_get_data(G_OBJECT(dialog),"address_book");
if (ab!=NULL) fill_address_book(lookup_widget(ab,"address_list"));
return 0;
}
enum{
SIP_ADDRESS_COLUMN,
FRIEND_REFERENCE,
AB_NCOLUMNS
};
void choose_address_and_close(GtkWidget *ab){
GtkTreeSelection *select;
GtkWidget *addressentry=get_main_window()->addressentry;
GtkTreeIter iter;
GtkTreeModel *model;
gchar *address=NULL;
GtkWidget *address_list=lookup_widget(ab,"address_list");
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (address_list));
if (select==NULL) return;
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
gtk_tree_model_get (model, &iter,SIP_ADDRESS_COLUMN , &address, -1);
}
if (address!=NULL){
gtk_entry_set_text (GTK_ENTRY(addressentry),address);
g_free(address);
}
gtk_widget_destroy(ab);
}
void
address_book_close (GtkWidget *object,
gpointer user_data)
{
gtk_widget_destroy(gtk_widget_get_toplevel(object));
}
void address_selection_changed_cb(GtkTreeSelection *selection, gpointer data)
{
}
gboolean address_button_press(GtkWidget *widget,GdkEventButton *event,gpointer user_data)
{
GtkWidget *ab=(GtkWidget*)user_data;
if (event->type==GDK_2BUTTON_PRESS){
choose_address_and_close(ab);
return TRUE;
}
return FALSE;
}
void fill_address_book(GtkWidget *address_list){
GtkListStore *store;
GtkTreeIter iter;
GtkTreeModel *model;
MSList *elem;
gchar *tmpstr;
/* fill the store */
elem=linphone_core_get_friend_list(get_core());
model=gtk_tree_view_get_model(GTK_TREE_VIEW(address_list));
store=GTK_LIST_STORE(model);
gtk_list_store_clear(store);
for(;elem!=NULL;elem=ms_list_next(elem)){
LinphoneFriend *lf=(LinphoneFriend*)elem->data;
tmpstr=linphone_friend_get_url(lf);
gtk_list_store_append(store,&iter);
gtk_list_store_set(store,&iter,SIP_ADDRESS_COLUMN,tmpstr,FRIEND_REFERENCE,(gpointer)lf,-1);
ms_free(tmpstr);
}
}
GtkWidget *create_and_fill_address_book(){
GtkListStore *store;
GtkCellRenderer *renderer;
GtkTreeViewColumn *column;
GtkTreeSelection *select;
GtkWidget *address_list;
GtkWidget *ret=create_address_book();
address_list=lookup_widget(ret,"address_list");
store = gtk_list_store_new (AB_NCOLUMNS, G_TYPE_STRING,G_TYPE_POINTER);
gtk_tree_view_set_model(GTK_TREE_VIEW(address_list),GTK_TREE_MODEL(store));
g_object_unref(G_OBJECT(store));
renderer = gtk_cell_renderer_text_new ();
column = gtk_tree_view_column_new_with_attributes (_("Contact list"),
renderer,
"text", SIP_ADDRESS_COLUMN,
NULL);
gtk_tree_view_append_column (GTK_TREE_VIEW (address_list), column);
/* Setup the selection handler */
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (address_list));
gtk_tree_selection_set_mode (select, GTK_SELECTION_SINGLE);
g_signal_connect (G_OBJECT (select), "changed",
G_CALLBACK (address_selection_changed_cb),
NULL);
/* setup handler for double click */
g_signal_connect(G_OBJECT(address_list),"button-press-event",G_CALLBACK(address_button_press),(gpointer)ret);
fill_address_book(address_list);
return ret;
}
void
on_modify_address_clicked (GtkButton *button,
gpointer user_data)
{
GtkTreeSelection *select;
GtkTreeIter iter;
GtkTreeModel *model;
GtkWidget *address_list=lookup_widget(gtk_widget_get_toplevel(GTK_WIDGET(button)),"address_list");
/* change the address in the view */
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (address_list));
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
LinphoneFriend *lf=NULL;
gtk_tree_model_get(model,&iter,FRIEND_REFERENCE,&lf,-1);
contact_edit(lf,gtk_widget_get_toplevel(GTK_WIDGET(button)));
}
}
void on_add_address_clicked(GtkButton *button,gpointer user_data)
{
LinphoneFriend *lf=linphone_friend_new();
contact_new(lf,gtk_widget_get_toplevel(GTK_WIDGET(button)));
}
void on_remove_address_clicked(GtkButton *button,gpointer user_data)
{
GtkTreeSelection *select;
GtkTreeIter iter;
GtkTreeModel *model;
GtkWidget *address_list=lookup_widget(gtk_widget_get_toplevel(GTK_WIDGET(button)),"address_list");
select = gtk_tree_view_get_selection (GTK_TREE_VIEW (address_list));
if (gtk_tree_selection_get_selected (select, &model, &iter))
{
LinphoneFriend *lf=NULL;
gtk_tree_model_get(model,&iter,FRIEND_REFERENCE,&lf,-1);
linphone_core_remove_friend(get_core(),lf);
gtk_list_store_remove(GTK_LIST_STORE(model), &iter);
}
}
void on_select_address_clicked(GtkButton *button,gpointer user_data)
{
choose_address_and_close(gtk_widget_get_toplevel(GTK_WIDGET(button)));
}
void
on_contact_box_response (GtkDialog *dialog,
gint response_id,
gpointer user_data)
{
switch (response_id){
case GTK_RESPONSE_OK:
contact_ok(GTK_WIDGET(dialog));
break;
default:
break;
}
gtk_widget_destroy(GTK_WIDGET(dialog));
}
/***************************************************************************
addressbook.h -
-------------------
begin : Wed Jan 30 2002
copyright : (C) 2002 by Simon Morlat
email : simon.morlat@linphone.org
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#ifndef ADDRESSBOOK_H
#define ADDRESSBOOK_H
GtkWidget *create_and_fill_address_book();
void show_address_book();
GtkWidget * contact_new(LinphoneFriend *lf, GtkWidget *ab);
GtkWidget * contact_edit(LinphoneFriend *lf, GtkWidget *ab);
GtkWidget * subscriber_edit(LinphoneFriend *lf);
#endif
/***************************************************************************
applet.c - Applet code for linphone's gnome
interface
-------------------
begin : Sat Dec 14 2002
copyright : (C) 2001 by Simon Morlat
email : simon.morlat@linphone.org
***************************************************************************/
/***************************************************************************
* *
* 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 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
#include "linphone.h"
#include <panel-applet.h>
#define get_uiobj() (uiobj)
LinphoneCore core;
LinphoneGnomeUI ui;
static int show=0;
static gulong signal_ref;
static GtkWidget *applet_button=NULL;
static GdkPixbuf *original_icon=NULL;
static GtkWidget *icon=NULL;
void draw_icon(GtkWidget *button, int size)
{
GdkPixbuf *resized;
if (original_icon==NULL){
original_icon=gdk_pixbuf_new_from_file(PACKAGE_DATA_DIR "/pixmaps/linphone/linphone2.xpm",
NULL);
g_return_if_fail( original_icon!=NULL);
}
if (icon!=NULL){
gtk_container_remove(GTK_CONTAINER(button),icon);
gtk_widget_destroy(icon);
}
resized=gdk_pixbuf_scale_simple(original_icon,size,size,GDK_INTERP_BILINEAR);
g_return_if_fail(resized!=NULL);
icon=gtk_image_new_from_pixbuf(resized);
g_return_if_fail(icon!=NULL);
gdk_pixbuf_unref(resized);
gtk_container_add(GTK_CONTAINER(button),icon);
gtk_widget_show(icon);
}
void linphone_applet_about_cb(gpointer p)
{
GtkWidget *about2;
about2 = create_about2 ();
gtk_widget_show (about2);
}
static void applet_change_pixel_size(GtkWidget *applet, int size)
{
g_return_if_fail(applet_button!=NULL);
draw_icon(applet_button,size);
}
static void applet_destroy_cb(GtkWidget *widget, gpointer data)
{
if (get_uiobj()->main_window.window!=NULL){
gtk_widget_destroy(get_uiobj()->main_window.window);
}
linphone_gnome_uninit(get_uiobj());
}
static gboolean
gui_destroy_cb (GtkWidget *widget, gpointer data)
{
linphone_gnome_ui_uninit(get_uiobj());
show=0;
return FALSE;
}
static gboolean button_press_cb(GtkWidget *applet, GdkEventButton* event, gpointer data)
{
if (event->button!=1) return FALSE;
if (show){
g_signal_handlers_disconnect_by_func(G_OBJECT(get_uiobj()->main_window.window),
G_CALLBACK(gui_destroy_cb),NULL);
linphone_gnome_ui_hide(get_uiobj());
show=0;
}else {
linphone_gnome_ui_show(get_uiobj());
signal_ref=g_signal_connect(G_OBJECT(get_uiobj()->main_window.window),
"destroy",
G_CALLBACK(gui_destroy_cb),NULL);
show=1;
}
return FALSE;
}
const BonoboUIVerb linphone_applet_menu_verbs [] = {
BONOBO_UI_UNSAFE_VERB ("About", linphone_applet_about_cb),
BONOBO_UI_VERB_END
};
static gboolean
linphone_applet_fill (PanelApplet *applet)
{
gint size=panel_applet_get_size(applet);
applet_button=gtk_frame_new(NULL);
gtk_container_add(GTK_CONTAINER(applet),applet_button);
gtk_widget_show(applet_button);
draw_icon(applet_button,size);
g_signal_connect(G_OBJECT(applet),"button-press-event",G_CALLBACK(button_press_cb),NULL);
g_signal_connect(G_OBJECT(applet),"change_size",
G_CALLBACK(applet_change_pixel_size),
NULL);
g_signal_connect (G_OBJECT (applet), "destroy",
G_CALLBACK (applet_destroy_cb), NULL);
//sizehint = panel_applet_get_size (PANEL_APPLET (applet));
panel_applet_setup_menu_from_file (applet,
NULL,
"GNOME_LinphoneApplet.xml",
NULL,
linphone_applet_menu_verbs,
NULL);
/* tracing for osip */
TRACE_INITIALIZE(5,stdout);
linphone_gnome_init(&ui,&core);