[gthumb] empty list: fix the widget style using the css



commit a6e43298d0dd2212d4210cb507c77d33318f14ae
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Oct 31 14:03:04 2012 +0100

    empty list: fix the widget style using the css
    
    using a scrolled window as parent causes some problems

 gthumb/gth-empty-list.c     |   30 ++++++++++++++----------------
 gthumb/gth-empty-list.h     |    6 +++---
 gthumb/resources/gthumb.css |   11 +++++++++++
 3 files changed, 28 insertions(+), 19 deletions(-)
---
diff --git a/gthumb/gth-empty-list.c b/gthumb/gth-empty-list.c
index dc60391..d81b7f6 100644
--- a/gthumb/gth-empty-list.c
+++ b/gthumb/gth-empty-list.c
@@ -33,11 +33,11 @@ struct _GthEmptyListPrivate {
 };
 
 
-G_DEFINE_TYPE (GthEmptyList, gth_empty_list, GTK_TYPE_SCROLLED_WINDOW)
+G_DEFINE_TYPE (GthEmptyList, gth_empty_list, GTK_TYPE_WIDGET)
 
 
-static void 
-gth_empty_list_finalize (GObject *obj) 
+static void
+gth_empty_list_finalize (GObject *obj)
 {
 	g_free (GTH_EMPTY_LIST (obj)->priv->text);
 	G_OBJECT_CLASS (gth_empty_list_parent_class)->finalize (obj);
@@ -137,7 +137,7 @@ gth_empty_list_realize (GtkWidget *widget)
 
 	style_context = gtk_widget_get_style_context (widget);
 	gtk_style_context_set_background (style_context, window);
-	
+
 	/* 'No Image' message Layout */
 
 	if (self->priv->layout != NULL)
@@ -163,9 +163,7 @@ gth_empty_list_unrealize (GtkWidget *widget)
 		self->priv->layout = NULL;
 	}
 
-	/* note the use of g_type_class_peek_parent to skip GtkScrolledWindow::unrealize */
-
-	GTK_WIDGET_CLASS (g_type_class_peek_parent (gth_empty_list_parent_class))->unrealize (widget);
+	GTK_WIDGET_CLASS (gth_empty_list_parent_class)->unrealize (widget);
 }
 
 
@@ -250,19 +248,19 @@ gth_empty_list_button_press (GtkWidget      *widget,
 }
 
 
-static void 
-gth_empty_list_class_init (GthEmptyListClass *klass) 
+static void
+gth_empty_list_class_init (GthEmptyListClass *klass)
 {
 	GObjectClass   *object_class;
 	GtkWidgetClass *widget_class;
-	
+
 	g_type_class_add_private (klass, sizeof (GthEmptyListPrivate));
 
 	object_class = (GObjectClass*) (klass);
 	object_class->set_property = gth_empty_list_set_property;
 	object_class->get_property = gth_empty_list_get_property;
 	object_class->finalize = gth_empty_list_finalize;
-	
+
 	widget_class = (GtkWidgetClass*) klass;
 	widget_class->realize = gth_empty_list_realize;
 	widget_class->unrealize = gth_empty_list_unrealize;
@@ -273,7 +271,7 @@ gth_empty_list_class_init (GthEmptyListClass *klass)
 	widget_class->button_press_event = gth_empty_list_button_press;
 
 	/* properties */
-	
+
 	g_object_class_install_property (object_class,
 					 PROP_TEXT,
 					 g_param_spec_string ("text",
@@ -284,7 +282,7 @@ gth_empty_list_class_init (GthEmptyListClass *klass)
 }
 
 
-static void 
+static void
 gth_empty_list_init (GthEmptyList *self)
 {
 	GtkStyleContext *style_context;
@@ -303,15 +301,15 @@ gth_empty_list_init (GthEmptyList *self)
 
 
 GtkWidget *
-gth_empty_list_new (const char *text) 
+gth_empty_list_new (const char *text)
 {
 	return g_object_new (GTH_TYPE_EMPTY_LIST, "text", text, NULL);
 }
 
 
-void 
+void
 gth_empty_list_set_text (GthEmptyList *self,
-			 const char   *text) 
+			 const char   *text)
 {
 	g_object_set (self, "text", text, NULL);
 }
diff --git a/gthumb/gth-empty-list.h b/gthumb/gth-empty-list.h
index 912548c..2f774be 100644
--- a/gthumb/gth-empty-list.h
+++ b/gthumb/gth-empty-list.h
@@ -42,17 +42,17 @@ typedef struct _GthEmptyListClass GthEmptyListClass;
 typedef struct _GthEmptyListPrivate GthEmptyListPrivate;
 
 struct _GthEmptyList {
-	GtkScrolledWindow parent_instance;
+	GtkWidget parent_instance;
 	GthEmptyListPrivate * priv;
 };
 
 struct _GthEmptyListClass {
-	GtkScrolledWindowClass parent_class;
+	GtkWidgetClass parent_class;
 };
 
 GType        gth_empty_list_get_type  (void);
 GtkWidget *  gth_empty_list_new       (const char   *text);
-void         gth_empty_list_set_text  (GthEmptyList *self, 
+void         gth_empty_list_set_text  (GthEmptyList *self,
 				       const char   *text);
 
 G_END_DECLS
diff --git a/gthumb/resources/gthumb.css b/gthumb/resources/gthumb.css
index d702d01..7e00971 100644
--- a/gthumb/resources/gthumb.css
+++ b/gthumb/resources/gthumb.css
@@ -2,3 +2,14 @@ GthColorScale.trough.color {
 	box-shadow: none;
 	background: transparent;
 }
+GthEmptyList.frame {
+	border-style: solid;
+	border-color: @borders;
+	border-width: 1px;
+	border-radius: 2px;
+	padding: 0;
+}
+
+GthEmptyList.frame:backdrop {
+	border-color: @unfocused_borders;
+}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]