[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Volunteers for wrapping new API?



Here is a patch to add the GtkStatusIcon stuff.

please take a look and make sure I did 'the right thing'.

One possible issue is that the new api for uses 'const char *' instead of 
using gchar in a few places (which I'm guessing is a mistake), however I've 
used  const gchar_ornull in the patch.

It seems to work.

Also in case it helps someone else save a few minutes, to use a gtk 
trunk installed into a different PREFIX (for example $HOME/local)
it helps to do something like: 

export PKG_CONFIG_PATH="$HOME/local/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="$HOME/local/lib:$LD_LIBRARY_PATH"

so that the Makefile.PL finds the right gtk installation.


cheers,
Chris
Index: xs/GtkStatusIcon.xs
===================================================================
--- xs/GtkStatusIcon.xs	(revision 2104)
+++ xs/GtkStatusIcon.xs	(working copy)
@@ -133,3 +133,23 @@
 guint32 gtk_status_icon_get_x11_window_id (GtkStatusIcon *status_icon);
 
 #endif /* 2.14 */
+
+#if GTK_CHECK_VERSION (2, 16, 0)
+
+void gtk_status_icon_set_has_tooltip (GtkStatusIcon *status_icon, gboolean has_tooltip);
+
+gboolean gtk_status_icon_get_has_tooltip (GtkStatusIcon *status_icon);
+
+gchar_own_ornull *gtk_status_icon_get_tooltip_markup (GtkStatusIcon *status_icon);
+
+gchar_own_ornull *gtk_status_icon_get_tooltip_text (GtkStatusIcon *status_icon);
+
+#Unlike the corresponding methods in GtkWidget, these setters use plain char instead of gchar.
+#However I expect that is an error or oversight and the char and gchar types are supposedly
+#equivalent anyway. Also using gchar lets me use the _ornull.
+
+void gtk_status_icon_set_tooltip_text (GtkStatusIcon *status_icon,  const gchar_ornull *text);
+
+void gtk_status_icon_set_tooltip_markup (GtkStatusIcon *status_icon, const gchar_ornull *markup);
+
+#endif /* 2.16 */
Index: t/GtkStatusIcon.t
===================================================================
--- t/GtkStatusIcon.t	(revision 2104)
+++ t/GtkStatusIcon.t	(working copy)
@@ -4,7 +4,7 @@
 use strict;
 use warnings;
 use Gtk2::TestHelper
-  tests => 30,
+  tests => 34,
   at_least_version => [2, 10, 0, "Gtk2::StatusIcon is new in 2.10"];
 
 # $Id$
@@ -134,6 +134,28 @@
   ok (defined $icon -> get_x11_window_id());
 }
 
+# --------------------------------------------------------------------------- #
+
+SKIP: {
+  skip 'new 2.16 stuff', 4
+    unless Gtk2->CHECK_VERSION(2, 16, 0);
+
+  $icon->set_has_tooltip(TRUE);
+  ok ($icon->get_has_tooltip() == TRUE);
+
+  $icon->set_has_tooltip(FALSE);
+  ok ($icon->get_has_tooltip() == FALSE);
+
+  $icon->set_tooltip_markup("<b>TEST1</b>");
+  ok ($icon->get_tooltip_markup() eq "<b>TEST1</b>");
+
+  $icon->set_tooltip_text("TEST2");
+  ok ($icon->get_tooltip_text() eq "TEST2");
+
+
+}
+
+
 __END__
 
 Copyright (C) 2006 by the gtk2-perl team (see the file AUTHORS for the


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]