[gthumb] use a different margin for the properties combobox when it's on the right side



commit ecc383ae7b0e4d7c0059d96a37f4f65b09740bc5
Author: Paolo Bacchilega <paobac src gnome org>
Date:   Wed Nov 16 16:04:24 2011 +0100

    use a different margin for the properties combobox when it's on the right side
    
    use the same margin of the location chooser.

 gthumb/gth-browser.c   |    2 +-
 gthumb/gth-multipage.c |   37 +++++++++++++++++++++++++++++++++++--
 2 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/gthumb/gth-browser.c b/gthumb/gth-browser.c
index b63b75e..f7452b2 100644
--- a/gthumb/gth-browser.c
+++ b/gthumb/gth-browser.c
@@ -4384,7 +4384,7 @@ gth_browser_init (GthBrowser *browser)
 	/* the location combobox */
 
 	browser->priv->location_chooser_container = gtk_alignment_new (0, 0.5, 1.0, 1.0);
-	gtk_alignment_set_padding (GTK_ALIGNMENT (browser->priv->location_chooser_container), 0, 4, 0, 0);
+	gtk_alignment_set_padding (GTK_ALIGNMENT (browser->priv->location_chooser_container), 4, 4, 0, 0);
 	gtk_widget_show (browser->priv->location_chooser_container);
 	gtk_box_pack_start (GTK_BOX (vbox), browser->priv->location_chooser_container, FALSE, FALSE, 0);
 
diff --git a/gthumb/gth-multipage.c b/gthumb/gth-multipage.c
index d314113..5259923 100644
--- a/gthumb/gth-multipage.c
+++ b/gthumb/gth-multipage.c
@@ -86,6 +86,37 @@ combobox_changed_cb (GtkComboBox *widget,
 
 
 static void
+multipage_realize_cb (GtkWidget *widget,
+		      gpointer   user_data)
+{
+	GthMultipage *multipage = user_data;
+	GtkWidget    *orientable_parent;
+
+	orientable_parent = gtk_widget_get_parent (widget);
+	while ((orientable_parent != NULL ) && ! GTK_IS_ORIENTABLE (orientable_parent)) {
+		orientable_parent = gtk_widget_get_parent (orientable_parent);
+	}
+
+	if (orientable_parent == NULL)
+		return;
+
+	switch (gtk_orientable_get_orientation (GTK_ORIENTABLE (orientable_parent))) {
+	case GTK_ORIENTATION_HORIZONTAL:
+		gtk_box_set_spacing (GTK_BOX (multipage), 0);
+		gtk_widget_set_margin_top (multipage->priv->combobox, 4);
+		gtk_widget_set_margin_bottom (multipage->priv->combobox, 4);
+		break;
+
+	case GTK_ORIENTATION_VERTICAL:
+		gtk_box_set_spacing (GTK_BOX (multipage), 6);
+		gtk_widget_set_margin_top (multipage->priv->combobox, 0);
+		gtk_widget_set_margin_bottom (multipage->priv->combobox, 0);
+		break;
+	}
+}
+
+
+static void
 gth_multipage_init (GthMultipage *multipage)
 {
 	GtkCellRenderer *renderer;
@@ -93,8 +124,10 @@ gth_multipage_init (GthMultipage *multipage)
 	multipage->priv = GTH_MULTIPAGE_GET_PRIVATE (multipage);
 	multipage->priv->children = NULL;
 
-	gtk_box_set_spacing (GTK_BOX (multipage), 6);
-
+	g_signal_connect (multipage,
+			  "realize",
+			  G_CALLBACK (multipage_realize_cb),
+			  multipage);
 	multipage->priv->model = gtk_list_store_new (N_COLUMNS,
 						     G_TYPE_STRING,
 						     G_TYPE_STRING);



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