diff options
Diffstat (limited to 'pluma/pluma-status-combo-box.c')
-rw-r--r-- | pluma/pluma-status-combo-box.c | 29 |
1 files changed, 27 insertions, 2 deletions
diff --git a/pluma/pluma-status-combo-box.c b/pluma/pluma-status-combo-box.c index c5b8ac3c..aaae9824 100644 --- a/pluma/pluma-status-combo-box.c +++ b/pluma/pluma-status-combo-box.c @@ -26,6 +26,10 @@ #define PLUMA_STATUS_COMBO_BOX_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE((object), PLUMA_TYPE_STATUS_COMBO_BOX, PlumaStatusComboBoxPrivate)) +#if GTK_CHECK_VERSION (3, 0, 0) +#define gtk_hbox_new(X,Y) gtk_box_new(GTK_ORIENTATION_HORIZONTAL,Y) +#endif + struct _PlumaStatusComboBoxPrivate { GtkWidget *frame; @@ -176,8 +180,12 @@ menu_position_func (GtkMenu *menu, GtkAllocation allocation; *push_in = FALSE; - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (gtk_widget_get_toplevel (GTK_WIDGET (menu)), NULL, &request); +#else gtk_widget_size_request (gtk_widget_get_toplevel (GTK_WIDGET (menu)), &request); +#endif /* get the origin... */ gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (combo)), x, y); @@ -201,8 +209,12 @@ button_press_event (GtkWidget *widget, GtkRequisition request; GtkAllocation allocation; gint max_height; - + +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (combo->priv->menu, NULL, &request); +#else gtk_widget_size_request (combo->priv->menu, &request); +#endif gtk_widget_get_allocation (GTK_WIDGET (combo), &allocation); /* do something relative to our own height here, maybe we can do better */ @@ -275,7 +287,11 @@ pluma_status_combo_box_init (PlumaStatusComboBox *self) gtk_widget_show (self->priv->label); gtk_label_set_single_line_mode (GTK_LABEL (self->priv->label), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (self->priv->label, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (self->priv->label), 0.0, 0.5); +#endif gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->label, FALSE, TRUE, 0); @@ -283,13 +299,22 @@ pluma_status_combo_box_init (PlumaStatusComboBox *self) gtk_widget_show (self->priv->item); gtk_label_set_single_line_mode (GTK_LABEL (self->priv->item), TRUE); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (self->priv->item, GTK_ALIGN_START); +#else gtk_misc_set_alignment (GTK_MISC (self->priv->item), 0, 0.5); +#endif gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->item, TRUE, TRUE, 0); self->priv->arrow = gtk_arrow_new (GTK_ARROW_DOWN, GTK_SHADOW_NONE); gtk_widget_show (self->priv->arrow); +#if GTK_CHECK_VERSION (3, 14, 0) + gtk_widget_set_halign (self->priv->arrow, GTK_ALIGN_CENTER); + gtk_widget_set_valign (self->priv->arrow, GTK_ALIGN_CENTER); +#else gtk_misc_set_alignment (GTK_MISC (self->priv->arrow), 0.5, 0.5); +#endif gtk_box_pack_start (GTK_BOX (self->priv->hbox), self->priv->arrow, FALSE, TRUE, 0); |