summaryrefslogtreecommitdiff
path: root/mate-panel/panel-separator.c
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-11-22 18:30:38 +0100
committerinfirit <[email protected]>2014-11-22 18:43:04 +0100
commit232713d42e79c519cfb060bb286e4cd600678559 (patch)
tree10f856f9c23aef8c83a107f457f6864b548f5e2c /mate-panel/panel-separator.c
parent1b0b03e09e3910280c1734475f0b0ac4122fcfca (diff)
downloadmate-panel-232713d42e79c519cfb060bb286e4cd600678559.tar.bz2
mate-panel-232713d42e79c519cfb060bb286e4cd600678559.tar.xz
Gtk3: Sync get_preferred_width/height() usage with gnome-panel
Even tough it works it makes taking code (eg StyleContext) from gnome-panel much easier. Also fixes a bug where applets are not drawn when moved/added.
Diffstat (limited to 'mate-panel/panel-separator.c')
-rw-r--r--mate-panel/panel-separator.c58
1 files changed, 37 insertions, 21 deletions
diff --git a/mate-panel/panel-separator.c b/mate-panel/panel-separator.c
index 022797c6..7233d59a 100644
--- a/mate-panel/panel-separator.c
+++ b/mate-panel/panel-separator.c
@@ -133,6 +133,43 @@ static gboolean panel_separator_expose_event(GtkWidget* widget, GdkEventExpose*
return FALSE;
}
+#if GTK_CHECK_VERSION (3, 0, 0)
+static void
+panel_separator_get_preferred_width (GtkWidget *widget,
+ gint *minimal_width,
+ gint *natural_width)
+{
+ PanelSeparator *separator;
+ int size;
+
+ separator = PANEL_SEPARATOR (widget);
+
+ size = panel_toplevel_get_size (separator->priv->panel->toplevel);
+
+ if (separator->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ *minimal_width = *natural_width = size;
+ else
+ *minimal_width = *natural_width = SEPARATOR_SIZE;
+}
+
+static void
+panel_separator_get_preferred_height (GtkWidget *widget,
+ gint *minimal_height,
+ gint *natural_height)
+{
+ PanelSeparator *separator;
+ int size;
+
+ separator = PANEL_SEPARATOR (widget);
+
+ size = panel_toplevel_get_size (separator->priv->panel->toplevel);
+
+ if (separator->priv->orientation == GTK_ORIENTATION_VERTICAL)
+ *minimal_height = *natural_height = SEPARATOR_SIZE;
+ else
+ *minimal_height = *natural_height = size;
+}
+#else
static void
panel_separator_size_request (GtkWidget *widget,
GtkRequisition *requisition)
@@ -152,27 +189,6 @@ panel_separator_size_request (GtkWidget *widget,
requisition->height = size;
}
}
-
-#if GTK_CHECK_VERSION (3, 0, 0)
-static void
-panel_separator_get_preferred_width (GtkWidget *widget,
- gint *minimum_width,
- gint *natural_width)
-{
- GtkRequisition req;
- panel_separator_size_request (widget, &req);
- *minimum_width = *natural_width = req.width;
-}
-
-static void
-panel_separator_get_preferred_height (GtkWidget *widget,
- gint *minimum_height,
- gint *natural_height)
-{
- GtkRequisition req;
- panel_separator_size_request (widget, &req);
- *minimum_height = *natural_height = req.height;
-}
#endif
static void