diff options
-rw-r--r-- | mate-volume-control/src/gvc-balance-bar.c | 6 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-balance-bar.h | 8 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-channel-bar.c | 6 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-channel-bar.h | 8 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-combo-box.c | 4 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-combo-box.h | 8 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-level-bar.c | 47 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-level-bar.h | 8 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-mixer-dialog.c | 6 | ||||
-rw-r--r-- | mate-volume-control/src/gvc-stream-status-icon.c | 11 |
10 files changed, 112 insertions, 0 deletions
diff --git a/mate-volume-control/src/gvc-balance-bar.c b/mate-volume-control/src/gvc-balance-bar.c index 0e2e4f4..b4bedf9 100644 --- a/mate-volume-control/src/gvc-balance-bar.c +++ b/mate-volume-control/src/gvc-balance-bar.c @@ -74,7 +74,11 @@ static gboolean on_scale_scroll_event (GtkWidget *widget, static void on_adjustment_value_changed (GtkAdjustment *adjustment, GvcBalanceBar *bar); +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE (GvcBalanceBar, gvc_balance_bar, GTK_TYPE_BOX) +#else G_DEFINE_TYPE (GvcBalanceBar, gvc_balance_bar, GTK_TYPE_HBOX) +#endif static GtkWidget * _scale_box_new (GvcBalanceBar *bar) @@ -139,7 +143,9 @@ _scale_box_new (GvcBalanceBar *bar) bar->priv->end_box = ebox = gtk_hbox_new (FALSE, 6); gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, FALSE, 0); +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_range_set_update_policy (GTK_RANGE (priv->scale), GTK_UPDATE_CONTINUOUS); +#endif ca_gtk_widget_disable_sounds (bar->priv->scale, FALSE); gtk_widget_add_events (bar->priv->scale, GDK_SCROLL_MASK); diff --git a/mate-volume-control/src/gvc-balance-bar.h b/mate-volume-control/src/gvc-balance-bar.h index 53f8c83..bb3b8f7 100644 --- a/mate-volume-control/src/gvc-balance-bar.h +++ b/mate-volume-control/src/gvc-balance-bar.h @@ -46,13 +46,21 @@ typedef struct GvcBalanceBarPrivate GvcBalanceBarPrivate; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox parent; +#else GtkHBox parent; +#endif GvcBalanceBarPrivate *priv; } GvcBalanceBar; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkHBoxClass parent_class; +#endif } GvcBalanceBarClass; GType gvc_balance_bar_get_type (void); diff --git a/mate-volume-control/src/gvc-channel-bar.c b/mate-volume-control/src/gvc-channel-bar.c index 1e75f51..3d21119 100644 --- a/mate-volume-control/src/gvc-channel-bar.c +++ b/mate-volume-control/src/gvc-channel-bar.c @@ -97,7 +97,11 @@ static gboolean on_scale_scroll_event (GtkWidget *widget, GdkEventScroll *event, GvcChannelBar *bar); +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE (GvcChannelBar, gvc_channel_bar, GTK_TYPE_BOX) +#else G_DEFINE_TYPE (GvcChannelBar, gvc_channel_bar, GTK_TYPE_HBOX) +#endif static GtkWidget * _scale_box_new (GvcChannelBar *bar) @@ -157,7 +161,9 @@ _scale_box_new (GvcChannelBar *bar) gtk_box_pack_start (GTK_BOX (ebox), priv->mute_box, FALSE, FALSE, 0); } +#if !GTK_CHECK_VERSION (3, 0, 0) gtk_range_set_update_policy (GTK_RANGE (priv->scale), GTK_UPDATE_CONTINUOUS); +#endif ca_gtk_widget_disable_sounds (bar->priv->scale, FALSE); gtk_widget_add_events (bar->priv->scale, GDK_SCROLL_MASK); diff --git a/mate-volume-control/src/gvc-channel-bar.h b/mate-volume-control/src/gvc-channel-bar.h index 1fa5602..b398756 100644 --- a/mate-volume-control/src/gvc-channel-bar.h +++ b/mate-volume-control/src/gvc-channel-bar.h @@ -36,13 +36,21 @@ typedef struct GvcChannelBarPrivate GvcChannelBarPrivate; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox parent; +#else GtkHBox parent; +#endif GvcChannelBarPrivate *priv; } GvcChannelBar; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkHBoxClass parent_class; +#endif } GvcChannelBarClass; GType gvc_channel_bar_get_type (void); diff --git a/mate-volume-control/src/gvc-combo-box.c b/mate-volume-control/src/gvc-combo-box.c index 2665486..6576efa 100644 --- a/mate-volume-control/src/gvc-combo-box.c +++ b/mate-volume-control/src/gvc-combo-box.c @@ -74,7 +74,11 @@ static void gvc_combo_box_class_init (GvcComboBoxClass *klass); static void gvc_combo_box_init (GvcComboBox *combo_box); static void gvc_combo_box_finalize (GObject *object); +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE (GvcComboBox, gvc_combo_box, GTK_TYPE_BOX) +#else G_DEFINE_TYPE (GvcComboBox, gvc_combo_box, GTK_TYPE_HBOX) +#endif void gvc_combo_box_set_size_group (GvcComboBox *combo_box, diff --git a/mate-volume-control/src/gvc-combo-box.h b/mate-volume-control/src/gvc-combo-box.h index b945ba3..ee18ff8 100644 --- a/mate-volume-control/src/gvc-combo-box.h +++ b/mate-volume-control/src/gvc-combo-box.h @@ -36,13 +36,21 @@ typedef struct GvcComboBoxPrivate GvcComboBoxPrivate; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox parent; +#else GtkHBox parent; +#endif GvcComboBoxPrivate *priv; } GvcComboBox; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkHBoxClass parent_class; +#endif void (* changed) (GvcComboBox *combobox, const char *name); void (* button_clicked) (GvcComboBox *combobox); } GvcComboBoxClass; diff --git a/mate-volume-control/src/gvc-level-bar.c b/mate-volume-control/src/gvc-level-bar.c index 7303703..fbc0538 100644 --- a/mate-volume-control/src/gvc-level-bar.c +++ b/mate-volume-control/src/gvc-level-bar.c @@ -86,7 +86,11 @@ static void gvc_level_bar_class_init (GvcLevelBarClass *klass); static void gvc_level_bar_init (GvcLevelBar *level_bar); static void gvc_level_bar_finalize (GObject *object); +#if GTK_CHECK_VERSION (3, 0, 0) +G_DEFINE_TYPE (GvcLevelBar, gvc_level_bar, GTK_TYPE_BOX) +#else G_DEFINE_TYPE (GvcLevelBar, gvc_level_bar, GTK_TYPE_HBOX) +#endif #define check_rectangle(rectangle1, rectangle2) \ { \ @@ -457,6 +461,30 @@ gvc_level_bar_size_request (GtkWidget *widget, } static void +gvc_level_bar_get_preferred_width (GtkWidget *widget, + gint *minimum, + gint *natural) +{ + GtkRequisition requisition; + + gvc_level_bar_size_request (widget, &requisition); + + *minimum = *natural = requisition.width; +} + +static void +gvc_level_bar_get_preferred_height (GtkWidget *widget, + gint *minimum, + gint *natural) +{ + GtkRequisition requisition; + + gvc_level_bar_size_request (widget, &requisition); + + *minimum = *natural = requisition.height; +} + +static void gvc_level_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation) { @@ -542,29 +570,40 @@ curved_rectangle (cairo_t *cr, } static int +#if GTK_CHECK_VERSION (3, 0, 0) +gvc_level_bar_draw (GtkWidget *widget, + cairo_t *cr) +#else gvc_level_bar_expose (GtkWidget *widget, GdkEventExpose *event) +#endif { GvcLevelBar *bar; +#if !GTK_CHECK_VERSION (3, 0, 0) cairo_t *cr; GtkAllocation allocation; +#endif g_return_val_if_fail (GVC_IS_LEVEL_BAR (widget), FALSE); +#if !GTK_CHECK_VERSION (3, 0, 0) g_return_val_if_fail (event != NULL, FALSE); /* event queue compression */ if (event->count > 0) { return FALSE; } +#endif bar = GVC_LEVEL_BAR (widget); +#if !GTK_CHECK_VERSION (3, 0, 0) cr = gdk_cairo_create (gtk_widget_get_window (widget)); gtk_widget_get_allocation (widget, &allocation); cairo_translate (cr, allocation.x, allocation.y); +#endif if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) { int i; @@ -637,7 +676,9 @@ gvc_level_bar_expose (GtkWidget *widget, cairo_stroke (cr); } } +#if !GTK_CHECK_VERSION (3, 0, 0) cairo_destroy (cr); +#endif return FALSE; } @@ -653,8 +694,14 @@ gvc_level_bar_class_init (GvcLevelBarClass *klass) object_class->set_property = gvc_level_bar_set_property; object_class->get_property = gvc_level_bar_get_property; +#if GTK_CHECK_VERSION (3, 0, 0) + widget_class->draw = gvc_level_bar_draw; + widget_class->get_preferred_width = gvc_level_bar_get_preferred_width; + widget_class->get_preferred_height = gvc_level_bar_get_preferred_height; +#else widget_class->expose_event = gvc_level_bar_expose; widget_class->size_request = gvc_level_bar_size_request; +#endif widget_class->size_allocate = gvc_level_bar_size_allocate; g_object_class_install_property (object_class, diff --git a/mate-volume-control/src/gvc-level-bar.h b/mate-volume-control/src/gvc-level-bar.h index 2873209..844d0f9 100644 --- a/mate-volume-control/src/gvc-level-bar.h +++ b/mate-volume-control/src/gvc-level-bar.h @@ -37,13 +37,21 @@ typedef struct GvcLevelBarPrivate GvcLevelBarPrivate; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBox parent; +#else GtkHBox parent; +#endif GvcLevelBarPrivate *priv; } GvcLevelBar; typedef struct { +#if GTK_CHECK_VERSION (3, 0, 0) + GtkBoxClass parent_class; +#else GtkHBoxClass parent_class; +#endif } GvcLevelBarClass; typedef enum diff --git a/mate-volume-control/src/gvc-mixer-dialog.c b/mate-volume-control/src/gvc-mixer-dialog.c index 37eaaf0..8db0ebf 100644 --- a/mate-volume-control/src/gvc-mixer-dialog.c +++ b/mate-volume-control/src/gvc-mixer-dialog.c @@ -23,11 +23,15 @@ #include <stdlib.h> #include <stdio.h> #include <unistd.h> +#include <math.h> #include <glib.h> #include <glib/gi18n.h> #include <gdk/gdkkeysyms.h> #include <gtk/gtk.h> +#if GTK_CHECK_VERSION (3, 0, 0) +#include <gdk/gdkkeysyms-compat.h> +#endif #include "gvc-channel-bar.h" #include "gvc-balance-bar.h" @@ -2099,7 +2103,9 @@ gvc_mixer_dialog_new (GvcMixerControl *control) dialog = g_object_new (GVC_TYPE_MIXER_DIALOG, "icon-name", "multimedia-volume-control", "title", _("Sound Preferences"), +#if !GTK_CHECK_VERSION (3, 0, 0) "has-separator", FALSE, +#endif "mixer-control", control, NULL); return GVC_MIXER_DIALOG (dialog); diff --git a/mate-volume-control/src/gvc-stream-status-icon.c b/mate-volume-control/src/gvc-stream-status-icon.c index e0b5124..ce13a83 100644 --- a/mate-volume-control/src/gvc-stream-status-icon.c +++ b/mate-volume-control/src/gvc-stream-status-icon.c @@ -23,6 +23,7 @@ #include <stdlib.h> #include <stdio.h> #include <unistd.h> +#include <math.h> #include <glib.h> #include <glib/gi18n.h> @@ -37,6 +38,12 @@ #include "gvc-channel-bar.h" #include "gvc-stream-status-icon.h" +#if GTK_CHECK_VERSION (3, 0, 0) +#define MATE_DESKTOP_USE_UNSTABLE_API +#include <libmate-desktop/mate-desktop-utils.h> +#define gdk_spawn_command_line_on_screen mate_gdk_spawn_command_line_on_screen +#endif + #define GVC_STREAM_STATUS_ICON_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GVC_TYPE_STREAM_STATUS_ICON, GvcStreamStatusIconPrivate)) struct GvcStreamStatusIconPrivate @@ -137,7 +144,11 @@ popup_dock (GvcStreamStatusIcon *icon, gtk_container_foreach (GTK_CONTAINER (icon->priv->dock), (GtkCallback) gtk_widget_show_all, NULL); +#if GTK_CHECK_VERSION (3, 0, 0) + gtk_widget_get_preferred_size (icon->priv->dock, &dock_req, NULL); +#else gtk_widget_size_request (icon->priv->dock, &dock_req); +#endif if (orientation == GTK_ORIENTATION_VERTICAL) { if (area.x + area.width + dock_req.width <= monitor.x + monitor.width) { |