Skip to content
Snippets Groups Projects
Commit a1c6260d authored by Pierre-Luc Beaudoin's avatar Pierre-Luc Beaudoin
Browse files

Say hi to Mr. Status Icon!

parent 89264d66
No related branches found
No related tags found
No related merge requests found
...@@ -14,13 +14,15 @@ sflphone_gtk_SOURCES = \ ...@@ -14,13 +14,15 @@ sflphone_gtk_SOURCES = \
accountlist.c \ accountlist.c \
accountwindow.c \ accountwindow.c \
marshaller.c \ marshaller.c \
sliders.c sliders.c \
statusicon.c
noinst_HEADERS = actions.h dbus.h mainwindow.h calllist.h dialpad.h \ noinst_HEADERS = actions.h dbus.h mainwindow.h calllist.h dialpad.h \
callmanager-glue.h menus.h calltree.h screen.h configwindow.h \ callmanager-glue.h menus.h calltree.h screen.h configwindow.h \
accountlist.h accountwindow.h marshaller.h sliders.h accountlist.h accountwindow.h marshaller.h sliders.h statusicon.h
EXTRA_DIST = marshaller.list EXTRA_DIST = marshaller.list
sflphone_gtk_LDADD = $(DEPS_LIBS) sflphone_gtk_LDADD = $(DEPS_LIBS)
AM_CPPFLAGS = $(DEPS_CFLAGS) \ AM_CPPFLAGS = $(DEPS_CFLAGS) \
-DICONS_DIR=\""$(datadir)/sflphone"\" -DICONS_DIR=\""$(datadir)/sflphone"\" \
-DICON_DIR=\""$(datadir)/pixmaps"\"
...@@ -17,11 +17,12 @@ ...@@ -17,11 +17,12 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <config.h> #include <actions.h>
#include <calllist.h> #include <calllist.h>
#include <config.h>
#include <dbus.h> #include <dbus.h>
#include <mainwindow.h> #include <mainwindow.h>
#include <actions.h> #include <statusicon.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <stdlib.h> #include <stdlib.h>
...@@ -41,6 +42,7 @@ There is NO WARRANTY, to the extent permitted by law.\n\n"); ...@@ -41,6 +42,7 @@ There is NO WARRANTY, to the extent permitted by law.\n\n");
if(sflphone_init()) if(sflphone_init())
{ {
show_status_icon();
create_main_window (); create_main_window ();
/* start the main loop */ /* start the main loop */
......
...@@ -116,7 +116,7 @@ create_main_window () ...@@ -116,7 +116,7 @@ create_main_window ()
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), PACKAGE); gtk_window_set_title (GTK_WINDOW (window), PACKAGE);
gtk_window_set_default_size (GTK_WINDOW (window), 200, 300); gtk_window_set_default_size (GTK_WINDOW (window), 200, 300);
gtk_window_set_default_icon_from_file (ICONS_DIR "/sflphone.png", gtk_window_set_default_icon_from_file (ICON_DIR "/sflphone.png",
NULL); NULL);
/* Connect the destroy event of the window with our on_destroy function /* Connect the destroy event of the window with our on_destroy function
......
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <gtk/gtk.h>
#include <actions.h>
#include <mainwindow.h>
#include <statusicon.h>
GtkStatusIcon* status;
gboolean minimized = FALSE;
void
status_quit ( void * foo)
{
sflphone_quit();
}
void
activate (GtkStatusIcon *status_icon, void * foo)
{
if(minimized)
{
gtk_widget_show(GTK_WIDGET(get_main_window()));
}
else
{
gtk_widget_hide(GTK_WIDGET(get_main_window()));
}
minimized = !minimized;
}
void menu (GtkStatusIcon *status_icon,
guint button,
guint activate_time,
GtkWidget * menu)
{
gtk_menu_popup(GTK_MENU(menu), NULL, NULL, NULL, NULL, button, activate_time);
}
GtkWidget *
create_menu()
{
GtkWidget * menu;
GtkWidget * menu_items;
menu = gtk_menu_new ();
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);
return menu;
}
void
show_status_icon()
{
status = gtk_status_icon_new_from_file(ICON_DIR "/sflphone.png");
g_signal_connect (G_OBJECT (status), "activate",
G_CALLBACK (activate),
NULL);
g_signal_connect (G_OBJECT (status), "popup-menu",
G_CALLBACK (menu),
create_menu());
}
/*
* Copyright (C) 2007 Savoir-Faire Linux inc.
* Author: Pierre-Luc Beaudoin <pierre-luc.beaudoin@savoirfairelinux.com>
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef __STATUSICON_H__
#define __STATUSICON_H__
#include <gtk/gtk.h>
/** @file statusicon.h
* @brief The status icon.
*/
void show_status_icon();
#endif
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment