[gnome-control-center] Tighten up the spacing of the category views
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-control-center] Tighten up the spacing of the category views
- Date: Sun, 31 Oct 2010 17:32:50 +0000 (UTC)
commit b9b2767d3325af779351470d99df8075a0167779
Author: William Jon McCann <jmccann redhat com>
Date: Sat Oct 30 23:40:32 2010 -0400
Tighten up the spacing of the category views
shell/cc-shell-category-view.c | 65 ++++++++++-----------------------------
shell/gnome-control-center.c | 3 +-
2 files changed, 19 insertions(+), 49 deletions(-)
---
diff --git a/shell/cc-shell-category-view.c b/shell/cc-shell-category-view.c
index 0436954..503b1e7 100644
--- a/shell/cc-shell-category-view.c
+++ b/shell/cc-shell-category-view.c
@@ -38,8 +38,6 @@ struct _CcShellCategoryViewPrivate
{
gchar *name;
GtkTreeModel *model;
-
- GtkWidget *header;
GtkWidget *iconview;
};
@@ -120,8 +118,8 @@ static void
cc_shell_category_view_constructed (GObject *object)
{
CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (object)->priv;
- gchar *header_name;
- GtkWidget *iconview, *vbox, *header, *self;
+ GtkWidget *iconview, *vbox, *self;
+ GtkWidget *alignment;
self = GTK_WIDGET (object);
@@ -132,67 +130,40 @@ cc_shell_category_view_constructed (GObject *object)
gtk_icon_view_set_pixbuf_column (GTK_ICON_VIEW (iconview), COL_PIXBUF);
gtk_icon_view_set_text_column (GTK_ICON_VIEW (iconview), COL_NAME);
- gtk_icon_view_set_item_width (GTK_ICON_VIEW (iconview), 120);
+ gtk_icon_view_set_item_width (GTK_ICON_VIEW (iconview), 100);
/* create the header if required */
if (priv->name)
{
- header_name = g_strdup_printf ("<b>%s</b>", priv->name);
-
- header = g_object_new (GTK_TYPE_LABEL,
- "use-markup", TRUE,
- "label", header_name,
- "wrap", TRUE,
- "xalign", 0.0,
- "xpad", 6,
- NULL);
-
- g_free (header_name);
- gtk_box_pack_start (GTK_BOX (vbox), header, FALSE, TRUE, 3);
-
- priv->header = header;
+ GtkWidget *label;
+ PangoAttrList *attrs;
+
+ label = gtk_label_new (priv->name);
+ attrs = pango_attr_list_new ();
+ pango_attr_list_insert (attrs, pango_attr_weight_new (PANGO_WEIGHT_BOLD));
+ gtk_label_set_attributes (GTK_LABEL (label), attrs);
+ pango_attr_list_unref (attrs);
+ gtk_frame_set_label_widget (GTK_FRAME (object), label);
}
/* add the iconview to the vbox */
gtk_box_pack_start (GTK_BOX (vbox), iconview, FALSE, TRUE, 0);
/* add the main vbox to the view */
- gtk_container_add (GTK_CONTAINER (object), vbox);
- gtk_widget_show_all (vbox);
+ alignment = gtk_alignment_new (0, 0, 1, 1);
+ gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 12, 0);
+ gtk_container_add (GTK_CONTAINER (alignment), vbox);
+ gtk_container_add (GTK_CONTAINER (object), alignment);
+ gtk_widget_show_all (alignment);
priv->iconview = iconview;
}
static void
-cc_shell_category_view_style_set (GtkWidget *widget,
- GtkStyle *old_style)
-{
- CcShellCategoryViewPrivate *priv = CC_SHELL_CATEGORY_VIEW (widget)->priv;
- GtkStyle *style = gtk_widget_get_style (widget);
-
- if (priv->header)
- {
- gtk_widget_modify_bg (priv->header, GTK_STATE_NORMAL,
- &style->base[GTK_STATE_NORMAL]);
- gtk_widget_modify_fg (priv->header, GTK_STATE_NORMAL,
- &style->text[GTK_STATE_NORMAL]);
- }
-
- if (priv->iconview)
- {
- gtk_widget_modify_bg (priv->iconview, GTK_STATE_NORMAL,
- &style->base[GTK_STATE_NORMAL]);
- gtk_widget_modify_fg (priv->iconview, GTK_STATE_NORMAL,
- &style->text[GTK_STATE_NORMAL]);
- }
-}
-
-static void
cc_shell_category_view_class_init (CcShellCategoryViewClass *klass)
{
GParamSpec *pspec;
GObjectClass *object_class = G_OBJECT_CLASS (klass);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
g_type_class_add_private (klass, sizeof (CcShellCategoryViewPrivate));
@@ -202,8 +173,6 @@ cc_shell_category_view_class_init (CcShellCategoryViewClass *klass)
object_class->finalize = cc_shell_category_view_finalize;
object_class->constructed = cc_shell_category_view_constructed;
- widget_class->style_set = cc_shell_category_view_style_set;
-
pspec = g_param_spec_string ("name",
"Name",
"Name of the category",
diff --git a/shell/gnome-control-center.c b/shell/gnome-control-center.c
index 0ce0844..2d120f4 100644
--- a/shell/gnome-control-center.c
+++ b/shell/gnome-control-center.c
@@ -607,6 +607,7 @@ fill_model (GnomeControlCenter *shell)
GnomeControlCenterPrivate *priv = shell->priv;
vbox = W (priv->builder, "main-vbox");
+ gtk_container_set_border_width (GTK_CONTAINER (vbox), 10);
sw = W (priv->builder, "scrolledwindow1");
gtk_container_set_focus_vadjustment (GTK_CONTAINER (vbox),
gtk_scrolled_window_get_vadjustment (GTK_SCROLLED_WINDOW (sw)));
@@ -648,7 +649,7 @@ fill_model (GnomeControlCenter *shell)
g_strdup (dir_name), g_free);
categoryview = cc_shell_category_view_new (dir_name, filter);
- gtk_box_pack_start (GTK_BOX (vbox), categoryview, FALSE, TRUE, 6);
+ gtk_box_pack_start (GTK_BOX (vbox), categoryview, FALSE, TRUE, 0);
g_signal_connect (cc_shell_category_view_get_item_view (CC_SHELL_CATEGORY_VIEW (categoryview)),
"desktop-item-activated",
G_CALLBACK (item_activated_cb), shell);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]