Commit 1ec76808 authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin

Better status icon behavior.

parent a1c6260d
......@@ -17,18 +17,18 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtk/gtk.h>
#include <string.h>
#include <glib/gprintf.h>
#include <stdlib.h>
#include <accountlist.h>
#include <actions.h>
#include <mainwindow.h>
#include <calltree.h>
#include <screen.h>
#include <dbus.h>
#include <accountlist.h>
#include <mainwindow.h>
#include <screen.h>
#include <statusicon.h>
#include <gtk/gtk.h>
#include <string.h>
#include <glib/gprintf.h>
#include <stdlib.h>
gboolean
sflphone_quit ()
......@@ -167,6 +167,7 @@ void
sflphone_incoming_call (call_t * c)
{
call_list_add ( c );
status_icon_unminimize();
update_call_tree_add(c);
}
......
......@@ -17,14 +17,15 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtk/gtk.h>
#include <actions.h>
#include <mainwindow.h>
#include <statusicon.h>
GtkStatusIcon* status;
GtkWidget * show_menu_item;
gboolean minimized = FALSE;
void
status_quit ( void * foo)
{
......@@ -32,7 +33,15 @@ status_quit ( void * foo)
}
void
activate (GtkStatusIcon *status_icon, void * foo)
status_icon_unminimize()
{
gtk_widget_show(GTK_WIDGET(get_main_window()));
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item), FALSE);
minimized = FALSE;
}
void
show_hide (GtkStatusIcon *status_icon, void * foo)
{
if(minimized)
{
......@@ -50,7 +59,8 @@ void menu (GtkStatusIcon *status_icon,
guint activate_time,
GtkWidget * menu)
{
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, activate_time);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, gtk_status_icon_position_menu,
status_icon, button, activate_time);
}
GtkWidget *
......@@ -61,12 +71,23 @@ create_menu()
menu = gtk_menu_new ();
show_menu_item = gtk_check_menu_item_new_with_mnemonic ("_Show main window");
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item), TRUE);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), show_menu_item);
g_signal_connect(G_OBJECT (show_menu_item), "toggled",
G_CALLBACK (show_hide),
NULL);
menu_items = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
menu_items = gtk_image_menu_item_new_from_stock( GTK_STOCK_QUIT, get_accel_group());
g_signal_connect_swapped (G_OBJECT (menu_items), "activate",
G_CALLBACK (status_quit),
NULL);
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
gtk_widget_show (menu_items);
gtk_widget_show_all (menu);
return menu;
}
......@@ -76,7 +97,7 @@ show_status_icon()
{
status = gtk_status_icon_new_from_file(ICON_DIR "/sflphone.png");
g_signal_connect (G_OBJECT (status), "activate",
G_CALLBACK (activate),
G_CALLBACK (show_hide),
NULL);
g_signal_connect (G_OBJECT (status), "popup-menu",
G_CALLBACK (menu),
......
......@@ -25,5 +25,7 @@
* @brief The status icon.
*/
void show_status_icon();
void status_icon_unminimize();
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment