diff options
author | Benedikt Meurer <benny@xfce.org> | 2006-01-04 22:34:59 +0000 |
---|---|---|
committer | Benedikt Meurer <benny@xfce.org> | 2006-01-04 22:34:59 +0000 |
commit | 93303151d1f69d6306f92a540991217a9b79cc25 (patch) | |
tree | 68ed7eb187d6f05c4d74a319675cd5ee78e85c5a | |
parent | 1d4706a4910e8120753b3dc6c1740c405964e6c3 (diff) | |
download | thunar-93303151d1f69d6306f92a540991217a9b79cc25.tar.gz |
2006-01-04 Benedikt Meurer <benny@xfce.org>
* thunar/Makefile.am, thunar/thunar-pango-extensions.{c,h}: Add common
PangoAttrList's here, to avoid allocating them over and over again,
and of course to avoid markup, which makes translator's life easier.
* thunar/thunar-location-buttons.c, thunar/thunar-preferences-dialog.c,
thunar/thunar-progress-dialog.c, thunar/thunar-properties-dialog.c:
Use common PangoAttrList's provided by the thunar-pango-extensions.
* thunar/thunar-permissions-view.c(thunar_permissions_view_init): Use
italic font for the warning to make it easier to distinguish the text
from the other parts of the GUI.
* thunar/thunar-chooser-dialog.c(thunar_chooser_dialog_update_header):
Also setup the window icon in addition to the header image icon.
(Old svn revision: 19299)
-rw-r--r-- | ChangeLog | 14 | ||||
-rw-r--r-- | thunar/Makefile.am | 2 | ||||
-rw-r--r-- | thunar/thunar-chooser-dialog.c | 1 | ||||
-rw-r--r-- | thunar/thunar-location-buttons.c | 20 | ||||
-rw-r--r-- | thunar/thunar-pango-extensions.c | 105 | ||||
-rw-r--r-- | thunar/thunar-pango-extensions.h | 33 | ||||
-rw-r--r-- | thunar/thunar-permissions-view.c | 2 | ||||
-rw-r--r-- | thunar/thunar-preferences-dialog.c | 7 | ||||
-rw-r--r-- | thunar/thunar-progress-dialog.c | 18 | ||||
-rw-r--r-- | thunar/thunar-properties-dialog.c | 38 |
10 files changed, 184 insertions, 56 deletions
@@ -1,5 +1,19 @@ 2006-01-04 Benedikt Meurer <benny@xfce.org> + * thunar/Makefile.am, thunar/thunar-pango-extensions.{c,h}: Add common + PangoAttrList's here, to avoid allocating them over and over again, + and of course to avoid markup, which makes translator's life easier. + * thunar/thunar-location-buttons.c, thunar/thunar-preferences-dialog.c, + thunar/thunar-progress-dialog.c, thunar/thunar-properties-dialog.c: + Use common PangoAttrList's provided by the thunar-pango-extensions. + * thunar/thunar-permissions-view.c(thunar_permissions_view_init): Use + italic font for the warning to make it easier to distinguish the text + from the other parts of the GUI. + * thunar/thunar-chooser-dialog.c(thunar_chooser_dialog_update_header): + Also setup the window icon in addition to the header image icon. + +2006-01-04 Benedikt Meurer <benny@xfce.org> + * docs/reference/thunar-vfs/thunar-vfs-sections.txt, thunar-vfs/thunar-vfs-info.{c,h}, thunar-vfs/thunar-vfs.symbols, docs/reference/thunar-vfs/tmpl/thunar-vfs-info.sgml: Add method diff --git a/thunar/Makefile.am b/thunar/Makefile.am index a07a2589..27d557a4 100644 --- a/thunar/Makefile.am +++ b/thunar/Makefile.am @@ -89,6 +89,8 @@ Thunar_SOURCES = \ thunar-navigator.h \ thunar-open-with-action.c \ thunar-open-with-action.h \ + thunar-pango-extensions.c \ + thunar-pango-extensions.h \ thunar-path-entry.c \ thunar-path-entry.h \ thunar-permissions-model.c \ diff --git a/thunar/thunar-chooser-dialog.c b/thunar/thunar-chooser-dialog.c index d52048e4..c78431ab 100644 --- a/thunar/thunar-chooser-dialog.c +++ b/thunar/thunar-chooser-dialog.c @@ -605,6 +605,7 @@ thunar_chooser_dialog_update_header (ThunarChooserDialog *dialog) icon_name = thunar_vfs_mime_info_lookup_icon_name (mime_info, icon_theme); icon = thunar_icon_factory_load_icon (icon_factory, icon_name, 48, NULL, FALSE); gtk_image_set_from_pixbuf (GTK_IMAGE (dialog->header_image), icon); + gtk_window_set_icon (GTK_WINDOW (dialog), icon); if (G_LIKELY (icon != NULL)) g_object_unref (G_OBJECT (icon)); diff --git a/thunar/thunar-location-buttons.c b/thunar/thunar-location-buttons.c index e5b774c8..f48a4b6c 100644 --- a/thunar/thunar-location-buttons.c +++ b/thunar/thunar-location-buttons.c @@ -33,6 +33,7 @@ #include <thunar/thunar-icon-factory.h> #include <thunar/thunar-location-buttons.h> +#include <thunar/thunar-pango-extensions.h> @@ -139,8 +140,6 @@ struct _ThunarLocationButtons ThunarFile *current_directory; - PangoAttrList *attr_list_bold; - gint slider_width; gboolean ignore_click : 1; @@ -284,8 +283,7 @@ thunar_location_buttons_location_bar_init (ThunarLocationBarIface *iface) static void thunar_location_buttons_init (ThunarLocationButtons *buttons) { - PangoAttribute *attribute; - GtkWidget *arrow; + GtkWidget *arrow; GTK_WIDGET_SET_FLAGS (buttons, GTK_NO_WINDOW); gtk_widget_set_redraw_on_allocate (GTK_WIDGET (buttons), FALSE); @@ -293,13 +291,6 @@ thunar_location_buttons_init (ThunarLocationButtons *buttons) buttons->enter_timeout_id = -1; buttons->scroll_timeout_id = -1; - /* pre-allocate a pango attr list for bold labels */ - buttons->attr_list_bold = pango_attr_list_new (); - attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD); - attribute->start_index = 0; - attribute->end_index = -1; - pango_attr_list_insert (buttons->attr_list_bold, attribute); - gtk_widget_push_composite_child (); buttons->left_slider = gtk_button_new (); @@ -352,9 +343,6 @@ thunar_location_buttons_finalize (GObject *object) /* release from the current_directory */ thunar_navigator_set_current_directory (THUNAR_NAVIGATOR (buttons), NULL); - /* release the pre-allocated bold attribute list */ - pango_attr_list_unref (buttons->attr_list_bold); - (*G_OBJECT_CLASS (thunar_location_buttons_parent_class)->finalize) (object); } @@ -909,7 +897,7 @@ thunar_location_buttons_make_button (ThunarLocationButtons *buttons, /* current directory gets a bold label */ if (file == buttons->current_directory) - gtk_label_set_attributes (GTK_LABEL (label), buttons->attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); } /* the current directory is toggled */ @@ -1176,7 +1164,7 @@ thunar_location_buttons_clicked (GtkWidget *button, { /* current directory gets a bold label */ if (directory == buttons->current_directory) - gtk_label_set_attributes (GTK_LABEL (label), buttons->attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); else gtk_label_set_attributes (GTK_LABEL (label), NULL); } diff --git a/thunar/thunar-pango-extensions.c b/thunar/thunar-pango-extensions.c new file mode 100644 index 00000000..4e1090fc --- /dev/null +++ b/thunar/thunar-pango-extensions.c @@ -0,0 +1,105 @@ +/* $Id$ */ +/*- + * Copyright (c) 2006 Benedikt Meurer <benny@xfce.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifdef HAVE_CONFIG_H +#include <config.h> +#endif + +#include <thunar/thunar-pango-extensions.h> + + + +static PangoAttrList *thunar_pango_attr_list_wrap (PangoAttribute *attribute) G_GNUC_MALLOC; + + + +static PangoAttrList* +thunar_pango_attr_list_wrap (PangoAttribute *attribute) +{ + PangoAttrList *attr_list; + + attr_list = pango_attr_list_new (); + attribute->start_index = 0; + attribute->end_index = -1; + pango_attr_list_insert (attr_list, attribute); + + return attr_list; +} + + + +/** + * thunar_pango_attr_list_big: + * + * Returns a #PangoAttrList for rendering big text. + * The returned list is owned by the callee and must + * not be freed or modified by the caller. + * + * Return value: a #PangoAttrList for rendering big text. + **/ +PangoAttrList* +thunar_pango_attr_list_big (void) +{ + static PangoAttrList *attr_list = NULL; + if (G_UNLIKELY (attr_list == NULL)) + attr_list = thunar_pango_attr_list_wrap (pango_attr_scale_new (PANGO_SCALE_LARGE)); + return attr_list; +} + + + +/** + * thunar_pango_attr_list_bold: + * + * Returns a #PangoAttrList for rendering bold text. + * The returned list is owned by the callee and must + * not be freed or modified by the caller. + * + * Return value: a #PangoAttrList for rendering bold text. + **/ +PangoAttrList* +thunar_pango_attr_list_bold (void) +{ + static PangoAttrList *attr_list = NULL; + if (G_UNLIKELY (attr_list == NULL)) + attr_list = thunar_pango_attr_list_wrap (pango_attr_weight_new (PANGO_WEIGHT_BOLD)); + return attr_list; +} + + + +/** + * thunar_pango_attr_list_italic: + * + * Returns a #PangoAttrList for rendering italic text. + * The returned list is owned by the callee and must + * not be freed or modified by the caller. + * + * Return value: a #PangoAttrList for rendering italic text. + **/ +PangoAttrList* +thunar_pango_attr_list_italic (void) +{ + static PangoAttrList *attr_list = NULL; + if (G_UNLIKELY (attr_list == NULL)) + attr_list = thunar_pango_attr_list_wrap (pango_attr_style_new (PANGO_STYLE_ITALIC)); + return attr_list; +} + + diff --git a/thunar/thunar-pango-extensions.h b/thunar/thunar-pango-extensions.h new file mode 100644 index 00000000..8b95f42d --- /dev/null +++ b/thunar/thunar-pango-extensions.h @@ -0,0 +1,33 @@ +/* $Id$ */ +/*- + * Copyright (c) 2006 Benedikt Meurer <benny@xfce.org> + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License as published by the Free + * Software Foundation; either version 2 of the License, or (at your option) + * any later version. + * + * This program 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 General Public License for + * more details. + * + * You should have received a copy of the GNU General Public License along with + * this program; if not, write to the Free Software Foundation, Inc., 59 Temple + * Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef __THUNAR_PANGO_EXTENSIONS_H__ +#define __THUNAR_PANGO_EXTENSIONS_H__ + +#include <pango/pango.h> + +G_BEGIN_DECLS; + +PangoAttrList *thunar_pango_attr_list_big (void) G_GNUC_CONST G_GNUC_INTERNAL; +PangoAttrList *thunar_pango_attr_list_bold (void) G_GNUC_CONST G_GNUC_INTERNAL; +PangoAttrList *thunar_pango_attr_list_italic (void) G_GNUC_CONST G_GNUC_INTERNAL; + +G_END_DECLS; + +#endif /* !__THUNAR_PANGO_EXTENSIONS_H__ */ diff --git a/thunar/thunar-permissions-view.c b/thunar/thunar-permissions-view.c index 77d00055..dcb2e0dd 100644 --- a/thunar/thunar-permissions-view.c +++ b/thunar/thunar-permissions-view.c @@ -23,6 +23,7 @@ #include <thunar/thunar-advanced-permissions-dialog.h> #include <thunar/thunar-dialogs.h> +#include <thunar/thunar-pango-extensions.h> #include <thunar/thunar-permissions-model.h> #include <thunar/thunar-permissions-view.h> @@ -241,6 +242,7 @@ thunar_permissions_view_init (ThunarPermissionsView *view) gtk_widget_show (image); label = gtk_label_new (_("You are not the owner of this file, so\nyou cannot change these permissions.")); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_italic ()); gtk_misc_set_alignment (GTK_MISC (label), 0.0f, 0.5f); gtk_box_pack_start (GTK_BOX (hbox), label, TRUE, TRUE, 0); gtk_widget_show (label); diff --git a/thunar/thunar-preferences-dialog.c b/thunar/thunar-preferences-dialog.c index a50a773a..9b9a88c5 100644 --- a/thunar/thunar-preferences-dialog.c +++ b/thunar/thunar-preferences-dialog.c @@ -27,6 +27,7 @@ #include <thunar/thunar-details-view.h> #include <thunar/thunar-icon-view.h> +#include <thunar/thunar-pango-extensions.h> #include <thunar/thunar-preferences-dialog.h> #include <thunar/thunar-preferences.h> @@ -197,7 +198,8 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog) gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_widget_show (frame); - label = g_object_new (GTK_TYPE_LABEL, "label", _("<b>Default View</b>"), "use-markup", TRUE, NULL); + label = gtk_label_new (_("Default View")); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_frame_set_label_widget (GTK_FRAME (frame), label); gtk_widget_show (label); @@ -248,7 +250,8 @@ thunar_preferences_dialog_init (ThunarPreferencesDialog *dialog) gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, TRUE, 0); gtk_widget_show (frame); - label = g_object_new (GTK_TYPE_LABEL, "label", _("<b>Icon View</b>"), "use-markup", TRUE, NULL); + label = gtk_label_new (_("Icon View")); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_frame_set_label_widget (GTK_FRAME (frame), label); gtk_widget_show (label); diff --git a/thunar/thunar-progress-dialog.c b/thunar/thunar-progress-dialog.c index 44e79879..d5e1ae90 100644 --- a/thunar/thunar-progress-dialog.c +++ b/thunar/thunar-progress-dialog.c @@ -25,6 +25,7 @@ #include <time.h> #endif +#include <thunar/thunar-pango-extensions.h> #include <thunar/thunar-progress-dialog.h> @@ -158,11 +159,9 @@ thunar_progress_dialog_class_init (ThunarProgressDialogClass *klass) static void thunar_progress_dialog_init (ThunarProgressDialog *dialog) { - PangoAttribute *attribute; - PangoAttrList *attr_list_big; - GtkWidget *table; - GtkWidget *image; - GtkWidget *label; + GtkWidget *table; + GtkWidget *image; + GtkWidget *label; /* remember the current time as start time */ g_get_current_time (&dialog->start_time); @@ -187,17 +186,10 @@ thunar_progress_dialog_init (ThunarProgressDialog *dialog) gtk_widget_show (image); label = g_object_new (GTK_TYPE_LABEL, "xalign", 0.0f, NULL); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_big ()); gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 6); gtk_widget_show (label); - attr_list_big = pango_attr_list_new (); - attribute = pango_attr_scale_new (PANGO_SCALE_LARGE); - attribute->start_index = 0; - attribute->end_index = -1; - pango_attr_list_insert (attr_list_big, attribute); - gtk_label_set_attributes (GTK_LABEL (label), attr_list_big); - pango_attr_list_unref (attr_list_big); - dialog->progress_label = g_object_new (EXO_TYPE_ELLIPSIZED_LABEL, "ellipsize", EXO_PANGO_ELLIPSIZE_START, "xalign", 0.0f, NULL); gtk_table_attach (GTK_TABLE (table), dialog->progress_label, 0, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (dialog->progress_label); diff --git a/thunar/thunar-properties-dialog.c b/thunar/thunar-properties-dialog.c index 7202619f..5adff7e9 100644 --- a/thunar/thunar-properties-dialog.c +++ b/thunar/thunar-properties-dialog.c @@ -33,6 +33,7 @@ #include <thunar/thunar-dialogs.h> #include <thunar/thunar-emblem-chooser.h> #include <thunar/thunar-icon-factory.h> +#include <thunar/thunar-pango-extensions.h> #include <thunar/thunar-permissions-view.h> #include <thunar/thunar-properties-dialog.h> @@ -180,26 +181,17 @@ thunar_properties_dialog_class_init (ThunarPropertiesDialogClass *klass) static void thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) { - PangoAttribute *attribute; - PangoAttrList *attr_list_bold; - GtkWidget *chooser; - GtkWidget *table; - GtkWidget *label; - GtkWidget *box; - GtkWidget *spacer; - gint row = 0; + GtkWidget *chooser; + GtkWidget *table; + GtkWidget *label; + GtkWidget *box; + GtkWidget *spacer; + gint row = 0; dialog->provider_factory = thunarx_provider_factory_get_default (); dialog->volume_manager = thunar_vfs_volume_manager_get_default (); dialog->rename_idle_id = -1; - /* allocate shared pango attribute list for bold labels */ - attr_list_bold = pango_attr_list_new (); - attribute = pango_attr_weight_new (PANGO_WEIGHT_BOLD); - attribute->start_index = 0; - attribute->end_index = -1; - pango_attr_list_insert (attr_list_bold, attribute); - gtk_dialog_add_buttons (GTK_DIALOG (dialog), GTK_STOCK_HELP, GTK_RESPONSE_HELP, GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, @@ -235,7 +227,7 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) gtk_widget_show (dialog->icon_image); label = gtk_label_new (_("Name:")); - gtk_label_set_attributes (GTK_LABEL (label), attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0); gtk_widget_show (label); @@ -260,7 +252,7 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) Second box (kind) */ label = gtk_label_new (_("Kind:")); - gtk_label_set_attributes (GTK_LABEL (label), attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); exo_binding_new (G_OBJECT (label), "visible", G_OBJECT (spacer), "visible"); gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); @@ -285,7 +277,7 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) Third box (modified, accessed) */ label = gtk_label_new (_("Modified:")); - gtk_label_set_attributes (GTK_LABEL (label), attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); @@ -298,7 +290,7 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) ++row; label = gtk_label_new (_("Accessed:")); - gtk_label_set_attributes (GTK_LABEL (label), attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); @@ -322,7 +314,7 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) Fourth box (volume, size) */ label = gtk_label_new (_("Volume:")); - gtk_label_set_attributes (GTK_LABEL (label), attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); @@ -345,7 +337,7 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) ++row; label = gtk_label_new (_("Size:")); - gtk_label_set_attributes (GTK_LABEL (label), attr_list_bold); + gtk_label_set_attributes (GTK_LABEL (label), thunar_pango_attr_list_bold ()); gtk_misc_set_alignment (GTK_MISC (label), 1.0f, 0.5f); gtk_table_attach (GTK_TABLE (table), label, 0, 1, row, row + 1, GTK_FILL, GTK_FILL, 0, 0); gtk_widget_show (label); @@ -385,10 +377,6 @@ thunar_properties_dialog_init (ThunarPropertiesDialog *dialog) gtk_notebook_append_page (GTK_NOTEBOOK (dialog->notebook), chooser, label); gtk_widget_show (chooser); gtk_widget_show (label); - - - /* release the shared pango attribute list */ - pango_attr_list_unref (attr_list_bold); } |