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
de315aa9
Commit
de315aa9
authored
Feb 07, 2008
by
Guillaume Carmel-Archambault
Browse files
GTK Dbus update list of active codecs
parent
08379a37
Changes
3
Show whitespace changes
Inline
Side-by-side
sflphone-gtk/src/codeclist.c
View file @
de315aa9
...
...
@@ -22,6 +22,8 @@
#include <string.h>
#include <stdlib.h>
#include "dbus.h"
GQueue
*
codecQueue
=
NULL
;
gint
...
...
@@ -68,8 +70,9 @@ void
codec_set_active
(
gchar
*
name
)
{
codec_t
*
c
=
codec_list_get
(
name
);
if
(
c
){
printf
(
"%s set active/n"
,
c
->
name
);
if
(
c
)
{
printf
(
"%s set active
\n
"
,
c
->
name
);
c
->
is_active
=
TRUE
;
}
}
...
...
@@ -112,6 +115,9 @@ codec_set_prefered_order(guint index)
g_queue_push_head
(
codecQueue
,
prefered
);
}
/**
*
*/
void
codec_list_move_codec_up
(
guint
index
)
{
...
...
@@ -121,13 +127,16 @@ codec_list_move_codec_up(guint index)
g_queue_push_nth
(
codecQueue
,
codec
,
index
-
1
);
}
//
TEMP
//
DEBUG
int
i
;
printf
(
"
\n
Codec list
\n
"
);
for
(
i
=
0
;
i
<
codecQueue
->
length
;
i
++
)
printf
(
"%s
\n
"
,
codec_list_get_nth
(
i
)
->
name
);
}
/**
*
*/
void
codec_list_move_codec_down
(
guint
index
)
{
...
...
@@ -137,9 +146,67 @@ codec_list_move_codec_down(guint index)
g_queue_push_nth
(
codecQueue
,
codec
,
index
+
1
);
}
//
TEMP
//
PRINT
int
i
;
printf
(
"
\n
Codec list
\n
"
);
for
(
i
=
0
;
i
<
codecQueue
->
length
;
i
++
)
printf
(
"%s
\n
"
,
codec_list_get_nth
(
i
)
->
name
);
}
/**
*
*/
void
codec_list_update_to_daemon
()
{
// String listing of all codecs payloads
const
gchar
**
codecList
;
// Length of the codec list
int
length
=
codecQueue
->
length
;
// Initiate double array char list for one string
codecList
=
(
void
*
)
malloc
(
sizeof
(
void
*
));
// Get all codecs in queue
int
i
,
c
=
0
;
printf
(
"List of active codecs :"
);
for
(
i
=
0
;
i
<
length
;
i
++
)
{
codec_t
*
currentCodec
=
codec_list_get_nth
(
i
);
// Assert not null
if
(
currentCodec
)
{
// Save only if active
if
(
currentCodec
->
is_active
)
{
// Reallocate memory each time more than one active codec is found
if
(
c
!=
0
)
codecList
=
(
void
*
)
realloc
(
codecList
,
(
c
+
1
)
*
sizeof
(
void
*
));
// Allocate memory for the payload
*
(
codecList
+
c
)
=
(
gchar
*
)
malloc
(
sizeof
(
gchar
*
));
char
payload
[
10
];
// Put payload string in char array
sprintf
(
payload
,
"%d"
,
currentCodec
->
_payload
);
strcpy
((
char
*
)
*
(
codecList
+
c
),
payload
);
g_print
(
" %s"
,
*
(
codecList
+
c
));
c
++
;
}
}
}
// Allocate NULL array at the end for Dbus
codecList
=
(
void
*
)
realloc
(
codecList
,
(
c
+
1
)
*
sizeof
(
void
*
));
*
(
codecList
+
c
)
=
NULL
;
printf
(
"
\n
"
);
// call dbus function with array of strings
dbus_set_active_codec_list
(
codecList
);
// Delete memory
for
(
i
=
0
;
i
<
c
;
i
++
)
{
free
((
gchar
*
)
*
(
codecList
+
i
));
}
free
(
codecList
);
}
sflphone-gtk/src/codeclist.h
View file @
de315aa9
...
...
@@ -54,5 +54,6 @@ void codec_set_prefered_order(guint index);
void
codec_list_move_codec_up
(
guint
index
);
void
codec_list_move_codec_down
(
guint
index
);
void
codec_list_update_to_daemon
();
#endif
sflphone-gtk/src/configwindow.c
View file @
de315aa9
...
...
@@ -298,7 +298,8 @@ codec_active_toggled(GtkCellRendererToggle *renderer, gchar *path, gpointer data
else
codec_set_inactive
(
name
);
// TODO Perpetuate changes to the deamon
// Perpetuate changes to the deamon
codec_list_update_to_daemon
();
}
/**
...
...
@@ -356,7 +357,8 @@ codec_move(gboolean moveUp, gpointer data)
else
codec_list_move_codec_down
(
indice
);
// TODO Perpetuate changes to the deamon
// Perpetuate changes to the deamon
codec_list_update_to_daemon
();
}
/**
...
...
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