[pulseaudio-discuss] [PATCH 2/2 pavucontrol] remove unnecessary Window -> MainWindow casting
Tanu Kaskinen
tanuk at iki.fi
Wed Nov 1 11:47:06 UTC 2017
mainwindow.h and pavucontrol.h include each other, which makes it
necessary to declare some types before the include directives.
---
src/mainwindow.h | 2 ++
src/pavuapplication.cc | 2 +-
src/pavucontrol.cc | 2 +-
src/pavucontrol.h | 4 +++-
4 files changed, 7 insertions(+), 3 deletions(-)
diff --git a/src/mainwindow.h b/src/mainwindow.h
index f45bf9a..b56cf73 100644
--- a/src/mainwindow.h
+++ b/src/mainwindow.h
@@ -21,6 +21,8 @@
#ifndef mainwindow_h
#define mainwindow_h
+class MainWindow;
+
#include "pavucontrol.h"
#include <pulse/ext-stream-restore.h>
#if HAVE_EXT_DEVICE_RESTORE_API
diff --git a/src/pavuapplication.cc b/src/pavuapplication.cc
index b67ec04..c8e5edd 100644
--- a/src/pavuapplication.cc
+++ b/src/pavuapplication.cc
@@ -42,7 +42,7 @@ MainWindow* PavuApplication::create_window()
m = pa_glib_mainloop_new(g_main_context_default());
g_assert(m);
- MainWindow* pavucontrol_window = (MainWindow *)pavucontrol_get_window(m, maximize, retry, tab);
+ MainWindow* pavucontrol_window = pavucontrol_get_window(m, maximize, retry, tab);
pavucontrol_window->signal_hide().connect(
sigc::bind<Gtk::Window*>(sigc::mem_fun(*this,
diff --git a/src/pavucontrol.cc b/src/pavucontrol.cc
index fc7499c..32935d8 100644
--- a/src/pavucontrol.cc
+++ b/src/pavucontrol.cc
@@ -625,7 +625,7 @@ gboolean connect_to_pulse(gpointer userdata) {
return false;
}
-Gtk::Window* pavucontrol_get_window(pa_glib_mainloop *m, bool maximize, bool _retry, int _tab_number) {
+MainWindow* pavucontrol_get_window(pa_glib_mainloop *m, bool maximize, bool _retry, int _tab_number) {
MainWindow* mainWindow = NULL;
diff --git a/src/pavucontrol.h b/src/pavucontrol.h
index 31fee6b..a5ecb03 100644
--- a/src/pavucontrol.h
+++ b/src/pavucontrol.h
@@ -69,8 +69,10 @@ enum SourceType {
SOURCE_MONITOR,
};
+#include "mainwindow.h"
+
pa_context* get_context(void);
void show_error(const char *txt);
-Gtk::Window* pavucontrol_get_window(pa_glib_mainloop *m, bool maximize, bool retry, int tab_number);
+MainWindow* pavucontrol_get_window(pa_glib_mainloop *m, bool maximize, bool retry, int tab_number);
#endif
--
2.14.2
More information about the pulseaudio-discuss
mailing list