diff options
-rw-r--r-- | src/application.c | 25 | ||||
-rw-r--r-- | src/application.h | 9 |
2 files changed, 34 insertions, 0 deletions
diff --git a/src/application.c b/src/application.c index 98f3c98..38904c8 100644 --- a/src/application.c +++ b/src/application.c @@ -38,6 +38,8 @@ struct MqApplication { GList *windows; + GHashTable *tabs; + gint64 last_tab_id; MqConfig *config; WebKitSettings *settings; gboolean marquee_mode; @@ -82,6 +84,8 @@ mq_application_new(const gchar *profile, gboolean G_GNUC_UNUSED private) application->config = mq_config_new(profile); mq_config_load(application->config); application->windows = NULL; + application->tabs = g_hash_table_new(g_int64_hash, g_int64_equal); + application->last_tab_id = 0; application->marquee_mode = FALSE; #if defined(RUN_IN_PLACE) && RUN_IN_PLACE @@ -244,6 +248,27 @@ mq_application_delete_window(MqApplication *application, MqWindow *window) } } +gint64 +mq_application_register_tab(MqApplication *application, MqTabPage *tab_page) +{ + ++application->last_tab_id; + g_hash_table_insert(application->tabs, &application->last_tab_id, + tab_page); + return application->last_tab_id; +} + +gboolean +mq_application_unregister_tab(MqApplication *application, gint64 tab_id) +{ + return g_hash_table_remove(application->tabs, &tab_id); +} + +MqTabPage * +mq_application_get_tab(MqApplication *application, gint64 tab_id) +{ + return g_hash_table_lookup(application->tabs, &tab_id); +} + const gchar * mq_application_get_resources_dir(MqApplication *application) { diff --git a/src/application.h b/src/application.h index ddaa535..e7426a2 100644 --- a/src/application.h +++ b/src/application.h @@ -51,6 +51,15 @@ mq_application_add_window(MqApplication *application, const gchar **uris); void mq_application_delete_window(MqApplication *application, MqWindow *window); +gint64 +mq_application_register_tab(MqApplication *application, MqTabPage *tab_page); + +gboolean +mq_application_unregister_tab(MqApplication *application, gint64 tab_id); + +MqTabPage * +mq_application_get_tab(MqApplication *application, gint64 tab_id); + const gchar * mq_application_get_resources_dir(MqApplication *application); |