fork download
  1. // =============================================================== ConfigurationWindow.h
  2.  
  3. /*
  4.  * ConfigurationWindow.h
  5.  *
  6.  * Created on: Jan 2, 2019
  7.  * Author: forsaken
  8.  */
  9.  
  10. #ifndef CONFIGURATIONWINDOW_H_
  11. #define CONFIGURATIONWINDOW_H_
  12.  
  13. #include <gtk/gtk.h>
  14.  
  15. namespace Rgb {
  16.  
  17. class ConfigurationWindow {
  18. protected:
  19. GtkApplication* app;
  20. GtkWidget* window;
  21. public:
  22. ConfigurationWindow(GtkApplication* app);
  23. virtual ~ConfigurationWindow();
  24.  
  25. void show();
  26. };
  27.  
  28. } /* namespace Rgb */
  29.  
  30. #endif /* CONFIGURATIONWINDOW_H_ */
  31.  
  32. // =============================================================== main.cpp
  33.  
  34. #include <iostream>
  35.  
  36. #include <gtk/gtk.h>
  37. #include <dbus/dbus.h>
  38.  
  39. static void appActivate(GtkApplication* app, gpointer userData) {
  40. Rgb::ConfigurationWindow* window = new Rgb::ConfigurationWindow(app);
  41. window->show();
  42. }
  43.  
  44. int main(int argc, char **argv) {
  45. int result = 0;
  46. GtkApplication* app;
  47.  
  48. gtk_application_new("org.forsaken.RgbFrontend", G_APPLICATION_FLAGS_NONE);
  49. g_signal_connect(app, "activate", G_CALLBACK(appActivate), NULL);
  50. result = g_application_run(G_APPLICATION(app), argc, argv);
  51. g_object_unref(app);
  52. return result;
  53. /*
  54. DBusError dbusError;
  55. DBusConnection* dbusConnection;
  56. dbus_error_init(&dbusError);
  57. dbusConnection = dbus_bus_get(DBUS_BUS_SESSION, &dbusError);
  58. return 0;
  59. */
  60. }
  61.  
  62. // =============================================================== ConfigurationWindow.cpp
  63.  
  64. /*
  65.  * ConfigurationWindow.cpp
  66.  *
  67.  * Created on: Jan 2, 2019
  68.  * Author: forsaken
  69.  */
  70.  
  71. #include "ConfigurationWindow.h"
  72.  
  73. namespace Rgb {
  74.  
  75. ConfigurationWindow::ConfigurationWindow(GtkApplication* app) {
  76. this->app = app;
  77. this->window = gtk_application_window_new(app);
  78. gtk_window_set_title(GTK_WINDOW(this->window), "RGB-Configuration");
  79. gtk_window_set_default_size(GTK_WINDOW(this->window), 200, 200);
  80. }
  81.  
  82. ConfigurationWindow::~ConfigurationWindow() {
  83.  
  84. }
  85.  
  86. void ConfigurationWindow::show() {
  87. gtk_widget_show_all(this->window);
  88. }
  89.  
  90. } /* namespace Rgb */
  91.  
Compilation error #stdin compilation error #stdout 0s 15232KB
stdin
Standard input is empty
compilation info
prog.cpp:13:21: fatal error: gtk/gtk.h: No such file or directory
 #include <gtk/gtk.h>
                     ^
compilation terminated.
stdout
Standard output is empty