summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gst-mixer-applet/applet.c37
-rw-r--r--gst-mixer-applet/dock.c3
-rw-r--r--gst-mixer-applet/preferences.c6
3 files changed, 40 insertions, 6 deletions
diff --git a/gst-mixer-applet/applet.c b/gst-mixer-applet/applet.c
index 2b4edc0..377ed8e 100644
--- a/gst-mixer-applet/applet.c
+++ b/gst-mixer-applet/applet.c
@@ -29,13 +29,22 @@
#include <math.h>
#include <string.h>
+#include <gtk/gtk.h>
+
#include <glib-object.h>
#include <gdk/gdkkeysyms.h>
-
-#include <gtk/gtk.h>
+#if GTK_CHECK_VERSION (3, 0, 0)
+#include <gdk/gdkkeysyms-compat.h>
+#endif
#include <gio/gio.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
+
#include "applet.h"
#include "keys.h"
#include "preferences.h"
@@ -69,10 +78,12 @@ gboolean mate_volume_applet_key (GtkWidget *widget,
static gdouble mate_volume_applet_get_volume (GstMixer *mixer,
GstMixerTrack *track);
+#if !GTK_CHECK_VERSION (3, 0, 0)
static void mate_volume_applet_background (MatePanelApplet *mate_panel_applet,
MatePanelAppletBackgroundType type,
GdkColor *colour,
GdkPixmap *pixmap);
+#endif
static void mate_volume_applet_orientation (MatePanelApplet *applet,
MatePanelAppletOrient orient);
@@ -155,7 +166,9 @@ mate_volume_applet_class_init (MateVolumeAppletClass *klass)
gtkwidget_class->scroll_event = mate_volume_applet_scroll;
gtkwidget_class->size_allocate = mate_volume_applet_size_allocate;
matepanelapplet_class->change_orient = mate_volume_applet_orientation;
+#if !GTK_CHECK_VERSION (3, 0, 0)
matepanelapplet_class->change_background = mate_volume_applet_background;
+#endif
/* FIXME:
* - style-set.
@@ -209,6 +222,9 @@ mate_volume_applet_init (MateVolumeApplet *applet)
applet);
/* other stuff */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ mate_panel_applet_set_background_widget (MATE_PANEL_APPLET (applet), GTK_WIDGET (applet));
+#endif
mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet),
MATE_PANEL_APPLET_EXPAND_MINOR);
@@ -375,7 +391,11 @@ gboolean
mate_volume_applet_setup (MateVolumeApplet *applet,
GList *elements)
{
+#if GTK_CHECK_VERSION (3, 0, 0)
+ GtkAdjustment *adj;
+#else
GtkObject *adj;
+#endif
static const GtkActionEntry actions[] = {
{ "RunMixer", NULL, N_("_Open Volume Control"),
NULL, NULL,
@@ -416,8 +436,11 @@ mate_volume_applet_setup (MateVolumeApplet *applet,
if (res) {
first_track = g_list_first (applet->tracks)->data;
- applet->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (50, 0, 100,
- 4, 10, 0));
+#if GTK_CHECK_VERSION (3, 0, 0)
+ applet->adjustment = gtk_adjustment_new (50, 0, 100, 4, 10, 0);
+#else
+ applet->adjustment = GTK_ADJUSTMENT (gtk_adjustment_new (50, 0, 100, 4, 10, 0));
+#endif
/* We want a reference from the applet as well as from the dock it
* will be attached to. */
g_object_ref_sink (applet->adjustment);
@@ -651,7 +674,11 @@ mate_volume_applet_popdown_dock (MateVolumeApplet *applet)
return;
/* hide */
+#if GTK_CHECK_VERSION (3, 0, 0)
+ gtk_widget_hide (GTK_WIDGET (applet->dock));
+#else
gtk_widget_hide_all (GTK_WIDGET (applet->dock));
+#endif
/* set menu item as active */
gtk_widget_set_state (GTK_WIDGET (applet), GTK_STATE_NORMAL);
@@ -985,6 +1012,7 @@ void mate_volume_applet_size_allocate (GtkWidget *widget,
mate_volume_applet_refresh (applet, TRUE, -1, -1);
}
+#if !GTK_CHECK_VERSION (3, 0, 0)
static void
mate_volume_applet_background (MatePanelApplet *_applet,
MatePanelAppletBackgroundType type,
@@ -1018,6 +1046,7 @@ mate_volume_applet_background (MatePanelApplet *_applet,
break;
}
}
+#endif
/*
* This needs to be here because not all tracks have the same volume range,
diff --git a/gst-mixer-applet/dock.c b/gst-mixer-applet/dock.c
index f9132c2..1af5f94 100644
--- a/gst-mixer-applet/dock.c
+++ b/gst-mixer-applet/dock.c
@@ -27,6 +27,9 @@
#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 "dock.h"
diff --git a/gst-mixer-applet/preferences.c b/gst-mixer-applet/preferences.c
index b3bfe12..6482a67 100644
--- a/gst-mixer-applet/preferences.c
+++ b/gst-mixer-applet/preferences.c
@@ -88,7 +88,9 @@ mate_volume_applet_preferences_init (MateVolumeAppletPreferences *prefs)
/* make window look cute */
gtk_window_set_title (GTK_WINDOW (prefs), _("Volume Control Preferences"));
+#if !GTK_CHECK_VERSION (3, 0, 0)
gtk_dialog_set_has_separator (GTK_DIALOG (prefs), FALSE);
+#endif
gtk_container_set_border_width (GTK_CONTAINER (prefs), 5);
gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG(prefs))), 2);
gtk_dialog_add_buttons (GTK_DIALOG (prefs),
@@ -106,7 +108,7 @@ mate_volume_applet_preferences_init (MateVolumeAppletPreferences *prefs)
gtk_widget_show (label);
/* optionmenu */
- prefs->optionmenu = gtk_combo_box_new_text ();
+ prefs->optionmenu = gtk_combo_box_text_new ();
cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (prefs->optionmenu));
g_object_set (G_OBJECT (cells->data), "ellipsize", PANGO_ELLIPSIZE_END, NULL);
g_list_free (cells);
@@ -170,7 +172,7 @@ mate_volume_applet_preferences_new (MateVolumeApplet *applet,
for ( ; elements != NULL; elements = elements->next) {
gchar *name = g_object_get_data (G_OBJECT (elements->data),
"mate-volume-applet-name");
- gtk_combo_box_append_text (GTK_COMBO_BOX (prefs->optionmenu), name);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (prefs->optionmenu), name);
}
mate_volume_applet_preferences_change (prefs, mixer, tracks);