Skip to content
Snippets Groups Projects
Commit b51c1b82 authored by Emmanuel Lepage's avatar Emmanuel Lepage
Browse files

[ #13333 ] Fix some warning

parent ae4848e3
No related branches found
No related tags found
No related merge requests found
...@@ -51,6 +51,7 @@ ...@@ -51,6 +51,7 @@
#include "assistant.h" #include "assistant.h"
#include "accountlist.h" #include "accountlist.h"
#include "accountlistconfigdialog.h" #include "accountlistconfigdialog.h"
#include "messaging/message_tab.h"
#include "dbus.h" #include "dbus.h"
#include "actions.h" #include "actions.h"
...@@ -147,18 +148,16 @@ voice_mail_cb(DBusGProxy *proxy UNUSED, const gchar *accountID, guint nb, ...@@ -147,18 +148,16 @@ voice_mail_cb(DBusGProxy *proxy UNUSED, const gchar *accountID, guint nb,
static void static void
incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar *callID UNUSED, incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar *callID UNUSED,
const gchar *from, const gchar *msg, void *foo UNUSED) const gchar *from UNUSED, const gchar *msg, void *foo UNUSED)
{ {
// do not display message if instant messaging is disabled // do not display message if instant messaging is disabled
if (eel_gconf_key_exists(INSTANT_MESSAGING_ENABLED) && if (eel_gconf_key_exists(INSTANT_MESSAGING_ENABLED) &&
!eel_gconf_get_integer(INSTANT_MESSAGING_ENABLED)) !eel_gconf_get_integer(INSTANT_MESSAGING_ENABLED))
return; return;
gchar *id;
callable_obj_t *call = calllist_get_call(current_calls_tab, callID); callable_obj_t *call = calllist_get_call(current_calls_tab, callID);
if (call) { if (call) {
id = call->_callID;
new_text_message(call,msg); new_text_message(call,msg);
} else { } else {
conference_obj_t *conf = conferencelist_get(current_calls_tab, callID); conference_obj_t *conf = conferencelist_get(current_calls_tab, callID);
...@@ -167,7 +166,6 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar *callID UNUSED, ...@@ -167,7 +166,6 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar *callID UNUSED,
return; return;
} }
id = conf->_confID;
new_text_message(conf,msg); new_text_message(conf,msg);
} }
} }
...@@ -358,6 +356,7 @@ conference_removed_cb(DBusGProxy *proxy UNUSED, const gchar *confID, ...@@ -358,6 +356,7 @@ conference_removed_cb(DBusGProxy *proxy UNUSED, const gchar *confID,
// remove all participants for this conference // remove all participants for this conference
for (GSList *p = c->participant_list; p; p = g_slist_next(p)) { for (GSList *p = c->participant_list; p; p = g_slist_next(p)) {
callable_obj_t *call = calllist_get_call(current_calls_tab, p->data); callable_obj_t *call = calllist_get_call(current_calls_tab, p->data);
/*TODO elepage(2012) implement unmerging of IM here*/
} }
conferencelist_remove(current_calls_tab, c->_confID); conferencelist_remove(current_calls_tab, c->_confID);
......
...@@ -43,25 +43,7 @@ GtkWidget *get_tab_box() ...@@ -43,25 +43,7 @@ GtkWidget *get_tab_box()
return tab_box; return tab_box;
} }
void new_text_message(gchar* call_id, char* message) void append_message(message_tab* self, gchar* name, const gchar* message)
{
message_tab *tab = g_hash_table_lookup(tabs,call_id);
if (!tab)
tab = create_messaging_tab(call_id,call_id);
append_message(tab,"Peer",message);
}
void replace_markup_tag(GtkTextBuffer* text_buffer, GtkTextIter* start)
{
GtkTextIter start_match,end_match;
while ( gtk_text_iter_forward_search(start, "<b>", GTK_TEXT_SEARCH_TEXT_ONLY | GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, NULL) ) {
gtk_text_iter_forward_search(start, "</b>", GTK_TEXT_SEARCH_TEXT_ONLY | GTK_TEXT_SEARCH_VISIBLE_ONLY, &end_match, &end_match, NULL);
gtk_text_buffer_apply_tag_by_name(text_buffer, "b", &start_match, &end_match);
int offset = gtk_text_iter_get_offset(&end_match);
gtk_text_buffer_get_iter_at_offset(text_buffer, start, offset);
}
}
void append_message(message_tab* self, gchar* name, gchar* message)
{ {
GtkTextIter current_end,new_end; GtkTextIter current_end,new_end;
gtk_text_buffer_get_end_iter(self->buffer, &current_end); gtk_text_buffer_get_end_iter(self->buffer, &current_end);
...@@ -69,7 +51,7 @@ void append_message(message_tab* self, gchar* name, gchar* message) ...@@ -69,7 +51,7 @@ void append_message(message_tab* self, gchar* name, gchar* message)
gtk_text_buffer_insert(self->buffer, &current_end, ": ", -1); gtk_text_buffer_insert(self->buffer, &current_end, ": ", -1);
gtk_text_buffer_get_end_iter(self->buffer, &current_end); gtk_text_buffer_get_end_iter(self->buffer, &current_end);
for (int i=0;i<strlen(name)+2;i++){ for (unsigned int i=0;i<strlen(name)+2;i++){
if (!gtk_text_iter_backward_char(&current_end)) if (!gtk_text_iter_backward_char(&current_end))
break; break;
} }
...@@ -82,16 +64,34 @@ void append_message(message_tab* self, gchar* name, gchar* message) ...@@ -82,16 +64,34 @@ void append_message(message_tab* self, gchar* name, gchar* message)
gtk_text_view_scroll_to_iter(self->view,&new_end,FALSE,0,0,FALSE); gtk_text_view_scroll_to_iter(self->view,&new_end,FALSE,0,0,FALSE);
} }
static gboolean on_enter(GtkEntry *entry, gpointer user_data) void new_text_message(callable_obj_t* call, const gchar* message)
{
message_tab *tab = g_hash_table_lookup(tabs,call->_callID);
if (!tab)
tab = create_messaging_tab(call,call->_callID);
append_message(tab,"Peer",message);
}
void replace_markup_tag(GtkTextBuffer* text_buffer, GtkTextIter* start)
{
GtkTextIter start_match,end_match;
while ( gtk_text_iter_forward_search(start, "<b>", GTK_TEXT_SEARCH_TEXT_ONLY | GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, NULL) ) {
gtk_text_iter_forward_search(start, "</b>", GTK_TEXT_SEARCH_TEXT_ONLY | GTK_TEXT_SEARCH_VISIBLE_ONLY, &end_match, &end_match, NULL);
gtk_text_buffer_apply_tag_by_name(text_buffer, "b", &start_match, &end_match);
int offset = gtk_text_iter_get_offset(&end_match);
gtk_text_buffer_get_iter_at_offset(text_buffer, start, offset);
}
}
static void on_enter(GtkEntry *entry, gpointer user_data)
{ {
message_tab *tab = (message_tab*)user_data; message_tab *tab = (message_tab*)user_data;
append_message(tab,"Me",gtk_entry_get_text(entry)); append_message(tab,(gchar*)"Me",gtk_entry_get_text(entry));
dbus_send_text_message(tab->call_id,gtk_entry_get_text(entry)); dbus_send_text_message(tab->call_id,gtk_entry_get_text(entry));
gtk_entry_set_text(entry,""); gtk_entry_set_text(entry,"");
} }
//conference_obj_t //conference_obj_t
message_tab* create_messaging_tab(callable_obj_t* call,const char* title) message_tab* create_messaging_tab(callable_obj_t* call,const gchar* title)
{ {
message_tab *tab = g_hash_table_lookup(tabs,call->_callID); message_tab *tab = g_hash_table_lookup(tabs,call->_callID);
if (tab) { if (tab) {
...@@ -107,10 +107,9 @@ message_tab* create_messaging_tab(callable_obj_t* call,const char* title) ...@@ -107,10 +107,9 @@ message_tab* create_messaging_tab(callable_obj_t* call,const char* title)
GtkWidget *scoll_area = gtk_scrolled_window_new(NULL,NULL); GtkWidget *scoll_area = gtk_scrolled_window_new(NULL,NULL);
GtkWidget *text_box_widget = gtk_text_view_new_with_buffer(text_buffer); GtkWidget *text_box_widget = gtk_text_view_new_with_buffer(text_buffer);
gtk_text_view_set_editable(text_box_widget,FALSE); gtk_text_view_set_editable(GTK_TEXT_VIEW(text_box_widget),FALSE);
gtk_text_view_set_wrap_mode(text_box_widget,GTK_WRAP_CHAR); gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text_box_widget),GTK_WRAP_CHAR);
gtk_container_add(scoll_area,text_box_widget);
gtk_box_pack_start(GTK_BOX(vbox), scoll_area, TRUE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), scoll_area, TRUE, TRUE, 0);
GtkWidget *line_edit = gtk_entry_new(); GtkWidget *line_edit = gtk_entry_new();
...@@ -120,19 +119,20 @@ message_tab* create_messaging_tab(callable_obj_t* call,const char* title) ...@@ -120,19 +119,20 @@ message_tab* create_messaging_tab(callable_obj_t* call,const char* title)
self->widget = vbox; self->widget = vbox;
self->call_id = call->_callID; self->call_id = call->_callID;
self->title = title; self->title = malloc(strlen(title) * sizeof(gchar*));
strcpy(self->title,title);
self->buffer = text_buffer; self->buffer = text_buffer;
self->entry = line_edit; self->entry = line_edit;
self->view = text_box_widget; self->view = GTK_TEXT_VIEW(text_box_widget);
GtkWidget *tab_label = gtk_label_new(call->_peer_number);
gchar* label_text; gchar* label_text;
if (strcmp(call->_display_name,"")) if (strcmp(call->_display_name,""))
label_text = call->_display_name; label_text = call->_display_name;
else else
label_text = call->_peer_number; label_text = call->_peer_number;
int ret = gtk_notebook_append_page(GTK_NOTEBOOK(get_tab_box()),vbox,tab_label); GtkWidget *tab_label = gtk_label_new(label_text);
gtk_notebook_append_page(GTK_NOTEBOOK(get_tab_box()),vbox,tab_label);
gtk_widget_show (vbox); gtk_widget_show (vbox);
gtk_widget_show (scoll_area); gtk_widget_show (scoll_area);
gtk_widget_show (text_box_widget); gtk_widget_show (text_box_widget);
......
...@@ -47,9 +47,8 @@ typedef struct { ...@@ -47,9 +47,8 @@ typedef struct {
GtkWidget* entry; GtkWidget* entry;
} message_tab; } message_tab;
// void add_message_box(ClutterActor* stage, const char* author, const char* message); message_tab* create_messaging_tab(callable_obj_t* call,const gchar* title);
message_tab* create_messaging_tab(callable_obj_t* call,const char* title);
GtkWidget *get_tab_box(); GtkWidget *get_tab_box();
void new_text_message(gchar* call_id, char* message); void new_text_message(callable_obj_t* call, const gchar* message);
#endif #endif
\ No newline at end of file
...@@ -63,6 +63,8 @@ ...@@ -63,6 +63,8 @@
#include "account_schema.h" #include "account_schema.h"
#include "config/accountlistconfigdialog.h" #include "config/accountlistconfigdialog.h"
#include "messaging/message_tab.h"
#include <sys/stat.h> #include <sys/stat.h>
#include <sliders.h> #include <sliders.h>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment