diff options
Diffstat (limited to 'src/ui/preview-widget.c')
-rw-r--r-- | src/ui/preview-widget.c | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/src/ui/preview-widget.c b/src/ui/preview-widget.c index 9e592cdc..5b008fa2 100644 --- a/src/ui/preview-widget.c +++ b/src/ui/preview-widget.c @@ -2,9 +2,9 @@ /* Marco theme preview widget */ -/* +/* * Copyright (C) 2002 Havoc Pennington - * + * * 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 @@ -14,7 +14,7 @@ * 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., 51 Franklin St, Fifth Floor, Boston, MA @@ -122,7 +122,7 @@ static void meta_preview_init (MetaPreview *preview) { int i; - + gtk_widget_set_has_window (GTK_WIDGET (preview), FALSE); i = 0; @@ -132,13 +132,13 @@ meta_preview_init (MetaPreview *preview) preview->button_layout.right_buttons[i] = META_BUTTON_FUNCTION_LAST; ++i; } - + preview->button_layout.left_buttons[0] = META_BUTTON_FUNCTION_MENU; preview->button_layout.right_buttons[0] = META_BUTTON_FUNCTION_MINIMIZE; preview->button_layout.right_buttons[1] = META_BUTTON_FUNCTION_MAXIMIZE; preview->button_layout.right_buttons[2] = META_BUTTON_FUNCTION_CLOSE; - + preview->type = META_FRAME_TYPE_NORMAL; preview->flags = META_FRAME_ALLOWS_DELETE | @@ -150,7 +150,7 @@ meta_preview_init (MetaPreview *preview) META_FRAME_HAS_FOCUS | META_FRAME_ALLOWS_SHADE | META_FRAME_ALLOWS_MOVE; - + preview->left_width = -1; preview->right_width = -1; preview->top_height = -1; @@ -161,13 +161,13 @@ GtkWidget* meta_preview_new (void) { MetaPreview *preview; - + #if GTK_CHECK_VERSION(3, 0, 0) preview = g_object_new (META_TYPE_PREVIEW, NULL); #else preview = gtk_type_new (META_TYPE_PREVIEW); #endif - + return GTK_WIDGET (preview); } @@ -180,7 +180,7 @@ meta_preview_finalize (GObject *object) g_free (preview->title); preview->title = NULL; - + G_OBJECT_CLASS (parent_class)->finalize (object); } @@ -190,7 +190,7 @@ ensure_info (MetaPreview *preview) GtkWidget *widget; widget = GTK_WIDGET (preview); - + if (preview->layout == NULL) { PangoFontDescription *font_desc; @@ -198,34 +198,34 @@ ensure_info (MetaPreview *preview) PangoAttrList *attrs; PangoAttribute *attr; - if (preview->theme) + if (preview->theme) scale = meta_theme_get_title_scale (preview->theme, preview->type, preview->flags); else scale = 1.0; - + preview->layout = gtk_widget_create_pango_layout (widget, preview->title); - + font_desc = meta_gtk_widget_get_font_desc (widget, scale, NULL); - + preview->text_height = meta_pango_font_desc_get_text_height (font_desc, gtk_widget_get_pango_context (widget)); - + attrs = pango_attr_list_new (); - + attr = pango_attr_size_new (pango_font_description_get_size (font_desc)); attr->start_index = 0; attr->end_index = G_MAXINT; - + pango_attr_list_insert (attrs, attr); - + pango_layout_set_attributes (preview->layout, attrs); - - pango_attr_list_unref (attrs); - + + pango_attr_list_unref (attrs); + pango_font_description_free (font_desc); } @@ -341,7 +341,7 @@ meta_preview_draw(GtkWidget *widget, META_BUTTON_STATE_NORMAL, META_BUTTON_STATE_NORMAL }; - + g_return_val_if_fail (META_IS_PREVIEW (widget), FALSE); preview = META_PREVIEW (widget); @@ -351,7 +351,7 @@ meta_preview_draw(GtkWidget *widget, cairo_save (cr); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - + gtk_widget_get_allocation (widget, &allocation); client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2; client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2; @@ -359,8 +359,8 @@ meta_preview_draw(GtkWidget *widget, if (client_width < 0) client_width = 1; if (client_height < 0) - client_height = 1; - + client_height = 1; + if (preview->theme) { border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); @@ -403,7 +403,7 @@ meta_preview_expose (GtkWidget *widget, META_BUTTON_STATE_NORMAL, META_BUTTON_STATE_NORMAL }; - + g_return_val_if_fail (META_IS_PREVIEW (widget), FALSE); g_return_val_if_fail (event != NULL, FALSE); @@ -412,7 +412,7 @@ meta_preview_expose (GtkWidget *widget, ensure_info (preview); border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - + gtk_widget_get_allocation (widget, &allocation); client_width = allocation.width - preview->left_width - preview->right_width - border_width * 2; client_height = allocation.height - preview->top_height - preview->bottom_height - border_width * 2; @@ -420,12 +420,12 @@ meta_preview_expose (GtkWidget *widget, if (client_width < 0) client_width = 1; if (client_height < 0) - client_height = 1; - + client_height = 1; + if (preview->theme) { border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - + meta_theme_draw_frame (preview->theme, widget, gtk_widget_get_window (widget), @@ -464,7 +464,7 @@ meta_preview_size_request (GtkWidget *widget, req->width = preview->left_width + preview->right_width; req->height = preview->top_height + preview->bottom_height; - + child = gtk_bin_get_child (GTK_BIN (preview)); if (child && gtk_widget_get_visible (child)) @@ -500,11 +500,11 @@ meta_preview_size_allocate (GtkWidget *widget, GtkAllocation child_allocation; #endif GtkWidget *child; - + preview = META_PREVIEW (widget); ensure_info (preview); - + #if GTK_CHECK_VERSION(3, 0, 0) gtk_widget_set_allocation (widget, allocation); #else @@ -512,7 +512,7 @@ meta_preview_size_allocate (GtkWidget *widget, #endif border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); - + child = gtk_bin_get_child (GTK_BIN (widget)); if (child && gtk_widget_get_visible (child)) @@ -521,13 +521,13 @@ meta_preview_size_allocate (GtkWidget *widget, gtk_widget_get_allocation (widget, &widget_allocation); child_allocation.x = widget_allocation.x + border_width + preview->left_width; child_allocation.y = widget_allocation.y + border_width + preview->top_height; - + child_allocation.width = MAX (1, widget_allocation.width - border_width * 2 - preview->left_width - preview->right_width); child_allocation.height = MAX (1, widget_allocation.height - border_width * 2 - preview->top_height - preview->bottom_height); #else child_allocation.x = allocation->x + border_width + preview->left_width; child_allocation.y = allocation->y + border_width + preview->top_height; - + child_allocation.width = MAX (1, allocation->width - border_width * 2 - preview->left_width - preview->right_width); child_allocation.height = MAX (1, allocation->height - border_width * 2 - preview->top_height - preview->bottom_height); #endif @@ -557,7 +557,7 @@ meta_preview_set_theme (MetaPreview *preview, g_return_if_fail (META_IS_PREVIEW (preview)); preview->theme = theme; - + clear_cache (preview); gtk_widget_queue_resize (GTK_WIDGET (preview)); @@ -571,7 +571,7 @@ meta_preview_set_title (MetaPreview *preview, g_free (preview->title); preview->title = g_strdup (title); - + clear_cache (preview); gtk_widget_queue_resize (GTK_WIDGET (preview)); @@ -608,9 +608,9 @@ meta_preview_set_button_layout (MetaPreview *preview, const MetaButtonLayout *button_layout) { g_return_if_fail (META_IS_PREVIEW (preview)); - - preview->button_layout = *button_layout; - + + preview->button_layout = *button_layout; + gtk_widget_queue_draw (GTK_WIDGET (preview)); } @@ -643,7 +643,7 @@ meta_preview_get_icon (void) g_assert (default_icon); } - + return default_icon; } @@ -676,7 +676,7 @@ meta_preview_get_mini_icon (void) g_assert (default_icon); } - + return default_icon; } |