badwolf.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  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 <webkit/webkit.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. GtkEntryBuffer *location_buf;
  40. uint32_t session_id;
  41. WebKitWebView *webView;
  42. GtkWidget *statusbar;
  43. GtkWidget *statuslabel;
  44. GtkWidget *search;
  45. };
  46. GtkWidget *badwolf_new_tab_box(const gchar *title, struct Client *browser);
  47. void webView_tab_label_change(struct Client *browser, const gchar *title);
  48. struct Client *new_browser(const gchar *target_url, struct Client *old_browser);
  49. int badwolf_new_tab(GtkNotebook *notebook, struct Client *browser, bool auto_switch);
  50. extern void man_uri_scheme_request_cb(WebKitURISchemeRequest *request, gpointer user_data);
  51. #endif /* BADWOLF_H_INCLUDED */