Skip to content
This repository has been archived by the owner on Apr 16, 2022. It is now read-only.

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
DisableGraphics authored Oct 26, 2021
1 parent 3b83f56 commit dca5f97
Show file tree
Hide file tree
Showing 5 changed files with 98 additions and 64 deletions.
72 changes: 59 additions & 13 deletions Greending/Greending/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ public partial class MainWindow : Gtk.Window
string[] args;
//is a global variable bcs it doesn't want to work correctly
Entry entry = new Entry();
Gtk.Window donate_dialog = new Gtk.Window("Donations");
Gtk.Window dialog_change = new Gtk.Window("Select search engine");
WebKit2.Settings settings = new WebKit2.Settings();
Button donationCancelButton = new Button("Cancel");
Label labelTitle = new Label("Tab 1");

//We begin the Main Window (Now with 30% more stupid comments)
Expand Down Expand Up @@ -50,7 +52,7 @@ public MainWindow() : base(Gtk.WindowType.Toplevel)
settings.EnableSmoothScrolling = true;

//入 webView

webView.Add(new WebView());
//download.Destination = working_dir + "downloads";
if (!loadpages)
Expand All @@ -68,7 +70,7 @@ public MainWindow() : base(Gtk.WindowType.Toplevel)
}
//Put the WebView into the VBox1
notebook1.InsertPage(webView[0], labelTitle, 0);

