[gtk+/gtk-style-context: 97/191] GtkWidgetPath: Add methods to check topmost widget type.
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/gtk-style-context: 97/191] GtkWidgetPath: Add methods to check topmost widget type.
- Date: Tue, 17 Aug 2010 13:56:21 +0000 (UTC)
commit 270392a7a6c81d9e8f8a45f350148ba78ffff5ea
Author: Carlos Garnacho <carlosg gnome org>
Date: Fri Jun 18 16:59:14 2010 +0200
GtkWidgetPath: Add methods to check topmost widget type.
gtk/gtkwidgetpath.c | 29 +++++++++++++++++++++++++++++
gtk/gtkwidgetpath.h | 8 ++++++--
2 files changed, 35 insertions(+), 2 deletions(-)
---
diff --git a/gtk/gtkwidgetpath.c b/gtk/gtkwidgetpath.c
index 2573273..c39b4c7 100644
--- a/gtk/gtkwidgetpath.c
+++ b/gtk/gtkwidgetpath.c
@@ -305,6 +305,35 @@ gtk_widget_path_iter_has_region (GtkWidgetPath *path,
return TRUE;
}
+GType
+gtk_widget_path_get_widget_type (const GtkWidgetPath *path)
+{
+ GtkPathElement *elem;
+
+ g_return_val_if_fail (path != NULL, G_TYPE_INVALID);
+
+ elem = &g_array_index (path->elems, GtkPathElement, 0);
+ return elem->type;
+}
+
+gboolean
+gtk_widget_path_is_type (const GtkWidgetPath *path,
+ GType type)
+{
+ GtkPathElement *elem;
+
+ g_return_val_if_fail (path != NULL, FALSE);
+ g_return_val_if_fail (g_type_is_a (type, GTK_TYPE_WIDGET), FALSE);
+
+ elem = &g_array_index (path->elems, GtkPathElement, 0);
+
+ if (elem->type == type ||
+ g_type_is_a (elem->type, type))
+ return TRUE;
+
+ return FALSE;
+}
+
gboolean
gtk_widget_path_has_parent (const GtkWidgetPath *path,
GType type)
diff --git a/gtk/gtkwidgetpath.h b/gtk/gtkwidgetpath.h
index 7020c82..9e2d0ed 100644
--- a/gtk/gtkwidgetpath.h
+++ b/gtk/gtkwidgetpath.h
@@ -68,8 +68,12 @@ gboolean gtk_widget_path_iter_has_region (GtkWidgetPath *path,
const gchar *name,
GtkChildClassFlags *flags);
-gboolean gtk_widget_path_has_parent (const GtkWidgetPath *path,
- GType type);
+GType gtk_widget_path_get_widget_type (const GtkWidgetPath *path);
+
+gboolean gtk_widget_path_is_type (const GtkWidgetPath *path,
+ GType type);
+gboolean gtk_widget_path_has_parent (const GtkWidgetPath *path,
+ GType type);
G_END_DECLS
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]