Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
jami-daemon
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
savoirfairelinux
jami-daemon
Commits
45970911
Project 'savoirfairelinux/ring-daemon' was moved to 'savoirfairelinux/jami-daemon'. Please update any links and bookmarks that may still have the old path.
Commit
45970911
authored
13 years ago
by
Tristan Matthews
Browse files
Options
Downloads
Patches
Plain Diff
gnome: mainwindow whitespace cleanup
parent
561492a9
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
gnome/src/mainwindow.c
+207
-258
207 additions, 258 deletions
gnome/src/mainwindow.c
with
207 additions
and
258 deletions
gnome/src/mainwindow.c
+
207
−
258
View file @
45970911
...
@@ -31,17 +31,17 @@
...
@@ -31,17 +31,17 @@
*/
*/
#include
<config.h>
#include
<config.h>
#include
<
actions.h
>
#include
"
actions.h
"
#include
<
calltree.h
>
#include
"
calltree.h
"
#include
<
calltab.h
>
#include
"
calltab.h
"
#include
<
preferencesdialog.h
>
#include
"
preferencesdialog.h
"
#include
<
dialpad.h
>
#include
"
dialpad.h
"
#include
<
mainwindow.h
>
#include
"
mainwindow.h
"
#include
<
sliders.h
>
#include
"
sliders.h
"
#include
<
contacts/searchbar.h
>
#include
"
contacts/searchbar.h
"
#include
<
assistant.h
>
#include
"
assistant.h
"
#include
<
widget/gtkscrollbook.h
>
#include
"
widget/gtkscrollbook.h
"
#include
<
widget/minidialog.h
>
#include
"
widget/minidialog.h
"
#include
"uimanager.h"
#include
"uimanager.h"
#include
"config/audioconf.h"
#include
"config/audioconf.h"
...
@@ -58,18 +58,18 @@
...
@@ -58,18 +58,18 @@
#include
<eel-gconf-extensions.h>
#include
<eel-gconf-extensions.h>
/** Local variables */
/** Local variables */
static
GtkUIManager
*
ui_manager
=
NULL
;
static
GtkUIManager
*
ui_manager
;
static
GtkAccelGroup
*
accelGroup
=
NULL
;
static
GtkAccelGroup
*
accelGroup
;
static
GtkWidget
*
window
=
NULL
;
static
GtkWidget
*
window
;
static
GtkWidget
*
subvbox
=
NULL
;
static
GtkWidget
*
subvbox
;
static
GtkWidget
*
vbox
=
NULL
;
static
GtkWidget
*
vbox
;
static
GtkWidget
*
dialpad
=
NULL
;
static
GtkWidget
*
dialpad
;
static
GtkWidget
*
speaker_control
=
NULL
;
static
GtkWidget
*
speaker_control
;
static
GtkWidget
*
mic_control
=
NULL
;
static
GtkWidget
*
mic_control
;
static
GtkWidget
*
statusBar
=
NULL
;
static
GtkWidget
*
statusBar
;
static
PidginScrollBook
*
embedded_error_notebook
;
static
PidginScrollBook
*
embedded_error_notebook
;
static
gchar
*
status_current_message
=
NULL
;
static
gchar
*
status_current_message
;
static
GMutex
*
gmutex
;
static
GMutex
*
gmutex
;
/**
/**
...
@@ -77,12 +77,10 @@ static GMutex *gmutex;
...
@@ -77,12 +77,10 @@ static GMutex *gmutex;
*/
*/
static
gboolean
window_configure_cb
(
GtkWidget
*
win
UNUSED
,
GdkEventConfigure
*
event
)
static
gboolean
window_configure_cb
(
GtkWidget
*
win
UNUSED
,
GdkEventConfigure
*
event
)
{
{
int
pos_x
,
pos_y
;
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_WIDTH
,
event
->
width
);
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_WIDTH
,
event
->
width
);
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_HEIGHT
,
event
->
height
);
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_HEIGHT
,
event
->
height
);
int
pos_x
,
pos_y
;
gtk_window_get_position
(
GTK_WINDOW
(
window
),
&
pos_x
,
&
pos_y
);
gtk_window_get_position
(
GTK_WINDOW
(
window
),
&
pos_x
,
&
pos_y
);
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_POSITION_X
,
pos_x
);
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_POSITION_X
,
pos_x
);
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_POSITION_Y
,
pos_y
);
eel_gconf_set_integer
(
CONF_MAIN_WINDOW_POSITION_Y
,
pos_y
);
...
@@ -113,28 +111,21 @@ on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED)
...
@@ -113,28 +111,21 @@ on_delete (GtkWidget * widget UNUSED, gpointer data UNUSED)
gboolean
gboolean
main_window_ask_quit
()
main_window_ask_quit
()
{
{
guint
count
=
calllist_get_size
(
current_calls
);
GtkWidget
*
dialog
;
gint
response
;
gchar
*
question
;
gchar
*
question
;
if
(
calllist_get_size
(
current_calls
)
==
1
)
if
(
count
==
1
)
{
question
=
_
(
"There is one call in progress."
);
question
=
_
(
"There is one call in progress."
);
}
else
{
else
question
=
_
(
"There are calls in progress."
);
question
=
_
(
"There are calls in progress."
);
}
dialog
=
gtk_message_dialog_new_with_markup
(
GTK_WINDOW
(
window
),
GtkWidget
*
dialog
=
gtk_message_dialog_new_with_markup
(
GTK_WINDOW
(
window
),
GTK_DIALOG_MODAL
,
GTK_MESSAGE_QUESTION
,
GTK_BUTTONS_YES_NO
,
"%s
\n
%s"
,
GTK_DIALOG_MODAL
,
GTK_MESSAGE_QUESTION
,
GTK_BUTTONS_YES_NO
,
"%s
\n
%s"
,
question
,
_
(
"Do you still want to quit?"
));
question
,
_
(
"Do you still want to quit?"
));
response
=
gtk_dialog_run
(
GTK_DIALOG
(
dialog
));
gint
response
=
gtk_dialog_run
(
GTK_DIALOG
(
dialog
));
gtk_widget_destroy
(
dialog
);
gtk_widget_destroy
(
dialog
);
return
(
response
==
GTK_RESPONSE_NO
)
?
FALSE
:
TRUE
;
return
(
response
==
GTK_RESPONSE_NO
)
?
FALSE
:
TRUE
;
}
}
static
gboolean
static
gboolean
...
@@ -148,10 +139,9 @@ on_key_released (GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_dat
...
@@ -148,10 +139,9 @@ on_key_released (GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_dat
sflphone_keypad
(
event
->
keyval
,
event
->
string
);
sflphone_keypad
(
event
->
keyval
,
event
->
string
);
return
TRUE
;
return
TRUE
;
}
}
else
if
(
active_calltree
==
history
)
{
else
if
(
active_calltree
==
history
)
return
FALSE
;
return
FALSE
;
}
}
}
// If a modifier key is pressed, it's a shortcut, pass along
// If a modifier key is pressed, it's a shortcut, pass along
if
(
event
->
state
&
GDK_CONTROL_MASK
||
event
->
state
&
GDK_MOD1_MASK
||
if
(
event
->
state
&
GDK_CONTROL_MASK
||
event
->
state
&
GDK_MOD1_MASK
||
...
@@ -165,49 +155,29 @@ on_key_released (GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_dat
...
@@ -165,49 +155,29 @@ on_key_released (GtkWidget *widget UNUSED, GdkEventKey *event, gpointer user_dat
event
->
keyval
==
GDK_Right
||
event
->
keyval
==
GDK_Right
||
event
->
keyval
==
GDK_Down
||
event
->
keyval
==
GDK_Down
||
(
event
->
keyval
>=
GDK_F1
&&
event
->
keyval
<=
GDK_F12
)
||
(
event
->
keyval
>=
GDK_F1
&&
event
->
keyval
<=
GDK_F12
)
||
event
->
keyval
==
' '
event
->
keyval
==
' '
)
)
return
FALSE
;
return
FALSE
;
else
{
else
sflphone_keypad
(
event
->
keyval
,
event
->
string
);
sflphone_keypad
(
event
->
keyval
,
event
->
string
);
}
return
TRUE
;
return
TRUE
;
}
}
void
focus_on_mainwindow_out
()
{
// gtk_widget_grab_focus(GTK_WIDGET(window));
}
void
focus_on_mainwindow_in
()
{
// gtk_widget_grab_focus(GTK_WIDGET(window));
}
void
void
create_main_window
()
create_main_window
()
{
{
GtkWidget
*
widget
;
GError
*
error
=
NULL
;
const
char
*
window_title
=
"SFLphone VoIP Client"
;
int
width
,
height
,
position_x
,
position_y
;
focus_is_on_calltree
=
FALSE
;
focus_is_on_calltree
=
FALSE
;
focus_is_on_searchbar
=
FALSE
;
focus_is_on_searchbar
=
FALSE
;
// Get configuration stored in gconf
// Get configuration stored in gconf
width
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_WIDTH
);
int
width
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_WIDTH
);
height
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_HEIGHT
);
int
height
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_HEIGHT
);
position_x
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_POSITION_X
);
int
position_x
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_POSITION_X
);
position_y
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_POSITION_Y
);
int
position_y
=
eel_gconf_get_integer
(
CONF_MAIN_WINDOW_POSITION_Y
);
window
=
gtk_window_new
(
GTK_WINDOW_TOPLEVEL
);
window
=
gtk_window_new
(
GTK_WINDOW_TOPLEVEL
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
window
),
0
);
gtk_container_set_border_width
(
GTK_CONTAINER
(
window
),
0
);
gtk_window_set_title
(
GTK_WINDOW
(
window
),
window_title
);
gtk_window_set_title
(
GTK_WINDOW
(
window
),
"SFLphone VoIP Client"
);
gtk_window_set_default_size
(
GTK_WINDOW
(
window
),
width
,
height
);
gtk_window_set_default_size
(
GTK_WINDOW
(
window
),
width
,
height
);
struct
stat
st
;
struct
stat
st
;
if
(
!
stat
(
LOGO
,
&
st
))
if
(
!
stat
(
LOGO
,
&
st
))
...
@@ -224,12 +194,6 @@ create_main_window ()
...
@@ -224,12 +194,6 @@ create_main_window ()
g_signal_connect
(
G_OBJECT
(
window
),
"key-release-event"
,
g_signal_connect
(
G_OBJECT
(
window
),
"key-release-event"
,
G_CALLBACK
(
on_key_released
),
NULL
);
G_CALLBACK
(
on_key_released
),
NULL
);
g_signal_connect_after
(
G_OBJECT
(
window
),
"focus-in-event"
,
G_CALLBACK
(
focus_on_mainwindow_in
),
NULL
);
g_signal_connect_after
(
G_OBJECT
(
window
),
"focus-out-event"
,
G_CALLBACK
(
focus_on_mainwindow_out
),
NULL
);
g_signal_connect_object
(
G_OBJECT
(
window
),
"configure-event"
,
g_signal_connect_object
(
G_OBJECT
(
window
),
"configure-event"
,
G_CALLBACK
(
window_configure_cb
),
NULL
,
0
);
G_CALLBACK
(
window_configure_cb
),
NULL
,
0
);
...
@@ -239,7 +203,6 @@ create_main_window ()
...
@@ -239,7 +203,6 @@ create_main_window ()
if
(
!
ui_manager
)
{
if
(
!
ui_manager
)
{
ERROR
(
"Could not load xml GUI
\n
"
);
ERROR
(
"Could not load xml GUI
\n
"
);
g_error_free
(
error
);
exit
(
1
);
exit
(
1
);
}
}
...
@@ -250,7 +213,7 @@ create_main_window ()
...
@@ -250,7 +213,7 @@ create_main_window ()
vbox
=
gtk_vbox_new
(
FALSE
/*homogeneous*/
,
0
/*spacing*/
);
vbox
=
gtk_vbox_new
(
FALSE
/*homogeneous*/
,
0
/*spacing*/
);
subvbox
=
gtk_vbox_new
(
FALSE
/*homogeneous*/
,
5
/*spacing*/
);
subvbox
=
gtk_vbox_new
(
FALSE
/*homogeneous*/
,
5
/*spacing*/
);
widget
=
create_menus
(
ui_manager
);
GtkWidget
*
widget
=
create_menus
(
ui_manager
);
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
widget
,
FALSE
/*expand*/
,
TRUE
/*fill*/
,
gtk_box_pack_start
(
GTK_BOX
(
vbox
),
widget
,
FALSE
/*expand*/
,
TRUE
/*fill*/
,
0
/*padding*/
);
0
/*padding*/
);
...
@@ -286,7 +249,6 @@ create_main_window ()
...
@@ -286,7 +249,6 @@ create_main_window ()
gtk_widget_show_all
(
mic_control
);
gtk_widget_show_all
(
mic_control
);
}
}
if
(
eel_gconf_get_boolean
(
CONF_SHOW_DIALPAD
))
{
if
(
eel_gconf_get_boolean
(
CONF_SHOW_DIALPAD
))
{
dialpad
=
create_dialpad
();
dialpad
=
create_dialpad
();
gtk_box_pack_end
(
GTK_BOX
(
subvbox
),
dialpad
,
FALSE
/*expand*/
,
TRUE
/*fill*/
,
0
/*padding*/
);
gtk_box_pack_end
(
GTK_BOX
(
subvbox
),
dialpad
,
FALSE
/*expand*/
,
TRUE
/*fill*/
,
0
/*padding*/
);
...
@@ -326,13 +288,12 @@ create_main_window ()
...
@@ -326,13 +288,12 @@ create_main_window ()
GTK_BUTTONS_YES_NO
,
GTK_BUTTONS_YES_NO
,
"<b><big>Welcome to SFLphone!</big></b>
\n\n
There are no VoIP accounts configured, would you like to edit the preferences now?"
);
"<b><big>Welcome to SFLphone!</big></b>
\n\n
There are no VoIP accounts configured, would you like to edit the preferences now?"
);
int
response
=
gtk_dialog_run
(
GTK_DIALOG
(
dialog
));
g
int
response
=
gtk_dialog_run
(
GTK_DIALOG
(
dialog
));
gtk_widget_destroy
(
dialog
);
gtk_widget_destroy
(
dialog
);
if
(
response
==
GTK_RESPONSE_YES
)
if
(
response
==
GTK_RESPONSE_YES
)
show_preferences_dialog
();
show_preferences_dialog
();
#endif
#endif
}
}
...
@@ -385,9 +346,6 @@ main_window_volume_controls (gboolean state)
...
@@ -385,9 +346,6 @@ main_window_volume_controls (gboolean state)
void
void
statusbar_push_message
(
const
gchar
*
const
left_hand_message
,
const
gchar
*
const
right_hand_message
,
guint
id
)
statusbar_push_message
(
const
gchar
*
const
left_hand_message
,
const
gchar
*
const
right_hand_message
,
guint
id
)
{
{
// The actual message to be push in the statusbar
gchar
*
message_to_display
;
g_mutex_lock
(
gmutex
);
g_mutex_lock
(
gmutex
);
g_free
(
status_current_message
);
g_free
(
status_current_message
);
...
@@ -395,6 +353,7 @@ statusbar_push_message (const gchar * const left_hand_message, const gchar * con
...
@@ -395,6 +353,7 @@ statusbar_push_message (const gchar * const left_hand_message, const gchar * con
status_current_message
=
g_strdup
(
left_hand_message
);
status_current_message
=
g_strdup
(
left_hand_message
);
// Format message according to right hand member
// Format message according to right hand member
gchar
*
message_to_display
;
if
(
right_hand_message
)
if
(
right_hand_message
)
message_to_display
=
g_strdup_printf
(
"%s %s"
,
message_to_display
=
g_strdup_printf
(
"%s %s"
,
left_hand_message
,
right_hand_message
);
left_hand_message
,
right_hand_message
);
...
@@ -446,10 +405,9 @@ destroy_error_dialog_cb (GtkObject *dialog, callable_obj_t * call)
...
@@ -446,10 +405,9 @@ destroy_error_dialog_cb (GtkObject *dialog, callable_obj_t * call)
void
void
main_window_zrtp_not_supported
(
callable_obj_t
*
c
)
main_window_zrtp_not_supported
(
callable_obj_t
*
c
)
{
{
account_t
*
account_details
=
NULL
;
gchar
*
warning_enabled
=
""
;
gchar
*
warning_enabled
=
""
;
account_details
=
account_list_get_by_id
(
c
->
_accountID
);
account_t
*
account_details
=
account_list_get_by_id
(
c
->
_accountID
);
if
(
account_details
!=
NULL
)
{
if
(
account_details
!=
NULL
)
{
warning_enabled
=
g_hash_table_lookup
(
account_details
->
properties
,
warning_enabled
=
g_hash_table_lookup
(
account_details
->
properties
,
...
@@ -459,11 +417,10 @@ main_window_zrtp_not_supported (callable_obj_t * c)
...
@@ -459,11 +417,10 @@ main_window_zrtp_not_supported (callable_obj_t * c)
DEBUG
(
"Account is null callID %s"
,
c
->
_callID
);
DEBUG
(
"Account is null callID %s"
,
c
->
_callID
);
GHashTable
*
properties
=
sflphone_get_ip2ip_properties
();
GHashTable
*
properties
=
sflphone_get_ip2ip_properties
();
if
(
properties
!=
NULL
)
{
if
(
properties
!=
NULL
)
warning_enabled
=
g_hash_table_lookup
(
properties
,
warning_enabled
=
g_hash_table_lookup
(
properties
,
ACCOUNT_ZRTP_NOT_SUPP_WARNING
);
ACCOUNT_ZRTP_NOT_SUPP_WARNING
);
}
}
}
if
(
g_strcasecmp
(
warning_enabled
,
"true"
)
==
0
)
{
if
(
g_strcasecmp
(
warning_enabled
,
"true"
)
==
0
)
{
PidginMiniDialog
*
mini_dialog
;
PidginMiniDialog
*
mini_dialog
;
...
@@ -490,37 +447,30 @@ main_window_zrtp_negotiation_failed (const gchar* const callID, const gchar* con
...
@@ -490,37 +447,30 @@ main_window_zrtp_negotiation_failed (const gchar* const callID, const gchar* con
callable_obj_t
*
c
=
NULL
;
callable_obj_t
*
c
=
NULL
;
c
=
calllist_get_call
(
current_calls
,
callID
);
c
=
calllist_get_call
(
current_calls
,
callID
);
if
(
c
!=
NULL
)
{
if
(
c
!=
NULL
)
peer_number
=
c
->
_peer_number
;
peer_number
=
c
->
_peer_number
;
}
PidginMiniDialog
*
mini_dialog
;
gchar
*
desc
=
g_markup_printf_escaped
(
_
(
"A %s error forced the call with "
gchar
"%s to fall under unencrypted "
*
desc
=
"mode.
\n
Exact reason: %s
\n
"
),
g_markup_printf_escaped
(
_
(
"A %s error forced the call with %s to fall under unencrypted mode.
\n
Exact reason: %s
\n
"
),
severity
,
peer_number
,
reason
);
severity
,
peer_number
,
reason
);
mini_dialog
=
pidgin_mini_dialog_new
(
_
(
"ZRTP negotiation failed"
),
desc
,
PidginMiniDialog
*
mini_dialog
=
pidgin_mini_dialog_new
(
_
(
"ZRTP negotiation failed"
),
desc
,
GTK_STOCK_DIALOG_WARNING
);
GTK_STOCK_DIALOG_WARNING
);
pidgin_mini_dialog_add_button
(
mini_dialog
,
_
(
"Continue"
),
NULL
,
NULL
);
pidgin_mini_dialog_add_button
(
mini_dialog
,
_
(
"Continue"
),
NULL
,
NULL
);
pidgin_mini_dialog_add_button
(
mini_dialog
,
_
(
"Stop Call"
),
sflphone_hang_up
,
pidgin_mini_dialog_add_button
(
mini_dialog
,
_
(
"Stop Call"
),
sflphone_hang_up
,
NULL
);
NULL
);
g_signal_connect_after
(
mini_dialog
,
"destroy"
,(
GCallback
)
destroy_error_dialog_cb
,
c
);
g_signal_connect_after
(
mini_dialog
,
"destroy"
,(
GCallback
)
destroy_error_dialog_cb
,
c
);
add_error_dialog
(
GTK_WIDGET
(
mini_dialog
),
c
);
add_error_dialog
(
GTK_WIDGET
(
mini_dialog
),
c
);
}
}
void
void
main_window_confirm_go_clear
(
callable_obj_t
*
c
)
main_window_confirm_go_clear
(
callable_obj_t
*
c
)
{
{
PidginMiniDialog
*
mini_dialog
;
gchar
*
desc
=
g_markup_printf_escaped
(
gchar
*
desc
=
g_markup_printf_escaped
(
_
(
"%s wants to stop using secure communication. Confirm will resume conversation without SRTP.
\n
"
),
_
(
"%s wants to stop using secure communication. Confirm will resume conversation without SRTP.
\n
"
),
c
->
_peer_number
);
c
->
_peer_number
);
mini_dialog
=
pidgin_mini_dialog_new
(
_
(
"Confirm Go Clear"
),
desc
,
PidginMiniDialog
*
mini_dialog
=
pidgin_mini_dialog_new
(
_
(
"Confirm Go Clear"
),
desc
,
GTK_STOCK_STOP
);
GTK_STOCK_STOP
);
pidgin_mini_dialog_add_button
(
mini_dialog
,
_
(
"Confirm"
),
pidgin_mini_dialog_add_button
(
mini_dialog
,
_
(
"Confirm"
),
(
PidginMiniDialogCallback
)
dbus_set_confirm_go_clear
,
NULL
);
(
PidginMiniDialogCallback
)
dbus_set_confirm_go_clear
,
NULL
);
...
@@ -529,4 +479,3 @@ main_window_confirm_go_clear (callable_obj_t * c)
...
@@ -529,4 +479,3 @@ main_window_confirm_go_clear (callable_obj_t * c)
add_error_dialog
(
GTK_WIDGET
(
mini_dialog
),
c
);
add_error_dialog
(
GTK_WIDGET
(
mini_dialog
),
c
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment