2 * viking -- GPS Data and Topo Analyzer, Explorer, and Manager
4 * Copyright (C) 2003-2005, Evan Battaglia <gtoevan@gmx.net>
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
22 /* gtk status bars: just plain dumb. this file
23 shouldn't have to exist. */
26 #include "vikstatus.h"
28 #define STATUS_COUNT 5
30 struct _VikStatusbar
{
33 GtkWidget
*status
[STATUS_COUNT
-1];
34 gboolean empty
[STATUS_COUNT
];
37 GType
vik_statusbar_get_type (void)
39 static GType vs_type
= 0;
43 static const GTypeInfo vs_info
=
45 sizeof (VikStatusbarClass
),
47 NULL
, /* base_finalize */
48 NULL
, /* class init */
49 NULL
, /* class_finalize */
50 NULL
, /* class_data */
51 sizeof (VikStatusbar
),
53 NULL
/* instance init */
55 vs_type
= g_type_register_static ( GTK_TYPE_STATUSBAR
, "VikStatusbar", &vs_info
, 0 );
61 VikStatusbar
*vik_statusbar_new ()
63 VikStatusbar
*vs
= VIK_STATUSBAR ( g_object_new ( VIK_STATUSBAR_TYPE
, NULL
) );
66 gtk_statusbar_set_has_resize_grip ( GTK_STATUSBAR(vs
), FALSE
);
68 vs
->status
[0] = gtk_statusbar_new();
69 gtk_statusbar_set_has_resize_grip ( GTK_STATUSBAR(vs
->status
[0]), FALSE
);
70 gtk_box_pack_start ( GTK_BOX(vs
), vs
->status
[0], FALSE
, FALSE
, 1);
71 gtk_widget_set_size_request ( vs
->status
[0], 100, -1 );
73 vs
->status
[1] = gtk_statusbar_new();
74 gtk_statusbar_set_has_resize_grip ( GTK_STATUSBAR(vs
->status
[1]), FALSE
);
75 gtk_box_pack_start ( GTK_BOX(vs
), vs
->status
[1], FALSE
, FALSE
, 1);
76 gtk_widget_set_size_request ( vs
->status
[1], 100, -1 );
78 vs
->status
[2] = gtk_statusbar_new();
79 gtk_statusbar_set_has_resize_grip ( GTK_STATUSBAR(vs
->status
[2]), FALSE
);
80 gtk_box_pack_end ( GTK_BOX(vs
), vs
->status
[2], TRUE
, TRUE
, 1);
82 vs
->status
[3] = gtk_statusbar_new();
83 gtk_statusbar_set_has_resize_grip ( GTK_STATUSBAR(vs
->status
[3]), FALSE
);
84 gtk_box_pack_end ( GTK_BOX(vs
), vs
->status
[3], TRUE
, TRUE
, 1);
86 for ( i
= 0; i
< STATUS_COUNT
; i
++ )
92 void vik_statusbar_set_message ( VikStatusbar
*vs
, gint field
, const gchar
*message
)
94 if ( field
>= 0 && field
< STATUS_COUNT
)
98 gsb
= GTK_STATUSBAR(vs
);
100 gsb
= GTK_STATUSBAR(vs
->status
[field
-1]);
102 if ( !vs
->empty
[field
] )
103 gtk_statusbar_pop ( gsb
, 0 );
105 vs
->empty
[field
] = FALSE
;
107 gtk_statusbar_push ( gsb
, 0, message
);