Skip to content

Commit

Permalink
Merge pull request #284 from torikulhabib/master
Browse files Browse the repository at this point in the history
Fix window
  • Loading branch information
torikulhabib authored Jun 28, 2024
2 parents a7c8042 + fa5908d commit 783088f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 37 deletions.
3 changes: 2 additions & 1 deletion src/Application.vala
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ namespace Gabut {
gabutwindow.load_dowanload ();
download_table ();
if (!startingup && !dontopen) {
gabutwindow.show ();
open_now ();
}
clipboard = Gdk.Display.get_default ().get_clipboard ();
Timeout.add_seconds (1, on_clipboard);
Expand All @@ -185,6 +185,7 @@ namespace Gabut {
startingup = false;
} else {
gabutwindow.present ();
gabutwindow.show ();
}
}

Expand Down
6 changes: 3 additions & 3 deletions src/Downloader.vala
Original file line number Diff line number Diff line change
Expand Up @@ -493,10 +493,10 @@ namespace Gabut {
});
var centerbox = new Gtk.CenterBox () {
margin_top = 10,
margin_bottom = 10
margin_bottom = 10,
start_widget = server_button,
end_widget = box_action
};
centerbox.set_start_widget (server_button);
centerbox.set_end_widget (box_action);

lisboxserver = new Gtk.ListBox ();
listserver = new Gee.ArrayList<ServerRow> ();
Expand Down
59 changes: 26 additions & 33 deletions src/GabutWindow.vala
Original file line number Diff line number Diff line change
Expand Up @@ -234,14 +234,23 @@ namespace Gabut {
vexpand = true,
child = list_box
};
search_entry = new Gtk.SearchEntry () {
hexpand = true,
margin_top = 4,
margin_bottom = 4,
halign = Gtk.Align.CENTER,
valign = Gtk.Align.CENTER,
placeholder_text = _("Find Here")
};
search_entry.search_changed.connect (view_status);

headerstack = new Gtk.Stack () {
transition_type = Gtk.StackTransitionType.SLIDE_UP,
transition_duration = 500,
hhomogeneous = false
};
headerstack.add_named (bottom_action (), "mode");
headerstack.add_named (saarch_headerbar (), "search");
headerstack.add_named (search_entry, "search");
headerstack.visible_child_name = "mode";
headerstack.show ();

Expand Down Expand Up @@ -505,20 +514,13 @@ namespace Gabut {
}

private Gtk.CenterBox bottom_action () {
var actionbar = new Gtk.CenterBox () {
hexpand = false,
margin_top = 4,
margin_bottom = 4,
orientation = Gtk.Orientation.HORIZONTAL
};
var property_button = new Gtk.MenuButton () {
child = new Gtk.Image.from_icon_name ("com.github.gabutakut.gabutdm.menu"),
direction = Gtk.ArrowType.UP,
margin_start = 6,
tooltip_text = _("Property")
};
properties = new GLib.List<AddUrl> ();
actionbar.set_start_widget (property_button);
list_box.row_selected.connect ((rw)=> {
if (rw != null) {
var row = (DownloadRow) rw;
Expand Down Expand Up @@ -566,7 +568,6 @@ namespace Gabut {
view_mode.append_icon_text ("com.github.gabutakut.gabutdm.waiting", "Waiting");
view_mode.append_icon_text ("com.github.gabutakut.gabutdm.error", "Error");
view_mode.selected = 0;
actionbar.set_center_widget (view_mode);
view_mode.notify["selected"].connect (view_status);

var shortbutton = new Gtk.MenuButton () {
Expand All @@ -576,7 +577,15 @@ namespace Gabut {
margin_end = 6,
tooltip_text = _("Sort by")
};
actionbar.set_end_widget (shortbutton);
var actionbar = new Gtk.CenterBox () {
hexpand = false,
margin_top = 4,
margin_bottom = 4,
orientation = Gtk.Orientation.HORIZONTAL,
start_widget = property_button,
center_widget = view_mode,
end_widget = shortbutton
};
return actionbar;
}

Expand Down Expand Up @@ -648,8 +657,8 @@ namespace Gabut {
sort_popover.hide ();
deascend = (DeAscend) dsasc.id;
set_dbsetting (DBSettings.ASCEDESCEN, dsasc.id.to_string ());
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
listrow.sort (sort_dm);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
});
dsasc.id = int.parse (get_dbsetting (DBSettings.ASCEDESCEN));
deascend = (DeAscend) dsasc.id;
Expand Down Expand Up @@ -678,8 +687,8 @@ namespace Gabut {
((Gtk.Label)((SortBy) sorttype).get_last_child ()).attributes = set_attribute (Pango.Weight.BOLD);
sorttype = shorty as SortBy;
((Gtk.Label)sorttype.get_last_child ()).attributes = color_attribute (0, 60000, 0);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
listrow.sort (sort_dm);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
});
sorttype = sort_flow.get_child_at_index (int.parse (get_dbsetting (DBSettings.SORTBY))) as SortBy;
((Gtk.Label)sorttype.get_last_child ()).attributes = color_attribute (0, 60000, 0);
Expand All @@ -697,22 +706,6 @@ namespace Gabut {
}
}

private Gtk.Box saarch_headerbar () {
var headerbar = new Gtk.Box (Gtk.Orientation.HORIZONTAL, 0) {
hexpand = true,
margin_top = 4,
margin_bottom = 4,
halign = Gtk.Align.CENTER,
valign = Gtk.Align.CENTER
};
search_entry = new Gtk.SearchEntry () {
placeholder_text = _("Find Here")
};
search_entry.search_changed.connect (view_status);
headerbar.append (search_entry);
return headerbar;
}

public override void show () {
base.show ();
remove_dbus.begin (openmenu);
Expand Down Expand Up @@ -894,10 +887,10 @@ namespace Gabut {
list_box.row_activated (row);
}
row.destroy.connect (()=> {
listrow.remove (row);
list_box.remove (row);
remove_dbus.begin (row.rowbus);
next_download ();
listrow.remove (row);
stop_launcher ();
view_status ();
});
Expand All @@ -907,8 +900,8 @@ namespace Gabut {
row.activedm.connect (activedm);
}
});
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
listrow.sort (sort_dm);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
update_info ();
view_status ();
}
Expand Down Expand Up @@ -954,10 +947,10 @@ namespace Gabut {
update_info ();
});
row.destroy.connect (()=> {
listrow.remove (row);
list_box.remove (row);
remove_dbus.begin (row.rowbus);
next_download ();
listrow.remove (row);
stop_launcher ();
view_status ();
});
Expand All @@ -975,8 +968,8 @@ namespace Gabut {
} else {
aria_pause (row.ariagid);
}
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
listrow.sort (sort_dm);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
update_info ();
view_status ();
}
Expand Down Expand Up @@ -1329,8 +1322,8 @@ namespace Gabut {
break;
}
labelview.label = indexv.to_string ();
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
listrow.sort (sort_dm);
list_box.set_sort_func ((Gtk.ListBoxSortFunc) sort_dm);
}
}
}

0 comments on commit 783088f

Please sign in to comment.