[maemo-commits] [maemo-commits] r14362 - in projects/haf/trunk/hildon-fm: . debian hildon-fm
From: subversion at stage.maemo.org subversion at stage.maemo.orgDate: Mon Oct 8 19:36:57 EEST 2007
- Previous message: [maemo-commits] r14361 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r14363 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Author: marivoll Date: 2007-10-08 19:36:55 +0300 (Mon, 08 Oct 2007) New Revision: 14362 Modified: projects/haf/trunk/hildon-fm/ChangeLog projects/haf/trunk/hildon-fm/debian/changelog projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c Log: * hildon-fm/hildon-file-details-dialog.c (do_line_wrapping): New. (hildon_file_details_dialog_init): Call it when the dialog is shown (N53155). Modified: projects/haf/trunk/hildon-fm/ChangeLog =================================================================== --- projects/haf/trunk/hildon-fm/ChangeLog 2007-10-08 15:35:02 UTC (rev 14361) +++ projects/haf/trunk/hildon-fm/ChangeLog 2007-10-08 16:36:55 UTC (rev 14362) @@ -1,3 +1,9 @@ +2007-10-08 Marius Vollmer <marius.vollmer at nokia.com> + + * hildon-fm/hildon-file-details-dialog.c (do_line_wrapping): New. + (hildon_file_details_dialog_init): Call it when the dialog is + shown (N53155). + 2007-10-02 Marius Vollmer <marius.vollmer at nokia.com> Released 1.9.42.1. Patch up stupid mistakes in 1.9.42 release. Modified: projects/haf/trunk/hildon-fm/debian/changelog =================================================================== --- projects/haf/trunk/hildon-fm/debian/changelog 2007-10-08 15:35:02 UTC (rev 14361) +++ projects/haf/trunk/hildon-fm/debian/changelog 2007-10-08 16:36:55 UTC (rev 14362) @@ -1,6 +1,6 @@ libhildonfm (1:1.9.43~unreleased) unstable; urgency=low - * + * Fixes: NB#53155. -- Marius Vollmer <marius.vollmer at nokia.com> Tue, 02 Oct 2007 15:31:36 +0300 Modified: projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c =================================================================== --- projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c 2007-10-08 15:35:02 UTC (rev 14361) +++ projects/haf/trunk/hildon-fm/hildon-fm/hildon-file-details-dialog.c 2007-10-08 16:36:55 UTC (rev 14362) @@ -69,6 +69,7 @@ GtkWidget *file_location_image, *file_device_image; GtkWidget *file_image; GtkWidget *ok_button; + GtkWidget *scroll; GtkTreeRowReference *active_file; gboolean checkbox_original_state; @@ -97,6 +98,8 @@ static void hildon_file_details_dialog_response(GtkDialog *dialog, gint response_id); +void do_line_wrapping (GtkWidget *w, gpointer data); + static GtkDialogClass *file_details_dialog_parent_class = NULL; GType hildon_file_details_dialog_get_type(void) @@ -335,7 +338,6 @@ GtkWidget *caption_read, *caption_device; GtkWidget *hbox_location, *hbox_device, *hbox_type; GtkWidget *vbox; - GtkWidget *scroll; GtkSizeGroup *group; GdkGeometry geometry; @@ -347,7 +349,7 @@ HildonFileDetailsDialogPrivate); priv->notebook = GTK_NOTEBOOK(gtk_notebook_new()); - scroll = gtk_scrolled_window_new(NULL, NULL); + priv->scroll = gtk_scrolled_window_new(NULL, NULL); vbox = gtk_vbox_new(FALSE, 0); group = gtk_size_group_new(GTK_SIZE_GROUP_BOTH); @@ -368,9 +370,6 @@ priv->file_time = g_object_new(GTK_TYPE_LABEL, "xalign", 0.0f, NULL); priv->file_readonly = gtk_check_button_new(); - gtk_label_set_line_wrap (GTK_LABEL (priv->file_name), TRUE); - gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_name), PANGO_WRAP_CHAR); - hbox_type = gtk_hbox_new (FALSE, HILDON_MARGIN_DEFAULT); hbox_location = gtk_hbox_new(FALSE, HILDON_MARGIN_DEFAULT); hbox_device = gtk_hbox_new(FALSE, HILDON_MARGIN_DEFAULT); @@ -438,23 +437,23 @@ gtk_box_pack_start(GTK_BOX(vbox), caption_size, FALSE, TRUE, 0); gtk_box_pack_start(GTK_BOX(vbox), caption_read, FALSE, TRUE, 0); - gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(scroll), vbox); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroll), + gtk_scrolled_window_add_with_viewport(GTK_SCROLLED_WINDOW(priv->scroll), vbox); + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(priv->scroll), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_container_set_border_width(GTK_CONTAINER(scroll), + gtk_container_set_border_width(GTK_CONTAINER(priv->scroll), HILDON_MARGIN_DEFAULT); /* Both scrolled window and viewport have separate shadows... */ - gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scroll), + gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(priv->scroll), GTK_SHADOW_NONE); gtk_viewport_set_shadow_type( - GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(scroll))), + GTK_VIEWPORT(gtk_bin_get_child(GTK_BIN(priv->scroll))), GTK_SHADOW_NONE); gtk_container_set_focus_vadjustment(GTK_CONTAINER(vbox), - gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(scroll))); + gtk_scrolled_window_get_vadjustment(GTK_SCROLLED_WINDOW(priv->scroll))); /* Populate dialog */ - gtk_notebook_append_page(priv->notebook, scroll, + gtk_notebook_append_page(priv->notebook, priv->scroll, gtk_label_new(_("sfil_ti_notebook_common"))); gtk_box_pack_start(GTK_BOX(GTK_DIALOG(self)->vbox), @@ -487,7 +486,9 @@ G_CALLBACK(hildon_file_details_dialog_read_only_toggled), self); - gtk_widget_set_usize (GTK_WIDGET (self), 400, -1); + gtk_widget_set_size_request (GTK_WIDGET (self), 400, -1); + g_signal_connect (G_OBJECT (self), "show", + G_CALLBACK (do_line_wrapping), priv); } static void @@ -914,3 +915,78 @@ return result; } + +/* + This function is a workaround to be able to show long labels on + HildonFileDetailsDialog without using horizontal scrolling. + This function is called after all the widgets are realized. so + that their actual size is known. Sizes are differnt in different + locales. +*/ +void +do_line_wrapping (GtkWidget *w, gpointer data) +{ + HildonFileDetailsDialogPrivate *priv = (HildonFileDetailsDialogPrivate*)data; + + GtkWidget *label; + GtkAllocation label_allocation; + GtkAllocation window_allocation; + + gint ideal_width; + + label = priv->file_name; + label_allocation = label->allocation; + window_allocation = priv->scroll->allocation; + + /* GtkWidgets are not aware of their parents size, so we have to explicitly + tell to the labels where their visibility ends --> wrapping point. + Scrolled window is actually aware of it's size on screen so we adjust + the label widths according to it + */ + ideal_width = (window_allocation.width) - (label_allocation.x); + + if (gtk_scrolled_window_get_vscrollbar (GTK_SCROLLED_WINDOW(priv->scroll))) + ideal_width -= 40; //Scroll bar width + + gtk_label_set_line_wrap (GTK_LABEL (priv->file_name), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_name), PANGO_WRAP_CHAR); + + gtk_label_set_line_wrap (GTK_LABEL (priv->file_device), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_device), PANGO_WRAP_CHAR); + + gtk_label_set_line_wrap (GTK_LABEL (priv->file_location), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_location), PANGO_WRAP_CHAR); + + gtk_label_set_line_wrap (GTK_LABEL (priv->file_type), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_type), PANGO_WRAP_CHAR); + + gtk_label_set_line_wrap (GTK_LABEL (priv->file_size), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_size), PANGO_WRAP_CHAR); + + gtk_label_set_line_wrap (GTK_LABEL (priv->file_date), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_date), PANGO_WRAP_CHAR); + + gtk_label_set_line_wrap (GTK_LABEL (priv->file_time), TRUE); + gtk_label_set_line_wrap_mode (GTK_LABEL (priv->file_time), PANGO_WRAP_CHAR); + + gtk_widget_set_size_request (GTK_WIDGET (priv->file_name), + ideal_width, -1); + + gtk_widget_set_size_request (GTK_WIDGET (priv->file_device), + (ideal_width - 30), -1); //reduce icon width + + gtk_widget_set_size_request (GTK_WIDGET (priv->file_location), + (ideal_width - 30), -1); //reduce icon width + + gtk_widget_set_size_request (GTK_WIDGET (priv->file_type), + ideal_width, -1); + + gtk_widget_set_size_request (GTK_WIDGET (priv->file_size), + ideal_width, -1); + + gtk_widget_set_size_request (GTK_WIDGET (priv->file_date), + ideal_width, -1); + + gtk_widget_set_size_request (GTK_WIDGET (priv->file_time), + ideal_width, -1); +}
- Previous message: [maemo-commits] r14361 - projects/haf/hafbuildbot
- Next message: [maemo-commits] r14363 - projects/haf/trunk/hildon-fm/hildon-fm
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]