eventlog: Remove spinner code and use GTK+3's native spinner
This commit is contained in:
parent
3c2efa090d
commit
d239cf56a4
|
@ -28,7 +28,6 @@ SOURCES = \
|
||||||
SparkleEventLog.cs \
|
SparkleEventLog.cs \
|
||||||
SparkleSetup.cs \
|
SparkleSetup.cs \
|
||||||
SparkleSetupWindow.cs \
|
SparkleSetupWindow.cs \
|
||||||
SparkleSpinner.cs \
|
|
||||||
SparkleStatusIcon.cs \
|
SparkleStatusIcon.cs \
|
||||||
SparkleUI.cs \
|
SparkleUI.cs \
|
||||||
SparkleUIHelpers.cs
|
SparkleUIHelpers.cs
|
||||||
|
|
|
@ -23,7 +23,6 @@ system_theme_icons = \
|
||||||
status,process-syncing-error-48.png
|
status,process-syncing-error-48.png
|
||||||
|
|
||||||
app_theme_icons = \
|
app_theme_icons = \
|
||||||
animations,process-working-22.png \
|
|
||||||
status,document-added-12.png \
|
status,document-added-12.png \
|
||||||
status,document-edited-12.png \
|
status,document-edited-12.png \
|
||||||
status,document-deleted-12.png \
|
status,document-deleted-12.png \
|
||||||
|
|
Binary file not shown.
Before Width: | Height: | Size: 4 KiB |
|
@ -39,7 +39,8 @@ namespace SparkleShare {
|
||||||
private EventBox content_wrapper;
|
private EventBox content_wrapper;
|
||||||
private ScrolledWindow scrolled_window;
|
private ScrolledWindow scrolled_window;
|
||||||
// private WebView web_view;
|
// private WebView web_view;
|
||||||
private SparkleSpinner spinner;
|
private VBox spinner_wrapper;
|
||||||
|
private Spinner spinner;
|
||||||
|
|
||||||
|
|
||||||
public SparkleEventLog () : base ("")
|
public SparkleEventLog () : base ("")
|
||||||
|
@ -86,27 +87,29 @@ namespace SparkleShare {
|
||||||
layout_sizes.Add (this.history_label);
|
layout_sizes.Add (this.history_label);
|
||||||
|
|
||||||
VBox layout_vertical = new VBox (false, 0);
|
VBox layout_vertical = new VBox (false, 0);
|
||||||
this.spinner = new SparkleSpinner (22);
|
this.spinner = new Spinner ();
|
||||||
|
this.spinner_wrapper = new VBox ();
|
||||||
this.content_wrapper = new EventBox ();
|
this.content_wrapper = new EventBox ();
|
||||||
this.scrolled_window = new ScrolledWindow ();
|
this.scrolled_window = new ScrolledWindow ();
|
||||||
|
|
||||||
this.content_wrapper.OverrideBackgroundColor (StateFlags.Normal,
|
this.content_wrapper.OverrideBackgroundColor (StateFlags.Normal,
|
||||||
new Gdk.RGBA () { Red = 1, Green = 1, Blue=1, Alpha = 1 });
|
new Gdk.RGBA () { Red = 1, Green = 1, Blue=1, Alpha = 1 });
|
||||||
|
|
||||||
/*
|
// this.web_view = new WebView () { Editable = false };
|
||||||
this.web_view = new WebView () {
|
// this.web_view.NavigationRequested += WebViewNavigationRequested;
|
||||||
Editable = false
|
|
||||||
};
|
|
||||||
|
|
||||||
|
// this.scrolled_window.Add (this.web_view);
|
||||||
this.web_view.NavigationRequested += WebViewNavigationRequested;
|
|
||||||
*/
|
|
||||||
// this.scrolled_window.Add (this.web_view);
|
|
||||||
this.scrolled_window.AddWithViewport (new Button ("WebView"));
|
this.scrolled_window.AddWithViewport (new Button ("WebView"));
|
||||||
this.content_wrapper.Add (this.spinner);
|
|
||||||
|
|
||||||
|
this.spinner_wrapper = new VBox (false, 0);
|
||||||
|
this.spinner_wrapper.PackStart (new Label(""), true, true, 0);
|
||||||
|
this.spinner_wrapper.PackStart (this.spinner, false, false, 0);
|
||||||
|
this.spinner_wrapper.PackStart (new Label(""), true, true, 0);
|
||||||
|
this.spinner.SetSizeRequest (24, 24);
|
||||||
this.spinner.Start ();
|
this.spinner.Start ();
|
||||||
|
|
||||||
|
this.content_wrapper.Add (this.spinner_wrapper);
|
||||||
|
|
||||||
this.layout_horizontal = new HBox (true, 0);
|
this.layout_horizontal = new HBox (true, 0);
|
||||||
this.layout_horizontal.PackStart (layout_sizes, true, true, 12);
|
this.layout_horizontal.PackStart (layout_sizes, true, true, 12);
|
||||||
|
|
||||||
|
@ -157,15 +160,11 @@ namespace SparkleShare {
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.UpdateChooserEnablementEvent += delegate (bool enabled) {
|
Controller.UpdateChooserEnablementEvent += delegate (bool enabled) {
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate { this.combo_box.Sensitive = enabled; });
|
||||||
this.combo_box.Sensitive = enabled;
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.UpdateContentEvent += delegate (string html) {
|
Controller.UpdateContentEvent += delegate (string html) {
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate { UpdateContent (html); });
|
||||||
UpdateContent (html);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Controller.ContentLoadingEvent += delegate {
|
Controller.ContentLoadingEvent += delegate {
|
||||||
|
@ -173,7 +172,7 @@ namespace SparkleShare {
|
||||||
if (this.content_wrapper.Child != null)
|
if (this.content_wrapper.Child != null)
|
||||||
this.content_wrapper.Remove (this.content_wrapper.Child);
|
this.content_wrapper.Remove (this.content_wrapper.Child);
|
||||||
|
|
||||||
this.content_wrapper.Add (this.spinner);
|
this.content_wrapper.Add (this.spinner_wrapper);
|
||||||
this.spinner.Start ();
|
this.spinner.Start ();
|
||||||
this.content_wrapper.ShowAll ();
|
this.content_wrapper.ShowAll ();
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,76 +0,0 @@
|
||||||
// SparkleShare, a collaboration and sharing tool.
|
|
||||||
// Copyright (C) 2010 Hylke Bons <hylkebons@gmail.com>
|
|
||||||
//
|
|
||||||
// This program is free software: you can redistribute it and/or modify
|
|
||||||
// it under the terms of the GNU General Public License as published by
|
|
||||||
// the Free Software Foundation, either version 3 of the License, or
|
|
||||||
// (at your option) any later version.
|
|
||||||
//
|
|
||||||
// This program is distributed in the hope that it will be useful,
|
|
||||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
// GNU General Public License for more details.
|
|
||||||
//
|
|
||||||
// You should have received a copy of the GNU General Public License
|
|
||||||
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
|
|
||||||
using System.Timers;
|
|
||||||
using Gtk;
|
|
||||||
|
|
||||||
namespace SparkleShare {
|
|
||||||
|
|
||||||
// This is a close implementation of GtkSpinner
|
|
||||||
public class SparkleSpinner : Image {
|
|
||||||
|
|
||||||
private Timer timer;
|
|
||||||
|
|
||||||
|
|
||||||
public SparkleSpinner (int size) : base ()
|
|
||||||
{
|
|
||||||
int current_frame = 0;
|
|
||||||
Gdk.Pixbuf spinner_gallery = SparkleUIHelpers.GetIcon ("process-working", size);
|
|
||||||
int frames_in_width = spinner_gallery.Width / size;
|
|
||||||
int frames_in_height = spinner_gallery.Height / size;
|
|
||||||
int frame_count = (frames_in_width * frames_in_height) - 1;
|
|
||||||
Gdk.Pixbuf [] frames = new Gdk.Pixbuf [frame_count];
|
|
||||||
|
|
||||||
int i = 0;
|
|
||||||
for (int y = 0; y < frames_in_height; y++) {
|
|
||||||
for (int x = 0; x < frames_in_width; x++) {
|
|
||||||
if (!(y == 0 && x == 0)) {
|
|
||||||
frames [i] = new Gdk.Pixbuf (spinner_gallery, x * size, y * size, size, size);
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
timer = new Timer () {
|
|
||||||
Interval = 600 / frame_count
|
|
||||||
};
|
|
||||||
|
|
||||||
timer.Elapsed += delegate {
|
|
||||||
if (current_frame < frame_count - 1)
|
|
||||||
current_frame++;
|
|
||||||
else
|
|
||||||
current_frame = 0;
|
|
||||||
|
|
||||||
Application.Invoke (delegate {
|
|
||||||
Pixbuf = frames [current_frame];
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Start ()
|
|
||||||
{
|
|
||||||
timer.Start ();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public void Stop ()
|
|
||||||
{
|
|
||||||
timer.Stop ();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in a new issue