From 3beebbc9d79accc0101faa53a6c6cb9bf464c8d2 Mon Sep 17 00:00:00 2001 From: Jesse van den Kieboom Date: Fri, 31 Mar 2006 20:28:12 +0000 Subject: [PATCH] Added find parent window --- gnoemoe/gm-support.c | 14 ++++++++++++++ gnoemoe/gm-support.h | 2 ++ 2 files changed, 16 insertions(+) diff --git a/gnoemoe/gm-support.c b/gnoemoe/gm-support.c index 2dd8a2a..0dff80b 100644 --- a/gnoemoe/gm-support.c +++ b/gnoemoe/gm-support.c @@ -569,6 +569,20 @@ gm_notebook_focus_from_label(GtkNotebook *note, gchar *caption) { } } +GtkWidget * +gm_find_parent(GtkWidget *widget, GType parent_type) { + if (widget == NULL) { + return NULL; + } + + if (G_TYPE_CHECK_INSTANCE_TYPE(widget, parent_type)) { + return widget; + } + + return gm_find_parent(gtk_widget_get_parent(widget), parent_type); +} + + gchar * gm_convert_with_fallback(gchar const *text, gssize len, gchar const *from, gchar const *to, gchar const *fallback) { diff --git a/gnoemoe/gm-support.h b/gnoemoe/gm-support.h index cc584c0..0cc1a68 100644 --- a/gnoemoe/gm-support.h +++ b/gnoemoe/gm-support.h @@ -147,6 +147,8 @@ void gm_widget_destroy_data(GtkWidget *caller, GtkWidget *destroyer); const gchar *gm_default_charset(); void gm_notebook_focus_from_label(GtkNotebook *note, gchar *caption); +GtkWidget *gm_find_parent(GtkWidget *widget, GType parent_type); + gchar *gm_from_utf8_with_fallback(gchar const *text, gssize len, gchar const *to, gchar const *fallback); gchar *gm_to_utf8_with_fallback(gchar const *text, gssize len,