From e2b4392a3950d724f3eea58326fa843b1156d9cb Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 23 Jan 2004 03:38:23 +0000 Subject: [PATCH] * src/grampslib.i: same fixes as grampslib_wrap.c * src/plugins/RelCalc.py: use preferred name format svn: r2695 --- gramps2/src/grampslib.i | 50 ++++++++++++++++++++++++++-------- gramps2/src/plugins/RelCalc.py | 5 ++-- 2 files changed, 42 insertions(+), 13 deletions(-) diff --git a/gramps2/src/grampslib.i b/gramps2/src/grampslib.i index 97cc1e460..f85026086 100644 --- a/gramps2/src/grampslib.i +++ b/gramps2/src/grampslib.i @@ -1,6 +1,10 @@ %module grampslib %{ +#include +#include #include +GList *gnome_vfs_get_registered_mime_types(void); +void gnome_vfs_mime_registered_mime_type_list_free(GList*); %} extern const char* gnome_vfs_mime_get_icon(const char *); @@ -10,21 +14,45 @@ extern const char* gnome_vfs_mime_get_value(const char*,const char*); %inline %{ const char* default_application_name(const char* type) { - GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); - if (a) { - return a->name; - } else { - return (char*) NULL; + + GList *node; + char* value; + char* retval = NULL; + + GList *s = gnome_vfs_get_registered_mime_types(); + + for (node = g_list_first(s); node != NULL; node = g_list_next(node)) { + if (!strcmp((char*)node->data,type)) { + GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); + if (a) { + retval = a->name; + break; + } + } } + gnome_vfs_mime_registered_mime_type_list_free(s); + return retval; } const char* default_application_command(const char* type) { - GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); - if (a) { - return a->command; - } else { - return (char*) NULL; - } + + GList *node; + char* value; + char* retval = NULL; + + GList *s = gnome_vfs_get_registered_mime_types(); + + for (node = g_list_first(s); node != NULL; node = g_list_next(node)) { + if (!strcmp((char*)node->data,type)) { + GnomeVFSMimeApplication *a = gnome_vfs_mime_get_default_application(type); + if (a) { + retval = a->command; + break; + } + } + } + gnome_vfs_mime_registered_mime_type_list_free(s); + return retval; } %} diff --git a/gramps2/src/plugins/RelCalc.py b/gramps2/src/plugins/RelCalc.py index b313484c5..5da341c12 100644 --- a/gramps2/src/plugins/RelCalc.py +++ b/gramps2/src/plugins/RelCalc.py @@ -43,6 +43,7 @@ import gtk.glade #------------------------------------------------------------------------- import Utils +import GrampsCfg import ListModel import Plugins from gettext import gettext as _ @@ -136,8 +137,8 @@ class RelCalc: commontext = "" text1 = self.glade.get_widget("text1").get_buffer() - p1 = self.person.getPrimaryName().getName() - p2 = other_person.getPrimaryName().getName() + p1 = GrampsCfg.nameof(self.person) + p2 = GrampsCfg.nameof(other_person) if rel_string == "": rstr = _("%(person)s and %(active_person)s are not related.") % {