badwolf.h 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // SPDX-FileCopyrightText: 2019-2022 Badwolf Authors <https://hacktivis.me/projects/badwolf>
  2. // SPDX-License-Identifier: BSD-3-Clause
  3. #ifndef BADWOLF_H_INCLUDED
  4. #define BADWOLF_H_INCLUDED
  5. #include <gtk/gtk.h>
  6. #include <inttypes.h> /* uint64_t */
  7. #include <webkit2/webkit2.h>
  8. #if !WEBKIT_CHECK_VERSION(2, 32, 0)
  9. #error WebkitGTK 2.32.0 is the latest supported version for badwolf.
  10. #endif
  11. #ifdef UNUSED
  12. #error UNUSED is already defined
  13. #elif defined(__GNUC__)
  14. #define UNUSED(x) UNUSED_##x __attribute__((unused))
  15. #else
  16. #define UNUSED(x) x
  17. #endif
  18. extern const gchar *homepage;
  19. extern const gchar *version;
  20. extern struct Window *window;
  21. struct Window
  22. {
  23. GtkWidget *main_window;
  24. GtkWidget *notebook;
  25. GtkWidget *new_tab;
  26. GtkWidget *downloads_tab;
  27. WebKitUserContentManager *content_manager;
  28. WebKitUserContentFilterStore *content_store;
  29. };
  30. struct Client
  31. {
  32. GtkWidget *box;
  33. GtkWidget *toolbar;
  34. GtkWidget *back;
  35. GtkWidget *forward;
  36. GtkWidget *javascript;
  37. GtkWidget *auto_load_images;
  38. GtkWidget *location;
  39. uint64_t context_id;
  40. WebKitWebView *webView;
  41. GtkWidget *statusbar;
  42. GtkWidget *statuslabel;
  43. GtkWidget *search;
  44. };
  45. GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser);
  46. void webView_tab_label_change(struct Client *browser, const gchar *title);
  47. struct Client *new_browser(const gchar *target_url, struct Client *old_browser);
  48. int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser, bool auto_switch);
  49. gint badwolf_get_tab_position(GtkContainer *notebook, GtkWidget *child);
  50. #endif /* BADWOLF_H_INCLUDED */