summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Jeske <stefan@gtk.org>1998-07-21 04:49:01 +0000
committerStefan Jeske <stefan@src.gnome.org>1998-07-21 04:49:01 +0000
commitdbfe3d3967f3efc89095337b160ebbb2f6805f51 (patch)
treee4077d3ad6f4bbb04f4c7b30557b748babfebab8
parent7c30f2a15fbfa5f50d4859d635ab15ad1d6e1d37 (diff)
downloadgdk-pixbuf-dbfe3d3967f3efc89095337b160ebbb2f6805f51.tar.gz
Fixed wrong size of activity indicator. It is settable now as a fraction
Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org> * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of activity indicator. It is settable now as a fraction of the total width/height using gtk_progress_bar_set_activity_blocks. Renamed gtk_progress_bar_set_number_of_blocks to gtk_progress_bar_set_discrete_blocks.
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLog.pre-2-08
-rw-r--r--ChangeLog.pre-2-108
-rw-r--r--ChangeLog.pre-2-28
-rw-r--r--ChangeLog.pre-2-48
-rw-r--r--ChangeLog.pre-2-68
-rw-r--r--ChangeLog.pre-2-88
-rw-r--r--gtk/gtkprogressbar.c45
-rw-r--r--gtk/gtkprogressbar.h5
-rw-r--r--gtk/testgtk.c29
-rw-r--r--tests/testgtk.c29
11 files changed, 145 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 5613f285c..9e1818f35 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
+
+ * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
+ activity indicator. It is settable now as a fraction of the
+ total width/height using gtk_progress_bar_set_activity_blocks.
+ Renamed gtk_progress_bar_set_number_of_blocks to
+ gtk_progress_bar_set_discrete_blocks.
+
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
diff --git a/ChangeLog.pre-2-0 b/ChangeLog.pre-2-0
index 5613f285c..9e1818f35 100644
--- a/ChangeLog.pre-2-0
+++ b/ChangeLog.pre-2-0
@@ -1,3 +1,11 @@
+Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
+
+ * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
+ activity indicator. It is settable now as a fraction of the
+ total width/height using gtk_progress_bar_set_activity_blocks.
+ Renamed gtk_progress_bar_set_number_of_blocks to
+ gtk_progress_bar_set_discrete_blocks.
+
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10
index 5613f285c..9e1818f35 100644
--- a/ChangeLog.pre-2-10
+++ b/ChangeLog.pre-2-10
@@ -1,3 +1,11 @@
+Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
+
+ * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
+ activity indicator. It is settable now as a fraction of the
+ total width/height using gtk_progress_bar_set_activity_blocks.
+ Renamed gtk_progress_bar_set_number_of_blocks to
+ gtk_progress_bar_set_discrete_blocks.
+
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
diff --git a/ChangeLog.pre-2-2 b/ChangeLog.pre-2-2
index 5613f285c..9e1818f35 100644
--- a/ChangeLog.pre-2-2
+++ b/ChangeLog.pre-2-2
@@ -1,3 +1,11 @@
+Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
+
+ * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
+ activity indicator. It is settable now as a fraction of the
+ total width/height using gtk_progress_bar_set_activity_blocks.
+ Renamed gtk_progress_bar_set_number_of_blocks to
+ gtk_progress_bar_set_discrete_blocks.
+
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
diff --git a/ChangeLog.pre-2-4 b/ChangeLog.pre-2-4
index 5613f285c..9e1818f35 100644
--- a/ChangeLog.pre-2-4
+++ b/ChangeLog.pre-2-4
@@ -1,3 +1,11 @@
+Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
+
+ * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
+ activity indicator. It is settable now as a fraction of the
+ total width/height using gtk_progress_bar_set_activity_blocks.
+ Renamed gtk_progress_bar_set_number_of_blocks to
+ gtk_progress_bar_set_discrete_blocks.
+
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6
index 5613f285c..9e1818f35 100644
--- a/ChangeLog.pre-2-6
+++ b/ChangeLog.pre-2-6
@@ -1,3 +1,11 @@
+Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
+
+ * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
+ activity indicator. It is settable now as a fraction of the
+ total width/height using gtk_progress_bar_set_activity_blocks.
+ Renamed gtk_progress_bar_set_number_of_blocks to
+ gtk_progress_bar_set_discrete_blocks.
+
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8
index 5613f285c..9e1818f35 100644
--- a/ChangeLog.pre-2-8
+++ b/ChangeLog.pre-2-8
@@ -1,3 +1,11 @@
+Tue Jul 21 06:32:43 1998 Stefan Jeske <stefan@gtk.org>
+
+ * gtk/gtkprogressbar.{c,h} gtk/testgtk.c: Fixed wrong size of
+ activity indicator. It is settable now as a fraction of the
+ total width/height using gtk_progress_bar_set_activity_blocks.
+ Renamed gtk_progress_bar_set_number_of_blocks to
+ gtk_progress_bar_set_discrete_blocks.
+
Mon Jul 20 21:28:18 1998 Lars Hamann <lars@gtk.org>
* gtk/gtkctree.c (gtk_ctree_post_recursive_to_depth)
diff --git a/gtk/gtkprogressbar.c b/gtk/gtkprogressbar.c
index f00e51e58..86ddec169 100644
--- a/gtk/gtkprogressbar.c
+++ b/gtk/gtkprogressbar.c
@@ -93,6 +93,7 @@ gtk_progress_bar_init (GtkProgressBar *pbar)
pbar->activity_pos = 0;
pbar->activity_dir = 1;
pbar->activity_step = 3;
+ pbar->activity_blocks = 5;
}
@@ -157,8 +158,7 @@ gtk_progress_bar_real_update (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
{
- size = widget->allocation.height -
- widget->style->klass->ythickness * 2;
+ size = MAX (2, widget->allocation.width / pbar->activity_blocks);
if (pbar->activity_dir == 0)
{
@@ -184,8 +184,7 @@ gtk_progress_bar_real_update (GtkProgress *progress)
}
else
{
- size = widget->allocation.width -
- widget->style->klass->xthickness * 2;
+ size = MAX (2, widget->allocation.height / pbar->activity_blocks);
if (pbar->activity_dir == 0)
{
@@ -304,6 +303,7 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
{
GtkProgressBar *pbar;
GtkWidget *widget;
+ gint size;
pbar = GTK_PROGRESS_BAR (progress);
widget = GTK_WIDGET (progress);
@@ -313,6 +313,8 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
{
+ size = MAX (2, widget->allocation.width / pbar->activity_blocks);
+
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT)
{
pbar->activity_pos = widget->style->klass->xthickness;
@@ -328,6 +330,8 @@ gtk_progress_bar_act_mode_enter (GtkProgress *progress)
}
else
{
+ size = MAX (2, widget->allocation.height / pbar->activity_blocks);
+
if (pbar->orientation == GTK_PROGRESS_TOP_TO_BOTTOM)
{
pbar->activity_pos = widget->style->klass->ythickness;
@@ -355,6 +359,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
gint x;
gint y;
gfloat percentage;
+ gint size;
g_return_if_fail (progress != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (progress));
@@ -394,13 +399,14 @@ gtk_progress_bar_paint (GtkProgress *progress)
if (pbar->orientation == GTK_PROGRESS_LEFT_TO_RIGHT ||
pbar->orientation == GTK_PROGRESS_RIGHT_TO_LEFT)
{
+ size = MAX (2, widget->allocation.width / pbar->activity_blocks);
+
gdk_draw_rectangle (progress->offscreen_pixmap,
widget->style->bg_gc[GTK_STATE_PRELIGHT],
TRUE,
pbar->activity_pos,
widget->style->klass->ythickness,
- widget->allocation.height -
- widget->style->klass->ythickness * 2,
+ size,
widget->allocation.height -
widget->style->klass->ythickness * 2);
@@ -409,14 +415,15 @@ gtk_progress_bar_paint (GtkProgress *progress)
GTK_STATE_PRELIGHT, GTK_SHADOW_OUT,
pbar->activity_pos,
widget->style->klass->ythickness,
- widget->allocation.height -
- widget->style->klass->ythickness * 2,
+ size,
widget->allocation.height -
widget->style->klass->ythickness * 2);
return;
}
else
{
+ size = MAX (2, widget->allocation.height / pbar->activity_blocks);
+
gdk_draw_rectangle (progress->offscreen_pixmap,
widget->style->bg_gc[GTK_STATE_PRELIGHT],
TRUE,
@@ -424,8 +431,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
pbar->activity_pos,
widget->allocation.width -
widget->style->klass->xthickness * 2,
- widget->allocation.width -
- widget->style->klass->xthickness * 2);
+ size);
gtk_draw_shadow (widget->style,
progress->offscreen_pixmap,
@@ -434,8 +440,7 @@ gtk_progress_bar_paint (GtkProgress *progress)
pbar->activity_pos,
widget->allocation.width -
widget->style->klass->xthickness * 2,
- widget->allocation.width -
- widget->style->klass->xthickness * 2);
+ size);
return;
}
}
@@ -764,8 +769,8 @@ gtk_progress_bar_set_bar_style (GtkProgressBar *pbar,
}
void
-gtk_progress_bar_set_number_of_blocks (GtkProgressBar *pbar,
- guint blocks)
+gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar,
+ guint blocks)
{
g_return_if_fail (pbar != NULL);
g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
@@ -790,3 +795,15 @@ gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
if (pbar->activity_step != step)
pbar->activity_step = step;
}
+
+void
+gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
+ guint blocks)
+{
+ g_return_if_fail (pbar != NULL);
+ g_return_if_fail (GTK_IS_PROGRESS_BAR (pbar));
+ g_return_if_fail (blocks > 1);
+
+ if (pbar->activity_blocks != blocks)
+ pbar->activity_blocks = blocks;
+}
diff --git a/gtk/gtkprogressbar.h b/gtk/gtkprogressbar.h
index 6099ba364..a8f235fa0 100644
--- a/gtk/gtkprogressbar.h
+++ b/gtk/gtkprogressbar.h
@@ -64,6 +64,7 @@ struct _GtkProgressBar
gint activity_pos;
guint activity_step;
+ guint activity_blocks;
guint activity_dir : 1;
};
@@ -80,10 +81,12 @@ void gtk_progress_bar_construct (GtkProgressBar *pbar,
GtkAdjustment *adjustment);
void gtk_progress_bar_set_bar_style (GtkProgressBar *pbar,
GtkProgressBarStyle style);
-void gtk_progress_bar_set_number_of_blocks (GtkProgressBar *pbar,
+void gtk_progress_bar_set_discrete_blocks (GtkProgressBar *pbar,
guint blocks);
void gtk_progress_bar_set_activity_step (GtkProgressBar *pbar,
guint step);
+void gtk_progress_bar_set_activity_blocks (GtkProgressBar *pbar,
+ guint blocks);
void gtk_progress_bar_set_orientation (GtkProgressBar *pbar,
GtkProgressBarOrientation orientation);
void gtk_progress_bar_update (GtkProgressBar *pbar,
diff --git a/gtk/testgtk.c b/gtk/testgtk.c
index 2fd6ef858..2efa514ed 100644
--- a/gtk/testgtk.c
+++ b/gtk/testgtk.c
@@ -5903,6 +5903,7 @@ typedef struct _ProgressData {
GtkWidget *x_align_spin;
GtkWidget *y_align_spin;
GtkWidget *step_spin;
+ GtkWidget *act_blocks_spin;
GtkWidget *label;
GtkWidget *omenu1;
GtkWidget *omenu3;
@@ -6005,7 +6006,7 @@ static void
adjust_blocks (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_set_percentage (GTK_PROGRESS (pdata->pbar), 0);
- gtk_progress_bar_set_number_of_blocks (GTK_PROGRESS_BAR (pdata->pbar),
+ gtk_progress_bar_set_discrete_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pdata->block_spin)));
}
@@ -6017,6 +6018,14 @@ adjust_step (GtkAdjustment *adj, ProgressData *pdata)
}
static void
+adjust_act_blocks (GtkAdjustment *adj, ProgressData *pdata)
+{
+ gtk_progress_bar_set_activity_blocks (GTK_PROGRESS_BAR (pdata->pbar),
+ gtk_spin_button_get_value_as_int
+ (GTK_SPIN_BUTTON (pdata->act_blocks_spin)));
+}
+
+static void
adjust_align (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_set_text_alignment (GTK_PROGRESS (pdata->pbar),
@@ -6033,6 +6042,8 @@ toggle_activity_mode (GtkWidget *widget, ProgressData *pdata)
GTK_TOGGLE_BUTTON (widget)->active);
gtk_widget_set_sensitive (pdata->step_spin,
GTK_TOGGLE_BUTTON (widget)->active);
+ gtk_widget_set_sensitive (pdata->act_blocks_spin,
+ GTK_TOGGLE_BUTTON (widget)->active);
}
static void
@@ -6119,7 +6130,7 @@ create_progress_bar (void)
vbox2 = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
- tab = gtk_table_new (6, 2, FALSE);
+ tab = gtk_table_new (7, 2, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), tab, FALSE, TRUE, 0);
label = gtk_label_new ("Orientation :");
@@ -6306,6 +6317,20 @@ create_progress_bar (void)
gtk_box_pack_start (GTK_BOX (hbox), pdata->step_spin, FALSE, TRUE, 0);
gtk_widget_set_sensitive (pdata->step_spin, FALSE);
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_table_attach (GTK_TABLE (tab), hbox, 1, 2, 6, 7,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
+ 5, 5);
+ label = gtk_label_new ("Blocks : ");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ adj = (GtkAdjustment *) gtk_adjustment_new (5, 2, 10, 1, 5, 0);
+ pdata->act_blocks_spin = gtk_spin_button_new (adj, 0, 0);
+ gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
+ GTK_SIGNAL_FUNC (adjust_act_blocks), pdata);
+ gtk_box_pack_start (GTK_BOX (hbox), pdata->act_blocks_spin, FALSE, TRUE,
+ 0);
+ gtk_widget_set_sensitive (pdata->act_blocks_spin, FALSE);
+
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),
diff --git a/tests/testgtk.c b/tests/testgtk.c
index 2fd6ef858..2efa514ed 100644
--- a/tests/testgtk.c
+++ b/tests/testgtk.c
@@ -5903,6 +5903,7 @@ typedef struct _ProgressData {
GtkWidget *x_align_spin;
GtkWidget *y_align_spin;
GtkWidget *step_spin;
+ GtkWidget *act_blocks_spin;
GtkWidget *label;
GtkWidget *omenu1;
GtkWidget *omenu3;
@@ -6005,7 +6006,7 @@ static void
adjust_blocks (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_set_percentage (GTK_PROGRESS (pdata->pbar), 0);
- gtk_progress_bar_set_number_of_blocks (GTK_PROGRESS_BAR (pdata->pbar),
+ gtk_progress_bar_set_discrete_blocks (GTK_PROGRESS_BAR (pdata->pbar),
gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (pdata->block_spin)));
}
@@ -6017,6 +6018,14 @@ adjust_step (GtkAdjustment *adj, ProgressData *pdata)
}
static void
+adjust_act_blocks (GtkAdjustment *adj, ProgressData *pdata)
+{
+ gtk_progress_bar_set_activity_blocks (GTK_PROGRESS_BAR (pdata->pbar),
+ gtk_spin_button_get_value_as_int
+ (GTK_SPIN_BUTTON (pdata->act_blocks_spin)));
+}
+
+static void
adjust_align (GtkAdjustment *adj, ProgressData *pdata)
{
gtk_progress_set_text_alignment (GTK_PROGRESS (pdata->pbar),
@@ -6033,6 +6042,8 @@ toggle_activity_mode (GtkWidget *widget, ProgressData *pdata)
GTK_TOGGLE_BUTTON (widget)->active);
gtk_widget_set_sensitive (pdata->step_spin,
GTK_TOGGLE_BUTTON (widget)->active);
+ gtk_widget_set_sensitive (pdata->act_blocks_spin,
+ GTK_TOGGLE_BUTTON (widget)->active);
}
static void
@@ -6119,7 +6130,7 @@ create_progress_bar (void)
vbox2 = gtk_vbox_new (FALSE, 5);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
- tab = gtk_table_new (6, 2, FALSE);
+ tab = gtk_table_new (7, 2, FALSE);
gtk_box_pack_start (GTK_BOX (vbox2), tab, FALSE, TRUE, 0);
label = gtk_label_new ("Orientation :");
@@ -6306,6 +6317,20 @@ create_progress_bar (void)
gtk_box_pack_start (GTK_BOX (hbox), pdata->step_spin, FALSE, TRUE, 0);
gtk_widget_set_sensitive (pdata->step_spin, FALSE);
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_table_attach (GTK_TABLE (tab), hbox, 1, 2, 6, 7,
+ GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL,
+ 5, 5);
+ label = gtk_label_new ("Blocks : ");
+ gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
+ adj = (GtkAdjustment *) gtk_adjustment_new (5, 2, 10, 1, 5, 0);
+ pdata->act_blocks_spin = gtk_spin_button_new (adj, 0, 0);
+ gtk_signal_connect (GTK_OBJECT (adj), "value_changed",
+ GTK_SIGNAL_FUNC (adjust_act_blocks), pdata);
+ gtk_box_pack_start (GTK_BOX (hbox), pdata->act_blocks_spin, FALSE, TRUE,
+ 0);
+ gtk_widget_set_sensitive (pdata->act_blocks_spin, FALSE);
+
button = gtk_button_new_with_label ("close");
gtk_signal_connect_object (GTK_OBJECT (button), "clicked",
GTK_SIGNAL_FUNC (gtk_widget_destroy),