3
* A Nautilus extension which offers configurable context menu actions.
5
* Copyright (C) 2005 The GNOME Foundation
6
* Copyright (C) 2006, 2007, 2008 Frederic Ruaudel and others (see AUTHORS)
7
* Copyright (C) 2009 Pierre Wieser and others (see AUTHORS)
9
* This Program is free software; you can redistribute it and/or
10
* modify it under the terms of the GNU General Public License as
11
* published by the Free Software Foundation; either version 2 of
12
* the License, or (at your option) any later version.
14
* This Program is distributed in the hope that it will be useful,
15
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* You should have received a copy of the GNU General Public
20
* License along with this Library; see the file COPYING. If not,
21
* write to the Free Software Foundation, Inc., 59 Temple Place,
22
* Suite 330, Boston, MA 02111-1307, USA.
25
* Frederic Ruaudel <grumz@grumz.net>
26
* Rodrigo Moya <rodrigo@gnome-db.org>
27
* Pierre Wieser <pwieser@trychlos.org>
28
* ... and many others (see AUTHORS)
35
#include "nact-main-statusbar.h"
38
guint event_source_id;
42
StatusbarTimeoutDisplayStruct;
44
static GtkStatusbar *get_statusbar( const NactMainWindow *window );
45
static gboolean display_timeout( StatusbarTimeoutDisplayStruct *stds );
46
static void display_timeout_free( StatusbarTimeoutDisplayStruct *stds );
49
nact_main_statusbar_display_status( NactMainWindow *window, const gchar *context, const gchar *status )
53
if( !status || !g_utf8_strlen( status, -1 )){
57
bar = get_statusbar( window );
60
guint context_id = gtk_statusbar_get_context_id( bar, context );
61
gtk_statusbar_push( bar, context_id, status );
67
* automatically pop it after a timeout
68
* the timeout is not suspended when another message is pushed onto the
72
nact_main_statusbar_display_with_timeout( NactMainWindow *window, const gchar *context, const gchar *status )
75
StatusbarTimeoutDisplayStruct *stds;
77
if( !status || !g_utf8_strlen( status, -1 )){
81
bar = get_statusbar( window );
84
guint context_id = gtk_statusbar_get_context_id( bar, context );
85
gtk_statusbar_push( bar, context_id, status );
87
stds = g_new0( StatusbarTimeoutDisplayStruct, 1 );
88
stds->context_id = context_id;
90
stds->event_source_id = g_timeout_add_seconds_full(
93
( GSourceFunc ) display_timeout,
95
( GDestroyNotify ) display_timeout_free );
100
nact_main_statusbar_hide_status( NactMainWindow *window, const gchar *context )
104
bar = get_statusbar( window );
107
guint context_id = gtk_statusbar_get_context_id( bar, context );
108
gtk_statusbar_pop( bar, context_id );
113
* Returns the status bar widget
115
static GtkStatusbar *
116
get_statusbar( const NactMainWindow *window )
118
GtkWidget *statusbar;
120
statusbar = base_window_get_widget( BASE_WINDOW( window ), "StatusBar" );
122
return( GTK_STATUSBAR( statusbar ));
126
display_timeout( StatusbarTimeoutDisplayStruct *stds )
128
gboolean keep_source = FALSE;
130
gtk_statusbar_pop( stds->bar, stds->context_id );
132
return( keep_source );
136
display_timeout_free( StatusbarTimeoutDisplayStruct *stds )
138
g_debug( "nact_main_statusbar_display_timeout_free: stds=%p", ( void * ) stds );