Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added gtk_window_group_list_windows override #2

Merged
merged 4 commits into from

4 participants

@xektrum

added GtkWindowGroup->list_windows() method
gtk_window_group_list_windows override

@auroraeosrose

This is missing the override - could you add it to the PR please?

@auroraeosrose

Docs say http://developer.gnome.org/gtk/2.24/GtkWindowGroup.html#gtk-window-group-list-windows transfer container for that glist, which means you need to free the container but not the elements- see http://developer.gnome.org/gtk/2.24/annotation-glossary.html for annotation information

@minktee

Added gtk_window_group_list_windows override

thank author by xektrum

@php-pulls php-pulls merged commit 96fa7ca into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Nov 7, 2012
  1. Added gtk_window_group_list_windows override

    xektrum authored
Commits on Nov 14, 2012
  1. g_list_free(list) added

    xektrum authored
This page is out of date. Refresh to see the latest.
View
28 ext/gtk+/gtk-2.14.overrides
@@ -1,6 +1,32 @@
%% include gtk-2.12.overrides
%%
+override gtk_window_group_list_windows
+PHP_METHOD
+{
+ GList *list, *item;
+
+ NOT_STATIC_METHOD();
+
+ if (!php_gtk_parse_args(ZEND_NUM_ARGS(), "")){
+ return;
+ }
+
+ list = gtk_window_group_list_windows(GTK_WINDOW_GROUP(PHPG_GOBJECT(this_ptr)));
+
+ array_init(return_value);
+
+ for (item = list; item; item = item->next) {
+ zval *php_item = NULL;
+ GtkWidget *window = item->data;
+ phpg_gobject_new(&php_item, G_OBJECT(window) TSRMLS_CC);
+ add_next_index_zval(return_value, php_item);
+ }
+
+ g_list_free(list);
+}
+
+%%
deprecate gtk_box_pack_end_defaults
since GTK+ 2.14, use GtkBox::pack_end() instead
@@ -26,4 +52,4 @@ since GTK+ 2.14, The toolkit-wide \"gtk-enable-tooltips\" property is now used i
%%
deprecate gtk_toolbar_get_tooltips
-since GTK+ 2.14, The toolkit-wide \"gtk-enable-tooltips\" property is now used instead.
+since GTK+ 2.14, The toolkit-wide \"gtk-enable-tooltips\" property is now used instead.
View
36 tests/GtkWindowGroup/list_windows.phpt
@@ -0,0 +1,36 @@
+--TEST--
+GtkWindowGroup->list_windows method
+--SKIPIF--
+<?php
+if(!extension_loaded('php-gtk')) die('skip - PHP-GTK extension not available');
+if(!method_exists('GtkWindowGroup', 'list_windows')) die('skip -GtkWindowGroup->list_windows not available, requires GTK 2.14 or higher');
+?>
+--FILE--
+<?php
+
+$group = new GtkWindowGroup();
+
+$window = new GtkWindow();
+$window2 = new GtkWindow();
+
+//Add a couple of windows to test
+$group->add_window($window);
+$group->add_window($window2);
+
+$list = $group->list_windows();
+
+var_dump(is_array($list));
+
+foreach ($list as $obj){
+ echo $obj.PHP_EOL;
+}
+
+/* Test wrong arg */
+var_dump($group->list_windows(1));
+?>
+--EXPECTF--
+bool(true)
+[GtkWindow object (GtkWindow Gtk+ type)]
+[GtkWindow object (GtkWindow Gtk+ type)]
+PHP Warning: GtkWindowGroup::list_windows() expects exactly 0 parameters, 1 given in %s on line %d
+NULL
Something went wrong with that request. Please try again.