Skip to content
Snippets Groups Projects
Commit 1ae7471a authored by Emmanuel Milou's avatar Emmanuel Milou
Browse files

Add a GtkProgressBar when quiting the client

The progress should be displayed as long as the daemon is not completly terminate
parent 757dcc85
No related branches found
No related tags found
No related merge requests found
...@@ -6,6 +6,7 @@ sflphone_gtk_SOURCES = \ ...@@ -6,6 +6,7 @@ sflphone_gtk_SOURCES = \
mainwindow.c \ mainwindow.c \
calllist.c \ calllist.c \
dialpad.c \ dialpad.c \
quit.c \
menus.c \ menus.c \
calltree.c \ calltree.c \
screen.c \ screen.c \
...@@ -22,7 +23,7 @@ sflphone_gtk_SOURCES = \ ...@@ -22,7 +23,7 @@ sflphone_gtk_SOURCES = \
noinst_HEADERS = actions.h dbus.h mainwindow.h calllist.h dialpad.h codeclist.h\ 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 \ 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 EXTRA_DIST = marshaller.list
sflphone_gtk_LDADD = $(DEPS_LIBS) sflphone_gtk_LDADD = $(DEPS_LIBS)
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <menus.h> #include <menus.h>
#include <screen.h> #include <screen.h>
#include <statusicon.h> #include <statusicon.h>
#include <quit.h>
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include <string.h> #include <string.h>
...@@ -68,6 +69,7 @@ sflphone_quit () ...@@ -68,6 +69,7 @@ sflphone_quit ()
dbus_clean (); dbus_clean ();
//call_list_clean(); TODO //call_list_clean(); TODO
//account_list_clean() //account_list_clean()
create_progress_bar();
gtk_main_quit (); gtk_main_quit ();
} }
return quit; return quit;
......
/*
* 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 );
}
/*
* 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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment