]> git.pld-linux.org Git - packages/xfce4-mixer.git/blame - git.patch
- add updates from upstream git
[packages/xfce4-mixer.git] / git.patch
CommitLineData
58fdf33a
JR
1diff --git a/configure.ac b/configure.ac
2index 4397463..c66273c 100644
3--- a/configure.ac
4+++ b/configure.ac
5@@ -26,7 +26,7 @@ m4_define([xfce4_mixer_version_minor], [11])
6 m4_define([xfce4_mixer_version_micro], [0])
7 m4_define([xfce4_mixer_version_nano], []) dnl leave this empty to have no nano version
8 m4_define([xfce4_mixer_version_build], [rfe42d58])
9-m4_define([xfce4_mixer_version_tag], [])
10+m4_define([xfce4_mixer_version_tag], [git])
11 m4_define([xfce4_mixer_version], [xfce4_mixer_version_major().xfce4_mixer_version_minor().xfce4_mixer_version_micro()ifelse(xfce4_mixer_version_nano(), [], [], [.xfce4_mixer_version_nano()])ifelse(xfce4_mixer_version_tag(), [git], [xfce4_mixer_version_tag()-xfce4_mixer_version_build()], [xfce4_mixer_version_tag()])])
12
13 dnl *******************************************
14@@ -93,21 +93,20 @@ AC_CHECK_LIB([m],[round])
15 dnl ***********************************
16 dnl *** Check for required packages ***
17 dnl ***********************************
18-XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.24.0])
19-XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.24.0])
20+XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.42.0])
21+XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.42.0])
22 XDT_CHECK_PACKAGE([DBUS_GLIB], [dbus-glib-1], [0.84])
23 XDT_CHECK_PACKAGE([GST_PLUGINS_BASE], [gstreamer-plugins-base-0.10], [0.10.25])
24-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.20.0])
25-XDT_CHECK_PACKAGE([UNIQUE], [unique-1.0], [1.1])
26-XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.10.0])
27-XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-1], [4.10.0])
28-XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-1.0], [4.10.0])
29-XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.10.0])
30+XDT_CHECK_PACKAGE([GTK], [gtk+-3.0], [3.14.0])
31+XDT_CHECK_PACKAGE([LIBXFCE4UTIL], [libxfce4util-1.0], [4.12.0])
32+XDT_CHECK_PACKAGE([LIBXFCE4UI], [libxfce4ui-2], [4.12.0])
33+XDT_CHECK_PACKAGE([LIBXFCE4PANEL], [libxfce4panel-2.0], [4.12.0])
34+XDT_CHECK_PACKAGE([XFCONF], [libxfconf-0], [4.12.0])
35
36 dnl ***********************************
37 dnl *** Check for optional packages ***
38 dnl ***********************************
39-XDT_CHECK_OPTIONAL_PACKAGE([KEYBINDER], [keybinder], [0.2.2], [keybinder],
40+XDT_CHECK_OPTIONAL_PACKAGE([KEYBINDER], [keybinder-3.0], [0.3], [keybinder],
41 [keybinder Support])
42
43 dnl ***********************************
44diff --git a/icons/16x16/Makefile.am b/icons/16x16/Makefile.am
45index 803a2e4..ace4a07 100644
46--- a/icons/16x16/Makefile.am
47+++ b/icons/16x16/Makefile.am
48@@ -1,4 +1,4 @@
49-iconsdir = $(pkgdatadir)/icons/hicolor/16x16/status
50+iconsdir = $(datadir)/xfce4/mixer/icons/hicolor/16x16/status
51 icons_DATA = audio-input-microphone-muted.png
52
53 EXTRA_DIST = $(icons_DATA)
54diff --git a/icons/Makefile.am b/icons/Makefile.am
55index 70638c1..035476a 100644
56--- a/icons/Makefile.am
57+++ b/icons/Makefile.am
58@@ -4,17 +4,4 @@ SUBDIRS = \
59 16x16 \
60 scalable
61
62-gtk_update_icon_cache = gtk-update-icon-cache -f -t $(datadir)/icons/hicolor
63-
64-install-data-hook:
65- @-if test -z "$(DESTDIR)"; then \
66- echo "Updating Gtk icon cache."; \
67- $(gtk_update_icon_cache); \
68- else \
69- echo "*** Icon cache not updated. Remember to run:"; \
70- echo "***"; \
71- echo "*** $(gtk_update_icon_cache)"; \
72- echo "***"; \
73- fi
74-
75 # vi:set ts=8 sw=8 noet ai nocindent syntax=automake:
76diff --git a/icons/scalable/Makefile.am b/icons/scalable/Makefile.am
77index 5bfc12c..5212e63 100644
78--- a/icons/scalable/Makefile.am
79+++ b/icons/scalable/Makefile.am
80@@ -1,4 +1,4 @@
81-iconsdir = $(pkgdatadir)/icons/hicolor/scalable/status
82+iconsdir = $(datadir)/xfce4/mixer/icons/hicolor/scalable/status
83 icons_DATA = audio-input-microphone-muted.svg
84
85 EXTRA_DIST = $(icons_DATA)
86diff --git a/libxfce4mixer/Makefile.am b/libxfce4mixer/Makefile.am
87index 792a95e..e864ea8 100644
88--- a/libxfce4mixer/Makefile.am
89+++ b/libxfce4mixer/Makefile.am
90@@ -25,7 +25,7 @@ libxfce4mixer_la_CPPFLAGS = \
91 -DDATADIR=\"$(datadir)\" \
92 -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
93 -DG_LOG_DOMAIN=\"libxfce4mixer\" \
94- -DMIXER_DATADIR=\"$(pkgdatadir)\"
95+ -DMIXER_DATADIR=\"$(datadir)/xfce4/mixer\"
96
97 libxfce4mixer_la_CFLAGS = \
98 $(PLATFORM_CFLAGS) \
99diff --git a/libxfce4mixer/xfce-mixer-debug.h b/libxfce4mixer/xfce-mixer-debug.h
100index 4ade97c..8643d4d 100644
101--- a/libxfce4mixer/xfce-mixer-debug.h
102+++ b/libxfce4mixer/xfce-mixer-debug.h
103@@ -34,7 +34,7 @@ void xfce_mixer_debug_real (const gchar *log_domain,
104 const gchar *file,
105 const gchar *func,
106 gint line,
107- const gchar *format, ...);
108+ const gchar *format, ...) G_GNUC_PRINTF(5, 6);
109 void xfce_mixer_dump_gst_data (void);
110
111
112diff --git a/panel-plugin/mixer.desktop.in b/panel-plugin/mixer.desktop.in
113index f4e7637..728f808 100644
114--- a/panel-plugin/mixer.desktop.in
115+++ b/panel-plugin/mixer.desktop.in
116@@ -6,3 +6,4 @@ Icon=multimedia-volume-control
117 X-XFCE-Internal=false
118 X-XFCE-Module=mixer
119 X-XFCE-Unique=true
120+X-XFCE-API=2.0
121diff --git a/panel-plugin/xfce-mixer-plugin.c b/panel-plugin/xfce-mixer-plugin.c
122index 949e63e..85f4805 100644
123--- a/panel-plugin/xfce-mixer-plugin.c
124+++ b/panel-plugin/xfce-mixer-plugin.c
125@@ -276,7 +276,7 @@ xfce_mixer_plugin_init (XfceMixerPlugin *mixer_plugin)
126 xfce_mixer_dump_gst_data ();
127
128 /* Create container for the plugin */
129- mixer_plugin->hvbox = GTK_WIDGET (xfce_hvbox_new (GTK_ORIENTATION_HORIZONTAL, FALSE, 0));
130+ mixer_plugin->hvbox = GTK_WIDGET (gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0));
131 xfce_panel_plugin_add_action_widget (XFCE_PANEL_PLUGIN (mixer_plugin), mixer_plugin->hvbox);
132 gtk_container_add (GTK_CONTAINER (mixer_plugin), mixer_plugin->hvbox);
133 gtk_widget_show (mixer_plugin->hvbox);
134@@ -300,7 +300,6 @@ xfce_mixer_plugin_construct (XfcePanelPlugin *plugin)
135 {
136 XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (plugin);
137 GtkWidget *command_menu_item;
138- GtkWidget *command_image;
139
140 xfce_panel_plugin_menu_show_configure (plugin);
141
142@@ -311,10 +310,7 @@ xfce_mixer_plugin_construct (XfcePanelPlugin *plugin)
143 gtk_widget_show (mixer_plugin->mute_menu_item);
144
145 /* Add menu item for running the user-defined command */
146- command_image = gtk_image_new_from_icon_name ("multimedia-volume-control", GTK_ICON_SIZE_MENU);
147- gtk_widget_show (command_image);
148- command_menu_item = gtk_image_menu_item_new_with_mnemonic (_("Run Audio Mi_xer"));
149- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (command_menu_item), command_image);
150+ command_menu_item = gtk_menu_item_new_with_mnemonic (_("Run Audio Mi_xer"));
151 xfce_panel_plugin_menu_insert_item (plugin, GTK_MENU_ITEM (command_menu_item));
152 g_signal_connect_swapped (G_OBJECT (command_menu_item), "activate", G_CALLBACK (xfce_mixer_plugin_command_item_activated), mixer_plugin);
153 gtk_widget_show (command_menu_item);
154@@ -608,6 +604,9 @@ xfce_mixer_plugin_size_changed (XfcePanelPlugin *plugin,
155 gint size)
156 {
157 XfceMixerPlugin *mixer_plugin = XFCE_MIXER_PLUGIN (plugin);
158+ GtkBorder button_padding;
159+ gint xthickness;
160+ gint ythickness;
161 gint icon_size;
162
163 g_return_val_if_fail (mixer_plugin != NULL, FALSE);
164@@ -616,7 +615,11 @@ xfce_mixer_plugin_size_changed (XfcePanelPlugin *plugin,
165 size /= xfce_panel_plugin_get_nrows (XFCE_PANEL_PLUGIN (mixer_plugin));
166
167 /* Determine size for the volume button icons */
168- icon_size = size - 2 - 2 * MAX (mixer_plugin->button->style->xthickness, mixer_plugin->button->style->ythickness);
169+ gtk_style_context_get_padding (gtk_widget_get_style_context (GTK_WIDGET (mixer_plugin->button)), GTK_STATE_FLAG_NORMAL,
170+ &button_padding);
171+ xthickness = button_padding.left + button_padding.right;
172+ ythickness = button_padding.top + button_padding.bottom;
173+ icon_size = size - 2 - MAX (xthickness, ythickness);
174
175 /* Set volume button icon size and update the volume button */
176 xfce_volume_button_set_icon_size (XFCE_VOLUME_BUTTON (mixer_plugin->button), icon_size);
177diff --git a/panel-plugin/xfce-plugin-dialog.c b/panel-plugin/xfce-plugin-dialog.c
178index f89f872..64dbf4d 100644
179--- a/panel-plugin/xfce-plugin-dialog.c
180+++ b/panel-plugin/xfce-plugin-dialog.c
181@@ -142,7 +142,7 @@ xfce_plugin_dialog_new (XfcePanelPlugin *plugin)
182 static void
183 xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog)
184 {
185- GtkWidget *table;
186+ GtkWidget *grid;
187 GtkWidget *button;
188 GtkWidget *label;
189
190@@ -151,33 +151,35 @@ xfce_plugin_dialog_create_contents (XfcePluginDialog *dialog)
191
192 xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), _("Configure the sound card and mixer track"));
193
194- button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
195+ button = gtk_button_new_with_mnemonic (_("_Close"));
196+ gtk_button_set_image (GTK_BUTTON (button),
197+ gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_BUTTON));
198 gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CLOSE);
199 gtk_widget_show (button);
200
201- table = gtk_table_new (2, 2, FALSE);
202- gtk_table_set_row_spacings (GTK_TABLE (table), 12);
203- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
204- gtk_container_set_border_width (GTK_CONTAINER (table), 6);
205- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), table);
206- gtk_widget_show (table);
207+ grid = gtk_grid_new ();
208+ g_object_set (G_OBJECT (grid), "row-spacing", 6, "column-spacing", 12, "margin-top", 6, "margin-bottom", 6, NULL);
209+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), grid);
210+ gtk_widget_show (grid);
211
212 label = gtk_label_new_with_mnemonic (_("Sound _card:"));
213- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
214+ gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
215 gtk_widget_show (label);
216
217 dialog->card_combo = xfce_mixer_card_combo_new (NULL);
218 gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->card_combo);
219- gtk_table_attach (GTK_TABLE (table), dialog->card_combo, 1, 2, 0, 1, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
220+ g_object_set (G_OBJECT (dialog->card_combo), "halign", GTK_ALIGN_FILL, "hexpand", TRUE, NULL);
221+ gtk_grid_attach (GTK_GRID (grid), dialog->card_combo, 1, 0, 1, 1);
222 gtk_widget_show (dialog->card_combo);
223
224 label = gtk_label_new_with_mnemonic (_("Mixer _track:"));
225 gtk_label_set_mnemonic_widget (GTK_LABEL (label), dialog->track_combo);
226- gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
227+ gtk_grid_attach (GTK_GRID (grid), label, 0, 1, 1, 1);
228 gtk_widget_show (label);
229
230 dialog->track_combo = xfce_mixer_track_combo_new (NULL, NULL);
231- gtk_table_attach (GTK_TABLE (table), dialog->track_combo, 1, 2, 1, 2, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
232+ g_object_set (G_OBJECT (dialog->track_combo), "halign", GTK_ALIGN_FILL, "hexpand", TRUE, NULL);
233+ gtk_grid_attach (GTK_GRID (grid), dialog->track_combo, 1, 1, 1, 1);
234 gtk_widget_show (dialog->track_combo);
235
236 /* Hack to initialize the widget state */
237diff --git a/panel-plugin/xfce-volume-button.c b/panel-plugin/xfce-volume-button.c
238index 6877614..0481a66 100644
239--- a/panel-plugin/xfce-volume-button.c
240+++ b/panel-plugin/xfce-volume-button.c
241@@ -152,7 +152,7 @@ struct _XfceVolumeButton
242 GtkWidget *vbox;
243
244 /* Adjustment for the volume range and current value */
245- GtkObject *adjustment;
246+ GtkAdjustment *adjustment;
247
248 /* Icon size currently used */
249 gint icon_size;
250@@ -292,13 +292,16 @@ xfce_volume_button_init (XfceVolumeButton *button)
251
252 /* Make the button look flat and make it never grab the focus */
253 gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
254- gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
255+ gtk_widget_set_focus_on_click (GTK_WIDGET (button), FALSE);
256 gtk_widget_set_can_default (GTK_WIDGET (button), FALSE);
257 gtk_widget_set_can_focus (GTK_WIDGET (button), FALSE);
258
259 /* Connect signal for theme changes */
260 g_signal_connect_swapped (gtk_icon_theme_get_default (), "changed", G_CALLBACK (xfce_volume_button_update_icons), button);
261
262+ /* Intercept scroll events */
263+ gtk_widget_add_events (GTK_WIDGET (button), GDK_SCROLL_MASK);
264+
265 /* Update the state of the button */
266 xfce_volume_button_update (button);
267 }
268@@ -499,13 +502,13 @@ xfce_volume_button_create_dock_contents (XfceVolumeButton *button)
269 * not matter here since only one of the boxes it holds will be visibe at any
270 * time depending on the panel orientation
271 */
272- box = gtk_vbox_new (TRUE, 6);
273+ box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
274 gtk_container_set_border_width (GTK_CONTAINER (box), 2);
275 gtk_container_add (GTK_CONTAINER (frame), box);
276 gtk_widget_show (box);
277
278 /* Container for the widgets shown in vertical mode */
279- button->hbox = gtk_hbox_new(FALSE, 6);
280+ button->hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
281 gtk_box_pack_start (GTK_BOX (box), button->hbox, TRUE, TRUE, 0);
282
283 /* Show the position of lowest and highest volume through icons */
284@@ -513,7 +516,7 @@ xfce_volume_button_create_dock_contents (XfceVolumeButton *button)
285 gtk_box_pack_start (GTK_BOX (button->hbox), image, TRUE, TRUE, 0);
286 gtk_widget_show (image);
287
288- scale = gtk_hscale_new (GTK_ADJUSTMENT (button->adjustment));
289+ scale = gtk_scale_new (GTK_ORIENTATION_HORIZONTAL, GTK_ADJUSTMENT (button->adjustment));
290 gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
291 gtk_box_pack_start (GTK_BOX (button->hbox), scale, TRUE, TRUE, 0);
292 gtk_widget_set_size_request (scale, SCALE_SIZE, -1);
293@@ -525,10 +528,10 @@ xfce_volume_button_create_dock_contents (XfceVolumeButton *button)
294 gtk_widget_show (image);
295
296 /* Container for the widgets shown in horizontal mode */
297- button->vbox = gtk_vbox_new(FALSE, 6);
298+ button->vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, 6);
299 gtk_box_pack_start (GTK_BOX (box), button->vbox, TRUE, TRUE, 0);
300
301- scale = gtk_vscale_new (GTK_ADJUSTMENT (button->adjustment));
302+ scale = gtk_scale_new (GTK_ORIENTATION_VERTICAL, GTK_ADJUSTMENT (button->adjustment));
303 gtk_scale_set_draw_value (GTK_SCALE (scale), FALSE);
304 gtk_range_set_inverted (GTK_RANGE (scale), TRUE);
305 gtk_box_pack_start (GTK_BOX (button->vbox), scale, TRUE, TRUE, 0);
306@@ -549,6 +552,72 @@ xfce_volume_button_create_dock_contents (XfceVolumeButton *button)
307
308
309
310+static gboolean
311+xfce_volume_button_grab_input (XfceVolumeButton *button)
312+{
313+ GtkWidget *dock = button->dock;
314+ GdkWindow *window = gtk_widget_get_window (dock);
315+ GdkDisplay *display = gtk_widget_get_display (dock);
316+#if GTK_CHECK_VERSION(3, 20, 0)
317+ GdkSeat *seat = gdk_display_get_default_seat (display);
318+#else
319+ GdkDeviceManager *device_manager = gdk_display_get_device_manager (display);
320+ GdkDevice *pointer = gdk_device_manager_get_client_pointer (device_manager);
321+ GdkDevice *keyboard = gdk_device_get_associated_device (pointer);
322+#endif
323+
324+ gtk_grab_add (dock);
325+
326+#if GTK_CHECK_VERSION(3, 20, 0)
327+ if (gdk_seat_grab (seat, window, GDK_SEAT_CAPABILITY_ALL, TRUE, NULL, NULL, NULL, NULL) != GDK_GRAB_SUCCESS)
328+ goto fail_remove_grab;
329+#else
330+ if (gdk_device_grab (pointer, window, GDK_OWNERSHIP_WINDOW, TRUE, GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK |
331+ GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK, NULL, GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
332+ goto fail_remove_grab;
333+
334+ if (gdk_device_grab (keyboard, window, GDK_OWNERSHIP_WINDOW, TRUE, GDK_KEY_PRESS | GDK_KEY_RELEASE, NULL,
335+ GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
336+ {
337+ gdk_device_ungrab (pointer, GDK_CURRENT_TIME);
338+ goto fail_remove_grab;
339+ }
340+#endif
341+
342+ return TRUE;
343+
344+fail_remove_grab:
345+ gtk_grab_remove (dock);
346+ return FALSE;
347+}
348+
349+
350+
351+static void
352+xfce_volume_button_ungrab_input (XfceVolumeButton *button)
353+{
354+ GtkWidget *dock = button->dock;
355+ GdkDisplay *display = gtk_widget_get_display (dock);
356+#if GTK_CHECK_VERSION(3, 20, 0)
357+ GdkSeat *seat = gdk_display_get_default_seat (display);
358+#else
359+ GdkDeviceManager *device_manager = gdk_display_get_device_manager (display);
360+ GdkDevice *pointer = gdk_device_manager_get_client_pointer (device_manager);
361+ GdkDevice *keyboard = gdk_device_get_associated_device (pointer);
362+#endif
363+
364+#if GTK_CHECK_VERSION(3, 20, 0)
365+ gdk_seat_ungrab (seat);
366+#else
367+ gdk_device_ungrab (pointer, GDK_CURRENT_TIME);
368+ gdk_device_ungrab (keyboard, GDK_CURRENT_TIME);
369+#endif
370+
371+ gtk_grab_remove (dock);
372+}
373+
374+
375+
376 static void
377 xfce_volume_button_popup_dock (XfceVolumeButton *button)
378 {
379@@ -564,7 +633,7 @@ xfce_volume_button_popup_dock (XfceVolumeButton *button)
380 gint x;
381 gint y;
382 GtkPositionType position;
383- GdkDisplay *display;
384+ GtkAllocation button_allocation;
385
386 /* Lazily create dock contents */
387 if (button->dock == NULL)
388@@ -591,12 +660,13 @@ xfce_volume_button_popup_dock (XfceVolumeButton *button)
389 }
390
391 /* Get size request of the dock */
392- gtk_widget_size_request (GTK_WIDGET (button->dock), &dock_requisition);
393+ gtk_widget_get_preferred_size (GTK_WIDGET (button->dock), NULL, &dock_requisition);
394
395 /* Determine the absolute coordinates of the button widget */
396 gdk_window_get_origin (gtk_widget_get_window (GTK_WIDGET (button)), &x, &y);
397- x += button_widget->allocation.x;
398- y += button_widget->allocation.y;
399+ gtk_widget_get_allocation (button_widget, &button_allocation);
400+ x += button_allocation.x;
401+ y += button_allocation.y;
402
403 /* Determine the geometry of the monitor containing the window containing the button */
404 screen = gtk_widget_get_screen (button_widget);
405@@ -631,22 +701,22 @@ xfce_volume_button_popup_dock (XfceVolumeButton *button)
406 switch (position)
407 {
408 case GTK_POS_TOP:
409- x += (button_widget->allocation.width / 2) - (dock_requisition.width / 2);
410+ x += (button_allocation.width / 2) - (dock_requisition.width / 2);
411 y -= dock_requisition.height;
412 break;
413 case GTK_POS_RIGHT:
414- x += button_widget->allocation.width;
415- y += (button_widget->allocation.height / 2) - (dock_requisition.height / 2);
416+ x += button_allocation.width;
417+ y += (button_allocation.height / 2) - (dock_requisition.height / 2);
418 break;
419 case GTK_POS_LEFT:
420 x -= dock_requisition.width;
421- y += (button_widget->allocation.height / 2) - (dock_requisition.height / 2);
422+ y += (button_allocation.height / 2) - (dock_requisition.height / 2);
423 break;
424 case GTK_POS_BOTTOM:
425 default:
426 /* default to GTK_POS_BOTTOM */
427- x += (button_widget->allocation.width / 2) - (dock_requisition.width / 2);
428- y += button_widget->allocation.height;
429+ x += (button_allocation.width / 2) - (dock_requisition.width / 2);
430+ y += button_allocation.height;
431 break;
432 }
433
434@@ -666,25 +736,12 @@ xfce_volume_button_popup_dock (XfceVolumeButton *button)
435 gtk_widget_show (button->dock);
436
437 /* Grab keyboard and mouse, focus on the slider */
438- gtk_grab_add (button->dock);
439-
440- if (gdk_pointer_grab (gtk_widget_get_window (button->dock), TRUE,
441- GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_SCROLL_MASK,
442- NULL, NULL, GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
443+ if (!xfce_volume_button_grab_input (button))
444 {
445- gtk_grab_remove (button->dock);
446 gtk_widget_hide (button->dock);
447 return;
448 }
449
450- if (gdk_keyboard_grab (gtk_widget_get_window (button->dock), TRUE, GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS)
451- {
452- display = gtk_widget_get_display (button->dock);
453- gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
454- gtk_grab_remove (button->dock);
455- gtk_widget_hide (button->dock);
456- return;
457- }
458 gtk_widget_grab_focus (button->dock);
459
460 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), TRUE);
461@@ -695,14 +752,9 @@ xfce_volume_button_popup_dock (XfceVolumeButton *button)
462 static void
463 xfce_volume_button_popdown_dock (XfceVolumeButton *button)
464 {
465- GdkDisplay *display;
466-
467 if (button->dock != NULL && gtk_widget_get_visible (button->dock))
468 {
469- display = gtk_widget_get_display (GTK_WIDGET (button->dock));
470- gdk_display_keyboard_ungrab (display, GDK_CURRENT_TIME);
471- gdk_display_pointer_ungrab (display, GDK_CURRENT_TIME);
472- gtk_grab_remove (button->dock);
473+ xfce_volume_button_ungrab_input (button);
474
475 gtk_widget_hide (button->dock);
476 gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button), FALSE);
477@@ -776,6 +828,9 @@ xfce_volume_button_scroll_event (GtkWidget *widget,
478 /* Decrease one step when scrolling down/left */
479 gtk_adjustment_set_value (GTK_ADJUSTMENT (button->adjustment), old_value - increment);
480 break;
481+
482+ case GDK_SCROLL_SMOOTH:
483+ break;
484 }
485
486 new_value = gtk_adjustment_get_value (GTK_ADJUSTMENT (button->adjustment));
487@@ -923,7 +978,7 @@ xfce_volume_button_dock_key_release (XfceVolumeButton *button,
488 GtkWidget *widget)
489 {
490 /* Pop down on Escape */
491- if (event->keyval == GDK_Escape)
492+ if (event->keyval == GDK_KEY_Escape)
493 {
494 xfce_volume_button_popdown_dock (button);
495 return TRUE;
496diff --git a/xfce4-mixer/Makefile.am b/xfce4-mixer/Makefile.am
497index 4af69e9..d7742df 100644
498--- a/xfce4-mixer/Makefile.am
499+++ b/xfce4-mixer/Makefile.am
500@@ -5,6 +5,8 @@ bin_PROGRAMS = \
501
502 xfce4_mixer_SOURCES = \
503 main.c \
504+ xfce-mixer-application.c \
505+ xfce-mixer-application.h \
506 xfce-mixer-track.c \
507 xfce-mixer-track.h \
508 xfce-mixer-switch.c \
509@@ -23,13 +25,12 @@ xfce4_mixer_CPPFLAGS = \
510 -I$(top_srcdir) \
511 -DPACKAGE_LOCALE_DIR=\"$(localedir)\" \
512 -DDATADIR=\"$(datadir)\" \
513- -DMIXER_DATADIR=\"$(pkgdatadir)\" \
514+ -DMIXER_DATADIR=\"$(datadir)/xfce4/mixer\" \
515 -DG_LOG_DOMAIN=\"xfce4-mixer\"
516
517 xfce4_mixer_CFLAGS = \
518 $(GLIB_CFLAGS) \
519 $(GTK_CFLAGS) \
520- $(UNIQUE_CFLAGS) \
521 $(LIBXFCE4UTIL_CFLAGS) \
522 $(LIBXFCE4UI_CFLAGS) \
523 $(XFCONF_CFLAGS) \
524@@ -43,7 +44,6 @@ xfce4_mixer_LDFLAGS = \
525 $(GLIB_LIBS) \
526 $(GTHREAD_LIBS) \
527 $(GTK_LIBS) \
528- $(UNIQUE_LIBS) \
529 $(LIBXFCE4UTIL_LIBS) \
530 $(LIBXFCE4UI_LIBS) \
531 $(XFCONF_LIBS) \
532diff --git a/xfce4-mixer/main.c b/xfce4-mixer/main.c
533index 9e8417b..585c9e6 100644
534--- a/xfce4-mixer/main.c
535+++ b/xfce4-mixer/main.c
536@@ -23,51 +23,11 @@
537 #include <config.h>
538 #endif
539
540-#ifdef HAVE_STDLIB_H
541-#include <stdlib.h>
542-#endif
543-
544-#include <gst/gst.h>
545-
546 #include <gtk/gtk.h>
547-#include <unique/unique.h>
548
549 #include <libxfce4util/libxfce4util.h>
550-#include <libxfce4ui/libxfce4ui.h>
551-#include <xfconf/xfconf.h>
552-
553-#include "libxfce4mixer/libxfce4mixer.h"
554-
555-#include "xfce-mixer-window.h"
556
557-
558-
559-static UniqueResponse
560-message_received (UniqueApp *app,
561- UniqueCommand command,
562- UniqueMessageData *message,
563- guint time_,
564- GtkWidget *window)
565-{
566- UniqueResponse response;
567-
568- switch (command)
569- {
570- case UNIQUE_ACTIVATE:
571- /* Move window to the screen the command was started on */
572- gtk_window_set_screen (GTK_WINDOW (window), unique_message_data_get_screen (message));
573- /* Bring window to the foreground */
574- gtk_window_present_with_time (GTK_WINDOW (window), time_);
575- response = UNIQUE_RESPONSE_OK;
576- break;
577- default:
578- /* Invalid command */
579- response = UNIQUE_RESPONSE_FAIL;
580- break;
581- }
582-
583- return response;
584-}
585+#include "xfce-mixer-application.h"
586
587
588
589@@ -75,129 +35,20 @@ int
590 main (int argc,
591 char **argv)
592 {
593- UniqueApp *app;
594- GtkWidget *window;
595- GError *error = NULL;
596- gboolean debug_mode = FALSE;
597- gboolean show_version = FALSE;
598- GOptionContext *option_context;
599- GOptionEntry option_entries[] =
600- {
601- { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug_mode, N_("Enable debugging output"), NULL },
602- { "version", 'V', 0, G_OPTION_ARG_NONE, &show_version, N_("Show version and exit"), NULL },
603- { NULL, 0, 0, 0, NULL, NULL, NULL }
604- };
605+ GApplication *app;
606+ gint status;
607
608 /* Setup translation domain */
609 xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
610
611-#if !GLIB_CHECK_VERSION(2, 32, 0)
612- /* Initialize the threading system */
613- if (G_LIKELY (!g_thread_supported ()))
614- g_thread_init (NULL);
615-#endif
616-
617 /* Set application name */
618 g_set_application_name (_("Audio Mixer"));
619
620- /* Parse commandline options */
621- option_context = g_option_context_new ("- Adjust volume levels");
622- g_option_context_add_main_entries (option_context, option_entries, GETTEXT_PACKAGE);
623- g_option_context_add_group (option_context, gtk_get_option_group (FALSE));
624- g_option_context_add_group (option_context, gst_init_get_option_group ());
625- g_option_context_parse (option_context, &argc, &argv, &error);
626- g_option_context_free (option_context);
627- if (error != NULL)
628- {
629- g_printerr ("xfce4-mixer: %s\n", error->message);
630-
631- return EXIT_FAILURE;
632- }
633-
634- if (show_version)
635- {
636- g_print ("xfce4-mixer " VERSION "\n");
637-
638- return EXIT_SUCCESS;
639- }
640-
641- /* Initialize GTK+ fully */
642- gtk_init (NULL, NULL);
643-
644- /* Initialize Xfconf */
645- if (G_UNLIKELY (!xfconf_init (&error)))
646- {
647- if (G_LIKELY (error != NULL))
648- {
649- g_printerr (_("xfce4-mixer: Failed to initialize xfconf: %s\n"), error->message);
650- g_error_free (error);
651- }
652-
653- return EXIT_FAILURE;
654- }
655-
656- /* Initialize the mixer library */
657- xfce_mixer_init ();
658-
659- /* Use volume control icon for all mixer windows */
660- gtk_window_set_default_icon_name ("multimedia-volume-control");
661-
662- /* Warn users if there were no sound cards detected by GStreamer */
663- if (G_UNLIKELY (g_list_length (xfce_mixer_get_cards ()) <= 0))
664- {
665- xfce_dialog_show_error (NULL,
666- NULL,
667- _("GStreamer was unable to detect any sound devices. "
668- "Some sound system specific GStreamer packages may "
669- "be missing. It may also be a permissions problem."));
670-
671- return EXIT_FAILURE;
672- }
673-
674- /* Initialize debugging code */
675- xfce_mixer_debug_init (G_LOG_DOMAIN, debug_mode);
676-
677- xfce_mixer_debug ("xfce4-mixer version " VERSION " starting up");
678-
679- if (debug_mode)
680- xfce_mixer_dump_gst_data ();
681-
682- /* Create unique application */
683- app = unique_app_new ("org.xfce.xfce4-mixer", NULL);
684- if (unique_app_is_running (app))
685- {
686- unique_app_send_message (app, UNIQUE_ACTIVATE, NULL);
687-
688- g_object_unref (app);
689- }
690- else
691- {
692- /* Create the mixer window */
693- window = xfce_mixer_window_new ();
694-
695- /* Display the mixer window */
696- gtk_widget_show (window);
697-
698- /* Watch mixer window */
699- unique_app_watch_window (app, GTK_WINDOW (window));
700-
701- /* Handle messages */
702- g_signal_connect (app, "message-received", G_CALLBACK (message_received), window);
703-
704- /* Enter the GTK+ main loop */
705- gtk_main ();
706-
707- g_object_unref (app);
708-
709- /* Destroy the window */
710- gtk_widget_destroy (window);
711- }
712+ app = xfce_mixer_application_new ();
713
714- /* Shutdown the mixer library */
715- xfce_mixer_shutdown ();
716+ status = g_application_run (app, argc, argv);
717
718- /* Shutdown Xfconf */
719- xfconf_shutdown ();
720+ g_object_unref (app);
721
722- return EXIT_SUCCESS;
723+ return status;
724 }
725diff --git a/xfce4-mixer/xfce-mixer-application.c b/xfce4-mixer/xfce-mixer-application.c
726new file mode 100644
727index 0000000..1559675
728--- /dev/null
729+++ b/xfce4-mixer/xfce-mixer-application.c
730@@ -0,0 +1,232 @@
731+/* vi:set expandtab sw=2 sts=2: */
732+/*-
733+ * Copyright (c) 2008 Jannis Pohlmann <jannis@xfce.org>
734+ * Copyright (c) 2012 Guido Berhoerster <guido+xfce@berhoerster.name>
735+ *
736+ * This program is free software; you can redistribute it and/or modify
737+ * it under the terms of the GNU General Public License as published by
738+ * the Free Software Foundation; either version 2 of the License, or
739+ * (at your option) any later version.
740+ *
741+ * This program is distributed in the hope that it will be useful,
742+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
743+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
744+ * General Public License for more details.
745+ *
746+ * You should have received a copy of the GNU General Public License
747+ * along with this program; if not, write to the Free Software
748+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
749+ * Boston, MA 02110-1301, USA.
750+ */
751+
752+#ifdef HAVE_CONFIG_H
753+#include <config.h>
754+#endif
755+
756+#ifdef HAVE_STDLIB_H
757+#include <stdlib.h>
758+#endif
759+
760+#include <gst/gst.h>
761+#include <gtk/gtk.h>
762+
763+#include <libxfce4util/libxfce4util.h>
764+#include <libxfce4ui/libxfce4ui.h>
765+#include <xfconf/xfconf.h>
766+
767+#include "libxfce4mixer/libxfce4mixer.h"
768+
769+#include "xfce-mixer-application.h"
770+#include "xfce-mixer-window.h"
771+
772+
773+
774+static void xfce_mixer_application_dispose (GObject *object);
775+static void xfce_mixer_application_finalize (GObject *object);
776+static void xfce_mixer_application_startup (GApplication *app);
777+static void xfce_mixer_application_activate (GApplication *app);
778+static void xfce_mixer_application_shutdown (GApplication *app);
779+static gint xfce_mixer_application_handle_local_options (GApplication *app,
780+ GVariantDict *options,
781+ gpointer user_data);
782+
783+
784+
785+struct _XfceMixerApplicationClass
786+{
787+ GtkApplicationClass __parent__;
788+};
789+
790+struct _XfceMixerApplication
791+{
792+ GtkApplication __parent__;
793+
794+ GtkWidget *main_window;
795+};
796+
797+
798+
799+G_DEFINE_TYPE (XfceMixerApplication, xfce_mixer_application, GTK_TYPE_APPLICATION)
800+
801+
802+
803+static gboolean debug_mode = FALSE;
804+static gboolean show_version = FALSE;
805+
806+static GOptionEntry option_entries[] =
807+{
808+ { "debug", 'd', 0, G_OPTION_ARG_NONE, &debug_mode, N_("Enable debugging output"), NULL },
809+ { "version", 'V', 0, G_OPTION_ARG_NONE, &show_version, N_("Show version and exit"), NULL },
810+ { NULL, 0, 0, 0, NULL, NULL, NULL }
811+};
812+
813+
814+
815+static void
816+xfce_mixer_application_class_init (XfceMixerApplicationClass *klass)
817+{
818+ GObjectClass *gobject_class;
819+ GApplicationClass *g_application_class;
820+
821+ gobject_class = G_OBJECT_CLASS (klass);
822+ gobject_class->dispose = xfce_mixer_application_dispose;
823+ gobject_class->finalize = xfce_mixer_application_finalize;
824+
825+ g_application_class = G_APPLICATION_CLASS (klass);
826+ g_application_class->startup = xfce_mixer_application_startup;
827+ g_application_class->activate = xfce_mixer_application_activate;
828+ g_application_class->shutdown = xfce_mixer_application_shutdown;
829+}
830+
831+
832+
833+static void
834+xfce_mixer_application_init (XfceMixerApplication *app)
835+{
836+ app->main_window = NULL;
837+
838+ g_application_add_main_option_entries (G_APPLICATION (app), option_entries);
839+ g_application_add_option_group (G_APPLICATION (app), gst_init_get_option_group ());
840+
841+ g_signal_connect (app, "handle-local-options", G_CALLBACK (xfce_mixer_application_handle_local_options), NULL);
842+}
843+
844+
845+
846+static void
847+xfce_mixer_application_dispose (GObject *object)
848+{
849+ (*G_OBJECT_CLASS (xfce_mixer_application_parent_class)->dispose) (object);
850+}
851+
852+
853+
854+static void
855+xfce_mixer_application_finalize (GObject *object)
856+{
857+ (*G_OBJECT_CLASS (xfce_mixer_application_parent_class)->finalize) (object);
858+}
859+
860+
861+
862+static void
863+xfce_mixer_application_startup (GApplication *app)
864+{
865+ GError *error = NULL;
866+
867+ (*G_APPLICATION_CLASS (xfce_mixer_application_parent_class)->startup) (app);
868+
869+ /* Initialize Xfconf */
870+ if (G_UNLIKELY (!xfconf_init (&error)))
871+ {
872+ if (G_LIKELY (error != NULL))
873+ {
874+ g_printerr (_("xfce4-mixer: Failed to initialize xfconf: %s\n"), error->message);
875+ g_error_free (error);
876+ }
877+
878+ exit (EXIT_FAILURE);
879+ }
880+
881+ /* Initialize the mixer library */
882+ xfce_mixer_init ();
883+
884+ /* Use volume control icon for all mixer windows */
885+ gtk_window_set_default_icon_name ("multimedia-volume-control");
886+
887+ /* Warn users if there were no sound cards detected by GStreamer */
888+ if (G_UNLIKELY (g_list_length (xfce_mixer_get_cards ()) <= 0))
889+ {
890+ xfce_dialog_show_error (NULL,
891+ NULL,
892+ _("GStreamer was unable to detect any sound devices. "
893+ "Some sound system specific GStreamer packages may "
894+ "be missing. It may also be a permissions problem."));
895+ exit (EXIT_FAILURE);
896+ }
897+
898+ /* Initialize debugging code */
899+ xfce_mixer_debug_init (G_LOG_DOMAIN, debug_mode);
900+
901+ xfce_mixer_debug ("xfce4-mixer version " VERSION " starting up");
902+
903+ if (debug_mode)
904+ xfce_mixer_dump_gst_data ();
905+}
906+
907+
908+
909+static void
910+xfce_mixer_application_activate (GApplication *app_)
911+{
912+ XfceMixerApplication *app = XFCE_MIXER_APPLICATION (app_);
913+
914+ /* Create the mixer window */
915+ if (app->main_window == NULL)
916+ app->main_window = xfce_mixer_window_new (app_);
917+
918+ /* Display the mixer window */
919+ gtk_window_present (GTK_WINDOW (app->main_window));
920+}
921+
922+
923+
924+static void
925+xfce_mixer_application_shutdown (GApplication *app)
926+{
927+ /* Shutdown the mixer library */
928+ xfce_mixer_shutdown ();
929+
930+ /* Shutdown Xfconf */
931+ xfconf_shutdown ();
932+
933+ (*G_APPLICATION_CLASS (xfce_mixer_application_parent_class)->shutdown) (app);
934+}
935+
936+
937+
938+static gint
939+xfce_mixer_application_handle_local_options (GApplication *app,
940+ GVariantDict *options,
941+ gpointer user_data)
942+{
943+ if (show_version)
944+ {
945+ g_print ("xfce4-mixer " VERSION "\n");
946+ return EXIT_SUCCESS;
947+ }
948+
949+ return -1;
950+}
951+
952+
953+
954+GApplication*
955+xfce_mixer_application_new (void)
956+{
957+ XfceMixerApplication *app;
958+
959+ app = g_object_new (TYPE_XFCE_MIXER_APPLICATION, "application-id", "org.xfce.xfce4-mixer", NULL);
960+
961+ return G_APPLICATION (app);
962+}
963diff --git a/xfce4-mixer/xfce-mixer-application.h b/xfce4-mixer/xfce-mixer-application.h
964new file mode 100644
965index 0000000..e4a5534
966--- /dev/null
967+++ b/xfce4-mixer/xfce-mixer-application.h
968@@ -0,0 +1,42 @@
969+/* vi:set expandtab sw=2 sts=2: */
970+/*-
971+ * This program is free software; you can redistribute it and/or modify
972+ * it under the terms of the GNU General Public License as published by
973+ * the Free Software Foundation; either version 2 of the License, or
974+ * (at your option) any later version.
975+ *
976+ * This program is distributed in the hope that it will be useful,
977+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
978+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
979+ * General Public License for more details.
980+ *
981+ * You should have received a copy of the GNU General Public License
982+ * along with this program; if not, write to the Free Software
983+ * Foundation, Inc., 51 Franklin Street, Fifth Floor,
984+ * Boston, MA 02110-1301, USA.
985+ */
986+
987+#ifndef __XFCE_MIXER_APPLICATION_H__
988+#define __XFCE_MIXER_APPLICATION_H__
989+
990+#include <gtk/gtk.h>
991+
992+G_BEGIN_DECLS
993+
994+typedef struct _XfceMixerApplicationClass XfceMixerApplicationClass;
995+typedef struct _XfceMixerApplication XfceMixerApplication;
996+
997+#define TYPE_XFCE_MIXER_APPLICATION (xfce_mixer_application_get_type ())
998+#define XFCE_MIXER_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_XFCE_MIXER_APPLICATION, XfceMixerApplication))
999+#define XFCE_MIXER_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_XFCE_MIXER_APPLICATION, XfceMixerApplicationClass))
1000+#define IS_XFCE_MIXER_APPLICATION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_XFCE_MIXER_APPLICATION))
1001+#define IS_XFCE_MIXER_APPLICATION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_XFCE_MIXER_APPLICATION))
1002+#define XFCE_MIXER_APPLICATION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_XFCE_MIXER_APPLICATION, XfceMixerApplicationClass))
1003+
1004+GType xfce_mixer_application_get_type (void) G_GNUC_CONST;
1005+
1006+GApplication *xfce_mixer_application_new (void);
1007+
1008+G_END_DECLS
1009+
1010+#endif /* !__XFCE_MIXER_APPLICATION_H__ */
1011diff --git a/xfce4-mixer/xfce-mixer-container.c b/xfce4-mixer/xfce-mixer-container.c
1012index d59240a..560ee66 100644
1013--- a/xfce4-mixer/xfce-mixer-container.c
1014+++ b/xfce4-mixer/xfce-mixer-container.c
1015@@ -216,15 +216,12 @@ xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
1016 GstMixerTrack *track;
1017 const GList *iter;
1018 const gchar *titles[4] = { N_("_Playback"), N_("C_apture"), N_("S_witches"), N_("_Options") };
1019- GtkWidget *label_alignment;
1020- GtkWidget *option_alignment;
1021 GtkWidget *track_widget;
1022 GtkWidget *track_label_widget;
1023 GtkWidget *labels[4];
1024 GtkWidget *scrollwins[4];
1025 GtkWidget *views[4];
1026 GtkWidget *last_separator[4] = { NULL, NULL, NULL, NULL };
1027- GtkWidget *alignment;
1028 GtkWidget *vbox;
1029 GtkWidget *label1;
1030 GtkWidget *label2;
1031@@ -248,16 +245,9 @@ xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
1032 gtk_container_set_border_width (GTK_CONTAINER (scrollwins[i]), 6);
1033 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwins[i]), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1034
1035- if (i < 2)
1036- views[i] = gtk_table_new (1, 2, FALSE);
1037- else
1038- views[i] = gtk_table_new (2, 1, FALSE);
1039-
1040- gtk_table_set_col_spacings (GTK_TABLE (views[i]), 12);
1041- gtk_table_set_row_spacings (GTK_TABLE (views[i]), 6);
1042-
1043- gtk_container_set_border_width (GTK_CONTAINER (views[i]), 6);
1044- gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrollwins[i]), views[i]);
1045+ views[i] = gtk_grid_new ();
1046+ g_object_set (G_OBJECT (views[i]), "row-spacing", 6, "column-spacing", 12, "border-width", 6, NULL);
1047+ gtk_container_add (GTK_CONTAINER (scrollwins[i]), views[i]);
1048 gtk_viewport_set_shadow_type (GTK_VIEWPORT (gtk_bin_get_child (GTK_BIN (scrollwins[i]))), GTK_SHADOW_NONE);
1049 gtk_widget_show (views[i]);
1050 gtk_widget_show (scrollwins[i]);
1051@@ -283,19 +273,17 @@ xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
1052 case XFCE_MIXER_TRACK_TYPE_PLAYBACK:
1053 /* Create a regular volume control for this track */
1054 track_label_widget = gtk_label_new (track_label);
1055- gtk_table_attach (GTK_TABLE (views[0]), track_label_widget,
1056- num_children[0], num_children[0] + 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
1057+ gtk_grid_attach (GTK_GRID (views[0]), track_label_widget, num_children[0], 0, 1, 1);
1058 gtk_widget_show (track_label_widget);
1059 track_widget = xfce_mixer_track_new (mixer_container->card, track);
1060- gtk_table_attach (GTK_TABLE (views[0]), track_widget,
1061- num_children[0], num_children[0] + 1, 1, 2, GTK_SHRINK, GTK_FILL|GTK_EXPAND, 0, 0);
1062+ g_object_set (G_OBJECT (track_widget), "valign", GTK_ALIGN_FILL, "vexpand", TRUE, NULL);
1063+ gtk_grid_attach (GTK_GRID (views[0]), track_widget, num_children[0], 1, 1, 1);
1064 gtk_widget_show (track_widget);
1065 num_children[0]++;
1066
1067 /* Append a separator. The last one will be destroyed later */
1068- last_separator[0] = gtk_vseparator_new ();
1069- gtk_table_attach (GTK_TABLE (views[0]), last_separator[0],
1070- num_children[0], num_children[0] + 1, 0, 2, GTK_SHRINK, GTK_FILL|GTK_EXPAND, 0, 0);
1071+ last_separator[0] = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
1072+ gtk_grid_attach (GTK_GRID (views[0]), last_separator[0], num_children[0], 0, 1, 2);
1073 gtk_widget_show (last_separator[0]);
1074 num_children[0]++;
1075
1076@@ -306,19 +294,17 @@ xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
1077 case XFCE_MIXER_TRACK_TYPE_CAPTURE:
1078 /* Create a regular volume control for this track */
1079 track_label_widget = gtk_label_new (track_label);
1080- gtk_table_attach (GTK_TABLE (views[1]), track_label_widget,
1081- num_children[1], num_children[1] + 1, 0, 1, GTK_SHRINK, GTK_SHRINK, 0, 0);
1082+ gtk_grid_attach (GTK_GRID (views[1]), track_label_widget, num_children[1], 0, 1, 1);
1083 gtk_widget_show (track_label_widget);
1084 track_widget = xfce_mixer_track_new (mixer_container->card, track);
1085- gtk_table_attach (GTK_TABLE (views[1]), track_widget,
1086- num_children[1], num_children[1] + 1, 1, 2, GTK_SHRINK, GTK_FILL|GTK_EXPAND, 0, 0);
1087+ g_object_set (G_OBJECT (track_widget), "valign", GTK_ALIGN_FILL, "vexpand", TRUE, NULL);
1088+ gtk_grid_attach (GTK_GRID (views[1]), track_widget, num_children[1], 1, 1, 1);
1089 gtk_widget_show (track_widget);
1090 num_children[1]++;
1091
1092 /* Append a separator. The last one will be destroyed later */
1093- last_separator[1] = gtk_vseparator_new ();
1094- gtk_table_attach (GTK_TABLE (views[1]), last_separator[1],
1095- num_children[1], num_children[1] + 1, 0, 2, GTK_SHRINK, GTK_FILL|GTK_EXPAND, 0, 0);
1096+ last_separator[1] = gtk_separator_new (GTK_ORIENTATION_VERTICAL);
1097+ gtk_grid_attach (GTK_GRID (views[1]), last_separator[1], num_children[1], 0, 1, 2);
1098 gtk_widget_show (last_separator[1]);
1099 num_children[1]++;
1100
1101@@ -328,8 +314,8 @@ xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
1102
1103 case XFCE_MIXER_TRACK_TYPE_SWITCH:
1104 track_widget = xfce_mixer_switch_new (mixer_container->card, track);
1105- gtk_table_attach (GTK_TABLE (views[2]), track_widget,
1106- 0, 1, num_children[2], num_children[2] + 1, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
1107+ g_object_set (G_OBJECT (track_widget), "halign", GTK_ALIGN_FILL, "hexpand", TRUE, NULL);
1108+ gtk_grid_attach (GTK_GRID (views[2]), track_widget, 0, num_children[2], 1, 1);
1109 gtk_widget_show (track_widget);
1110
1111 num_children[2]++;
1112@@ -339,24 +325,16 @@ xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
1113 break;
1114
1115 case XFCE_MIXER_TRACK_TYPE_OPTIONS:
1116- label_alignment = gtk_alignment_new (0, 0, 0, 0);
1117- gtk_table_attach (GTK_TABLE (views[3]), label_alignment,
1118- 0, 1, num_children[3], num_children[3] + 1, GTK_FILL, GTK_SHRINK, 0, 0);
1119- gtk_widget_show (label_alignment);
1120-
1121 option_track_label = g_strdup_printf ("%s:", track_label);
1122 track_label_widget = gtk_label_new (option_track_label);
1123- gtk_container_add (GTK_CONTAINER (label_alignment), track_label_widget);
1124+ g_object_set (G_OBJECT (track_label_widget), "halign", GTK_ALIGN_FILL, NULL);
1125+ gtk_grid_attach (GTK_GRID (views[3]), track_label_widget, 0, num_children[3], 1, 1);
1126 gtk_widget_show (track_label_widget);
1127 g_free (option_track_label);
1128
1129- option_alignment = gtk_alignment_new (0, 0, 1.0f, 0);
1130- gtk_table_attach (GTK_TABLE (views[3]), option_alignment,
1131- 1, 2, num_children[3], num_children[3] + 1, GTK_FILL|GTK_EXPAND, GTK_SHRINK, 0, 0);
1132- gtk_widget_show (option_alignment);
1133-
1134 track_widget = xfce_mixer_option_new (mixer_container->card, track);
1135- gtk_container_add (GTK_CONTAINER (option_alignment), track_widget);
1136+ g_object_set (G_OBJECT (track_widget), "halign", GTK_ALIGN_FILL, "hexpand", TRUE, NULL);
1137+ gtk_grid_attach (GTK_GRID (views[3]), track_widget, 1, num_children[3], 1, 1);
1138 gtk_widget_show (track_widget);
1139
1140 num_children[3]++;
1141@@ -390,30 +368,24 @@ xfce_mixer_container_create_contents (XfceMixerContainer *mixer_container)
1142 label1 = gtk_label_new (_("No controls visible"));
1143 gtk_widget_show (label1);
1144
1145- alignment = gtk_alignment_new (0.5, 0.5, 0, 0);
1146- gtk_widget_show (alignment);
1147-
1148- vbox = gtk_vbox_new (6, FALSE);
1149- gtk_container_add (GTK_CONTAINER (alignment), vbox);
1150+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
1151+ g_object_set (G_OBJECT (vbox), "halign", GTK_ALIGN_CENTER, "hexpand", TRUE, "valign", GTK_ALIGN_CENTER, "vexpand", TRUE,
1152+ "border-width", 6, NULL);
1153 gtk_widget_show (vbox);
1154
1155 label2 = gtk_label_new (NULL);
1156 gtk_label_set_markup (GTK_LABEL (label2), _("<span weight=\"bold\" size=\"larger\">No controls visible</span>"));
1157- gtk_label_set_max_width_chars (GTK_LABEL (label2), 80);
1158- gtk_label_set_line_wrap (GTK_LABEL (label2), TRUE);
1159- gtk_misc_set_alignment (GTK_MISC (label2), 0.0, 0.5);
1160+ g_object_set (G_OBJECT (label2), "max-width-chars", 80, "xalign", 0.0, "wrap", TRUE, NULL);
1161 gtk_box_pack_start (GTK_BOX (vbox), label2, FALSE, TRUE, 0);
1162 gtk_widget_show (label2);
1163
1164 label3 = gtk_label_new (NULL);
1165 gtk_label_set_markup (GTK_LABEL (label3), _("In order to toggle the visibility of mixer controls, open the <b>\"Select Controls\"</b> dialog."));
1166- gtk_label_set_max_width_chars (GTK_LABEL (label3), 80);
1167- gtk_label_set_line_wrap (GTK_LABEL (label3), TRUE);
1168- gtk_misc_set_alignment (GTK_MISC (label3), 0.0, 0.5);
1169+ g_object_set (G_OBJECT (label3), "max-width-chars", 80, "xalign", 0.0, "wrap", TRUE, NULL);
1170 gtk_box_pack_start (GTK_BOX (vbox), label3, FALSE, TRUE, 0);
1171 gtk_widget_show (label3);
1172
1173- gtk_notebook_append_page (GTK_NOTEBOOK (mixer_container), alignment, label1);
1174+ gtk_notebook_append_page (GTK_NOTEBOOK (mixer_container), vbox, label1);
1175 }
1176
1177 g_object_unref (preferences);
1178diff --git a/xfce4-mixer/xfce-mixer-controls-dialog.c b/xfce4-mixer/xfce-mixer-controls-dialog.c
1179index dd79a77..92886fb 100644
1180--- a/xfce4-mixer/xfce-mixer-controls-dialog.c
1181+++ b/xfce4-mixer/xfce-mixer-controls-dialog.c
1182@@ -119,7 +119,9 @@ xfce_mixer_controls_dialog_init (XfceMixerControlsDialog *dialog)
1183
1184 xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (dialog), _("Select which controls should be visible"));
1185
1186- button = gtk_button_new_from_stock (GTK_STOCK_CLOSE);
1187+ button = gtk_button_new_with_mnemonic (_("_Close"));
1188+ gtk_button_set_image (GTK_BUTTON (button),
1189+ gtk_image_new_from_icon_name ("window-close", GTK_ICON_SIZE_BUTTON));
1190 gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_CLOSE);
1191 gtk_widget_show (button);
1192 }
1193@@ -191,14 +193,15 @@ xfce_mixer_controls_dialog_create_contents (XfceMixerControlsDialog *dialog)
1194 dialog->store = gtk_list_store_new (2, G_TYPE_BOOLEAN, G_TYPE_STRING);
1195
1196 dialog->frame = gtk_frame_new (NULL);
1197- gtk_container_set_border_width (GTK_CONTAINER (dialog->frame), 6);
1198+ g_object_set (G_OBJECT (dialog->frame), "margin-top", 6, "margin-bottom", 6, NULL);
1199 gtk_frame_set_shadow_type (GTK_FRAME (dialog->frame), GTK_SHADOW_NONE);
1200- gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), dialog->frame);
1201+ gtk_container_add (GTK_CONTAINER (gtk_dialog_get_content_area (GTK_DIALOG (dialog))), dialog->frame);
1202 gtk_widget_show (dialog->frame);
1203
1204 scrollwin = gtk_scrolled_window_new (NULL, NULL);
1205 gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrollwin), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
1206 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrollwin), GTK_SHADOW_IN);
1207+ g_object_set (G_OBJECT (scrollwin), "halign", GTK_ALIGN_FILL, "hexpand", TRUE, "valign", GTK_ALIGN_FILL, "vexpand", TRUE, NULL);
1208 gtk_container_add (GTK_CONTAINER (dialog->frame), scrollwin);
1209 gtk_widget_show (scrollwin);
1210
1211diff --git a/xfce4-mixer/xfce-mixer-option.c b/xfce4-mixer/xfce-mixer-option.c
1212index d16b766..969baad 100644
1213--- a/xfce4-mixer/xfce-mixer-option.c
1214+++ b/xfce4-mixer/xfce-mixer-option.c
1215@@ -189,15 +189,15 @@ static void
1216 xfce_mixer_option_changed (GtkComboBox *combo,
1217 XfceMixerOption *option)
1218 {
1219- gchar *active_option;
1220+ GtkTreeIter iter;
1221+ gchar *active_option;
1222
1223 if (G_UNLIKELY (option->ignore_signals))
1224 return;
1225
1226- active_option = gtk_combo_box_get_active_text (combo);
1227-
1228- if (G_LIKELY (active_option != NULL))
1229+ if (G_LIKELY (gtk_combo_box_get_active_iter (combo, &iter)))
1230 {
1231+ gtk_tree_model_get (GTK_TREE_MODEL (option->list_store), &iter, OPTION_COLUMN, &active_option, -1);
1232 gst_mixer_set_option (GST_MIXER (option->card), GST_MIXER_OPTIONS (option->track),
1233 active_option);
1234 g_free (active_option);
1235diff --git a/xfce4-mixer/xfce-mixer-track.c b/xfce4-mixer/xfce-mixer-track.c
1236index a7442ed..831d127 100644
1237--- a/xfce4-mixer/xfce-mixer-track.c
1238+++ b/xfce4-mixer/xfce-mixer-track.c
1239@@ -45,8 +45,8 @@
1240
1241 static void xfce_mixer_track_dispose (GObject *object);
1242 static void xfce_mixer_track_finalize (GObject *object);
1243-static gboolean xfce_mixer_track_lock_button_line_expose_event (GtkWidget *widget,
1244- GdkEventExpose *event,
1245+static gboolean xfce_mixer_track_lock_button_line_draw (GtkWidget *widget,
1246+ cairo_t *cr,
1247 gpointer user_data);
1248 static void xfce_mixer_track_create_contents (XfceMixerTrack *track);
1249 static void xfce_mixer_track_fader_changed (GtkRange *range,
1250@@ -83,7 +83,7 @@ struct _XfceMixerTrack
1251
1252
1253
1254-G_DEFINE_TYPE (XfceMixerTrack, xfce_mixer_track, GTK_TYPE_VBOX)
1255+G_DEFINE_TYPE (XfceMixerTrack, xfce_mixer_track, GTK_TYPE_BOX)
1256
1257
1258
1259@@ -138,7 +138,7 @@ xfce_mixer_track_new (GstElement *card,
1260 g_return_val_if_fail (GST_IS_MIXER (card), NULL);
1261 g_return_val_if_fail (GST_IS_MIXER_TRACK (gst_track), NULL);
1262
1263- track = g_object_new (TYPE_XFCE_MIXER_TRACK, NULL);
1264+ track = g_object_new (TYPE_XFCE_MIXER_TRACK, "orientation", GTK_ORIENTATION_VERTICAL, NULL);
1265 track->card = card;
1266 track->gst_track = gst_track;
1267
1268@@ -150,32 +150,27 @@ xfce_mixer_track_new (GstElement *card,
1269
1270
1271 static gboolean
1272-xfce_mixer_track_lock_button_line_expose_event (GtkWidget *widget,
1273- GdkEventExpose *event,
1274- gpointer user_data)
1275+xfce_mixer_track_lock_button_line_draw (GtkWidget *widget,
1276+ cairo_t *cr,
1277+ gpointer user_data)
1278 {
1279 GtkPositionType position = GPOINTER_TO_INT (user_data);
1280 GtkAllocation allocation;
1281- cairo_t *cr;
1282- GtkStyle *style = gtk_widget_get_style (widget);
1283+ GtkStyleContext *style_context = gtk_widget_get_style_context (widget);
1284 GdkPoint points[3];
1285 double line_width = 2.0;
1286-
1287- cr = gdk_cairo_create (gtk_widget_get_window (widget));
1288+ GdkRGBA fg_color;
1289
1290 gtk_widget_get_allocation (widget, &allocation);
1291 if (gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
1292 position = (position == GTK_POS_LEFT) ? GTK_POS_RIGHT : GTK_POS_LEFT;
1293
1294- /* Only refresh regions where it is necessary */
1295- gdk_cairo_region (cr, event->region);
1296- cairo_clip (cr);
1297-
1298 /*
1299 * Draw an L-shaped line from the right/left center to the top middle of the
1300 * allocation
1301 */
1302- gdk_cairo_set_source_color (cr, &style->fg[GTK_STATE_NORMAL]);
1303+ gtk_style_context_get_color (style_context, GTK_STATE_FLAG_NORMAL, &fg_color);
1304+ gdk_cairo_set_source_rgba (cr, &fg_color);
1305 cairo_set_line_width(cr, line_width);
1306 if (position == GTK_POS_RIGHT)
1307 {
1308@@ -200,8 +195,6 @@ xfce_mixer_track_lock_button_line_expose_event (GtkWidget *widget,
1309 cairo_line_to (cr, points[2].x, points[2].y);
1310 cairo_stroke (cr);
1311
1312- cairo_destroy (cr);
1313-
1314 return TRUE;
1315 }
1316
1317@@ -216,7 +209,6 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1318 const gchar *track_label;
1319 gchar *tooltip_text;
1320 gdouble step;
1321- GtkWidget *faders_alignment;
1322 GtkWidget *faders_vbox;
1323 GtkWidget *faders_hbox;
1324 GtkWidget *lock_button_hbox;
1325@@ -224,7 +216,6 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1326 GtkWidget *lock_button_line1;
1327 GtkWidget *lock_button_line2;
1328 GtkWidget *image;
1329- GtkWidget *buttons_alignment;
1330 GtkWidget *buttons_hbox;
1331 GtkRequisition lock_button_hbox_requisition;
1332
1333@@ -239,15 +230,12 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1334 gtk_box_set_spacing (GTK_BOX (track), 6);
1335
1336 /* Center and do not expand faders and lock button */
1337- faders_alignment = gtk_alignment_new (0.5, 1.0, 0, 1.0);
1338- gtk_box_pack_start (GTK_BOX (track), faders_alignment, TRUE, TRUE, 0);
1339- gtk_widget_show (faders_alignment);
1340-
1341- faders_vbox = gtk_vbox_new (FALSE, 6);
1342- gtk_container_add (GTK_CONTAINER (faders_alignment), faders_vbox);
1343+ faders_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
1344+ g_object_set (G_OBJECT (faders_vbox), "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_FILL, "vexpand", TRUE, NULL);
1345+ gtk_box_pack_start (GTK_BOX (track), faders_vbox, TRUE, TRUE, 0);
1346 gtk_widget_show (faders_vbox);
1347
1348- faders_hbox = gtk_hbox_new (TRUE, 6);
1349+ faders_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
1350 gtk_box_pack_start (GTK_BOX (faders_vbox), faders_hbox, TRUE, TRUE, 0);
1351 gtk_widget_show (faders_hbox);
1352
1353@@ -256,7 +244,7 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1354 {
1355 tooltip_text = g_strdup_printf (_("Volume of channel %d on %s"), channel, track_label);
1356
1357- fader = gtk_vscale_new_with_range (track->gst_track->min_volume, track->gst_track->max_volume, step);
1358+ fader = gtk_scale_new_with_range (GTK_ORIENTATION_VERTICAL, track->gst_track->min_volume, track->gst_track->max_volume, step);
1359 gtk_scale_set_draw_value (GTK_SCALE (fader), FALSE);
1360 gtk_range_set_inverted (GTK_RANGE (fader), TRUE);
1361 gtk_range_set_value (GTK_RANGE (fader), volumes[channel]);
1362@@ -278,7 +266,7 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1363 }
1364
1365 /* Create lock button with lines */
1366- lock_button_hbox = gtk_hbox_new (FALSE, 0);
1367+ lock_button_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
1368 gtk_box_pack_start (GTK_BOX (faders_vbox), lock_button_hbox, FALSE, FALSE, 0);
1369 gtk_widget_show (lock_button_hbox);
1370
1371@@ -286,7 +274,7 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1372 lock_button_line1 = gtk_drawing_area_new ();
1373 gtk_widget_set_size_request (lock_button_line1, 12, 8);
1374 gtk_box_pack_start (GTK_BOX (lock_button_hbox), lock_button_line1, TRUE, TRUE, 0);
1375- g_signal_connect (G_OBJECT (lock_button_line1), "expose-event", G_CALLBACK (xfce_mixer_track_lock_button_line_expose_event), GINT_TO_POINTER (GTK_POS_LEFT));
1376+ g_signal_connect (G_OBJECT (lock_button_line1), "draw", G_CALLBACK (xfce_mixer_track_lock_button_line_draw), GINT_TO_POINTER (GTK_POS_LEFT));
1377 gtk_widget_show (lock_button_line1);
1378
1379 /* Lock button */
1380@@ -309,7 +297,7 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1381 lock_button_line2 = gtk_drawing_area_new ();
1382 gtk_widget_set_size_request (lock_button_line2, 12, 8);
1383 gtk_box_pack_start (GTK_BOX (lock_button_hbox), lock_button_line2, TRUE, TRUE, 0);
1384- g_signal_connect (G_OBJECT (lock_button_line2), "expose-event", G_CALLBACK (xfce_mixer_track_lock_button_line_expose_event), GINT_TO_POINTER (GTK_POS_RIGHT));
1385+ g_signal_connect (G_OBJECT (lock_button_line2), "draw", G_CALLBACK (xfce_mixer_track_lock_button_line_draw), GINT_TO_POINTER (GTK_POS_RIGHT));
1386 gtk_widget_show (lock_button_line2);
1387
1388 /*
1389@@ -318,20 +306,17 @@ xfce_mixer_track_create_contents (XfceMixerTrack *track)
1390 */
1391 if (track->gst_track->num_channels < 2)
1392 {
1393- gtk_widget_size_request (lock_button_hbox, &lock_button_hbox_requisition);
1394+ gtk_widget_get_preferred_size (lock_button_hbox, NULL, &lock_button_hbox_requisition);
1395 gtk_widget_destroy (lock_button_hbox);
1396- lock_button_hbox = gtk_hbox_new (FALSE, 0);
1397+ lock_button_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
1398 gtk_widget_set_size_request (lock_button_hbox, lock_button_hbox_requisition.width, lock_button_hbox_requisition.height);
1399 gtk_box_pack_start (GTK_BOX (faders_vbox), lock_button_hbox, FALSE, FALSE, 0);
1400 gtk_widget_show (lock_button_hbox);
1401 }
1402
1403- buttons_alignment = gtk_alignment_new (0.5, 1.0, 0, 0);
1404- gtk_box_pack_start (GTK_BOX (track), buttons_alignment, FALSE, FALSE, 0);
1405- gtk_widget_show (buttons_alignment);
1406-
1407- buttons_hbox = gtk_hbox_new (FALSE, 12);
1408- gtk_container_add (GTK_CONTAINER (buttons_alignment), buttons_hbox);
1409+ buttons_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
1410+ g_object_set (G_OBJECT (buttons_hbox), "halign", GTK_ALIGN_CENTER, "valign", GTK_ALIGN_END, NULL);
1411+ gtk_box_pack_start (GTK_BOX (track), buttons_hbox, FALSE, FALSE, 0);
1412 gtk_widget_show (buttons_hbox);
1413
1414 /* Mute button for playback tracks */
1415diff --git a/xfce4-mixer/xfce-mixer-window.c b/xfce4-mixer/xfce-mixer-window.c
1416index 7f9a9e9..248236b 100644
1417--- a/xfce4-mixer/xfce-mixer-window.c
1418+++ b/xfce4-mixer/xfce-mixer-window.c
1419@@ -40,22 +40,26 @@
1420
1421 static void xfce_mixer_window_dispose (GObject *object);
1422 static void xfce_mixer_window_finalize (GObject *object);
1423+static void xfce_mixer_window_size_allocate (GtkWidget *widget,
1424+ GtkAllocation *allocation);
1425+static gboolean xfce_mixer_window_state_event (GtkWidget *widget,
1426+ GdkEventWindowState *event);
1427+static void xfce_mixer_window_destroy (GtkWidget *widget);
1428 static void xfce_mixer_window_soundcard_changed (XfceMixerCardCombo *combo,
1429 GstElement *card,
1430 XfceMixerWindow *window);
1431 static void xfce_mixer_window_soundcard_property_changed (XfceMixerWindow *window,
1432 GParamSpec *pspec,
1433 GObject *object);
1434-static void xfce_mixer_window_action_select_controls (GtkAction *action,
1435- XfceMixerWindow *window);
1436+static void xfce_mixer_window_action_select_controls (GSimpleAction *action,
1437+ GVariant *parameter,
1438+ gpointer user_data);
1439 static void xfce_mixer_window_controls_property_changed (XfceMixerWindow *window,
1440 GParamSpec *pspec,
1441 GObject *object);
1442-static void xfce_mixer_window_close (GtkAction *action,
1443- XfceMixerWindow *window);
1444-static gboolean xfce_mixer_window_closed (GtkWidget *window,
1445- GdkEvent *event,
1446- XfceMixerWindow *mixer_window);
1447+static void xfce_mixer_window_close (GSimpleAction *action,
1448+ GVariant *parameter,
1449+ gpointer user_data);
1450 static void xfce_mixer_window_update_contents (XfceMixerWindow *window);
1451
1452
1453@@ -71,7 +75,11 @@ struct _XfceMixerWindow
1454
1455 XfceMixerPreferences *preferences;
1456
1457- GtkActionGroup *action_group;
1458+ /* Current window state */
1459+ gint current_width;
1460+ gint current_height;
1461+ gboolean is_maximized;
1462+ gboolean is_fullscreen;
1463
1464 GtkWidget *soundcard_combo;
1465
1466@@ -86,12 +94,10 @@ struct _XfceMixerWindow
1467
1468
1469
1470-static const GtkActionEntry action_entries[] =
1471+static const GActionEntry action_entries[] =
1472 {
1473- { "quit", GTK_STOCK_QUIT, N_ ("_Quit"), "<Control>q", N_ ("Exit the mixer"),
1474- G_CALLBACK (xfce_mixer_window_close) },
1475- { "select-controls", NULL, N_ ("_Select Controls..."), "<Control>s", N_ ("Select which controls are displayed"),
1476- G_CALLBACK (xfce_mixer_window_action_select_controls) },
1477+ { "quit", &xfce_mixer_window_close, NULL, NULL, NULL },
1478+ { "select-controls", &xfce_mixer_window_action_select_controls, NULL, NULL, NULL },
1479 };
1480
1481
1482@@ -103,11 +109,17 @@ G_DEFINE_TYPE (XfceMixerWindow, xfce_mixer_window, XFCE_TYPE_TITLED_DIALOG)
1483 static void
1484 xfce_mixer_window_class_init (XfceMixerWindowClass *klass)
1485 {
1486- GObjectClass *gobject_class;
1487+ GObjectClass *gobject_class;
1488+ GtkWidgetClass *gtk_widget_class;
1489
1490 gobject_class = G_OBJECT_CLASS (klass);
1491 gobject_class->dispose = xfce_mixer_window_dispose;
1492 gobject_class->finalize = xfce_mixer_window_finalize;
1493+
1494+ gtk_widget_class = GTK_WIDGET_CLASS (klass);
1495+ gtk_widget_class->size_allocate = xfce_mixer_window_size_allocate;
1496+ gtk_widget_class->window_state_event = xfce_mixer_window_state_event;
1497+ gtk_widget_class->destroy = xfce_mixer_window_destroy;
1498 }
1499
1500
1501@@ -115,8 +127,7 @@ xfce_mixer_window_class_init (XfceMixerWindowClass *klass)
1502 static void
1503 xfce_mixer_window_init (XfceMixerWindow *window)
1504 {
1505- GtkAccelGroup *accel_group;
1506- GtkAction *action;
1507+ GApplication *app = g_application_get_default ();
1508 GtkWidget *label;
1509 GtkWidget *button;
1510 GtkWidget *vbox;
1511@@ -124,15 +135,18 @@ xfce_mixer_window_init (XfceMixerWindow *window)
1512 GtkWidget *bbox;
1513 gchar *card_name;
1514 GstElement *card;
1515- guint i;
1516- gint width;
1517- gint height;
1518+ const gchar *select_controls_accels[] = { "<Control>s", NULL };
1519+ const gchar *quit_accels[] = { "<Control>q", NULL };
1520
1521 window->controls_dialog = NULL;
1522
1523 window->preferences = xfce_mixer_preferences_get ();
1524
1525- g_object_get (window->preferences, "window-width", &width, "window-height", &height, "sound-card", &card_name, NULL);
1526+ window->is_maximized = FALSE;
1527+ window->is_fullscreen = FALSE;
1528+
1529+ g_object_get (window->preferences, "window-width", &window->current_width, "window-height", &window->current_height,
1530+ "sound-card", &card_name, NULL);
1531 if (card_name != NULL)
1532 card = xfce_mixer_get_card (card_name);
1533 else
1534@@ -148,36 +162,21 @@ xfce_mixer_window_init (XfceMixerWindow *window)
1535 gtk_window_set_type_hint (GTK_WINDOW (window), GDK_WINDOW_TYPE_HINT_NORMAL);
1536 gtk_window_set_icon_name (GTK_WINDOW (window), "multimedia-volume-control");
1537 gtk_window_set_title (GTK_WINDOW (window), _("Audio Mixer"));
1538- gtk_window_set_default_size (GTK_WINDOW (window), width, height);
1539+ gtk_window_set_default_size (GTK_WINDOW (window), window->current_width, window->current_height);
1540 gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
1541- gtk_dialog_set_has_separator (GTK_DIALOG (window), FALSE);
1542 xfce_titled_dialog_set_subtitle (XFCE_TITLED_DIALOG (window), _("Configure sound card(s) and control the volume of selected tracks"));
1543
1544- g_signal_connect (window, "delete-event", G_CALLBACK (xfce_mixer_window_closed), window);
1545-
1546- /* Quit mixer when the main window is closed */
1547- g_signal_connect (G_OBJECT (window), "delete-event", G_CALLBACK (gtk_main_quit), NULL);
1548-
1549- /* Create window action group */
1550- window->action_group = gtk_action_group_new ("XfceMixerWindow");
1551- gtk_action_group_set_translation_domain (window->action_group, GETTEXT_PACKAGE);
1552- gtk_action_group_add_actions (window->action_group, action_entries, G_N_ELEMENTS (action_entries), GTK_WIDGET (window));
1553+ /* Install actions */
1554+ g_action_map_add_action_entries (G_ACTION_MAP (app), action_entries, G_N_ELEMENTS (action_entries), window);
1555
1556 /* Install action accelerators for the mixer window */
1557- accel_group = gtk_accel_group_new ();
1558- for (i = 0; i < G_N_ELEMENTS (action_entries); ++i)
1559- {
1560- action = gtk_action_group_get_action (window->action_group, action_entries[i].name);
1561- gtk_action_set_accel_group (action, accel_group);
1562- gtk_action_connect_accelerator (action);
1563- gtk_action_set_sensitive (action, TRUE);
1564- }
1565- gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
1566+ gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.select-controls", select_controls_accels);
1567+ gtk_application_set_accels_for_action (GTK_APPLICATION (app), "app.quit", quit_accels);
1568
1569 vbox = gtk_dialog_get_content_area (GTK_DIALOG (window));
1570 gtk_widget_show (vbox);
1571
1572- hbox = gtk_hbox_new (FALSE, 12);
1573+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
1574 gtk_container_set_border_width (GTK_CONTAINER (hbox), 6);
1575 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 0);
1576 gtk_widget_show (hbox);
1577@@ -188,37 +187,40 @@ xfce_mixer_window_init (XfceMixerWindow *window)
1578
1579 window->soundcard_combo = xfce_mixer_card_combo_new (card);
1580 g_signal_connect (G_OBJECT (window->soundcard_combo), "soundcard-changed", G_CALLBACK (xfce_mixer_window_soundcard_changed), window);
1581- gtk_container_add (GTK_CONTAINER (hbox), window->soundcard_combo);
1582+ gtk_box_pack_start (GTK_BOX (hbox), window->soundcard_combo, TRUE, TRUE, 0);
1583 gtk_label_set_mnemonic_widget (GTK_LABEL (label), window->soundcard_combo);
1584 gtk_widget_show (window->soundcard_combo);
1585
1586 window->mixer_frame = gtk_frame_new (NULL);
1587 gtk_frame_set_shadow_type (GTK_FRAME (window->mixer_frame), GTK_SHADOW_NONE);
1588 gtk_container_set_border_width (GTK_CONTAINER (window->mixer_frame), 6);
1589- gtk_container_add (GTK_CONTAINER (vbox), window->mixer_frame);
1590+ gtk_box_pack_start (GTK_BOX (vbox), window->mixer_frame, TRUE, TRUE, 0);
1591 gtk_widget_show (window->mixer_frame);
1592
1593 window->mixer_container = xfce_mixer_container_new (NULL);
1594 gtk_container_add (GTK_CONTAINER (window->mixer_frame), window->mixer_container);
1595 gtk_widget_show (window->mixer_container);
1596
1597+G_GNUC_BEGIN_IGNORE_DEPRECATIONS
1598+ /* Single place still using deprecated API. GTK+ uses it internally as well, so why should we suffer?
1599+ Suffice it to say, new API is quite limited. */
1600 bbox = gtk_dialog_get_action_area (GTK_DIALOG (window));
1601+G_GNUC_END_IGNORE_DEPRECATIONS
1602 gtk_button_box_set_layout (GTK_BUTTON_BOX (bbox), GTK_BUTTONBOX_EDGE);
1603 gtk_container_set_border_width (GTK_CONTAINER (bbox), 6);
1604
1605- window->select_controls_button = gtk_button_new ();
1606- gtk_activatable_set_related_action (GTK_ACTIVATABLE (window->select_controls_button),
1607- gtk_action_group_get_action (window->action_group, "select-controls"));
1608+ window->select_controls_button = gtk_button_new_with_mnemonic (_("_Select Controls..."));
1609 gtk_button_set_image (GTK_BUTTON (window->select_controls_button),
1610 gtk_image_new_from_icon_name ("preferences-desktop", GTK_ICON_SIZE_BUTTON));
1611+ gtk_actionable_set_action_name (GTK_ACTIONABLE (window->select_controls_button), "app.select-controls");
1612 gtk_widget_set_sensitive (window->select_controls_button, FALSE);
1613 gtk_box_pack_start (GTK_BOX (bbox), window->select_controls_button, FALSE, TRUE, 0);
1614 gtk_widget_show (window->select_controls_button);
1615
1616- button = gtk_button_new ();
1617- gtk_activatable_set_related_action (GTK_ACTIVATABLE (button),
1618- gtk_action_group_get_action (window->action_group, "quit"));
1619- gtk_button_set_image (GTK_BUTTON (button), gtk_image_new_from_stock (GTK_STOCK_QUIT, GTK_ICON_SIZE_BUTTON));
1620+ button = gtk_button_new_with_mnemonic (_("_Quit"));
1621+ gtk_button_set_image (GTK_BUTTON (button),
1622+ gtk_image_new_from_icon_name ("exit", GTK_ICON_SIZE_BUTTON));
1623+ gtk_actionable_set_action_name (GTK_ACTIONABLE (button), "app.quit");
1624 gtk_box_pack_start (GTK_BOX (bbox), button, FALSE, TRUE, 0);
1625 gtk_widget_show (button);
1626
1627@@ -252,10 +254,55 @@ xfce_mixer_window_finalize (GObject *object)
1628
1629
1630
1631+static void
1632+xfce_mixer_window_size_allocate (GtkWidget *widget,
1633+ GtkAllocation *allocation)
1634+{
1635+ XfceMixerWindow *window = XFCE_MIXER_WINDOW (widget);
1636+
1637+ (*GTK_WIDGET_CLASS (xfce_mixer_window_parent_class)->size_allocate) (widget, allocation);
1638+
1639+ if (!window->is_maximized && !window->is_fullscreen)
1640+ gtk_window_get_size (GTK_WINDOW (window), &window->current_width, &window->current_height);
1641+}
1642+
1643+
1644+
1645+static gboolean
1646+xfce_mixer_window_state_event (GtkWidget *widget,
1647+ GdkEventWindowState *event)
1648+{
1649+ XfceMixerWindow *window = XFCE_MIXER_WINDOW (widget);
1650+ gboolean result = GDK_EVENT_PROPAGATE;
1651+
1652+ if (GTK_WIDGET_CLASS (xfce_mixer_window_parent_class)->window_state_event != NULL)
1653+ result = (*GTK_WIDGET_CLASS (xfce_mixer_window_parent_class)->window_state_event) (widget, event);
1654+
1655+ window->is_maximized = (event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED) != 0;
1656+ window->is_fullscreen = (event->new_window_state & GDK_WINDOW_STATE_FULLSCREEN) != 0;
1657+
1658+ return result;
1659+}
1660+
1661+
1662+
1663+static void
1664+xfce_mixer_window_destroy (GtkWidget *widget)
1665+{
1666+ XfceMixerWindow *window = XFCE_MIXER_WINDOW (widget);
1667+
1668+ g_object_set (G_OBJECT (window->preferences), "window-width", window->current_width,
1669+ "window-height", window->current_height, NULL);
1670+
1671+ (*GTK_WIDGET_CLASS (xfce_mixer_window_parent_class)->destroy) (widget);
1672+}
1673+
1674+
1675+
1676 GtkWidget*
1677-xfce_mixer_window_new (void)
1678+xfce_mixer_window_new (GApplication *app)
1679 {
1680- return g_object_new (TYPE_XFCE_MIXER_WINDOW, NULL);
1681+ return g_object_new (TYPE_XFCE_MIXER_WINDOW, "application", app, NULL);
1682 }
1683
1684
1685@@ -334,9 +381,12 @@ xfce_mixer_window_soundcard_property_changed (XfceMixerWindow *window,
1686
1687
1688 static void
1689-xfce_mixer_window_action_select_controls (GtkAction *action,
1690- XfceMixerWindow *window)
1691+xfce_mixer_window_action_select_controls (GSimpleAction *action,
1692+ GVariant *parameter,
1693+ gpointer user_data)
1694 {
1695+ XfceMixerWindow *window = XFCE_MIXER_WINDOW (user_data);
1696+
1697 g_return_if_fail (window->controls_dialog == NULL);
1698
1699 window->controls_dialog = xfce_mixer_controls_dialog_new (window);
1700@@ -363,29 +413,15 @@ xfce_mixer_window_controls_property_changed (XfceMixerWindow *window,
1701
1702
1703 static void
1704-xfce_mixer_window_close (GtkAction *action,
1705- XfceMixerWindow *window)
1706+xfce_mixer_window_close (GSimpleAction *action,
1707+ GVariant *parameter,
1708+ gpointer user_data)
1709 {
1710- /* This is a nasty hack to save the settings before the application quits */
1711- xfce_mixer_window_closed (GTK_WIDGET (window), NULL, window);
1712-}
1713-
1714-
1715-
1716-static gboolean
1717-xfce_mixer_window_closed (GtkWidget *window,
1718- GdkEvent *event,
1719- XfceMixerWindow *mixer_window)
1720-{
1721- gint width;
1722- gint height;
1723-
1724- gtk_window_get_size (GTK_WINDOW (mixer_window), &width, &height);
1725- g_object_set (G_OBJECT (mixer_window->preferences), "window-width", width, "window-height", height, NULL);
1726+ XfceMixerWindow *window = XFCE_MIXER_WINDOW (user_data);
1727
1728- gtk_main_quit ();
1729+ gtk_widget_destroy (GTK_WIDGET (window));
1730
1731- return TRUE;
1732+ g_application_quit (g_application_get_default ());
1733 }
1734
1735
1736diff --git a/xfce4-mixer/xfce-mixer-window.h b/xfce4-mixer/xfce-mixer-window.h
1737index b2aba01..b9ff14a 100644
1738--- a/xfce4-mixer/xfce-mixer-window.h
1739+++ b/xfce4-mixer/xfce-mixer-window.h
1740@@ -38,7 +38,7 @@ typedef struct _XfceMixerWindow XfceMixerWindow;
1741
1742 GType xfce_mixer_window_get_type (void) G_GNUC_CONST;
1743
1744-GtkWidget *xfce_mixer_window_new (void);
1745+GtkWidget *xfce_mixer_window_new (GApplication *app);
1746 GstElement *xfce_mixer_window_get_active_card (XfceMixerWindow *window);
1747
1748 G_END_DECLS
This page took 0.406676 seconds and 4 git commands to generate.