From 14e7608e93853e39ffa514d521f53da3ac051154 Mon Sep 17 00:00:00 2001 From: Michael Dominic Kostrzewa Date: Wed, 10 Jan 2007 13:37:54 +0000 Subject: [PATCH] Adding an example for the HildonControlBar. Fixing some refactoring bugs. Gtk 2.10 fixes. --- ChangeLog | 14 +++++++++ examples/Makefile.am | 9 +++++- .../hildon-controlbar/hildon-controlbar-example.c | 33 ++++++++++++++++++++ src/hildon-banner.c | 7 ++--- src/hildon-defines.c | 2 +- src/hildon-number-editor.c | 4 +-- src/hildon-time-editor.c | 14 +++++++-- src/hildon-time-picker.c | 2 +- 8 files changed, 73 insertions(+), 12 deletions(-) create mode 100644 examples/hildon-controlbar/hildon-controlbar-example.c diff --git a/ChangeLog b/ChangeLog index ea10223..322c5ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2007-01-10 Michael Dominic Kostrzewa + + * examples/Makefile.am: + * examples/hildon-controlbar: + * examples/hildon-controlbar/hildon-controlbar-example.c: Adding an + example for the HildonControlBar. + + * src/hildon-banner.c: Fixing some refactoring bugs. + + * src/hildon-defines.c: + * src/hildon-number-editor.c: + * src/hildon-time-editor.c: + * src/hildon-time-picker.c: Gtk 2.10 fixes. + 2007-01-08 Michael Dominic Kostrzewa * src/hildon-date-editor.c: diff --git a/examples/Makefile.am b/examples/Makefile.am index 020773c..fb720b5 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -4,7 +4,8 @@ noinst_PROGRAMS = hildon-window-example \ hildon-banner-example \ hildon-caption-example \ hildon-weekday-picker-example \ - hildon-sort-dialog-example + hildon-sort-dialog-example \ + hildon-controlbar-example # HIldon window hildon_window_example_LDADD = $(HILDON_WIDGETS_OBJ_LIBS) @@ -30,3 +31,9 @@ hildon_weekday_picker_example_SOURCES = hildon-weekday-picker/hildon-weekday-pic hildon_sort_dialog_example_LDADD = $(HILDON_WIDGETS_OBJ_LIBS) hildon_sort_dialog_example_CFLAGS = $(HILDON_WIDGETS_OBJ_CFLAGS) hildon_sort_dialog_example_SOURCES = hildon-sort-dialog/hildon-sort-dialog-example.c + +# Hildon control bar +hildon_controlbar_example_LDADD = $(HILDON_WIDGETS_OBJ_LIBS) +hildon_controlbar_example_CFLAGS = $(HILDON_WIDGETS_OBJ_CFLAGS) +hildon_controlbar_example_SOURCES = hildon-controlbar/hildon-controlbar-example.c + diff --git a/examples/hildon-controlbar/hildon-controlbar-example.c b/examples/hildon-controlbar/hildon-controlbar-example.c new file mode 100644 index 0000000..bb615dc --- /dev/null +++ b/examples/hildon-controlbar/hildon-controlbar-example.c @@ -0,0 +1,33 @@ +#include +#include +#include +#include +#include "hildon-widgets/hildon-window.h" +#include "hildon-widgets/hildon-program.h" +#include "hildon-widgets/hildon-controlbar.h" + +int +main (int argc, char **args) +{ + gtk_init (&argc, &args); + + HildonProgram *program = hildon_program_get_instance (); + + GtkWidget *window = hildon_window_new (); + hildon_program_add_window (program, HILDON_WINDOW (window)); + + gtk_container_set_border_width (GTK_CONTAINER (window), 6); + + HildonControlbar *bar = HILDON_CONTROLBAR (hildon_controlbar_new ()); + hildon_controlbar_set_range (bar, 20, 120); + hildon_controlbar_set_value (bar, 100); + + g_signal_connect (G_OBJECT (window), "delete_event", G_CALLBACK (gtk_main_quit), NULL); + gtk_container_add (GTK_CONTAINER (window), GTK_WIDGET (bar)); + gtk_widget_show_all (GTK_WIDGET (window)); + + gtk_main (); + return 0; +} + + diff --git a/src/hildon-banner.c b/src/hildon-banner.c index 82e587b..af0bd8d 100644 --- a/src/hildon-banner.c +++ b/src/hildon-banner.c @@ -685,7 +685,6 @@ hildon_banner_ensure_child (HildonBanner *self, HildonBannerPrivate *priv = HILDON_BANNER_GET_PRIVATE (self); g_assert (HILDON_IS_BANNER (self)); - g_assert (GTK_IS_WIDGET (user_widget)); g_assert (priv); widget = priv->main_item; @@ -921,14 +920,14 @@ hildon_banner_show_progress (GtkWidget *widget, HildonBannerPrivate *priv; g_return_val_if_fail (GTK_IS_WIDGET(widget), NULL); - g_return_val_if_fail (bar == NULL || GTK_IS_PROGRESS_BAR(bar), NULL); + g_return_val_if_fail (bar == NULL || GTK_IS_PROGRESS_BAR (bar), NULL); g_return_val_if_fail (text != NULL, NULL); - priv = HILDON_BANNER_GET_PRIVATE (widget); - g_assert (priv); /* Prepare banner */ banner = hildon_banner_get_instance_for_widget (widget, FALSE); + priv = HILDON_BANNER_GET_PRIVATE (banner); + g_assert (priv); hildon_banner_ensure_child (banner, (GtkWidget *) bar, -1, GTK_TYPE_PROGRESS_BAR, NULL); gtk_widget_set_size_request (priv->main_item, diff --git a/src/hildon-defines.c b/src/hildon-defines.c index 52befc4..389f51e 100644 --- a/src/hildon-defines.c +++ b/src/hildon-defines.c @@ -118,7 +118,7 @@ static void hildon_change_style_recursive_from_ld (GtkWidget *widget, GtkStyle * /* Changing logical color */ GdkColor color; gtk_widget_ensure_style (widget); - if (gtk_style_lookup_logical_color (widget->style, ld->logicalcolorstring, &color) == TRUE) + if (gtk_style_lookup_color (widget->style, ld->logicalcolorstring, &color) == TRUE) switch (ld->rcflags) { case GTK_RC_FG: diff --git a/src/hildon-number-editor.c b/src/hildon-number-editor.c index a364c26..1e1072d 100644 --- a/src/hildon-number-editor.c +++ b/src/hildon-number-editor.c @@ -453,7 +453,7 @@ hildon_number_editor_button_pressed (GtkWidget *widget, g_assert (priv); settings = gtk_settings_get_default (); - g_object_get (settings, "gtk-initial-timeout", &timeout, NULL); + g_object_get (settings, "gtk-timeout-initial", &timeout, NULL); /* Save type of button pressed */ if (GTK_BUTTON (widget) == GTK_BUTTON (priv->plus)) @@ -482,7 +482,7 @@ hildon_number_editor_start_timer (HildonNumberEditor *editor) priv = HILDON_NUMBER_EDITOR_GET_PRIVATE (editor); settings = gtk_settings_get_default (); - g_object_get (settings, "gtk-update-timeout", &timeout, NULL); + g_object_get (settings, "gtk-timeout-update", &timeout, NULL); priv->button_event_id = g_timeout_add (timeout, (GSourceFunc) do_mouse_timeout, diff --git a/src/hildon-time-editor.c b/src/hildon-time-editor.c index c26d844..1fcd442 100644 --- a/src/hildon-time-editor.c +++ b/src/hildon-time-editor.c @@ -1774,10 +1774,18 @@ hildon_time_editor_entry_keypress (GtkWidget *widget, /* Return key popups up time picker dialog. Visually it looks as if the time picker icon was clicked. Before opening the time picker the fields are first validated and fixed. */ - hildon_time_editor_validate (editor, FALSE); - hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), TRUE); + + /* hildon_time_editor_validate (editor, FALSE); + hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), TRUE); + hildon_time_editor_icon_clicked (widget, data); + hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), FALSE); + + FIXME The above code used to be here before the consolidation that removed the + _set_depressed crap. However, I think this code had NO EFFECT anyways, since + there is no expose event after the _set functions. So I'm just cutting it out. + Another story would be to actually fix it... */ + hildon_time_editor_icon_clicked (widget, data); - hildon_gtk_button_set_depressed (GTK_BUTTON (priv->iconbutton), FALSE); return TRUE; case GDK_Left: diff --git a/src/hildon-time-picker.c b/src/hildon-time-picker.c index 60e2330..cd80d95 100644 --- a/src/hildon-time-picker.c +++ b/src/hildon-time-picker.c @@ -425,7 +425,7 @@ hildon_time_picker_init (HildonTimePicker *picker) /* Get button press repeater timeout from settings (in milliseconds) */ settings = gtk_settings_get_default (); - g_object_get (settings, "gtk-update-timeout", &priv->key_repeat, NULL); + g_object_get (settings, "gtk-timeout-update", &priv->key_repeat, NULL); /* This dialog isn't modal */ gtk_window_set_modal (GTK_WINDOW(dialog), FALSE); -- 1.7.9.5