summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <pj@pehjota.net>2017-10-29 18:38:45 (EDT)
committer Patrick McDermott <pj@pehjota.net>2017-10-29 18:38:45 (EDT)
commit7871fafb0a4d329c968d70f193426a1a8fb80c45 (patch)
tree814f8b0ca7c8741b8fa751523ce2064fff853038
parent2981b33230fb381ad7bc5d4910bbd3338fd91aa8 (diff)
downloadmarquee-7871fafb0a4d329c968d70f193426a1a8fb80c45.zip
marquee-7871fafb0a4d329c968d70f193426a1a8fb80c45.tar.gz
marquee-7871fafb0a4d329c968d70f193426a1a8fb80c45.tar.bz2
mq_application_*_tab(): New tab registration functions
-rw-r--r--src/application.c25
-rw-r--r--src/application.h9
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);