summaryrefslogtreecommitdiff
path: root/mate-volume-control
diff options
context:
space:
mode:
Diffstat (limited to 'mate-volume-control')
-rw-r--r--mate-volume-control/dialog-main.c50
-rw-r--r--mate-volume-control/gvc-balance-bar.c18
-rw-r--r--mate-volume-control/gvc-channel-bar.c47
-rw-r--r--mate-volume-control/gvc-combo-box.c8
-rw-r--r--mate-volume-control/gvc-level-bar.c110
-rw-r--r--mate-volume-control/gvc-mixer-dialog.c51
-rw-r--r--mate-volume-control/gvc-sound-theme-chooser.c29
-rw-r--r--mate-volume-control/gvc-speaker-test.c35
-rw-r--r--mate-volume-control/gvc-speaker-test.h8
-rw-r--r--mate-volume-control/gvc-stream-status-icon.c64
-rw-r--r--mate-volume-control/gvc-utils.c1
11 files changed, 9 insertions, 412 deletions
diff --git a/mate-volume-control/dialog-main.c b/mate-volume-control/dialog-main.c
index 56a321d..486ab4a 100644
--- a/mate-volume-control/dialog-main.c
+++ b/mate-volume-control/dialog-main.c
@@ -26,11 +26,7 @@
#include <gtk/gtk.h>
#include <libintl.h>
-#if GTK_CHECK_VERSION (3, 0, 0)
#include <gio/gio.h>
-#else
-#include <unique/uniqueapp.h>
-#endif
#include <libmatemixer/matemixer.h>
#include "gvc-mixer-dialog.h"
@@ -67,20 +63,6 @@ on_dialog_close (GtkDialog *dialog, gpointer data)
gtk_main_quit ();
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static UniqueResponse
-on_app_message_received (UniqueApp *app,
- int command,
- UniqueMessageData *message_data,
- guint time_,
- gpointer user_data)
-{
- gtk_window_present (GTK_WINDOW (user_data));
-
- return UNIQUE_RESPONSE_OK;
-}
-#endif
-
static void
remove_warning_dialog (void)
{
@@ -93,15 +75,10 @@ remove_warning_dialog (void)
}
static void
-#if GTK_CHECK_VERSION (3, 0, 0)
context_ready (MateMixerContext *context, GtkApplication *application)
-#else
-context_ready (MateMixerContext *context, UniqueApp *app)
-#endif
{
/* The dialog might be already created, e.g. when reconnected
* to a sound server */
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkApplication *app;
GError *error = NULL;
@@ -122,7 +99,6 @@ context_ready (MateMixerContext *context, UniqueApp *app)
gtk_main_quit ();
}
-#endif
if (app_dialog != NULL)
return;
@@ -139,28 +115,15 @@ context_ready (MateMixerContext *context, UniqueApp *app)
gvc_mixer_dialog_set_page (GVC_MIXER_DIALOG (app_dialog), page);
-#if !GTK_CHECK_VERSION (3, 0, 0)
- g_signal_connect (G_OBJECT (app),
- "message-received",
- G_CALLBACK (on_app_message_received),
- app_dialog);
-
-#endif
gtk_widget_show (app_dialog);
-#if GTK_CHECK_VERSION (3, 0, 0)
g_signal_connect_swapped (app, "activate", G_CALLBACK (gtk_window_present), app_dialog);
-#endif
}
static void
on_context_state_notify (MateMixerContext *context,
GParamSpec *pspec,
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkApplication *app)
-#else
- UniqueApp *app)
-#endif
{
MateMixerState state = mate_mixer_context_get_state (context);
@@ -221,11 +184,8 @@ main (int argc, char **argv)
GError *error = NULL;
gchar *backend = NULL;
MateMixerContext *context;
-#if GTK_CHECK_VERSION (3, 0, 0)
GApplication *app;
-#else
- UniqueApp *app;
-#endif
+
GOptionEntry entries[] = {
{ "backend", 'b', 0, G_OPTION_ARG_STRING, &backend, N_("Sound system backend"), "pulse|alsa|oss|null" },
{ "debug", 'd', 0, G_OPTION_ARG_NONE, &debug, N_("Enable debug"), NULL },
@@ -256,7 +216,6 @@ main (int argc, char **argv)
g_setenv ("G_MESSAGES_DEBUG", "all", FALSE);
}
-#if GTK_CHECK_VERSION (3, 0, 0)
app = g_application_new (GVC_DIALOG_DBUS_NAME, G_APPLICATION_FLAGS_NONE);
if (!g_application_register (app, NULL, &error))
@@ -265,14 +224,7 @@ main (int argc, char **argv)
g_error_free (error);
return 1;
}
-#else
- app = unique_app_new (GVC_DIALOG_DBUS_NAME, NULL);
- if (unique_app_is_running (app) == TRUE) {
- unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
- return 0;
- }
-#endif
if (mate_mixer_init () == FALSE) {
g_warning ("libmatemixer initialization failed, exiting");
return 1;
diff --git a/mate-volume-control/gvc-balance-bar.c b/mate-volume-control/gvc-balance-bar.c
index ff84842..f7a33b9 100644
--- a/mate-volume-control/gvc-balance-bar.c
+++ b/mate-volume-control/gvc-balance-bar.c
@@ -79,29 +79,15 @@ G_DEFINE_TYPE (GvcBalanceBar, gvc_balance_bar, GTK_TYPE_BOX)
static void
create_scale_box (GvcBalanceBar *bar)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
bar->priv->scale_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
bar->priv->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
bar->priv->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
bar->priv->scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL,
bar->priv->adjustment);
-#if GTK_CHECK_VERSION (3, 4, 0)
+
/* Balance and fade scales do not have an origin */
if (bar->priv->btype != BALANCE_TYPE_LFE)
gtk_scale_set_has_origin (GTK_SCALE (bar->priv->scale), FALSE);
-#endif
-#else
- bar->priv->scale_box = gtk_hbox_new (FALSE, 6);
- bar->priv->start_box = gtk_hbox_new (FALSE, 6);
- bar->priv->end_box = gtk_hbox_new (FALSE, 6);
- bar->priv->scale = gtk_hscale_new (bar->priv->adjustment);
-
- /* GTK2 way to remove the origin */
- if (bar->priv->btype != BALANCE_TYPE_LFE) {
- gtk_rc_parse_string (BALANCE_BAR_STYLE);
- gtk_widget_set_name (bar->priv->scale, "balance-bar-scale");
- }
-#endif
gtk_widget_set_size_request (bar->priv->scale, SCALE_SIZE, -1);
@@ -546,8 +532,6 @@ gvc_balance_bar_new (MateMixerStreamControl *control, GvcBalanceType btype)
return g_object_new (GVC_TYPE_BALANCE_BAR,
"balance-type", btype,
"control", control,
-#if GTK_CHECK_VERSION (3, 0, 0)
"orientation", GTK_ORIENTATION_HORIZONTAL,
-#endif
NULL);
}
diff --git a/mate-volume-control/gvc-channel-bar.c b/mate-volume-control/gvc-channel-bar.c
index b1b54ae..912eaa6 100644
--- a/mate-volume-control/gvc-channel-bar.c
+++ b/mate-volume-control/gvc-channel-bar.c
@@ -94,25 +94,11 @@ G_DEFINE_TYPE (GvcChannelBar, gvc_channel_bar, GTK_TYPE_BOX)
static void
create_scale_box (GvcChannelBar *bar)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
bar->priv->scale_box = gtk_box_new (bar->priv->orientation, 6);
bar->priv->start_box = gtk_box_new (bar->priv->orientation, 6);
bar->priv->end_box = gtk_box_new (bar->priv->orientation, 6);
bar->priv->scale = gtk_scale_new (bar->priv->orientation,
bar->priv->adjustment);
-#else
- if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
- bar->priv->scale_box = gtk_vbox_new (FALSE, 6);
- bar->priv->start_box = gtk_vbox_new (FALSE, 6);
- bar->priv->end_box = gtk_vbox_new (FALSE, 6);
- bar->priv->scale = gtk_vscale_new (bar->priv->adjustment);
- } else {
- bar->priv->scale_box = gtk_hbox_new (FALSE, 6);
- bar->priv->start_box = gtk_hbox_new (FALSE, 6);
- bar->priv->end_box = gtk_hbox_new (FALSE, 6);
- bar->priv->scale = gtk_hscale_new (bar->priv->adjustment);
- }
-#endif
if (bar->priv->orientation == GTK_ORIENTATION_VERTICAL) {
gtk_widget_set_size_request (bar->priv->scale, -1, SCALE_SIZE);
@@ -349,15 +335,11 @@ update_marks (GvcChannelBar *bar)
if (has_mark) {
gtk_alignment_set (GTK_ALIGNMENT (bar->priv->mute_box), 0.5, 0, 0, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (bar->priv->low_image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (bar->priv->low_image, GTK_ALIGN_START);
gtk_widget_set_halign (bar->priv->high_image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (bar->priv->high_image, GTK_ALIGN_START);
-#else
- gtk_misc_set_alignment (GTK_MISC (bar->priv->low_image), 0.5, 0.0);
- gtk_misc_set_alignment (GTK_MISC (bar->priv->high_image), 0.5, 0.0);
-#endif
+
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (bar->priv->label), 0.0);
gtk_label_set_yalign (GTK_LABEL (bar->priv->label), 0.0);
@@ -367,15 +349,11 @@ update_marks (GvcChannelBar *bar)
} else {
gtk_alignment_set (GTK_ALIGNMENT (bar->priv->mute_box), 0.5, 0.5, 0, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_set_halign (bar->priv->low_image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (bar->priv->low_image, GTK_ALIGN_CENTER);
gtk_widget_set_halign (bar->priv->high_image, GTK_ALIGN_CENTER);
gtk_widget_set_valign (bar->priv->high_image, GTK_ALIGN_CENTER);
-#else
- gtk_misc_set_alignment (GTK_MISC (bar->priv->low_image), 0.5, 0.5);
- gtk_misc_set_alignment (GTK_MISC (bar->priv->high_image), 0.5, 0.5);
-#endif
+
#if GTK_CHECK_VERSION (3, 16, 0)
gtk_label_set_xalign (GTK_LABEL (bar->priv->label), 0.0);
gtk_label_set_yalign (GTK_LABEL (bar->priv->label), 0.5);
@@ -468,17 +446,6 @@ on_scale_button_press_event (GtkWidget *widget,
GdkEventButton *event,
GvcChannelBar *bar)
{
-
-#if !GTK_CHECK_VERSION (3, 6, 0)
- /* Up to GTK 3.4 the slider selection only moves in increments when
- * clicking in the slider with the left button and it moves directly
- * to the clicked position with the middle mouse button.
- * Change this behaviour to also jump to the clicked position with the
- * left mouse button. */
- if (event->button == 1)
- event->button = 2;
-#endif
-
/* Muting the stream when volume is non-zero moves the slider to zero,
* but the volume remains the same. In this case delay unmuting and
* changing volume until user releases the mouse button. */
@@ -499,11 +466,6 @@ on_scale_button_release_event (GtkWidget *widget,
GdkEventButton *event,
GvcChannelBar *bar)
{
-#if !GTK_CHECK_VERSION (3, 6, 0)
- if (event->button == 1)
- event->button = 2;
-#endif
-
if (bar->priv->click_lock == TRUE) {
/* The volume change is not reflected while the lock is
* held, propagate the change now that user has released
@@ -531,7 +493,6 @@ on_scale_scroll_event (GtkWidget *widget,
{
GdkScrollDirection direction = event->direction;
-#if GTK_CHECK_VERSION (3, 4, 0)
if (direction == GDK_SCROLL_SMOOTH) {
gdouble dx = 0.0;
gdouble dy = 0.0;
@@ -544,7 +505,7 @@ on_scale_scroll_event (GtkWidget *widget,
else
return FALSE;
}
-#endif
+
return gvc_channel_bar_scroll (bar, direction);
}
@@ -1176,8 +1137,6 @@ gvc_channel_bar_new (MateMixerStreamControl *control)
{
return g_object_new (GVC_TYPE_CHANNEL_BAR,
"control", control,
-#if GTK_CHECK_VERSION (3, 0, 0)
"orientation", GTK_ORIENTATION_HORIZONTAL,
-#endif
NULL);
}
diff --git a/mate-volume-control/gvc-combo-box.c b/mate-volume-control/gvc-combo-box.c
index 6a49262..5e38fd1 100644
--- a/mate-volume-control/gvc-combo-box.c
+++ b/mate-volume-control/gvc-combo-box.c
@@ -373,7 +373,6 @@ gvc_combo_box_init (GvcComboBox *combobox)
"text",
COL_HUMAN_NAME);
-#if GTK_CHECK_VERSION (3, 0, 0)
combobox->priv->drop_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
combobox->priv->start_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
combobox->priv->end_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
@@ -385,11 +384,6 @@ gvc_combo_box_init (GvcComboBox *combobox)
NULL);
gtk_combo_box_set_popup_fixed_width (GTK_COMBO_BOX (combobox->priv->combobox), FALSE);
-#else
- combobox->priv->drop_box = gtk_hbox_new (FALSE, 6);
- combobox->priv->start_box = gtk_hbox_new (FALSE, 6);
- combobox->priv->end_box = gtk_hbox_new (FALSE, 6);
-#endif
gtk_box_pack_start (GTK_BOX (combobox),
frame,
@@ -454,8 +448,6 @@ gvc_combo_box_new (MateMixerSwitch *swtch, const gchar *label)
return g_object_new (GVC_TYPE_COMBO_BOX,
"switch", swtch,
"label", label,
-#if GTK_CHECK_VERSION (3, 0, 0)
"orientation", GTK_ORIENTATION_HORIZONTAL,
-#endif
NULL);
}
diff --git a/mate-volume-control/gvc-level-bar.c b/mate-volume-control/gvc-level-bar.c
index 71d7614..48ba9a7 100644
--- a/mate-volume-control/gvc-level-bar.c
+++ b/mate-volume-control/gvc-level-bar.c
@@ -47,15 +47,9 @@ typedef struct {
int box_width;
int box_height;
int box_radius;
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkRGBA color_bg;
GdkRGBA color_fg;
GdkRGBA color_dark;
-#else
- GdkColor color_bg;
- GdkColor color_fg;
- GdkColor color_dark;
-#endif
} LevelBarLayout;
struct _GvcLevelBarPrivate
@@ -108,21 +102,13 @@ layout_changed (LevelBarLayout *layout1, LevelBarLayout *layout2)
if (layout1->max_peak_num != layout2->max_peak_num)
return TRUE;
-#if GTK_CHECK_VERSION (3, 0, 0)
if (!gdk_rgba_equal (&layout1->color_fg, &layout2->color_fg))
return TRUE;
if (!gdk_rgba_equal (&layout1->color_bg, &layout2->color_bg))
return TRUE;
if (!gdk_rgba_equal (&layout1->color_dark, &layout2->color_dark))
return TRUE;
-#else
- if (!gdk_color_equal (&layout1->color_fg, &layout2->color_fg))
- return TRUE;
- if (!gdk_color_equal (&layout1->color_bg, &layout2->color_bg))
- return TRUE;
- if (!gdk_color_equal (&layout1->color_dark, &layout2->color_dark))
- return TRUE;
-#endif
+
return FALSE;
}
@@ -171,7 +157,6 @@ bar_calc_layout (GvcLevelBar *bar)
int max_peak_level;
GtkAllocation allocation;
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context;
context = gtk_widget_get_style_context (GTK_WIDGET (bar));
@@ -190,15 +175,6 @@ bar_calc_layout (GvcLevelBar *bar)
gtk_style_context_get_state (context),
&bar->priv->layout.color_fg);
gtk_style_context_restore (context);
-#else
- GtkStyle *style;
-
- style = gtk_widget_get_style (GTK_WIDGET (bar));
-
- bar->priv->layout.color_bg = style->bg[GTK_STATE_NORMAL];
- bar->priv->layout.color_fg = style->bg[GTK_STATE_SELECTED];
- bar->priv->layout.color_dark = style->dark[GTK_STATE_NORMAL];
-#endif
gtk_widget_get_allocation (GTK_WIDGET (bar), &allocation);
@@ -472,7 +448,6 @@ gvc_level_bar_size_request (GtkWidget *widget,
}
}
-#if GTK_CHECK_VERSION (3, 0, 0)
static void
gvc_level_bar_get_preferred_width (GtkWidget *widget,
gint *minimum,
@@ -502,7 +477,6 @@ gvc_level_bar_get_preferred_height (GtkWidget *widget,
if (natural != NULL)
*natural = requisition.height;
}
-#endif
static void
gvc_level_bar_size_allocate (GtkWidget *widget, GtkAllocation *allocation)
@@ -607,52 +581,28 @@ gvc_level_bar_draw (GtkWidget *widget, cairo_t *cr)
bar->priv->layout.box_radius);
if ((bar->priv->layout.max_peak_num - 1) == i) {
/* fill peak foreground */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_fg);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_fg);
-#endif
cairo_fill_preserve (cr);
} else if ((bar->priv->layout.peak_num - 1) >= i) {
/* fill background */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_bg);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_bg);
-#endif
cairo_fill_preserve (cr);
/* fill foreground */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source_rgba (cr,
bar->priv->layout.color_fg.red,
bar->priv->layout.color_fg.green,
bar->priv->layout.color_fg.blue,
0.5);
-#else
- cairo_set_source_rgba (cr,
- bar->priv->layout.color_fg.red / 65535.0,
- bar->priv->layout.color_fg.green / 65535.0,
- bar->priv->layout.color_fg.blue / 65535.0,
- 0.5);
-#endif
cairo_fill_preserve (cr);
} else {
/* fill background */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_bg);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_bg);
-#endif
cairo_fill_preserve (cr);
}
/* stroke border */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_dark);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_dark);
-#endif
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
}
@@ -680,52 +630,28 @@ gvc_level_bar_draw (GtkWidget *widget, cairo_t *cr)
if ((bar->priv->layout.max_peak_num - 1) == i) {
/* fill peak foreground */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_fg);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_fg);
-#endif
cairo_fill_preserve (cr);
} else if ((bar->priv->layout.peak_num - 1) >= i) {
/* fill background */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_bg);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_bg);
-#endif
cairo_fill_preserve (cr);
/* fill foreground */
-#if GTK_CHECK_VERSION (3, 0, 0)
cairo_set_source_rgba (cr,
bar->priv->layout.color_fg.red,
bar->priv->layout.color_fg.green,
bar->priv->layout.color_fg.blue,
0.5);
-#else
- cairo_set_source_rgba (cr,
- bar->priv->layout.color_fg.red / 65535.0,
- bar->priv->layout.color_fg.green / 65535.0,
- bar->priv->layout.color_fg.blue / 65535.0,
- 0.5);
-#endif
cairo_fill_preserve (cr);
} else {
/* fill background */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_bg);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_bg);
-#endif
cairo_fill_preserve (cr);
}
/* stroke border */
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_cairo_set_source_rgba (cr, &bar->priv->layout.color_dark);
-#else
- gdk_cairo_set_source_color (cr, &bar->priv->layout.color_dark);
-#endif
cairo_set_line_width (cr, 1);
cairo_stroke (cr);
}
@@ -736,33 +662,6 @@ gvc_level_bar_draw (GtkWidget *widget, cairo_t *cr)
return FALSE;
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static int
-gvc_level_bar_expose (GtkWidget *widget, GdkEventExpose *event)
-{
- cairo_t *cr;
- GtkAllocation allocation;
-
- g_return_val_if_fail (event != NULL, FALSE);
-
- /* Event queue compression */
- if (event->count > 0)
- return FALSE;
-
- gtk_widget_get_allocation (widget, &allocation);
-
- cr = gdk_cairo_create (gtk_widget_get_window (widget));
- cairo_translate (cr,
- allocation.x,
- allocation.y);
-
- gvc_level_bar_draw (widget, cr);
-
- cairo_destroy (cr);
- return FALSE;
-}
-#endif
-
static void
gvc_level_bar_class_init (GvcLevelBarClass *klass)
{
@@ -773,14 +672,9 @@ 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;
#if GTK_CHECK_VERSION (3, 20, 0)
gtk_widget_class_set_css_name (widget_class, "gvc-level-bar");
@@ -830,11 +724,9 @@ gvc_level_bar_class_init (GvcLevelBarClass *klass)
static void
gvc_level_bar_init (GvcLevelBar *bar)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkStyleContext *context = gtk_widget_get_style_context (GTK_WIDGET (bar));
gtk_style_context_add_class (context, GTK_STYLE_CLASS_LIST_ROW);
-#endif
bar->priv = GVC_LEVEL_BAR_GET_PRIVATE (bar);
diff --git a/mate-volume-control/gvc-mixer-dialog.c b/mate-volume-control/gvc-mixer-dialog.c
index 21fe4bd..287a694 100644
--- a/mate-volume-control/gvc-mixer-dialog.c
+++ b/mate-volume-control/gvc-mixer-dialog.c
@@ -1307,11 +1307,7 @@ make_label_bold (GtkLabel *label)
* from the current state of the widget, which comes from the
* theme or user prefs, since the font desc only has the
* weight flag turned on. */
-#if GTK_CHECK_VERSION (3, 0, 0)
gtk_widget_override_font (GTK_WIDGET (label), font_desc);
-#else
- gtk_widget_modify_font (GTK_WIDGET (label), font_desc);
-#endif
pango_font_description_free (font_desc);
}
@@ -1819,11 +1815,7 @@ create_page_effects (GvcMixerDialog *self)
GtkWidget *label;
GtkWidget *chooser;
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- box = gtk_vbox_new (FALSE, 6);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (box), 12);
label = gtk_label_new (_("Sound Effects"));
@@ -1909,11 +1901,7 @@ gvc_mixer_dialog_constructor (GType type,
gtk_container_set_border_width (GTK_CONTAINER (self), 6);
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->output_stream_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-#else
- self->priv->output_stream_box = gtk_hbox_new (FALSE, 12);
-#endif
alignment = gtk_alignment_new (0, 0, 1, 1);
gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 12, 0, 0, 0);
@@ -1964,11 +1952,7 @@ gvc_mixer_dialog_constructor (GType type,
/* Create notebook pages */
create_page_effects (self);
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->hw_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- self->priv->hw_box = gtk_vbox_new (FALSE, 12);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (self->priv->hw_box), 12);
label = gtk_label_new (_("Hardware"));
@@ -2009,19 +1993,11 @@ gvc_mixer_dialog_constructor (GType type,
gtk_frame_set_shadow_type (GTK_FRAME (box), GTK_SHADOW_NONE);
gtk_box_pack_start (GTK_BOX (self->priv->hw_box), box, FALSE, TRUE, 12);
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->hw_settings_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- self->priv->hw_settings_box = gtk_vbox_new (FALSE, 12);
-#endif
gtk_container_add (GTK_CONTAINER (box), self->priv->hw_settings_box);
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->input_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- self->priv->input_box = gtk_vbox_new (FALSE, 12);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (self->priv->input_box), 12);
@@ -2050,15 +2026,9 @@ gvc_mixer_dialog_constructor (GType type,
alignment,
FALSE, FALSE, 0);
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
sbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
ebox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-#else
- box = gtk_hbox_new (FALSE, 6);
- sbox = gtk_hbox_new (FALSE, 6);
- ebox = gtk_hbox_new (FALSE, 6);
-#endif
gtk_box_pack_start (GTK_BOX (self->priv->input_box),
box,
@@ -2087,11 +2057,7 @@ gvc_mixer_dialog_constructor (GType type,
FALSE, FALSE, 0);
gtk_size_group_add_widget (self->priv->size_group, ebox);
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->input_settings_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
-#else
- self->priv->input_settings_box = gtk_hbox_new (FALSE, 6);
-#endif
gtk_box_pack_start (GTK_BOX (self->priv->input_box),
self->priv->input_settings_box,
FALSE, FALSE, 0);
@@ -2125,11 +2091,7 @@ gvc_mixer_dialog_constructor (GType type,
gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
/* Output page */
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->output_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- self->priv->output_box = gtk_vbox_new (FALSE, 12);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (self->priv->output_box), 12);
label = gtk_label_new (_("Output"));
gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
@@ -2168,11 +2130,7 @@ gvc_mixer_dialog_constructor (GType type,
make_label_bold (GTK_LABEL (label));
gtk_frame_set_shadow_type (GTK_FRAME (box), GTK_SHADOW_NONE);
gtk_box_pack_start (GTK_BOX (self->priv->output_box), box, FALSE, FALSE, 12);
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->output_settings_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
-#else
- self->priv->output_settings_box = gtk_vbox_new (FALSE, 0);
-#endif
gtk_container_add (GTK_CONTAINER (box), self->priv->output_settings_box);
self->priv->output_settings_frame = box;
@@ -2186,20 +2144,11 @@ gvc_mixer_dialog_constructor (GType type,
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (self->priv->applications_window),
GTK_SHADOW_IN);
-#if GTK_CHECK_VERSION (3, 0, 0)
self->priv->applications_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
-#else
- self->priv->applications_box = gtk_vbox_new (FALSE, 12);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (self->priv->applications_box), 12);
-#if GTK_CHECK_VERSION (3, 8, 0)
gtk_container_add (GTK_CONTAINER (self->priv->applications_window),
self->priv->applications_box);
-#else
- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (self->priv->applications_window),
- self->priv->applications_box);
-#endif
label = gtk_label_new (_("Applications"));
gtk_notebook_append_page (GTK_NOTEBOOK (self->priv->notebook),
diff --git a/mate-volume-control/gvc-sound-theme-chooser.c b/mate-volume-control/gvc-sound-theme-chooser.c
index a30518d..c34ded8 100644
--- a/mate-volume-control/gvc-sound-theme-chooser.c
+++ b/mate-volume-control/gvc-sound-theme-chooser.c
@@ -995,29 +995,10 @@ on_key_changed (GSettings *settings,
update_theme (chooser);
}
-#if !GTK_CHECK_VERSION (3, 0, 0)
-static void
-constrain_list_size (GtkWidget *widget,
- GtkRequisition *requisition,
- GtkWidget *to_size)
-{
- GtkRequisition req;
- int max_height;
-
- /* Constrain height to be the tree height up to a max */
- max_height = (gdk_screen_get_height (gtk_widget_get_screen (widget))) / 4;
-
- gtk_widget_size_request (to_size, &req);
-
- requisition->height = MIN (req.height, max_height);
-}
-#endif
-
static void
setup_list_size_constraint (GtkWidget *widget,
GtkWidget *to_size)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
GtkRequisition req;
int max_height;
@@ -1029,12 +1010,6 @@ setup_list_size_constraint (GtkWidget *widget,
gtk_scrolled_window_set_min_content_height (GTK_SCROLLED_WINDOW (widget),
MIN (req.height, max_height));
-#else
- g_signal_connect (G_OBJECT (widget),
- "size-request",
- G_CALLBACK (constrain_list_size),
- to_size);
-#endif
}
static void
@@ -1048,11 +1023,7 @@ gvc_sound_theme_chooser_init (GvcSoundThemeChooser *chooser)
chooser->priv = GVC_SOUND_THEME_CHOOSER_GET_PRIVATE (chooser);
-#if GTK_CHECK_VERSION (3, 0, 0)
chooser->priv->theme_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- chooser->priv->theme_box = gtk_hbox_new (FALSE, 0);
-#endif
gtk_box_pack_start (GTK_BOX (chooser),
chooser->priv->theme_box, FALSE, FALSE, 0);
diff --git a/mate-volume-control/gvc-speaker-test.c b/mate-volume-control/gvc-speaker-test.c
index e638413..6764a8a 100644
--- a/mate-volume-control/gvc-speaker-test.c
+++ b/mate-volume-control/gvc-speaker-test.c
@@ -54,11 +54,7 @@ static void gvc_speaker_test_init (GvcSpeakerTest *test);
static void gvc_speaker_test_dispose (GObject *object);
static void gvc_speaker_test_finalize (GObject *object);
-#if GTK_CHECK_VERSION (3, 4, 0)
G_DEFINE_TYPE (GvcSpeakerTest, gvc_speaker_test, GTK_TYPE_GRID)
-#else
-G_DEFINE_TYPE (GvcSpeakerTest, gvc_speaker_test, GTK_TYPE_TABLE)
-#endif
typedef struct {
MateMixerChannelPosition position;
@@ -355,13 +351,9 @@ create_control (ca_context *canberra, MateMixerChannelPosition position)
GtkWidget *test_button;
const gchar *name;
-#if GTK_CHECK_VERSION (3, 0, 0)
control = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
-#else
- control = gtk_vbox_new (FALSE, 6);
- box = gtk_hbox_new (FALSE, 0);
-#endif
+
g_object_set_data (G_OBJECT (control), "playing", GINT_TO_POINTER (FALSE));
g_object_set_data (G_OBJECT (control), "position", GINT_TO_POINTER (position));
g_object_set_data (G_OBJECT (control), "canberra", canberra);
@@ -401,21 +393,11 @@ create_controls (GvcSpeakerTest *test)
for (i = 0; i < G_N_ELEMENTS (positions); i++) {
GtkWidget *control = create_control (test->priv->canberra, positions[i].position);
-#if GTK_CHECK_VERSION (3, 4, 0)
gtk_grid_attach (GTK_GRID (test),
control,
positions[i].left,
positions[i].top,
1, 1);
-#else
- gtk_table_attach (GTK_TABLE (test),
- control,
- positions[i].left,
- positions[i].left + 1,
- positions[i].top,
- positions[i].top + 1,
- GTK_EXPAND, GTK_EXPAND, 0, 0);
-#endif
g_array_insert_val (test->priv->controls, i, control);
}
}
@@ -431,7 +413,6 @@ gvc_speaker_test_init (GvcSpeakerTest *test)
face = gtk_image_new_from_icon_name ("face-smile", GTK_ICON_SIZE_DIALOG);
-#if GTK_CHECK_VERSION (3, 4, 0)
gtk_grid_attach (GTK_GRID (test),
face,
1, 1,
@@ -439,14 +420,6 @@ gvc_speaker_test_init (GvcSpeakerTest *test)
gtk_grid_set_baseline_row (GTK_GRID (test), 1);
-#else
- gtk_table_attach (GTK_TABLE (test),
- face,
- 2, 3, 1, 2,
- GTK_EXPAND,
- GTK_EXPAND,
- 0, 0);
-#endif
gtk_widget_show (face);
ca_context_create (&test->priv->canberra);
@@ -502,14 +475,8 @@ gvc_speaker_test_new (MateMixerStream *stream)
test = g_object_new (GVC_TYPE_SPEAKER_TEST,
"row-spacing", 6,
"column-spacing", 6,
-#if GTK_CHECK_VERSION (3, 4, 0)
"row-homogeneous", TRUE,
"column-homogeneous", TRUE,
-#else
- "homogeneous", TRUE,
- "n-rows", 3,
- "n-columns", 5,
-#endif
"stream", stream,
NULL);
diff --git a/mate-volume-control/gvc-speaker-test.h b/mate-volume-control/gvc-speaker-test.h
index 1c1546d..56650f1 100644
--- a/mate-volume-control/gvc-speaker-test.h
+++ b/mate-volume-control/gvc-speaker-test.h
@@ -43,21 +43,13 @@ typedef struct _GvcSpeakerTestPrivate GvcSpeakerTestPrivate;
struct _GvcSpeakerTest
{
-#if GTK_CHECK_VERSION (3, 4, 0)
GtkGrid parent;
-#else
- GtkTable parent;
-#endif
GvcSpeakerTestPrivate *priv;
};
struct _GvcSpeakerTestClass
{
-#if GTK_CHECK_VERSION (3, 4, 0)
GtkGridClass parent_class;
-#else
- GtkTableClass parent_class;
-#endif
};
GType gvc_speaker_test_get_type (void) G_GNUC_CONST;
diff --git a/mate-volume-control/gvc-stream-status-icon.c b/mate-volume-control/gvc-stream-status-icon.c
index 41dc208..231b95d 100644
--- a/mate-volume-control/gvc-stream-status-icon.c
+++ b/mate-volume-control/gvc-stream-status-icon.c
@@ -94,11 +94,7 @@ popup_dock (GvcStreamStatusIcon *icon, guint time)
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)
@@ -135,7 +131,6 @@ popup_dock (GvcStreamStatusIcon *icon, guint time)
display = gtk_widget_get_display (icon->priv->dock);
-#if GTK_CHECK_VERSION (3, 0, 0)
do {
GdkDeviceManager *manager = gdk_display_get_device_manager (display);
@@ -153,29 +148,7 @@ popup_dock (GvcStreamStatusIcon *icon, guint time)
gtk_widget_hide (icon->priv->dock);
}
} while (0);
-#else
- if (gdk_pointer_grab (gtk_widget_get_window (icon->priv->dock),
- TRUE,
- GDK_BUTTON_PRESS_MASK |
- GDK_BUTTON_RELEASE_MASK |
- GDK_POINTER_MOTION_MASK |
- GDK_SCROLL_MASK,
- NULL, NULL,
- time) != GDK_GRAB_SUCCESS) {
- gtk_grab_remove (icon->priv->dock);
- gtk_widget_hide (icon->priv->dock);
- return FALSE;
- }
- if (gdk_keyboard_grab (gtk_widget_get_window (icon->priv->dock),
- TRUE,
- time) != GDK_GRAB_SUCCESS) {
- gdk_display_pointer_ungrab (display, time);
- gtk_grab_remove (icon->priv->dock);
- gtk_widget_hide (icon->priv->dock);
- return FALSE;
- }
-#endif
gtk_widget_grab_focus (icon->priv->dock);
return TRUE;
@@ -251,7 +224,6 @@ on_status_icon_popup_menu (GtkStatusIcon *status_icon,
menu = gtk_menu_new ();
-#if GTK_CHECK_VERSION (3, 0, 0)
/*Set up theme and transparency support*/
GtkWidget *toplevel = gtk_widget_get_toplevel (menu);
/* Fix any failures of compiz/other wm's to communicate with gtk for transparency */
@@ -263,7 +235,7 @@ on_status_icon_popup_menu (GtkStatusIcon *status_icon,
context = gtk_widget_get_style_context (GTK_WIDGET(toplevel));
gtk_style_context_add_class(context,"gnome-panel-menu-bar");
gtk_style_context_add_class(context,"mate-panel-menu-bar");
-#endif
+
item = gtk_check_menu_item_new_with_mnemonic (_("_Mute"));
gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item),
mate_mixer_stream_control_get_mute (icon->priv->control));
@@ -274,20 +246,9 @@ on_status_icon_popup_menu (GtkStatusIcon *status_icon,
gtk_menu_shell_append (GTK_MENU_SHELL (menu), item);
-#if GTK_CHECK_VERSION (3, 10, 0)
+ /* FIXME: we lost an icon with migrating from gtk_image_menu_item_new_with_mnemonic */
item = gtk_menu_item_new_with_mnemonic (_("_Sound Preferences"));
-#else
- item = gtk_image_menu_item_new_with_mnemonic (_("_Sound Preferences"));
- do {
- GtkWidget *image;
-
- image = gtk_image_new_from_icon_name ("multimedia-volume-control",
- GTK_ICON_SIZE_MENU);
-
- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item), image);
- } while (0);
-#endif
g_signal_connect (G_OBJECT (item),
"activate",
G_CALLBACK (on_menu_activate_open_volume_control),
@@ -316,16 +277,7 @@ on_status_icon_scroll_event (GtkStatusIcon *status_icon,
static void
gvc_icon_release_grab (GvcStreamStatusIcon *icon, GdkEventButton *event)
{
-#if GTK_CHECK_VERSION (3, 0, 0)
gdk_device_ungrab (event->device, event->time);
-#else
- GdkDisplay *display;
-
- display = gtk_widget_get_display (GTK_WIDGET (icon->priv->dock));
-
- gdk_display_keyboard_ungrab (display, event->time);
- gdk_display_pointer_ungrab (display, event->time);
-#endif
gtk_grab_remove (icon->priv->dock);
/* Hide again */
@@ -352,16 +304,10 @@ popdown_dock (GvcStreamStatusIcon *icon)
display = gtk_widget_get_display (icon->priv->dock);
-#if GTK_CHECK_VERSION (3, 0, 0)
GdkDeviceManager *manager = gdk_display_get_device_manager (display);
gdk_device_ungrab (gdk_device_manager_get_client_pointer (manager),
GDK_CURRENT_TIME);
-#else
- gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
- gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
- gtk_grab_remove (icon->priv->dock);
-#endif
/* Hide again */
gtk_widget_hide (icon->priv->dock);
}
@@ -783,7 +729,6 @@ gvc_stream_status_icon_init (GvcStreamStatusIcon *icon)
gvc_channel_bar_set_orientation (GVC_CHANNEL_BAR (icon->priv->bar),
GTK_ORIENTATION_VERTICAL);
-#if GTK_CHECK_VERSION (3, 0, 0)
/* Set volume control frame, slider and toplevel window to follow panel theme */
GtkWidget *toplevel = gtk_widget_get_toplevel (icon->priv->dock);
GtkStyleContext *context;
@@ -793,13 +738,8 @@ gvc_stream_status_icon_init (GvcStreamStatusIcon *icon)
GdkScreen *screen = gtk_widget_get_screen(GTK_WIDGET(toplevel));
GdkVisual *visual = gdk_screen_get_rgba_visual(screen);
gtk_widget_set_visual(GTK_WIDGET(toplevel), visual);
-#endif
-#if GTK_CHECK_VERSION (3, 0, 0)
box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
-#else
- box = gtk_vbox_new (FALSE, 6);
-#endif
gtk_container_set_border_width (GTK_CONTAINER (box), 2);
gtk_container_add (GTK_CONTAINER (frame), box);
diff --git a/mate-volume-control/gvc-utils.c b/mate-volume-control/gvc-utils.c
index daae401..ec5d06d 100644
--- a/mate-volume-control/gvc-utils.c
+++ b/mate-volume-control/gvc-utils.c
@@ -22,7 +22,6 @@
#include <glib.h>
#include <glib/gi18n.h>
-#include <gtk/gtk.h>
#include <libmatemixer/matemixer.h>