* #19650: gnome: added "bring window to foreground" option

This commit is contained in:
Tristan Matthews
2013-06-06 13:59:26 -04:00
parent cbf0abc7c5
commit e2f5828904
5 changed files with 44 additions and 3 deletions

View File

@ -55,10 +55,16 @@
<summary>Notify all</summary>
<description>Notify all.</description>
</key>
<key name="bring-window-to-front" type="b">
<default>true</default>
<summary>Bring window to front</summary>
<description>Bring window to foreground on incoming calls
</description>
</key>
<key name="popup-main-window" type="b">
<default>true</default>
<summary>Popup main window</summary>
<description>Popup main window.</description>
<description>Popup main window (if in system tray).</description>
</key>
<key name='messaging-url-command' type='s'>
<summary>Messaging URL command</summary>

View File

@ -150,6 +150,14 @@ instant_messaging_load_configuration(SFLPhoneClient *client)
instant_messaging_enabled = g_settings_get_boolean(client->settings, "instant-messaging-enabled");
}
static void
win_to_front_cb(GtkToggleButton *widget, gpointer data)
{
SFLPhoneClient *client = (SFLPhoneClient *) data;
const gboolean window_to_front = gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(widget));
g_settings_set_boolean(client->settings, "bring-window-to-front", window_to_front);
}
GtkWidget*
create_general_settings(SFLPhoneClient *client)
{
@ -177,8 +185,22 @@ create_general_settings(SFLPhoneClient *client)
g_signal_connect(G_OBJECT(notifAll), "clicked", G_CALLBACK(set_notif_level), client);
gtk_grid_attach(GTK_GRID(grid), notifAll, 0, 0, 1, 1);
// Window Behaviour frame
gnome_main_section_new_with_grid(_("Window Behaviour"), &frame, &grid);
gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
// Whether or not to bring window to foreground on incoming call
const gboolean win_to_front = g_settings_get_boolean(client->settings, "bring-window-to-front");
GtkWidget *win_to_front_button =
gtk_check_button_new_with_mnemonic(_("Bring SFLphone to foreground on incoming calls"));
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(win_to_front_button), win_to_front);
g_signal_connect(G_OBJECT(win_to_front_button), "toggled",
G_CALLBACK(win_to_front_cb), client);
gtk_grid_attach(GTK_GRID(grid), win_to_front_button, 0, 0, 1, 1);
// System Tray option frame
gnome_main_section_new_with_grid(_("System Tray Icon"), &frame, &grid);
gnome_main_section_new_with_grid(_("System Tray Icon (Legacy)"), &frame, &grid);
gtk_box_pack_start(GTK_BOX(ret), frame, FALSE, FALSE, 0);
// Whether or not displaying an icon in the system tray

View File

@ -116,10 +116,14 @@ incoming_call_cb(G_GNUC_UNUSED DBusGProxy *proxy, const gchar *accountID,
g_free(peer_number);
g_free(display_name);
/* Legacy system tray option, requires TopIcons GNOME extension */
status_tray_icon_blink(TRUE);
if (g_settings_get_boolean(client->settings, "popup-main-window"))
popup_main_window(client);
if (g_settings_get_boolean(client->settings, "bring-window-to-front"))
main_window_bring_to_front(client, c->_time_start);
notify_incoming_call(c, client);
sflphone_incoming_call(c, client);
}

View File

@ -209,6 +209,14 @@ static void pack_main_window_start(GtkBox *box, GtkWidget *widget, gboolean expa
gtk_box_pack_start(box, alignment, expand, fill, padding);
}
void
main_window_bring_to_front(SFLPhoneClient *client, guint32 timestamp)
{
/* Window should not be in focus, in case user was entering sensitive
* information in another application */
gtk_window_present_with_time(GTK_WINDOW(client->win), timestamp);
}
void
create_main_window(SFLPhoneClient *client)
{

View File

@ -128,6 +128,7 @@ void main_window_hide_playback_scale();
*/
void main_window_pause_keygrabber(gboolean value);
void main_window_reset_playback_scale();
void main_window_bring_to_front(SFLPhoneClient *client, guint32 timestamp);
#endif