Skip to content
This repository was archived by the owner on Dec 8, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 27 additions & 1 deletion ext/gtk+/gtk-2.14.overrides
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
%% 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
Expand All @@ -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.
36 changes: 36 additions & 0 deletions tests/GtkWindowGroup/list_windows.phpt
Original file line number Diff line number Diff line change
@@ -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