diff options
-rw-r--r-- | gui_callbacks.pm | 1 | ||||
-rwxr-xr-x | rhimport | 18 | ||||
-rw-r--r-- | rhimport.pm | 5 |
3 files changed, 18 insertions, 6 deletions
diff --git a/gui_callbacks.pm b/gui_callbacks.pm index 10d3881..f101cf7 100644 --- a/gui_callbacks.pm +++ b/gui_callbacks.pm @@ -58,6 +58,7 @@ sub on_co_dropbox_changed my ($widget, $data) = @_; ::clear_status_gui(); + ::dropbox_updated_gui(); } sub on_filechooser_selection_changed @@ -236,23 +236,32 @@ sub clear_status_gui() $progressbar->set_fraction(0); } +sub dropbox_updated_gui() +{ + if(!$guixml) { + print STDERR "no GUI definition found!\n"; + exit 0; + } + + +} + if(!$FILE || !$DROPBOX) { Gtk2->init; $guixml = Gtk2::GladeXML->new('rhimport.glade'); $guixml or die "can't load glade xml file"; require gui_callbacks; - $guixml->signal_autoconnect_from_package('gui_callbacks'); - my $model = Gtk2::ListStore->new('Glib::String', 'Glib::String', 'Glib::String'); + my $model = Gtk2::ListStore->new('Glib::String', 'Glib::String', 'Glib::String', 'Glib::String'); for my $href ( @allowed_dbs ) { - $model->set ($model->append, 0, $href->{'PATH'}, 1, $href->{'GROUP'}, 2, $href->{'NAME'}); + $model->set ($model->append, 0, $href->{'PATH'}, 1, $href->{'GROUP'}, 2, $href->{'TO_CART'}, 3, $href->{'NAME'}); } my $co_dropbox = $guixml->get_widget('co_dropbox'); $co_dropbox->set_model($model); my $renderer = Gtk2::CellRendererText->new; $co_dropbox->pack_start($renderer, 1); - $co_dropbox->add_attribute($renderer, text => 2); + $co_dropbox->add_attribute($renderer, text => 3); $co_dropbox->set_active(0); my $cb_clear_carts = $guixml->get_widget('cb_clear_carts'); @@ -268,6 +277,7 @@ if(!$FILE || !$DROPBOX) { set_mode_file_gui(); } + $guixml->signal_autoconnect_from_package('gui_callbacks'); my $appwin = $guixml->get_widget('appwin'); $appwin or die "can't find Main Window"; $appwin->resize(800,600); diff --git a/rhimport.pm b/rhimport.pm index 2541660..4729969 100644 --- a/rhimport.pm +++ b/rhimport.pm @@ -30,11 +30,11 @@ sub get_dropboxes my $dbh = shift; my $user = shift; - my $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.PATH from USER_PERMS, DROPBOXES where USER_PERMS.USER_NAME='$user' and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME;}; + my $sql = qq{select USER_PERMS.GROUP_NAME,DROPBOXES.PATH,DROPBOXES.TO_CART from USER_PERMS, DROPBOXES where USER_PERMS.USER_NAME='$user' and DROPBOXES.GROUP_NAME=USER_PERMS.GROUP_NAME;}; my $sth = $dbh->prepare($sql); $sth->execute(); my @allowed_dbs; - while(my ($group, $path) = $sth->fetchrow_array()) { + while(my ($group, $path, $to_cart) = $sth->fetchrow_array()) { $path =~ s/\/\*$//; my $name = $path; $name =~ s/^\/programm\///; @@ -59,6 +59,7 @@ sub get_dropboxes my $perm = {}; $perm->{'GROUP'} = $group; $perm->{'PATH'} = $path; + $perm->{'TO_CART'} = $to_cart; $perm->{'NAME'} = $name; push @allowed_dbs, $perm; } |