Skip to content
Snippets Groups Projects
Commit 20e75417 authored by Alexandre Savard's avatar Alexandre Savard
Browse files

[#2558] Added hangup menu item in systray

parent 87670406
Branches
Tags
No related merge requests found
......@@ -26,10 +26,9 @@
#if GTK_CHECK_VERSION(2,10,0)
GtkStatusIcon *status;
GtkWidget * show_menu_item;
GtkWidget *show_menu_item, *hangup_menu_item;
gboolean __minimized = MINIMIZED;
void popup_main_window (void)
{
if (__POPUP_WINDOW)
......@@ -39,18 +38,39 @@ void popup_main_window (void)
}
}
void show_status_hangup_icon() {
DEBUG("Show Hangup in Systray");
gtk_widget_show(GTK_WIDGET(hangup_menu_item));
}
void hide_status_hangup_icon() {
DEBUG("Hide Hangup in Systray");
gtk_widget_hide(GTK_WIDGET(hangup_menu_item));
}
void
status_quit ( void * foo UNUSED)
{
sflphone_quit();
}
void
status_hangup ()
{
sflphone_hang_up();
}
void
status_icon_unminimize()
{
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item), TRUE);
}
gboolean main_widget_minimized()
{
return __minimized;
......@@ -90,6 +110,7 @@ GtkWidget* create_menu()
{
GtkWidget * menu;
GtkWidget * menu_items;
GtkWidget * image;
menu = gtk_menu_new ();
......@@ -100,6 +121,14 @@ GtkWidget* create_menu()
G_CALLBACK (show_hide),
NULL);
hangup_menu_item = gtk_image_menu_item_new_with_mnemonic(_("_Hang up"));
image = gtk_image_new_from_file( ICONS_DIR "/hang_up.svg");
gtk_image_menu_item_set_image(GTK_IMAGE_MENU_ITEM(hangup_menu_item), image);
gtk_menu_shell_append(GTK_MENU_SHELL(menu), hangup_menu_item);
g_signal_connect(G_OBJECT (hangup_menu_item), "activate",
G_CALLBACK (status_hangup),
NULL);
menu_items = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
......
......@@ -45,6 +45,19 @@ void show_status_icon();
*/
void status_icon_unminimize();
/**
* Show hangup icon
*/
void show_status_hangup_icon();
/**
* Show hangup icon
*/
void hide_status_hangup_icon();
/**
* Tells if the main window if minimized or not
* @return gboolean TRUE if the main window is minimized
......
......@@ -27,6 +27,7 @@
#include <glib/gprintf.h>
#include <libgnome/gnome-help.h>
#include <uimanager.h>
#include <statusicon.h>
static GtkWidget *toolbar;
static GtkWidget *toolbarWindows;
......@@ -147,7 +148,9 @@ void update_actions()
if (selectedCall)
{
// DEBUG("------------------------- selected call ---------------------------\n");
// update icon in systray
show_status_hangup_icon();
gtk_action_set_sensitive (GTK_ACTION (copyAction), TRUE);
switch(selectedCall->_state)
......@@ -225,7 +228,8 @@ void update_actions()
}
else if (selectedConf){
// DEBUG("------------------------- selected conf ---------------------------\n");
// update icon in systray
show_status_hangup_icon();
switch(selectedConf->_state) {
......@@ -265,6 +269,10 @@ void update_actions()
}
else {
// update icon in systray
hide_status_hangup_icon();
if( account_list_get_size() > 0 && current_account_has_mailbox ())
{
gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (voicemailToolbar), -2);
......
......@@ -40,8 +40,7 @@ void
CallManager::placeCall (const std::string& accountID,
const std::string& callID,
const std::string& to)
{
// Check if a destination number is available
{ // Check if a destination number is available
if (to == "") _debug ("No number entered - Call stopped");
else Manager::instance().outgoingCall (accountID, callID, to);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment