diff options
author | Havoc Pennington <hp@redhat.com> | 2000-07-25 22:58:17 +0000 |
---|---|---|
committer | Havoc Pennington <hp@src.gnome.org> | 2000-07-25 22:58:17 +0000 |
commit | f56297c5346cddb72b383161bbde9168824acb94 (patch) | |
tree | acf176b40ef8c399ed120d3c01687f2a3a3252f9 /gtk/gtkprogress.c | |
parent | d1a4a1ea28f0a3b87332874c68eccbe2d6272ea9 (diff) | |
download | gdk-pixbuf-f56297c5346cddb72b383161bbde9168824acb94.tar.gz |
Implement new sane, 5-function API for using GtkProgressBar. See
2000-07-25 Havoc Pennington <hp@redhat.com>
* gtk/gtkprogressbar.h: Implement new sane, 5-function API for
using GtkProgressBar. See Changes-2.0.txt for details.
* gtk/gtkprogressbar.c: Add object arguments "fraction" and
"pulse_step" which are the equivalent of
gtk_progress_bar_set_pulse_step and gtk_progress_bar_set_fraction.
Implement new API.
* gtk/gtkprogress.h (struct _GtkProgress): Add a field
(use_text_format) to mark whether text set on the progress bar is
a format string. Deprecate entire GtkProgress interface.
* gtk/gtkprogress.c (gtk_progress_init): init use_text_format to TRUE
(gtk_progress_build_string): make this a no-op if use_text_format
is FALSE
* docs/Changes-2.0.txt: Describe progress bar changes.
Diffstat (limited to 'gtk/gtkprogress.c')
-rw-r--r-- | gtk/gtkprogress.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/gtk/gtkprogress.c b/gtk/gtkprogress.c index 44ed4f4e8..4d31ce894 100644 --- a/gtk/gtkprogress.c +++ b/gtk/gtkprogress.c @@ -198,6 +198,7 @@ gtk_progress_init (GtkProgress *progress) progress->y_align = 0.5; progress->show_text = FALSE; progress->activity_mode = FALSE; + progress->use_text_format = TRUE; } static void @@ -357,6 +358,13 @@ gtk_progress_build_string (GtkProgress *progress, gchar fmt[10]; src = progress->format; + + /* This is the new supported version of this function */ + if (!progress->use_text_format) + return g_strdup (src); + + /* And here's all the deprecated goo. */ + dest = buf; while (src && *src) @@ -624,6 +632,11 @@ gtk_progress_set_format_string (GtkProgress *progress, g_return_if_fail (progress != NULL); g_return_if_fail (GTK_IS_PROGRESS (progress)); + /* Turn on format, in case someone called + * gtk_progress_bar_set_text() and turned it off. + */ + progress->use_text_format = TRUE; + if (format) { if (progress->format) |