summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimo Sirainen <cras@irssi.org>2002-04-27 19:35:17 +0000
committercras <cras@dbcabf3a-b0e7-0310-adc4-f8d773084564>2002-04-27 19:35:17 +0000
commitad9329a1a65cace9c61ce1aa189c9dbaacf564e2 (patch)
tree0346cf04c54e154144709fdec6a65fce0b6eb12b
parenta68d8dd5399cf543ce2e29170edc5aa616b1df03 (diff)
downloadirssi-ad9329a1a65cace9c61ce1aa189c9dbaacf564e2.zip
added Irssi::Theme::get_format()
git-svn-id: http://svn.irssi.org/repos/irssi/trunk@2726 dbcabf3a-b0e7-0310-adc4-f8d773084564
-rw-r--r--src/perl/ui/Themes.xs28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/perl/ui/Themes.xs b/src/perl/ui/Themes.xs
index fc3165e9..b56fc9df 100644
--- a/src/perl/ui/Themes.xs
+++ b/src/perl/ui/Themes.xs
@@ -223,3 +223,31 @@ PPCODE:
}
XPUSHs(sv_2mortal(new_pv(ret)));
g_free_not_null(ret);
+
+char *
+theme_get_format(theme, module, formatnum)
+ Irssi::UI::Theme theme
+ char *module
+ int formatnum
+PREINIT:
+ MODULE_THEME_REC *modtheme;
+ FORMAT_REC *formats;
+ char *ret;
+CODE:
+ formats = g_hash_table_lookup(default_formats, module);
+ if (formats == NULL)
+ croak("Unknown module: %s", module);
+
+ modtheme = g_hash_table_lookup(theme->modules, module);
+ if (modtheme != NULL && formatnum >= modtheme->count) {
+ croak("Format number out of range (%s: %d < %d)",
+ module, formatnum, modtheme->count);
+ }
+
+ RETVAL = modtheme == NULL ? NULL : modtheme->formats[formatnum];
+ if (RETVAL == NULL) {
+ formats = g_hash_table_lookup(default_formats, module);
+ RETVAL = formats == NULL ? NULL : formats[formatnum].def;
+ }
+OUTPUT:
+ RETVAL