2009-06-15 Alberto Garcia <agarcia@igalia.com>
+ * hildon/Makefile.am
+ * hildon/hildon-edit-toolbar-private.h
+ * hildon/hildon-edit-toolbar.c
+ (+hildon_edit_toolbar_set_progress_indicator)
+ (hildon_edit_toolbar_init): Add progress indicator to the
+ toolbar.
+
+ * hildon/hildon-gtk.c
+ (hildon_gtk_window_set_progress_indicator):
+ If the window contains a HildonEditToolbar, enable the progress
+ indicator there too.
+
+ * hildon/hildon-private.h
+ * hildon/hildon-private.c
+ (+hildon_private_create_animation)
+ * hildon/hildon-banner.c
+ (-hildon_banner_create_animation):
+ Moved to hildon-private.c
+
+ Fixes: NB#102373 (Progress indicator also for the Edit mode
+ toolbar)
+
+2009-06-15 Alberto Garcia <agarcia@igalia.com>
+
* hildon/hildon-app-menu-private.h
* hildon/hildon-app-menu.c (hildon_app_menu_insert)
(hildon_app_menu_add_filter, +menu_item_button_event)
hildon-color-chooser-private.h \
hildon-controlbar-private.h \
hildon-date-editor-private.h \
+ hildon-edit-toolbar-private.h \
hildon-find-toolbar-private.h \
hildon-font-selection-dialog-private.h \
hildon-get-password-dialog-private.h \
#undef HILDON_DISABLE_DEPRECATED
#include "hildon-banner.h"
+#include "hildon-private.h"
#include "hildon-defines.h"
#include "hildon-gtk.h"
return g_object_new (HILDON_TYPE_BANNER, "parent-window", window, "is-timed", timed, NULL);
}
-static GtkWidget *
-hildon_banner_create_animation (void)
-{
- GtkWidget *image;
- GdkPixbufSimpleAnim *anim;
- GdkPixbuf *frame;
- GtkIconTheme *theme;
- GError *error = NULL;
- gchar *icon_name;
- gint i;
-
- anim = gdk_pixbuf_simple_anim_new (HILDON_ICON_PIXEL_SIZE_STYLUS,
- HILDON_ICON_PIXEL_SIZE_STYLUS,
- HILDON_BANNER_ANIMATION_FRAMERATE);
- gdk_pixbuf_simple_anim_set_loop (anim, TRUE);
- theme = gtk_icon_theme_get_default ();
-
- for (i = 1; i <= HILDON_BANNER_ANIMATION_NFRAMES; i++) {
- icon_name = g_strdup_printf (HILDON_BANNER_ANIMATION_TMPL, i);
- frame = gtk_icon_theme_load_icon (theme, icon_name, HILDON_ICON_PIXEL_SIZE_STYLUS,
- 0, &error);
-
- if (error) {
- g_warning ("Icon theme lookup for icon `%s' failed: %s",
- icon_name, error->message);
- g_error_free (error);
- error = NULL;
- } else {
- gdk_pixbuf_simple_anim_add_frame (anim, frame);
- }
-
- g_object_unref (frame);
- g_free (icon_name);
- }
-
- image = gtk_image_new_from_animation (GDK_PIXBUF_ANIMATION (anim));
- g_object_unref (anim);
-
- return image;
-}
-
/**
* hildon_banner_show_information:
* @widget: the #GtkWidget that is the owner of the banner
g_return_val_if_fail (text != NULL, NULL);
- image_widget = hildon_banner_create_animation ();
+ image_widget = hildon_private_create_animation (
+ HILDON_BANNER_ANIMATION_FRAMERATE,
+ HILDON_BANNER_ANIMATION_TMPL,
+ HILDON_BANNER_ANIMATION_NFRAMES);
/* Prepare banner */
banner = hildon_banner_get_instance_for_widget (widget, FALSE);
--- /dev/null
+/*
+ * This file is a part of hildon
+ *
+ * Copyright (C) 2009 Nokia Corporation, all rights reserved.
+ *
+ * Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA
+ *
+ */
+
+#ifndef __HILDON_EDIT_TOOLBAR_PRIVATE_H__
+#define __HILDON_EDIT_TOOLBAR_PRIVATE_H__
+
+#include "hildon-edit-toolbar.h"
+
+void G_GNUC_INTERNAL
+hildon_edit_toolbar_set_progress_indicator (HildonEditToolbar *toolbar,
+ gboolean show);
+
+#endif /* __HILDON_EDIT_TOOLBAR_PRIVATE_H__ */
*/
#include "hildon-edit-toolbar.h"
+#include "hildon-edit-toolbar-private.h"
+#include "hildon-private.h"
#include "hildon-gtk.h"
G_DEFINE_TYPE (HildonEditToolbar, hildon_edit_toolbar, GTK_TYPE_HBOX);
#define TOOLBAR_LEFT_PADDING 24
#define TOOLBAR_RIGHT_PADDING 8
+#define HILDON_EDIT_TOOLBAR_ANIMATION_FRAMERATE ((float)1000/150)
+#define HILDON_EDIT_TOOLBAR_ANIMATION_TMPL "indicator_update%d"
+#define HILDON_EDIT_TOOLBAR_ANIMATION_NFRAMES 8
+
#define HILDON_EDIT_TOOLBAR_GET_PRIVATE(obj) \
(G_TYPE_INSTANCE_GET_PRIVATE ((obj), \
HILDON_TYPE_EDIT_TOOLBAR, HildonEditToolbarPrivate));
struct _HildonEditToolbarPrivate
{
+ GtkBox *hbox;
GtkLabel *label;
+ GtkWidget *animation;
GtkButton *button;
GtkButton *arrow;
};
GtkWidget *separator;
GtkAlignment *align;
GtkBox *hbox = GTK_BOX (self);
- GtkBox *hbox2;
- hbox2 = GTK_BOX (gtk_hbox_new (FALSE, 0));
+ priv->hbox = GTK_BOX (gtk_hbox_new (FALSE, 0));
align = GTK_ALIGNMENT (gtk_alignment_new (0, 0.5, 1, 1));
priv->label = GTK_LABEL (gtk_label_new (NULL));
+ priv->animation = hildon_private_create_animation (
+ HILDON_EDIT_TOOLBAR_ANIMATION_FRAMERATE,
+ HILDON_EDIT_TOOLBAR_ANIMATION_TMPL,
+ HILDON_EDIT_TOOLBAR_ANIMATION_NFRAMES);
priv->button = GTK_BUTTON (hildon_gtk_button_new (HILDON_SIZE_AUTO));
separator = gtk_vseparator_new ();
priv->arrow = GTK_BUTTON (gtk_button_new ());
gtk_widget_set_name (GTK_WIDGET (self), "toolbar-edit-mode");
gtk_widget_set_name (GTK_WIDGET (priv->arrow), "hildon-edit-toolbar-arrow");
- gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (hbox2));
- gtk_box_pack_start (hbox2, GTK_WIDGET (priv->label), TRUE, TRUE, 0);
- gtk_box_pack_start (hbox2, GTK_WIDGET (priv->button), FALSE, FALSE, 0);
+ gtk_container_add (GTK_CONTAINER (align), GTK_WIDGET (priv->hbox));
+ gtk_box_pack_start (priv->hbox, GTK_WIDGET (priv->label), TRUE, TRUE, 0);
+ gtk_box_pack_start (priv->hbox, priv->animation, TRUE, TRUE, 10);
+ gtk_box_pack_start (priv->hbox, GTK_WIDGET (priv->button), FALSE, FALSE, 0);
+
+ gtk_widget_set_no_show_all (priv->animation, TRUE);
gtk_box_pack_start (hbox, GTK_WIDGET (align), TRUE, TRUE, 0);
gtk_box_pack_start (hbox, separator, FALSE, FALSE, 0);
gtk_box_pack_start (hbox, GTK_WIDGET (priv->arrow), FALSE, FALSE, 0);
gtk_misc_set_alignment (GTK_MISC (priv->label), 0, 0.5);
+ gtk_misc_set_alignment (GTK_MISC (priv->animation), 0, 0.5);
gtk_widget_show_all (GTK_WIDGET (align));
gtk_widget_show_all (separator);
return toolbar;
}
+
+void G_GNUC_INTERNAL
+hildon_edit_toolbar_set_progress_indicator (HildonEditToolbar *toolbar,
+ gboolean show)
+{
+ HildonEditToolbarPrivate *priv;
+ g_return_if_fail (HILDON_IS_EDIT_TOOLBAR (toolbar));
+ priv = HILDON_EDIT_TOOLBAR_GET_PRIVATE (toolbar);
+ if (show) {
+ gtk_widget_show (priv->animation);
+ gtk_box_set_child_packing (priv->hbox, GTK_WIDGET (priv->label),
+ FALSE, FALSE, 0, GTK_PACK_START);
+ } else {
+ gtk_box_set_child_packing (priv->hbox, GTK_WIDGET (priv->label),
+ TRUE, TRUE, 0, GTK_PACK_START);
+ gtk_widget_hide (priv->animation);
+ }
+}
#include <gdk/gdkx.h>
#include "hildon-gtk.h"
+#include "hildon-window.h"
+#include "hildon-window-private.h"
+#include "hildon-edit-toolbar.h"
+#include "hildon-edit-toolbar-private.h"
typedef void (*HildonFlagFunc) (GtkWindow *window, gpointer userdata);
guint state)
{
set_flag (window, (HildonFlagFunc) do_set_progress_indicator, GUINT_TO_POINTER (state));
+ if (HILDON_IS_WINDOW (window)) {
+ HildonWindowPrivate *priv = HILDON_WINDOW_GET_PRIVATE (window);
+ if (priv->edit_toolbar) {
+ HildonEditToolbar *tb = HILDON_EDIT_TOOLBAR (priv->edit_toolbar);
+ hildon_edit_toolbar_set_progress_indicator (tb, state);
+ }
+ }
}
/**
/*
* This file is a part of hildon
*
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
+ * Copyright (C) 2005, 2006, 2009 Nokia Corporation, all rights reserved.
*
* Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
*
#include "hildon-private.h"
#include "hildon-date-editor.h"
#include "hildon-time-editor.h"
+#include "hildon-defines.h"
/* This function is a private function of hildon. It hadles focus
* changing for composite hildon widgets: HildonDateEditor,
}
+G_GNUC_INTERNAL GtkWidget *
+hildon_private_create_animation (gfloat framerate,
+ const gchar *template,
+ gint nframes)
+{
+ GtkWidget *image;
+ GdkPixbufSimpleAnim *anim;
+ GtkIconTheme *theme;
+ gint i;
+
+ anim = gdk_pixbuf_simple_anim_new (HILDON_ICON_PIXEL_SIZE_STYLUS,
+ HILDON_ICON_PIXEL_SIZE_STYLUS,
+ framerate);
+ gdk_pixbuf_simple_anim_set_loop (anim, TRUE);
+ theme = gtk_icon_theme_get_default ();
+
+ for (i = 1; i <= nframes; i++) {
+ GdkPixbuf *frame;
+ GError *error = NULL;
+ gchar *icon_name = g_strdup_printf (template, i);
+ frame = gtk_icon_theme_load_icon (theme, icon_name,
+ HILDON_ICON_PIXEL_SIZE_STYLUS,
+ 0, &error);
+
+ if (error) {
+ g_warning ("Icon theme lookup for icon `%s' failed: %s",
+ icon_name, error->message);
+ g_error_free (error);
+ } else {
+ gdk_pixbuf_simple_anim_add_frame (anim, frame);
+ }
+
+ g_object_unref (frame);
+ g_free (icon_name);
+ }
+
+ image = gtk_image_new_from_animation (GDK_PIXBUF_ANIMATION (anim));
+ g_object_unref (anim);
+
+ return image;
+}
/*
* This file is a part of hildon
*
- * Copyright (C) 2005, 2006 Nokia Corporation, all rights reserved.
+ * Copyright (C) 2005, 2006, 2009 Nokia Corporation, all rights reserved.
*
* Contact: Rodrigo Novo <rodrigo.novo@nokia.com>
*
GtkDirectionType direction,
GtkDirectionType *effective_direction);
+G_GNUC_INTERNAL GtkWidget *
+hildon_private_create_animation (gfloat framerate,
+ const gchar *template,
+ gint nframes);
+
G_END_DECLS
#endif /* __HILDON_PRIVATE_H__ */