label1.Text = "Tab 1";
webView[0].Show();
notebook1.RemovePage(1);
Expand Down Expand Up @@ -117,12 +119,12 @@ public string[] removeHashlines(string[] fileLines)
{
string[] result = fileLines;
string tmp = "";
for(int i = 0; i < result.Length; i++)
for (int i = 0; i < result.Length; i++)
{
tmp = "";
for(int j = 0; j < result[i].Length; j++)
for (int j = 0; j < result[i].Length; j++)
{
if(result[i][j] == '#')
if (result[i][j] == '#')
{
break;
}
Expand Down Expand Up @@ -155,7 +157,7 @@ protected void OpenURL(object sender, EventArgs e)
{ //Dis code works for 99% of cases. For di otha ones, fucc off
if (entry1.Text.Contains(".") && (entry1.Text.Contains("http://") || entry1.Text.Contains("https://")))
{
webView[notebook1.Page].LoadUri(entry1.Text);
webView[notebook1.Page].LoadUri(entry1.Text);
}
else if (entry1.Text.Contains("."))
{
Expand Down Expand Up @@ -209,9 +211,9 @@ protected void Quit(object sender, EventArgs e)
SavePages();
}
Application.Quit();

}

protected void Open(object sender, EventArgs e)
{ //Opel the fayel (No offense Opel buyers)
string url;
Expand Down Expand Up @@ -335,10 +337,11 @@ protected void About(object sender, EventArgs e)
//If this can be called a web browser...
about.ProgramName = "Greending Web Browser";
//Fun facc: 私のお尻 means "My butt" in Japanese
string[] authors = { "DisableGraphics", "私のお尻" };
string[] authors = { "DisableGraphics"};
about.Authors = authors;
about.Artists = authors;

about.Website = "https://github.com/DisableGraphics/zGreending";

//Bicos dis program don't worcc correccly
about.Version = "Version A_01";
Pixbuf icon = new Pixbuf(working_dir + "icons/icon.png");
Expand All @@ -362,7 +365,7 @@ void GenerateTab(string url)

Label labl = new Label("Tab " + Convert.ToString(newtab + 1));
notebook1.InsertPage(webView[newtab], labl, newtab);

webView[newtab].Show();
if (url != "default")
{
Expand Down Expand Up @@ -395,7 +398,7 @@ protected void CloseTab(object sender, EventArgs e)
notebook1.RemovePage(notebook1.Page);
webView.Remove(webView[pos]);
RefreshTabNames();
if(webView.Count > 0)
if (webView.Count > 0)
{
entry1.Text = webView[notebook1.Page].Uri;
}
Expand All @@ -410,7 +413,7 @@ protected void CloseTab(object sender, EventArgs e)
void SavePages()
{
File.Delete(working_dir + "conf/pages");
for(int i = 0; i < notebook1.NPages; i++)
for (int i = 0; i < notebook1.NPages; i++)
{
File.WriteAllText(working_dir + "conf/pages", webView[i].Uri);
}
Expand All @@ -436,4 +439,47 @@ void Loading()
{

}

protected void Donations(object sender, EventArgs e)
{
VBox bocs = new VBox();
donate_dialog.Add(bocs);
VBox bocs2 = new VBox();

Label description = new Label("This project is entirely funded by donations.\nIf you want to donate, we'll kindly accept:");

Label patreon = new Label("Patreon");

patreon.Markup = "<a href ='https://www.patreon.com/DisableGraphics' title =''>Patreon</a>";

Label bitcoin = new Label("Bitcoin: bc1q8u47hfu9s2zm2hr8gct4jdhl3mxy64mz6jznjg");
bitcoin.Selectable = true;

Label verge = new Label("Verge: DKww4JzvC7kuVKfyUfoxkUttbiKDrY6Pdk");
verge.Selectable = true;

bocs.PackEnd(bocs2, true, true, 0);

bocs.PackStart(description, true, true, 0);

bocs.PackStart(patreon, true, true, 0);

bocs2.PackStart(bitcoin, true, true, 5);

bocs2.PackStart(verge, true, true, 5);

donationCancelButton.Clicked += this.CancelDonation;

bocs2.PackEnd(donationCancelButton, true, true, 5);

donate_dialog.Resize(320, 240);

donate_dialog.SetIconFromFile(working_dir + "icons/icon.png");

donate_dialog.ShowAll();
}
void CancelDonation(object sender, EventArgs e)
{
donate_dialog.Hide();
}
}
Binary file modified Greending/Greending/bin/Debug/Greending.exe
Binary file not shown.
Binary file modified Greending/Greending/bin/Debug/Greending.pdb
Binary file not shown.
71 changes: 31 additions & 40 deletions Greending/Greending/gtk-gui/MainWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public partial class MainWindow

private global::Gtk.Action AboutAction;

private global::Gtk.Action DonationsAction;

private global::Gtk.VBox vbox1;

private global::Gtk.MenuBar menubar1;
Expand Down Expand Up @@ -49,8 +51,6 @@ public partial class MainWindow

private global::Gtk.Button button2;

private global::Gtk.HScale hscale3;

private global::Gtk.VBox vbox2;

private global::Gtk.ScrolledWindow scrolledwindow1;
Expand Down Expand Up @@ -88,6 +88,9 @@ protected virtual void Build()
this.AboutAction = new global::Gtk.Action("AboutAction", global::Mono.Unix.Catalog.GetString("About"), null, null);
this.AboutAction.ShortLabel = global::Mono.Unix.Catalog.GetString("About");
w1.Add(this.AboutAction, null);
this.DonationsAction = new global::Gtk.Action("DonationsAction", global::Mono.Unix.Catalog.GetString("Donations"), null, null);
this.DonationsAction.ShortLabel = global::Mono.Unix.Catalog.GetString("Donations");
w1.Add(this.DonationsAction, null);
this.UIManager.InsertActionGroup(w1, 0);
this.AddAccelGroup(this.UIManager.AccelGroup);
this.Name = "MainWindow";
Expand All @@ -98,7 +101,7 @@ protected virtual void Build()
this.vbox1.Name = "vbox1";
this.vbox1.Spacing = 6;
// Container child vbox1.Gtk.Box+BoxChild
this.UIManager.AddUiFromString(@"<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='OpenAction' action='OpenAction'/><menuitem name='QuitAction' action='QuitAction'/></menu><menu name='SettingsAction' action='SettingsAction'><menuitem name='HideMenuBarAction' action='HideMenuBarAction'/></menu><menu name='HelpAction' action='HelpAction'><menuitem name='AboutAction' action='AboutAction'/></menu></menubar></ui>");
this.UIManager.AddUiFromString(@"<ui><menubar name='menubar1'><menu name='FileAction' action='FileAction'><menuitem name='OpenAction' action='OpenAction'/><menuitem name='QuitAction' action='QuitAction'/></menu><menu name='SettingsAction' action='SettingsAction'><menuitem name='HideMenuBarAction' action='HideMenuBarAction'/></menu><menu name='HelpAction' action='HelpAction'><menuitem name='AboutAction' action='AboutAction'/><menuitem name='DonationsAction' action='DonationsAction'/></menu></menubar></ui>");
this.menubar1 = ((global::Gtk.MenuBar)(this.UIManager.GetWidget("/menubar1")));
this.menubar1.Name = "menubar1";
this.vbox1.Add(this.menubar1);
Expand Down Expand Up @@ -220,30 +223,17 @@ protected virtual void Build()
w12.Position = 1;
w12.Expand = false;
w12.Fill = false;
// Container child hbox5.Gtk.Box+BoxChild
this.hscale3 = new global::Gtk.HScale(null);
this.hscale3.CanFocus = true;
this.hscale3.Name = "hscale3";
this.hscale3.Adjustment.Upper = 100D;
this.hscale3.Adjustment.PageIncrement = 10D;
this.hscale3.Adjustment.StepIncrement = 1D;
this.hscale3.DrawValue = true;
this.hscale3.Digits = 0;
this.hscale3.ValuePos = ((global::Gtk.PositionType)(2));
this.hbox5.Add(this.hscale3);
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox5[this.hscale3]));
w13.Position = 2;
this.hbox4.Add(this.hbox5);
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox4[this.hbox5]));
w14.Position = 1;
global::Gtk.Box.BoxChild w13 = ((global::Gtk.Box.BoxChild)(this.hbox4[this.hbox5]));
w13.Position = 1;
this.hbox1.Add(this.hbox4);
global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.hbox4]));
w15.Position = 2;
global::Gtk.Box.BoxChild w14 = ((global::Gtk.Box.BoxChild)(this.hbox1[this.hbox4]));
w14.Position = 2;
this.vbox1.Add(this.hbox1);
global::Gtk.Box.BoxChild w16 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox1]));
w16.Position = 1;
w16.Expand = false;
w16.Fill = false;
global::Gtk.Box.BoxChild w15 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.hbox1]));
w15.Position = 1;
w15.Expand = false;
w15.Fill = false;
// Container child vbox1.Gtk.Box+BoxChild
this.vbox2 = new global::Gtk.VBox();
this.vbox2.Name = "vbox2";
Expand All @@ -254,38 +244,38 @@ protected virtual void Build()
this.scrolledwindow1.Name = "scrolledwindow1";
this.scrolledwindow1.ShadowType = ((global::Gtk.ShadowType)(1));
// Container child scrolledwindow1.Gtk.Container+ContainerChild
global::Gtk.Viewport w17 = new global::Gtk.Viewport();
w17.ShadowType = ((global::Gtk.ShadowType)(0));
global::Gtk.Viewport w16 = new global::Gtk.Viewport();
w16.ShadowType = ((global::Gtk.ShadowType)(0));
// Container child GtkViewport.Gtk.Container+ContainerChild
this.notebook1 = new global::Gtk.Notebook();
this.notebook1.CanFocus = true;
this.notebook1.Name = "notebook1";
this.notebook1.CurrentPage = 0;
// Notebook tab
global::Gtk.Label w18 = new global::Gtk.Label();
w18.Visible = true;
this.notebook1.Add(w18);
global::Gtk.Label w17 = new global::Gtk.Label();
w17.Visible = true;
this.notebook1.Add(w17);
this.label1 = new global::Gtk.Label();
this.label1.Name = "label1";
this.label1.LabelProp = global::Mono.Unix.Catalog.GetString("page1");
this.notebook1.SetTabLabel(w18, this.label1);
this.notebook1.SetTabLabel(w17, this.label1);
this.label1.ShowAll();
w17.Add(this.notebook1);
this.scrolledwindow1.Add(w17);
w16.Add(this.notebook1);
this.scrolledwindow1.Add(w16);
this.vbox2.Add(this.scrolledwindow1);
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.scrolledwindow1]));
w21.Position = 0;
global::Gtk.Box.BoxChild w20 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.scrolledwindow1]));
w20.Position = 0;
// Container child vbox2.Gtk.Box+BoxChild
this.hseparator1 = new global::Gtk.HSeparator();
this.hseparator1.Name = "hseparator1";
this.vbox2.Add(this.hseparator1);
global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hseparator1]));
w22.Position = 1;
w22.Expand = false;
w22.Fill = false;
global::Gtk.Box.BoxChild w21 = ((global::Gtk.Box.BoxChild)(this.vbox2[this.hseparator1]));
w21.Position = 1;
w21.Expand = false;
w21.Fill = false;
this.vbox1.Add(this.vbox2);
global::Gtk.Box.BoxChild w23 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.vbox2]));
w23.Position = 2;
global::Gtk.Box.BoxChild w22 = ((global::Gtk.Box.BoxChild)(this.vbox1[this.vbox2]));
w22.Position = 2;
this.Add(this.vbox1);
if ((this.Child != null))
{
Expand All @@ -299,6 +289,7 @@ protected virtual void Build()
this.QuitAction.Activated += new global::System.EventHandler(this.Quit);
this.HideMenuBarAction.Activated += new global::System.EventHandler(this.HideMenuBar);
this.AboutAction.Activated += new global::System.EventHandler(this.About);
this.DonationsAction.Activated += new global::System.EventHandler(this.Donations);
this.buttonBack.Clicked += new global::System.EventHandler(this.GoBack);
this.buttonForward.Clicked += new global::System.EventHandler(this.GoForward);
this.button4.Clicked += new global::System.EventHandler(this.Reload);
Expand Down
19 changes: 8 additions & 11 deletions Greending/Greending/gtk-gui/gui.stetic
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@
<property name="ShortLabel" translatable="yes">About</property>
<signal name="Activated" handler="About" />
</action>
<action id="DonationsAction">
<property name="Type">Action</property>
<property name="Label" translatable="yes">Donations</property>
<property name="ShortLabel" translatable="yes">Donations</property>
<signal name="Activated" handler="Donations" />
</action>
</action-group>
<property name="MemberName" />
<property name="Title" translatable="yes">Greending</property>
Expand All @@ -72,6 +78,7 @@
</node>
<node type="Menu" action="HelpAction">
<node type="Menuitem" action="AboutAction" />
<node type="Menuitem" action="DonationsAction" />
</node>
</node>
</widget>
Expand Down Expand Up @@ -243,17 +250,7 @@
</packing>
</child>
<child>
<widget class="Gtk.HScrollbar" id="hscrollbar2">
<property name="MemberName" />
<property name="Upper">100</property>
<property name="PageIncrement">10</property>
<property name="PageSize">10</property>
<property name="StepIncrement">1</property>
</widget>
<packing>
<property name="Position">2</property>
<property name="AutoSize">True</property>
</packing>
<placeholder />
</child>
</widget>
<packing>
Expand Down

0 comments on commit dca5f97

Please sign in to comment.