Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
savoirfairelinux
jami-daemon
Commits
b51c1b82
Commit
b51c1b82
authored
Jul 12, 2012
by
Emmanuel Lepage
Browse files
[ #13333 ] Fix some warning
parent
ae4848e3
Changes
4
Hide whitespace changes
Inline
Side-by-side
gnome/src/dbus/dbus.c
View file @
b51c1b82
...
...
@@ -51,6 +51,7 @@
#include
"assistant.h"
#include
"accountlist.h"
#include
"accountlistconfigdialog.h"
#include
"messaging/message_tab.h"
#include
"dbus.h"
#include
"actions.h"
...
...
@@ -147,18 +148,16 @@ voice_mail_cb(DBusGProxy *proxy UNUSED, const gchar *accountID, guint nb,
static
void
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
if
(
eel_gconf_key_exists
(
INSTANT_MESSAGING_ENABLED
)
&&
!
eel_gconf_get_integer
(
INSTANT_MESSAGING_ENABLED
))
return
;
gchar
*
id
;
callable_obj_t
*
call
=
calllist_get_call
(
current_calls_tab
,
callID
);
if
(
call
)
{
id
=
call
->
_callID
;
new_text_message
(
call
,
msg
);
}
else
{
conference_obj_t
*
conf
=
conferencelist_get
(
current_calls_tab
,
callID
);
...
...
@@ -167,7 +166,6 @@ incoming_message_cb(DBusGProxy *proxy UNUSED, const gchar *callID UNUSED,
return
;
}
id
=
conf
->
_confID
;
new_text_message
(
conf
,
msg
);
}
}
...
...
@@ -358,6 +356,7 @@ conference_removed_cb(DBusGProxy *proxy UNUSED, const gchar *confID,
// 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
);
/*TODO elepage(2012) implement unmerging of IM here*/
}
conferencelist_remove
(
current_calls_tab
,
c
->
_confID
);
...
...
gnome/src/messaging/message_tab.c
View file @
b51c1b82
...
...
@@ -43,25 +43,7 @@ GtkWidget *get_tab_box()
return
tab_box
;
}
void
new_text_message
(
gchar
*
call_id
,
char
*
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
)
void
append_message
(
message_tab
*
self
,
gchar
*
name
,
const
gchar
*
message
)
{
GtkTextIter
current_end
,
new_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)
gtk_text_buffer_insert
(
self
->
buffer
,
&
current_end
,
": "
,
-
1
);
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
))
break
;
}
...
...
@@ -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
);
}
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
;
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
));
gtk_entry_set_text
(
entry
,
""
);
}
//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
g
char
*
title
)
{
message_tab
*
tab
=
g_hash_table_lookup
(
tabs
,
call
->
_callID
);
if
(
tab
)
{
...
...
@@ -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
*
text_box_widget
=
gtk_text_view_new_with_buffer
(
text_buffer
);
gtk_text_view_set_editable
(
text_box_widget
,
FALSE
);
gtk_text_view_set_wrap_mode
(
text_box_widget
,
GTK_WRAP_CHAR
);
gtk_text_view_set_editable
(
GTK_TEXT_VIEW
(
text_box_widget
)
,
FALSE
);
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
);
GtkWidget
*
line_edit
=
gtk_entry_new
();
...
...
@@ -120,19 +119,20 @@ message_tab* create_messaging_tab(callable_obj_t* call,const char* title)
self
->
widget
=
vbox
;
self
->
call_id
=
call
->
_callID
;
self
->
title
=
title
;
self
->
title
=
malloc
(
strlen
(
title
)
*
sizeof
(
gchar
*
));
strcpy
(
self
->
title
,
title
);
self
->
buffer
=
text_buffer
;
self
->
entry
=
line_edit
;
self
->
view
=
text_box_widget
;
GtkWidget
*
tab_label
=
gtk_label_new
(
call
->
_peer_number
);
self
->
view
=
GTK_TEXT_VIEW
(
text_box_widget
);
gchar
*
label_text
;
if
(
strcmp
(
call
->
_display_name
,
""
))
label_text
=
call
->
_display_name
;
else
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
(
scoll_area
);
gtk_widget_show
(
text_box_widget
);
...
...
gnome/src/messaging/message_tab.h
View file @
b51c1b82
...
...
@@ -47,9 +47,8 @@ typedef struct {
GtkWidget
*
entry
;
}
message_tab
;
// void add_message_box(ClutterActor* stage, const char* author, const char* message);
message_tab
*
create_messaging_tab
(
callable_obj_t
*
call
,
const
char
*
title
);
message_tab
*
create_messaging_tab
(
callable_obj_t
*
call
,
const
gchar
*
title
);
GtkWidget
*
get_tab_box
();
void
new_text_message
(
gchar
*
call_id
,
char
*
message
);
void
new_text_message
(
callable_obj_t
*
call
,
const
g
char
*
message
);
#endif
\ No newline at end of file
gnome/src/uimanager.c
View file @
b51c1b82
...
...
@@ -63,6 +63,8 @@
#include
"account_schema.h"
#include
"config/accountlistconfigdialog.h"
#include
"messaging/message_tab.h"
#include
<sys/stat.h>
#include
<sliders.h>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment