[maemo-commits] [maemo-commits] r9257 - in projects/haf/branches/hildon-libs/hildon-1: . src
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Tue Jan 23 14:57:15 EET 2007
- Previous message: [maemo-commits] r9256 - projects/haf/tags/pango1.0
- Next message: [maemo-commits] r9258 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: mdk Date: 2007-01-23 14:57:13 +0200 (Tue, 23 Jan 2007) New Revision: 9257 Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.c projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.h projects/haf/branches/hildon-libs/hildon-1/src/hildon-note.c Log: Fixing documentation. Removing the n-lines helper function. Modified: projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 2007-01-23 12:56:56 UTC (rev 9256) +++ projects/haf/branches/hildon-libs/hildon-1/ChangeLog.2 2007-01-23 12:57:13 UTC (rev 9257) @@ -1,5 +1,13 @@ 2007-01-23 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + * src/hildon-banner.c: + * src/hildon-banner.h: Fixing documentation. Removing the n-lines + helper function. + + * src/hildon-note.c: Removing the n-lines wrapping stuff. + +2007-01-23 Michael Dominic Kostrzewa <michael.kostrzewa at nokia.com> + * tests/Makefile.am: Missing MAINTAINERCLEAN files. * tests/hildon-clock-widgets_tests.c: Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.c 2007-01-23 12:56:56 UTC (rev 9256) +++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.c 2007-01-23 12:57:13 UTC (rev 9257) @@ -153,7 +153,7 @@ /** * hildon_banner_get_type: * - * Initialises, and returns the type of a hildon banner. + * Initializes and returns the type of a hildon banner. * * @Returns: GType of #HildonBanner */ @@ -636,12 +636,25 @@ /* Install properties. We need construct properties for singleton purposes */ + + /** + * HildonBanner:parent-window: + * + * The window for which the banner will be singleton. + * + */ g_object_class_install_property (object_class, PROP_PARENT_WINDOW, g_param_spec_object ("parent-window", "Parent window", "The window for which the banner will be singleton", GTK_TYPE_WINDOW, G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY)); + /** + * HildonBanner:is-timed: + * + * Whether the banner is timed and goes away automatically. + * + */ g_object_class_install_property (object_class, PROP_IS_TIMED, g_param_spec_boolean ("is-timed", "Is timed", @@ -727,8 +740,8 @@ /** * hildon_banner_show_information: - * @widget: the #GtkWidget that wants to display banner - * @icon_name: the name of icon to use. Can be %NULL for default icon. + * @widget: the #GtkWidget that is the owner of the banner + * @icon_name: the name of icon to use. Can be %NULL for default icon * @text: Text to display * * This function creates and displays an information banner that @@ -763,6 +776,17 @@ gtk_widget_show_all (GTK_WIDGET (banner)); } +/** + * hildon_banner_show_informationf: + * @widget: the #GtkWidget that is the owner of the banner + * @icon_name: the name of icon to use. Can be %NULL for default icon + * @format: a printf-like format string + * @Varargs: arguments for the format string + * + * A helper function for #hildon_banner_show_information with + * string formatting. + * + */ void hildon_banner_show_informationf (GtkWidget *widget, const gchar *icon_name, @@ -846,7 +870,7 @@ * followed by #g_object_unref (in this order). * * Returns: a #HildonBanner widget. You must call #gtk_widget_destroy - * once you are ready with the banner. + * once you are done with the banner. * */ GtkWidget* @@ -905,7 +929,7 @@ * for more information. * * Returns: a #HildonBanner widget. You must call #gtk_widget_destroy - * once you are ready with the banner. + * once you are done with the banner. * */ GtkWidget* @@ -971,7 +995,6 @@ * * Sets the text with markup that is displayed in the banner. * - * Since: 0.12.8 */ void hildon_banner_set_markup (HildonBanner *self, @@ -1015,84 +1038,3 @@ gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (priv->main_item), fraction); } -/** - * Deprecated: really, do NOT use. - */ -void -hildon_gtk_label_set_text_n_lines (GtkLabel *label, - const gchar *text, - gint max_lines) -{ - /* Forces the wrapping of text into several lines and ellipsizes the rest. - Similar to combination of gtk_label_set_wrap and pango ellipzation. - We cannot just use those directly, since ellipzation always wins wrapping. - - This means that we have to: - * First wrap the text - * Insert forced linebreaks into text - * Truncate the result - - NOTE! This will not work with pango markup! - - FIXME: luc: DO NOT TRUNCATE the text. Use as many lines as needed. - Lenth of the text is under applications' responsibility. - Widget does not have to enforce this. */ - - PangoLayout *layout; - PangoLayoutLine *line; - GtkRequisition req; - GString *wrapped_text; - gchar *line_data; - gint lines, i; - - g_return_if_fail (GTK_IS_LABEL (label)); - g_return_if_fail (max_lines >= 1); - - /* Setup the label to contain the new data */ - gtk_label_set_text (label, text); - gtk_label_set_line_wrap (label, TRUE); - gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_NONE); - - /* We really want to recalculate the size, not use some old values */ - gtk_widget_size_request (GTK_WIDGET (label), &req); - layout = gtk_label_get_layout (label); - lines = pango_layout_get_line_count (layout); - - /* Now collect the wrapped text. */ - wrapped_text = g_string_new (NULL); - - for (i = 0; i < lines; i++) - { - /* Append the next line into wrapping buffer, but - avoid adding extra whitespaces at the end, since those - can cause other lines to be ellipsized as well. */ - line = pango_layout_get_line (layout, i); - line_data = g_strndup (pango_layout_get_text(layout) + line->start_index, - line->length); - g_strchomp (line_data); - g_string_append (wrapped_text, line_data); - - /* Append forced linebreaks, until we have the desired - amount of lines. After that we put the rest to the - last line to make ellipzation to happen */ - if (i < lines - 1) - { - if (i < max_lines - 1) - g_string_append_c (wrapped_text, '\n'); - else - g_string_append_c (wrapped_text, ' '); - } - - g_free(line_data); - } - - /* Now update the label to use wrapped text. Use builtin - ellipzation as well. */ - gtk_widget_set_size_request (GTK_WIDGET (label), req.width, -1); - gtk_label_set_text (label, wrapped_text->str); - gtk_label_set_ellipsize (label, PANGO_ELLIPSIZE_END); - gtk_label_set_line_wrap (label, FALSE); - - g_string_free (wrapped_text, TRUE); -} - Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.h =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.h 2007-01-23 12:56:56 UTC (rev 9256) +++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-banner.h 2007-01-23 12:57:13 UTC (rev 9257) @@ -98,12 +98,6 @@ hildon_banner_set_fraction (HildonBanner *self, gdouble fraction); -/* For internal use of hildon libraries only */ -void -hildon_gtk_label_set_text_n_lines (GtkLabel *label, - const gchar *text, - gint max_lines); - G_END_DECLS #endif /* __HILDON_BANNER_H__ */ Modified: projects/haf/branches/hildon-libs/hildon-1/src/hildon-note.c =================================================================== --- projects/haf/branches/hildon-libs/hildon-1/src/hildon-note.c 2007-01-23 12:56:56 UTC (rev 9256) +++ projects/haf/branches/hildon-libs/hildon-1/src/hildon-note.c 2007-01-23 12:57:13 UTC (rev 9257) @@ -131,13 +131,13 @@ break; case PROP_HILDON_NOTE_DESCRIPTION: - g_free (priv->original_description); + if (priv->original_description) + g_free (priv->original_description); priv->original_description = g_value_dup_string (value); - hildon_gtk_label_set_text_n_lines (GTK_LABEL (priv->label), - priv->original_description, - priv->note_n == HILDON_NOTE_PROGRESSBAR_TYPE ? 1 : 5); - + gtk_label_set_text (GTK_LABEL (priv->label), priv->original_description); + /* FIXME Is the "original_description" used anywhere? */ + break; case PROP_HILDON_NOTE_ICON: @@ -323,6 +323,8 @@ g_assert (priv); priv->label = gtk_label_new (NULL); + gtk_label_set_line_wrap (GTK_LABEL (priv->label), TRUE); + priv->icon = gtk_image_new (); /* Acquire real references to our internal children, since
- Previous message: [maemo-commits] r9256 - projects/haf/tags/pango1.0
- Next message: [maemo-commits] r9258 - projects/haf/hafbuildbot
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]