Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
More places sidebar properties
  • Loading branch information
azawawi committed Jun 7, 2016
1 parent 7522fd8 commit 648855f
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 1 deletion.
2 changes: 2 additions & 0 deletions examples/13-places-siderbar.pl6
Expand Up @@ -9,6 +9,8 @@ use GTK::Simple::PlacesSidebar;
my $app = GTK::Simple::App.new(:title("Places Sidebar Demo"));
my $places-sidebar = GTK::Simple::PlacesSidebar.new;

$places-sidebar.show-trash(False);

$app.set-content( $places-sidebar );
$app.border-width = 20;

Expand Down
64 changes: 63 additions & 1 deletion lib/GTK/Simple/PlacesSidebar.pm6
@@ -1,12 +1,74 @@
use v6;

use NativeCall;
use GTK::Simple::Raw :places-sidebar;
use GTK::Simple::Raw :places-sidebar, :DEFAULT;
use GTK::Simple::Common;
use GTK::Simple::Widget;

unit class GTK::Simple::PlacesSidebar does GTK::Simple::Widget;

has $!open-location-supply;

submethod BUILD() {
$!gtk_widget = gtk_places_sidebar_new();
}

method local-only()
returns Bool
is gtk-property(&gtk_places_sidebar_get_local_only, &gtk_places_sidebar_set_local_only)
{ * }

method open-flags()
returns GtkPlacesOpenFlags
is gtk-property(&gtk_places_sidebar_get_open_flags, &gtk_places_sidebar_set_open_flags)
{ * }

#TODO populate-all
#method populate-all()
# returns Bool
# is gtk-property(&gtk_places_sidebar_get_text, &gtk_places_sidebar_set_text)
# { * }

method show-connect-to-server()
returns Bool
is gtk-property(&gtk_places_sidebar_get_connect_to_server, &gtk_places_sidebar_set_connect_to_server)
{ * }

method show-desktop()
returns Bool
is gtk-property(&gtk_places_sidebar_get_show_desktop, &gtk_places_sidebar_set_show_desktop)
{ * }

#TODO show-enter-location
#method show-enter-location()
# returns GFile
# is gtk-property(&gtk_places_sidebar_get_enter_location, &gtk_places_sidebar_set_enter_location)
# { * }

method show-other-locations()
returns Bool
is gtk-property(&gtk_places_sidebar_get_other_locations, &gtk_places_sidebar_set_other_locations)
{ * }

method show-recent()
returns Bool
is gtk-property(&gtk_places_sidebar_get_show_recent, &gtk_places_sidebar_set_show_recent)
{ * }

method show-trash()
returns Bool
is gtk-property(&gtk_places_sidebar_get_show_trash, &gtk_places_sidebar_set_show_trash)
{ * }

method open-location() {
$!open-location-supply //= do {
my $s = Supplier.new;
g_signal_connect_wd($!gtk_widget, "open-location",
-> $, $ {
$s.emit(self);
CATCH { default { note $_; } }
},
OpaquePointer, 0);
$s.Supply;
}
}
83 changes: 83 additions & 0 deletions lib/GTK/Simple/Raw.pm6
Expand Up @@ -23,6 +23,12 @@ enum GtkFileChooserAction is export(:file-chooser) (
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER => 3,
);

enum GtkPlacesOpenFlags is export(:places-sidebar) (
GTK_PLACES_OPEN_NORMAL => 0,
GTK_PLACES_OPEN_NEW_TAB => 1,
GTK_PLACES_OPEN_NEW_WINDOW => 2,
);

# gtk_widget_... {{{

sub gtk_widget_show(GtkWidget $widgetw)
Expand Down Expand Up @@ -785,3 +791,80 @@ sub gtk_places_sidebar_new()
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_get_open_flags(GtkWidget $sidebar)
returns int32
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_set_open_flags(GtkWidget $sidebar, int32 $flags)
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_get_connect_to_server(GtkWidget $siderbar)
returns int32
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_set_connect_to_server(GtkWidget $sidebar, Bool $connect-to-server)
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_get_show_desktop(GtkWidget $sidebar)
returns Bool
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_set_show_desktop(GtkWidget $sidebar, Bool $show-desktop)
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_get_other_locations(GtkWidget $sidebar)
returns Bool
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_set_other_locations(GtkWidget $sidebar, Bool $show-other-locations)
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_get_show_recent(GtkWidget $sidebar)
returns Bool
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_set_show_recent(GtkWidget $sidebar, Bool $show-recent)
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_get_show_trash(GtkWidget $sidebar)
returns Bool
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_set_show_trash(GtkWidget $sidebar, Bool $show-desktop)
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_get_local_only(GtkWidget $sidebar)
returns Bool
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

sub gtk_places_sidebar_set_local_only(GtkWidget $sidebar, Bool $local-only)
is native(&gtk-lib)
is export(:places-sidebar)
{ * }

0 comments on commit 648855f

Please sign in to comment.