Commit bcdb30a3 authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

[#1640] Do not put a system icon tray as default

parent d39124b5
#Tue Feb 23 14:32:32 EST 2010
#Fri Feb 26 15:32:40 EST 2010
eclipse.preferences.version=1
org.eclipse.cdt.core.formatter.alignment_for_arguments_in_method_invocation=16
org.eclipse.cdt.core.formatter.alignment_for_base_clause_in_type_declaration=80
......@@ -124,8 +124,8 @@ org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_catch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_exception_specification=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_for=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_if=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_declaration=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_method_invocation=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_parenthesized_expression=do not insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_switch=insert
org.eclipse.cdt.core.formatter.insert_space_before_opening_paren_in_while=insert
......
#Thu Mar 26 14:05:05 EDT 2009
#Fri Feb 26 15:30:12 EST 2010
eclipse.preferences.version=1
formatter_profile=org.eclipse.cdt.ui.default.gnu_profile
formatter_profile=_GNU - SFLphone
formatter_settings_version=1
......@@ -461,6 +461,15 @@
<arg type="i" name="posY" direction="in"/>
</method>
<method name="enableStatusIcon">
<arg type="s" name="value" direction="in"/>
</method>
<method name="isStatusIconEnabled">
<arg type="s" name="value" direction="out"/>
</method>
<!-- Addressbook configuration -->
<method name="getAddressbookSettings">
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringInt"/>
......
......@@ -2580,3 +2580,32 @@ void dbus_set_window_position_y (const guint posy) {
}
}
void dbus_enable_status_icon (const gchar *value) {
GError *error = NULL;
org_sflphone_SFLphone_ConfigurationManager_enable_status_icon (configurationManagerProxy, value, &error);
if (error != NULL) {
ERROR ("Failed to call enable_status_icon on ConfigurationManager: %s",
error->message);
g_error_free (error);
}
}
gchar* dbus_is_status_icon_enabled (void) {
GError *error = NULL;
gchar* value = TRUE;
org_sflphone_SFLphone_ConfigurationManager_is_status_icon_enabled (configurationManagerProxy, &value, &error);
if (error != NULL) {
ERROR ("Failed to call is_status_icon_enabled on ConfigurationManager: %s",
error->message);
g_error_free (error);
}
return value;
}
......@@ -606,4 +606,8 @@ guint dbus_get_window_position_y (void);
void dbus_set_window_position_x (const guint posx);
void dbus_set_window_position_y (const guint posy);
void dbus_enable_status_icon (const gchar*);
gchar* dbus_is_status_icon_enabled (void);
#endif
......@@ -33,9 +33,9 @@
* Stop logging engine
*/
static void
shutdown_logging()
shutdown_logging ()
{
if (log4c_fini())
if (log4c_fini ())
{
ERROR("log4c_fini() failed");
}
......@@ -45,87 +45,88 @@ shutdown_logging()
* Start loggin engine
*/
static void
startup_logging()
startup_logging ()
{
log4c_init();
if (log4c_load(DATA_DIR "/log4crc") == -1)
g_warning("Cannot load log4j configuration file : %s",DATA_DIR "/log4crc");
log4c_init ();
if (log4c_load (DATA_DIR "/log4crc") == -1)
g_warning ("Cannot load log4j configuration file : %s", DATA_DIR "/log4crc");
log4c_sfl_gtk_category = log4c_category_get("org.sflphone.gtk");
log4c_sfl_gtk_category = log4c_category_get ("org.sflphone.gtk");
}
int
main(int argc, char *argv[])
main (int argc, char *argv[])
{
// Handle logging
int i;
gboolean statusicon = FALSE;
// Startup logging
startup_logging();
startup_logging ();
// Check arguments if debug mode is activated
for (i = 0; i < argc; i++)
if (g_strcmp0(argv[i], "--debug") == 0)
log4c_category_set_priority(log4c_sfl_gtk_category, LOG4C_PRIORITY_DEBUG);
if (g_strcmp0 (argv[i], "--debug") == 0)
log4c_category_set_priority (log4c_sfl_gtk_category, LOG4C_PRIORITY_DEBUG);
// Start GTK application
gtk_init(&argc, &argv);
gtk_init (&argc, &argv);
g_print("%s %s\n", PACKAGE, VERSION);
g_print("Copyright (c) 2005 2006 2007 2008 2009 Savoir-faire Linux Inc.\n");
g_print(
g_print ("%s %s\n", PACKAGE, VERSION);
g_print ("Copyright (c) 2005 2006 2007 2008 2009 Savoir-faire Linux Inc.\n");
g_print (
"This is free software. You may redistribute copies of it under the terms of\n\
the GNU General Public License Version 3 <http://www.gnu.org/licenses/gpl.html>.\n\
There is NO WARRANTY, to the extent permitted by law.\n\n");
DEBUG("Logging Started");
srand(time(NULL));
srand (time (NULL));
// Internationalization
bindtextdomain("sflphone-client-gnome", LOCALEDIR);
textdomain("sflphone-client-gnome");
bindtextdomain ("sflphone-client-gnome", LOCALEDIR);
textdomain ("sflphone-client-gnome");
// Initialises the GNOME libraries
gnome_program_init ( "sflphone", VERSION,
LIBGNOMEUI_MODULE, argc, argv,
GNOME_PROGRAM_STANDARD_PROPERTIES,
NULL);
gnome_program_init ("sflphone", VERSION, LIBGNOMEUI_MODULE, argc, argv,
GNOME_PROGRAM_STANDARD_PROPERTIES,
NULL) ;
if (sflphone_init())
if (sflphone_init ())
{
#if GTK_CHECK_VERSION(2,10,0)
show_status_icon();
#endif
create_main_window();
#if GTK_CHECK_VERSION(2,10,0)
if (dbus_is_start_hidden())
if (g_strcasecmp (dbus_is_status_icon_enabled (), "true") == 0)
statusicon = TRUE;
if (statusicon) show_status_icon ();
create_main_window ();
if (statusicon && dbus_is_start_hidden ())
{
gtk_widget_hide(GTK_WIDGET( get_main_window() ));
set_minimized(TRUE);
gtk_widget_hide (GTK_WIDGET( get_main_window() ));
set_minimized (TRUE);
}
#endif
status_bar_display_account();
// Load the history
sflphone_fill_history ();
status_bar_display_account ();
// Load the history
sflphone_fill_history ();
// Get the active calls and conferences at startup
sflphone_fill_call_list ();
sflphone_fill_conference_list ();
// Get the active calls and conferences at startup
sflphone_fill_call_list ();
sflphone_fill_conference_list();
// Update the GUI
update_actions ();
// Update the GUI
update_actions ();
/* start the main loop */
gtk_main();
/* start the main loop */
gtk_main ();
}
// Cleanly stop logging
shutdown_logging();
shutdown_logging ();
return 0;
}
......
This diff is collapsed.
......@@ -29,119 +29,129 @@ GtkStatusIcon *status;
GtkWidget *show_menu_item, *hangup_menu_item;
gboolean __minimized = MINIMIZED;
void popup_main_window (void)
void
popup_main_window(void)
{
if (__POPUP_WINDOW)
{
gtk_widget_show (get_main_window ());
gtk_window_move (GTK_WINDOW (get_main_window ()), dbus_get_window_position_x (), dbus_get_window_position_y ());
set_minimized (FALSE);
}
if (__POPUP_WINDOW)
{
gtk_widget_show(get_main_window());
gtk_window_move(GTK_WINDOW (get_main_window ()),
dbus_get_window_position_x(), dbus_get_window_position_y());
set_minimized(FALSE);
}
}
void show_status_hangup_icon() {
void
show_status_hangup_icon()
{
if (status) {
DEBUG("Show Hangup in Systray");
gtk_widget_show(GTK_WIDGET(hangup_menu_item));
}
}
void hide_status_hangup_icon() {
DEBUG("Hide Hangup in Systray");
void
hide_status_hangup_icon()
{
if (status) {
DEBUG("Hide Hangup in Systray");
gtk_widget_hide(GTK_WIDGET(hangup_menu_item));
}
}
void
status_quit ( void * foo UNUSED)
void
status_quit(void * foo UNUSED)
{
sflphone_quit();
}
void
status_hangup ()
status_hangup()
{
sflphone_hang_up();
}
}
void
void
status_icon_unminimize()
{
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item), TRUE);
}
gboolean main_widget_minimized()
gboolean
main_widget_minimized()
{
return __minimized;
}
void show_hide (void)
void
show_hide(void)
{
if(gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(show_menu_item)))
{
gtk_widget_show(GTK_WIDGET(get_main_window()));
gtk_window_move (GTK_WINDOW (get_main_window ()), dbus_get_window_position_x (), dbus_get_window_position_y ());
set_minimized( !MINIMIZED );
}
else
{
gtk_widget_hide(GTK_WIDGET(get_main_window()));
set_minimized( MINIMIZED );
}
if (gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(show_menu_item)))
{
gtk_widget_show(GTK_WIDGET(get_main_window()));
gtk_window_move(GTK_WINDOW (get_main_window ()),
dbus_get_window_position_x(), dbus_get_window_position_y());
set_minimized(!MINIMIZED);
}
else
{
gtk_widget_hide(GTK_WIDGET(get_main_window()));
set_minimized(MINIMIZED);
}
}
void status_click (GtkStatusIcon *status_icon UNUSED, void * foo UNUSED)
void
status_click(GtkStatusIcon *status_icon UNUSED, void * foo UNUSED)
{
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item),
!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(show_menu_item)));
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item),
!gtk_check_menu_item_get_active(GTK_CHECK_MENU_ITEM(show_menu_item)));
}
void menu (GtkStatusIcon *status_icon,
guint button,
guint activate_time,
GtkWidget * menu)
void
menu(GtkStatusIcon *status_icon, guint button, guint activate_time,
GtkWidget * menu)
{
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, gtk_status_icon_position_menu,
status_icon, button, activate_time);
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, gtk_status_icon_position_menu,
status_icon, button, activate_time);
}
GtkWidget* create_menu()
GtkWidget*
create_menu()
{
GtkWidget * menu;
GtkWidget * menu_items;
GtkWidget * image;
menu = gtk_menu_new ();
show_menu_item = gtk_check_menu_item_new_with_mnemonic (_("_Show main window"));
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);
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);
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 "/icon_hangup.svg");
image = gtk_image_new_from_file(ICONS_DIR "/icon_hangup.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);
G_CALLBACK (status_hangup),
NULL);
menu_items = gtk_separator_menu_item_new ();
gtk_menu_shell_append (GTK_MENU_SHELL (menu), menu_items);
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());
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_all (menu);
G_CALLBACK (status_quit),
NULL);
gtk_menu_shell_append(GTK_MENU_SHELL (menu), menu_items);
gtk_widget_show_all(menu);
return menu;
}
......@@ -150,52 +160,67 @@ show_status_icon()
{
status = gtk_status_icon_new_from_file(LOGO);
g_signal_connect (G_OBJECT (status), "activate",
G_CALLBACK (status_click),
NULL);
G_CALLBACK (status_click),
NULL);
g_signal_connect (G_OBJECT (status), "popup-menu",
G_CALLBACK (menu),
create_menu());
G_CALLBACK (menu),
create_menu());
statusicon_set_tooltip ();
statusicon_set_tooltip();
}
void statusicon_set_tooltip () {
int count;
gchar *tip;
void hide_status_icon (void) {
// Add a tooltip to the system tray icon
count = account_list_get_registered_accounts ();
tip = g_markup_printf_escaped ("%s - %s" ,
_("SFLphone"),
g_markup_printf_escaped(n_("%i active account", "%i active accounts", count),count));
gtk_status_icon_set_tooltip (status, tip);
g_free(tip);
g_object_unref (status);
status = NULL;
}
void status_tray_icon_blink (gboolean active)
void
statusicon_set_tooltip()
{
// Set a different icon to notify of an event
active ? gtk_status_icon_set_from_file (status, LOGO_NOTIF) : gtk_status_icon_set_from_file (status, LOGO);
int count;
gchar *tip;
// Add a tooltip to the system tray icon
count = account_list_get_registered_accounts();
tip = g_markup_printf_escaped("%s - %s", _("SFLphone"),
g_markup_printf_escaped(
n_("%i active account", "%i active accounts", count), count));
gtk_status_icon_set_tooltip(status, tip);
g_free(tip);
}
void status_tray_icon_online (gboolean online)
void
status_tray_icon_blink(gboolean active)
{
if (status) {
// Set a different icon to notify of an event
active ? gtk_status_icon_set_from_file(status, LOGO_NOTIF)
: gtk_status_icon_set_from_file(status, LOGO);
}
}
void
status_tray_icon_online(gboolean online)
{
// Set a different icon to notify of an event
online ? gtk_status_icon_set_from_file (status, LOGO) : gtk_status_icon_set_from_file (status, LOGO_OFFLINE);
if (status) {
// Set a different icon to notify of an event
online ? gtk_status_icon_set_from_file(status, LOGO)
: gtk_status_icon_set_from_file(status, LOGO_OFFLINE);
}
}
GtkStatusIcon*
get_status_icon( void )
GtkStatusIcon*
get_status_icon(void)
{
return status;
}
void
set_minimized( gboolean state)
set_minimized(gboolean state)
{
__minimized = state ;
__minimized = state;
gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(show_menu_item), !state);
}
......
......@@ -36,9 +36,15 @@
void popup_main_window (void);
/**
* Create the status icon
* Create the system tray icon
*/
void show_status_icon();
void show_status_icon ();
/**
* Hide the system tray icon
*/
void hide_status_icon ();
/**
* Set the menu active
......
This diff is collapsed.
......@@ -461,6 +461,15 @@
<arg type="i" name="posY" direction="in"/>
</method>
<method name="enableStatusIcon">
<arg type="s" name="value" direction="in"/>
</method>
<method name="isStatusIconEnabled">
<arg type="s" name="value" direction="out"/>
</method>
<!-- Addressbook configuration -->
<method name="getAddressbookSettings">
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringInt"/>
......
......@@ -868,3 +868,13 @@ void ConfigurationManager::setWindowPositionY (const int32_t& posY) {
Manager::instance ().setConfig (PREFERENCES, WINDOW_POSITION_Y, posY);
}
void ConfigurationManager::enableStatusIcon (const std::string& value) {
Manager::instance ().setConfig (PREFERENCES, SHOW_STATUSICON, value);
}
std::string ConfigurationManager::isStatusIconEnabled (void) {
return Manager::instance ().getConfigString (PREFERENCES, SHOW_STATUSICON);
}
......@@ -123,6 +123,9 @@ public:
void setWindowPositionX (const int32_t& posX);
void setWindowPositionY (const int32_t& posY);
void enableStatusIcon (const std::string&);
std::string isStatusIconEnabled (void);
std::map<std::string, int32_t> getAddressbookSettings (void);
void setAddressbookSettings (const std::map<std::string, int32_t>& settings);
std::vector< std::string > getAddressbookList ( void );
......
This diff is collapsed.
......@@ -64,6 +64,8 @@
#define WINDOW_HEIGHT "Window.height"
#define WINDOW_POSITION_X "Window.positionX"
#define WINDOW_POSITION_Y "Window.positionY"
#define SHOW_STATUSICON "Statusicon.show"
#define IP2IP_PROFILE "IP2IP"
#define SIGNALISATION "VoIPLink" /** Section Signalisation */
......
Supports Markdown
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