changeset 18293:5aae8608e1c6

UI info for finch and pidgin (finch guys probably want to take a look at what I did and clean it up)
author Nathan Walp <nwalp@pidgin.im>
date Mon, 02 Jul 2007 03:41:53 +0000
parents 9db52d9b8436
children c58b83d2b188
files finch/finch.c pidgin/gtkmain.c
diffstat 2 files changed, 38 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/finch/finch.c	Mon Jul 02 03:26:08 2007 +0000
+++ b/finch/finch.c	Mon Jul 02 03:41:53 2007 +0000
@@ -55,17 +55,36 @@
 	purple_debug_set_ui_ops(finch_debug_get_ui_ops());
 }
 
+/* XXX: this "leaks" a hashtable on shutdown.  I'll let
+ * the finch guys decide if they want to go through the trouble
+ * of properly freeing it, since their quit function doesn't
+ * live in this file */
+
+static GHashTable *ui_info = NULL;
+
+static GHashTable *finch_ui_get_info()
+{
+	if(NULL == ui_info) {
+		ui_info = g_hash_table_new(g_str_hash, g_str_equal);
+
+		g_hash_table_insert(ui_info, "name", (char*)_("Finch"));
+		g_hash_table_insert(ui_info, "version", VERSION);
+	}
+
+	return ui_info;
+}
+
 static PurpleCoreUiOps core_ops =
 {
 	finch_prefs_init,
 	debug_init,
 	gnt_ui_init,
 	gnt_ui_uninit,
+	finch_ui_get_info,
 
 	/* padding */
 	NULL,
 	NULL,
-	NULL,
 	NULL
 };
 
--- a/pidgin/gtkmain.c	Mon Jul 02 03:26:08 2007 +0000
+++ b/pidgin/gtkmain.c	Mon Jul 02 03:41:53 2007 +0000
@@ -316,6 +316,8 @@
 	pidgin_docklet_init();
 }
 
+static GHashTable *ui_info = NULL;
+
 static void
 pidgin_quit(void)
 {
@@ -337,17 +339,32 @@
 	pidgin_xfers_uninit();
 	pidgin_debug_uninit();
 
+	if(NULL != ui_info)
+		g_hash_table_destroy(ui_info);
+
 	/* and end it all... */
 	gtk_main_quit();
 }
 
+static GHashTable *pidgin_ui_get_info()
+{
+	if(NULL == ui_info) {
+		ui_info = g_hash_table_new(g_str_hash, g_str_equal);
+
+		g_hash_table_insert(ui_info, "name", (char*)PIDGIN_NAME);
+		g_hash_table_insert(ui_info, "version", VERSION);
+	}
+
+	return ui_info;
+}
+
 static PurpleCoreUiOps core_ops =
 {
 	pidgin_prefs_init,
 	debug_init,
 	pidgin_ui_init,
 	pidgin_quit,
-	NULL,
+	pidgin_ui_get_info,
 	NULL,
 	NULL,
 	NULL