diff --git a/sflphone-gtk/src/Makefile.am b/sflphone-gtk/src/Makefile.am index eeaa1392ff4c04cd4b397c68a6187627f065f66c..e4198bb4f0c526a830cc3ddc6e62674880f25cf8 100644 --- a/sflphone-gtk/src/Makefile.am +++ b/sflphone-gtk/src/Makefile.am @@ -6,6 +6,7 @@ sflphone_gtk_SOURCES = \ mainwindow.c \ calllist.c \ dialpad.c \ + quit.c \ menus.c \ calltree.c \ screen.c \ @@ -22,7 +23,7 @@ sflphone_gtk_SOURCES = \ noinst_HEADERS = actions.h dbus.h mainwindow.h calllist.h dialpad.h codeclist.h\ callmanager-glue.h configurationmanager-glue.h instance-glue.h menus.h calltree.h screen.h configwindow.h \ - accountlist.h accountwindow.h marshaller.h sliders.h statusicon.h + accountlist.h accountwindow.h marshaller.h sliders.h statusicon.h quit.h EXTRA_DIST = marshaller.list sflphone_gtk_LDADD = $(DEPS_LIBS) diff --git a/sflphone-gtk/src/actions.c b/sflphone-gtk/src/actions.c index 0ec2ae1e8a0d224c34fca8cd88f92a5fcd631357..0f2182f0c56387d3762aa2ca37334653ed69d6d8 100644 --- a/sflphone-gtk/src/actions.c +++ b/sflphone-gtk/src/actions.c @@ -25,6 +25,7 @@ #include <menus.h> #include <screen.h> #include <statusicon.h> +#include <quit.h> #include <gtk/gtk.h> #include <string.h> @@ -68,6 +69,7 @@ sflphone_quit () dbus_clean (); //call_list_clean(); TODO //account_list_clean() + create_progress_bar(); gtk_main_quit (); } return quit; diff --git a/sflphone-gtk/src/quit.c b/sflphone-gtk/src/quit.c new file mode 100644 index 0000000000000000000000000000000000000000..a375a82aba5a572a36c4001e65e9f68618bebcff --- /dev/null +++ b/sflphone-gtk/src/quit.c @@ -0,0 +1,76 @@ +/* + * Copyright (C) 2008 Savoir-Faire Linux inc. + * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.net> + * + * 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 3 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 "quit.h" + +void +update_progress_bar( GtkWidget* bar ) +{ + gdouble fraction; + gint i; + gint total = 2000; + //gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR (bar) , 0.0); + gtk_grab_add( bar ); + + for( i = 0 ; i < total ; i++) + { + fraction = (gdouble)i / (gdouble)total ; + usleep(5000); + if( i > 1000 ) + gtk_progress_bar_set_text( (GtkProgressBar *)bar , "Saving configuration...."); + //gtk_progress_bar_set_fraction( GTK_PROGRESS_BAR (bar) , fraction); + gtk_progress_bar_set_pulse_step( (GtkProgressBar*) bar , 0.01 ); + gtk_progress_bar_pulse( (GtkProgressBar*)bar); + gtk_main_iteration(); + } + gtk_grab_remove( bar ); +} + +GtkWidget* +create_progress_bar( void ) +{ + g_print("Progress Bar \n"); + GtkWidget *top; + GtkWidget *progressBar; + GtkWidget *vbox; + + top = gtk_window_new( GTK_WINDOW_TOPLEVEL ); + gtk_window_set_default_size( GTK_WINDOW( top ), 240, 20); + gtk_container_set_border_width(GTK_CONTAINER( top ), 0); + + vbox = gtk_vbox_new(TRUE, 0); + gtk_container_add(GTK_CONTAINER(top), vbox); + + progressBar = gtk_progress_bar_new(); + gtk_progress_bar_set_text( (GtkProgressBar *)progressBar , "Quiting...."); + gtk_box_pack_start( GTK_BOX( vbox ) , progressBar , TRUE , TRUE , 0); + gtk_widget_show_all( top ); + + update_progress_bar( progressBar ); + +} + +void +destroy_progress_bar() +{ + //gtk_widget_destroy( progressBar ); +} + + + diff --git a/sflphone-gtk/src/quit.h b/sflphone-gtk/src/quit.h new file mode 100644 index 0000000000000000000000000000000000000000..1baa4532051101598ff02613a63fa81c8785fd39 --- /dev/null +++ b/sflphone-gtk/src/quit.h @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2008 Savoir-Faire Linux inc. + * Author: Emmanuel Milou <emmanuel.milou@savoirfairelinux.net> + * + * 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 3 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 __QUIT_H__ +#define __QUIT_H__ + +#include <gtk/gtk.h> +/** @file quit.h + * @brief Display a progress bar when quiting. + */ +GtkWidget * create_progress_bar(); + +//GtkWidget* progressBar; + +#endif +