Signals for combobox entry
Hi I have a drop-down box which adds to the display depending on selection Combobox Comboboxentry Entry However I am having problems with signals with the combobox entry the actions are Combobox = changed Entry = Keypress event (tab/entry/return) however for the comboboxentry, changed isnt acceptable as it fires on every change (runs database query so not good performance) No keypress events seem to be generated for CBE so are there any other approaches that will fire only when whole field has been updated? ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
RE: Signals for combobox entry
Here are two examples that will exhibit the behavior you desire: my $combo = Gtk2::ComboBoxEntry-new; $combo-signal_connect(changed = \changed); $combo-signal_connect('focus-out-event' = \focus_out); sub changed { my $combo = shift; $combo-{changed} = TRUE; } sub focus_out { my $combo = shift; # commit to database if $combo-{changed}; $combo-{changed} = FALSE; } my $combo = Gtk2::ComboBoxEntry-new; $combo-signal_connect('focus-in-event' = \focus_in); $combo-signal_connect('focus-out-event' = \focus_out); sub focus_in { my $combo = shift; $combo-{check} = $comb-get_active_text; } sub focus_out { my $combo = shift; # commit to database if $combo-{check} ne $comb-get_active_text; $combo-{check} = ''; } -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Dave Howorth Sent: Tuesday, October 07, 2008 9:42 AM To: gtk-perl-list@gnome.org Subject: Re: Signals for combobox entry Mike Martin wrote: however for the comboboxentry, changed isnt acceptable as it fires on every change (runs database query so not good performance) No keypress events seem to be generated for CBE so are there any other approaches that will fire only when whole field has been updated? Connect to the changed signal of its Entry child? Cheers, Dave ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
StatusIcon stack
A callback stack case in StatusIcon position_menu. Nosing around its code it calls out to the menu size_request to figure how big the menu is (or would like to be). --- GtkStatusIcon.xs 08 Oct 2008 09:30:39 +1100 1.10 +++ GtkStatusIcon.xs 08 Oct 2008 09:30:52 +1100 @@ -93,7 +93,11 @@ icon = SvGtkStatusIcon (ST (3)); } else icon = SvGtkStatusIcon (ST (1)); + /* PUTBACK/SPAGAIN because gtk_status_icon_position_menu() calls out + to menu-size_request, which may be a perl class closure */ + PUTBACK; gtk_status_icon_position_menu (menu, x, y, push_in, icon); + SPAGAIN; EXTEND (sp, 3); PUSHs (sv_2mortal (newSViv (x))); PUSHs (sv_2mortal (newSViv (y))); --- GtkStatusIcon.t 06 Oct 2008 10:19:16 +1100 1.12 +++ GtkStatusIcon.t 06 Oct 2008 18:29:50 +1100 @@ -4,7 +4,7 @@ use strict; use warnings; use Gtk2::TestHelper - tests = 27, + tests = 30, at_least_version = [2, 10, 0, Gtk2::StatusIcon is new in 2.10]; # $Id: GtkStatusIcon.t,v 1.12 2008/10/05 12:49:35 kaffeetisch Exp $ @@ -86,7 +86,13 @@ $menu - popdown(); # Make sure the convenient way of calling works, too. -ok (defined Gtk2::StatusIcon::position_menu($menu, $icon)); +{ my @ret = Gtk2::StatusIcon::position_menu($menu, $icon); + is (scalar @ret, 3); + my ($x, $y, $pushed_in) = @ret; + like($x, qr/^\d+$/); + like($y, qr/^\d+$/); + like($pushed_in, qr/^[01]$/); # boolean +} # --- # -- Mining jargon elucidated for the layman: Open at depth -- we stopped drilling before finding just how thin the ore body is. ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list
TreeDragSource stack
This is the drag_data_get I think I mentioned before but didn't post, it's a usual one for an interface implementable in perl. --- GtkTreeDnd.xs 08 Oct 2008 09:41:01 +1100 1.12 +++ GtkTreeDnd.xs 08 Oct 2008 09:41:34 +1100 @@ -148,7 +148,7 @@ gtk_tree_drag_source_drag_data_get (GtkTreeDragSource *drag_source, GtkTreePath *path, GtkSelectionData *selection_data = NULL) PREINIT: SV *ret = PL_sv_undef; -PPCODE: +CODE: if (selection_data) { if (gtk_tree_drag_source_drag_data_get (drag_source, path, selection_data)) @@ -162,7 +162,8 @@ new_selection_data)) ret = sv_2mortal (newSVGtkSelectionData_copy (new_selection_data)); } - PUSHs (ret); + ST(0) = ret; + XSRETURN(1); MODULE = Gtk2::TreeDnd PACKAGE = Gtk2::TreeDragDest PREFIX = gtk_tree_drag_dest_ @@ -206,6 +207,8 @@ ## gboolean gtk_tree_get_row_drag_data (GtkSelectionData *selection_data, GtkTreeModel **tree_model, GtkTreePath **path) =for apidoc +If $selection_data is not type GTK_TREE_MODEL_ROW then the return is +an empty list. =for signature (tree_model, path) = $selection_data-get_row_drag_data =cut void #!/usr/bin/perl -w use strict; use Gtk2::TestHelper tests = 7, noinit = 1; # GtkTreeDragSource drag_data_get() # { my $list = Gtk2::ListStore-new('Glib::String'); $list-insert_with_values (0, 0='foo'); $list-insert_with_values (1, 0='bar'); # one arg returning new GtkSelectionData my $seldata = $list-drag_data_get (Gtk2::TreePath-new_from_indices(0)); isa_ok($seldata, 'Gtk2::SelectionData'); my ($model, $path) = $seldata-get_row_drag_data; is ($model, $list); is_deeply ([ 0 ], [ $path-get_indices ]); # storing to existing GtkSelectionData $list-drag_data_get (Gtk2::TreePath-new_from_indices(1), $seldata); ($model, $path) = $seldata-get_row_drag_data; is ($model, $list); is_deeply ([ 1 ], [ $path-get_indices ]); # check mortalizing require Scalar::Util; Scalar::Util::weaken ($seldata); is ($seldata, undef); $model = undef; Scalar::Util::weaken ($list);is ($list, undef); } exit 0; __END__ ___ gtk-perl-list mailing list gtk-perl-list@gnome.org http://mail.gnome.org/mailman/listinfo/gtk-perl-list