Skip to content

Commit 67bb899

Browse files
committed
Add style
1 parent 91ac888 commit 67bb899

12 files changed

+179
-53
lines changed

Screenshot0.png

-1.75 KB
Loading

Screenshot5.png

2.52 KB
Loading

Screenshot6.png

521 Bytes
Loading

com.github.gabutakut.gabutdm.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ command: com.github.gabutakut.gabutdm
99
finish-args:
1010
- '--share=network'
1111
- '--talk-name=com.canonical.Unity.LauncherEntry'
12+
- '--system-talk-name=io.elementary.pantheon.AccountsService'
13+
- '--system-talk-name=org.freedesktop.Accounts'
1214
- '--share=ipc'
1315
- '--socket=fallback-x11'
1416
- '--socket=wayland'
Lines changed: 70 additions & 0 deletions
Loading

data/meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ actions = [
1919
'.pause.svg',
2020
'.magnet.svg',
2121
'.waiting.svg',
22+
'.auto-symbolic.svg'
2223
]
2324

2425
foreach m : actions

meson.build

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ dependencies = [
2020
dependency ('libqrencode'),
2121
dependency ('gdk-pixbuf-2.0'),
2222
dependency ('cairo'),
23+
dependency ('libhandy-1'),
2324

2425
meson.get_compiler ('vala').find_library ('posix'),
2526
]

