diff options
author | Christian Persch <chpe@cvs.gnome.org> | 2004-05-11 04:45:23 +0800 |
---|---|---|
committer | Christian Persch <chpe@src.gnome.org> | 2004-05-11 04:45:23 +0800 |
commit | 6369e4883e19a85d144b066ec9c4e01330613ba4 (patch) | |
tree | fb01796251dcd7e91aa5b685598b64ceaed86423 /src/ephy-statusbar.c | |
parent | 800597c1683b3cb290a21cc66533a8cc6cf12618 (diff) | |
download | gsoc2013-epiphany-6369e4883e19a85d144b066ec9c4e01330613ba4.tar.gz gsoc2013-epiphany-6369e4883e19a85d144b066ec9c4e01330613ba4.tar.zst gsoc2013-epiphany-6369e4883e19a85d144b066ec9c4e01330613ba4.zip |
Statusbar re-design: Move lock icon to left; hide progress bar when no
2004-05-10 Christian Persch <chpe@cvs.gnome.org>
* src/ephy-statusbar.c: (create_statusbar_security_icon),
(create_statusbar_progress), (sync_shadow_type),
(ephy_statusbar_init), (ephy_statusbar_set_progress),
(ephy_statusbar_add_widget):
* src/ephy-tab.c: (ephy_tab_net_state_cb):
Statusbar re-design: Move lock icon to left; hide progress bar
when no activity. Part of bug #137845.
Diffstat (limited to 'src/ephy-statusbar.c')
-rwxr-xr-x | src/ephy-statusbar.c | 74 |
1 files changed, 64 insertions, 10 deletions
diff --git a/src/ephy-statusbar.c b/src/ephy-statusbar.c index 5545e1378..a3b62e575 100755 --- a/src/ephy-statusbar.c +++ b/src/ephy-statusbar.c @@ -33,6 +33,7 @@ #include <gtk/gtkeventbox.h> #include <gtk/gtkimage.h> #include <gtk/gtkframe.h> +#include <gtk/gtkwidget.h> static void ephy_statusbar_class_init (EphyStatusbarClass *klass); static void ephy_statusbar_init (EphyStatusbar *t); @@ -44,6 +45,8 @@ static GObjectClass *parent_class = NULL; struct EphyStatusbarPrivate { + GtkWidget *icon_container; + GtkWidget *security_icon; GtkWidget *progressbar; GtkWidget *security_evbox; @@ -109,9 +112,9 @@ create_statusbar_security_icon (EphyStatusbar *s) gtk_widget_show_all (s->security_frame); - gtk_box_pack_end (GTK_BOX (s), - GTK_WIDGET (s->security_frame), - FALSE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (s->priv->icon_container), + GTK_WIDGET (s->security_frame), + FALSE, TRUE, 0); } static void @@ -120,9 +123,32 @@ create_statusbar_progress (EphyStatusbar *s) s->priv->progressbar = gtk_progress_bar_new (); gtk_widget_show_all (s->priv->progressbar); - gtk_box_pack_start (GTK_BOX (s), - GTK_WIDGET (s->priv->progressbar), - FALSE, TRUE, 0); + gtk_box_pack_end (GTK_BOX (s), + GTK_WIDGET (s->priv->progressbar), + FALSE, TRUE, 0); +} + +static void +sync_shadow_type (EphyStatusbar *statusbar, + GParamSpec *pspec, + gpointer dummy) +{ + GtkShadowType shadow; + GList *children, *l; + + gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow-type", + &shadow, NULL); + + children = gtk_container_get_children + (GTK_CONTAINER (statusbar->priv->icon_container)); + for (l = children; l != NULL; l = l->next) + { + if (GTK_IS_FRAME (l->data)) + { + gtk_frame_set_shadow_type (GTK_FRAME (l->data), shadow); + } + } + g_list_free (children); } static void @@ -134,10 +160,21 @@ ephy_statusbar_init (EphyStatusbar *t) g_object_ref (G_OBJECT (t->tooltips)); gtk_object_sink (GTK_OBJECT (t->tooltips)); + t->priv->icon_container = gtk_hbox_new (FALSE, 0); + gtk_box_pack_start (GTK_BOX (t), t->priv->icon_container, FALSE, FALSE, 0); + gtk_box_reorder_child (GTK_BOX (t), t->priv->icon_container, 0); + gtk_widget_show (t->priv->icon_container); + + /* FIXME: enable this when gtk+ bug 73359 is fixed */ gtk_statusbar_set_has_resize_grip (GTK_STATUSBAR (t), FALSE); create_statusbar_progress (t); create_statusbar_security_icon (t); + + /* FIXME: is this the right way ? */ + sync_shadow_type (t, NULL, NULL); + g_signal_connect (t, "notify::shadow-type", + G_CALLBACK (sync_shadow_type), NULL); } static void @@ -205,10 +242,17 @@ ephy_statusbar_set_progress (EphyStatusbar *statusbar, } else { - float fraction; - fraction = (float)(progress) / 100; gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (statusbar->priv->progressbar), - fraction); + (float) (progress) / 100.0); + } + + if (progress < 100) + { + gtk_widget_show (statusbar->priv->progressbar); + } + else + { + gtk_widget_hide (statusbar->priv->progressbar); } } @@ -228,5 +272,15 @@ ephy_statusbar_add_widget (EphyStatusbar *statusbar, g_return_if_fail (EPHY_IS_STATUSBAR (statusbar)); g_return_if_fail (GTK_IS_WIDGET (widget)); - gtk_box_pack_start (GTK_BOX (statusbar), widget, FALSE, FALSE, 0); + gtk_box_pack_start (GTK_BOX (statusbar->priv->icon_container), + widget, FALSE, FALSE, 0); + + if (GTK_IS_FRAME (widget)) + { + GtkShadowType shadow; + + gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow-type", + &shadow, NULL); + gtk_frame_set_shadow_type (GTK_FRAME (widget), shadow); + } } |