src/Application.vala

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ namespace Gabut {
144144
start ();
145145
perform_key_event ("<Control>v", true, 100);
146146
perform_key_event ("<Control>v", false, 0);
147+
check_table ();
148+
pantheon_theme.begin ();
147149
} else {
148150
if (startingup) {
149151
gabutwindow.show_all ();

src/GabutWindow.vala

Lines changed: 40 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,13 @@
2020
*/
2121

2222
namespace Gabut {
23-
public class GabutWindow : Gtk.Window {
23+
public class GabutWindow : Hdy.ApplicationWindow {
2424
public signal void send_file (string url);
2525
public signal void stop_server ();
2626
public signal void restart_server ();
2727
public signal string get_host (bool reboot);
2828
private Gtk.ListBox list_box;
29-
private Gtk.Revealer search_rev;
29+
private Gtk.Stack headerstack;
3030
private Gtk.Revealer property_rev;
3131
private Preferences preferences = null;
3232
private QrCode qrcode;
@@ -41,7 +41,6 @@ namespace Gabut {
4141
}
4242

4343
construct {
44-
get_style_context ().add_class ("rounded");
4544
nodown_alert = new AlertView (
4645
_("No File Download"),
4746
_("Insert Link, add Torrent, add Metalink, Magnet URIs."),
@@ -56,38 +55,38 @@ namespace Gabut {
5655
list_box.set_placeholder (nodown_alert);
5756

5857
var scrolled = new Gtk.ScrolledWindow (null, null) {
58+
height_request = 350,
59+
width_request = 650,
5960
expand = true
6061
};
62+
scrolled.get_style_context ().add_class ("frame");
6163
scrolled.add (list_box);
6264

63-
var overlay = new Gtk.Overlay ();
64-
overlay.add (scrolled);
65-
66-
var frame = new Gtk.Frame (null) {
67-
width_request = 350,
68-
height_request = 350,
69-
expand = true
70-
};
71-
frame.add (overlay);
72-
var image_label = new Gtk.Grid () {
73-
margin_bottom = 5
65+
headerstack = new Gtk.Stack () {
66+
transition_type = Gtk.StackTransitionType.SLIDE_DOWN,
67+
transition_duration = 500,
68+
hhomogeneous = false
7469
};
70+
headerstack.add_named (mode_headerbar (), "mode");
71+
headerstack.add_named (saarch_headerbar (), "search");
72+
headerstack.visible_child_name = "mode";
73+
headerstack.show_all ();
74+
7575
var frame_header = new Gtk.Grid () {
7676
orientation = Gtk.Orientation.VERTICAL,
77-
valign = Gtk.Align.CENTER,
78-
width_request = 650
77+
valign = Gtk.Align.START
7978
};
80-
frame_header.get_style_context ().add_class (Gtk.STYLE_CLASS_HEADER);
81-
frame_header.get_style_context ().add_class ("default-decoration");
82-
search_rev = new Gtk.Revealer () {
83-
transition_type = Gtk.RevealerTransitionType.SLIDE_DOWN
84-
};
85-
search_rev.add (saarch_headerbar ());
8679
frame_header.add (build_headerbar ());
87-
frame_header.add (mode_headerbar ());
88-
frame_header.add (search_rev);
89-
set_titlebar (frame_header);
90-
add (frame);
80+
frame_header.add (headerstack);
81+
82+
var mainwindow = new Gtk.Grid () {
83+
orientation = Gtk.Orientation.VERTICAL,
84+
expand = true
85+
};
86+
mainwindow.get_style_context ().add_class ("rounded");
87+
mainwindow.add (frame_header);
88+
mainwindow.add (scrolled);
89+
add (mainwindow);
9190
list_box.remove.connect ((wid)=> {
9291
view_status ();
9392
});
@@ -103,21 +102,21 @@ namespace Gabut {
103102
return hide_on_delete ();
104103
} else {
105104
stop_server ();
106-
check_table ();
107105
return false;
108106
}
109107
});
110108
}
111109

112-
private Gtk.HeaderBar build_headerbar () {
113-
var headerbar = new Gtk.HeaderBar () {
114-
hexpand = true,
110+
private Hdy.HeaderBar build_headerbar () {
111+
var headerbar = new Hdy.HeaderBar () {
115112
title = _("Gabut Download Manager"),
116113
has_subtitle = false,
117114
show_close_button = true,
115+
interpolate_size = false,
118116
decoration_layout = "close:maximize"
119117
};
120118
headerbar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
119+
move_widget (headerbar);
121120
var menu_button = new Gtk.Button.from_icon_name ("open-menu", Gtk.IconSize.BUTTON) {
122121
tooltip_text = _("Open Settings")
123122
};
@@ -143,9 +142,14 @@ namespace Gabut {
143142
};
144143
headerbar.pack_end (search_button);
145144
search_button.clicked.connect (()=> {
146-
search_rev.reveal_child = !search_rev.reveal_child;
145+
((Gtk.Image) search_button.image).icon_name = headerstack.visible_child_name == "mode"? "com.github.gabutakut.gabutdm" : "system-search";
146+
headerstack.visible_child_name = headerstack.visible_child_name == "mode"? headerstack.visible_child_name = "search" : headerstack.visible_child_name = "mode";
147+
var row = (DownloadRow) list_box.get_selected_row ();
148+
if (row != null) {
149+
list_box.unselect_row (row);
150+
}
147151
});
148-
search_rev.notify["child-revealed"].connect (()=> {
152+
headerstack.notify["visible-child"].connect (()=> {
149153
view_status ();
150154
search_entry.text = "";
151155
});
@@ -191,7 +195,7 @@ namespace Gabut {
191195
}
192196
});
193197
property_rev = new Gtk.Revealer () {
194-
transition_type = Gtk.RevealerTransitionType.SLIDE_RIGHT
198+
transition_type = Gtk.RevealerTransitionType.CROSSFADE
195199
};
196200
property_rev.add (property_button);
197201
headerbar.pack_end (property_rev);
@@ -301,7 +305,6 @@ namespace Gabut {
301305
var headerbar = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
302306
hexpand = true
303307
};
304-
headerbar.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
305308
headerbar.get_style_context ().add_class ("default-decoration");
306309
view_mode = new ModeButton () {
307310
hexpand = false,
@@ -314,18 +317,17 @@ namespace Gabut {
314317
view_mode.append_text (_("Waiting"));
315318
view_mode.append_text (_("Error"));
316319
view_mode.selected = 0;
317-
view_mode.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
318320
headerbar.set_center_widget (view_mode);
319321
view_mode.notify["selected"].connect (view_status);
320322
return headerbar;
321323
}
322324

323325
private Gtk.Box saarch_headerbar () {
324326
var box_s = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0);
325-
box_s.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
326327
box_s.get_style_context ().add_class ("default-decoration");
327328
search_entry = new Gtk.SearchEntry () {
328-
placeholder_text = _("Search Download File")
329+
placeholder_text = _("Search Download File"),
330+
margin = 2
329331
};
330332
search_entry.search_changed.connect (view_status);
331333
box_s.set_center_widget (search_entry);
@@ -464,7 +466,7 @@ namespace Gabut {
464466
}
465467

466468
public void view_status () {
467-
if (search_rev.child_revealed) {
469+
if (headerstack.visible_child_name == "search") {
468470
list_box.set_filter_func ((item) => {
469471
return ((DownloadRow) item).filename.casefold ().contains (search_entry.text.casefold ());
470472
});

src/Preferences.vala

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,31 @@ namespace Gabut {
311311
};
312312
autorename.add (autorengrid);
313313

314+
var style_mode = new ModeButton ();
315+
style_mode.append_icon ("com.github.gabutakut.gabutdm.auto-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
316+
style_mode.append_icon ("display-brightness-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
317+
style_mode.append_icon ("weather-clear-night-symbolic", Gtk.IconSize.SMALL_TOOLBAR);
318+
style_mode.selected = int.parse (get_dbsetting (DBSettings.STYLE));
319+
style_mode.notify["selected"].connect (() => {
320+
set_dbsetting (DBSettings.STYLE, style_mode.selected.to_string ());
321+
pantheon_theme.begin ();
322+
});
314323
var notifyopt = new Gtk.Grid () {
315324
expand = true,
316325
height_request = 190
317326
};
318327
notifyopt.get_style_context ().add_class (Gtk.STYLE_CLASS_FLAT);
319-
notifyopt.attach (new HeaderLabel (_("Settings:"), 450), 0, 0, 1, 1);
320-
notifyopt.attach (retonhide, 0, 1, 1, 1);
321-
notifyopt.attach (appstartup, 0, 2, 1, 1);
322-
notifyopt.attach (new HeaderLabel (_("Notify:"), 450), 0, 3, 1, 1);
323-
notifyopt.attach (systemnotif, 0, 4, 1, 1);
324-
notifyopt.attach (dialognotify, 0, 5, 1, 1);
325-
notifyopt.attach (new HeaderLabel (_("File Download:"), 450), 0, 6, 1, 1);
326-
notifyopt.attach (allowrepl, 0, 7, 1, 1);
327-
notifyopt.attach (autorename, 0, 8, 1, 1);
328+
notifyopt.attach (new HeaderLabel (_("Style"), 450), 0, 0, 1, 1);
329+
notifyopt.attach (style_mode, 0, 1, 1, 1);
330+
notifyopt.attach (new HeaderLabel (_("Settings:"), 450), 0, 2, 1, 1);
331+
notifyopt.attach (retonhide, 0, 3, 1, 1);
332+
notifyopt.attach (appstartup, 0, 4, 1, 1);
333+
notifyopt.attach (new HeaderLabel (_("Notify:"), 450), 0, 5, 1, 1);
334+
notifyopt.attach (systemnotif, 0, 6, 1, 1);
335+
notifyopt.attach (dialognotify, 0, 7, 1, 1);
336+
notifyopt.attach (new HeaderLabel (_("File Download:"), 450), 0, 8, 1, 1);
337+
notifyopt.attach (allowrepl, 0, 9, 1, 1);
338+
notifyopt.attach (autorename, 0, 10, 1, 1);
328339

329340
var stack = new Gtk.Stack () {
330341
transition_type = Gtk.StackTransitionType.SLIDE_LEFT_RIGHT,

src/QrCode.vala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ namespace Gabut {
5353
overlay.add (icon_image);
5454
overlay.add_overlay (icon_badge);
5555

56-
var primary = new Gtk.Label ("Scan Code") {
56+
var primary = new Gtk.Label ("Scan QR Code") {
5757
ellipsize = Pango.EllipsizeMode.END,
5858
max_width_chars = 35,
5959
use_markup = true,

0 commit comments

Comments
 (0)