Implement #99
This commit is contained in:
parent
880412ca06
commit
4862438e15
|
@ -56,5 +56,19 @@
|
|||
<summary>Watched Hashtags</summary>
|
||||
<description>Comma separated list of hashtags to notify you about</description>
|
||||
</key>
|
||||
|
||||
<key name="window-x" type="i">
|
||||
<default>-1</default>
|
||||
</key>
|
||||
<key name="window-y" type="i">
|
||||
<default>-1</default>
|
||||
</key>
|
||||
<key name="window-w" type="i">
|
||||
<default>-1</default>
|
||||
</key>
|
||||
<key name="window-h" type="i">
|
||||
<default>-1</default>
|
||||
</key>
|
||||
|
||||
</schema>
|
||||
</schemalist>
|
||||
|
|
|
@ -22,6 +22,7 @@ executable(
|
|||
'src/Desktop.vala',
|
||||
'src/Drawing.vala',
|
||||
'src/Html.vala',
|
||||
'src/ISavedWindow.vala',
|
||||
'src/MainWindow.vala',
|
||||
'src/Settings.vala',
|
||||
'src/Accounts.vala',
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
using Gtk;
|
||||
|
||||
public interface Tootle.ISavedWindow : Gtk.Window {
|
||||
|
||||
public void restore_state () {
|
||||
settings = new Settings ();
|
||||
configure_window (settings);
|
||||
configure_event.connect ((ev) => on_configure (ev, settings));
|
||||
}
|
||||
|
||||
public bool on_configure (Gdk.EventConfigure event, Settings settings) {
|
||||
int x, y, w, h;
|
||||
get_position (out x, out y);
|
||||
get_size (out w, out h);
|
||||
|
||||
settings.window_x = x;
|
||||
settings.window_y = y;
|
||||
settings.window_w = w;
|
||||
settings.window_h = h;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void configure_window (Settings settings) {
|
||||
var x = settings.window_x;
|
||||
var y = settings.window_y;
|
||||
var w = settings.window_w;
|
||||
var h = settings.window_h;
|
||||
|
||||
if (x + y > 0)
|
||||
this.move (x, y);
|
||||
|
||||
if (h + w > 0) {
|
||||
this.default_width = w;
|
||||
this.default_height = h;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
using Gtk;
|
||||
|
||||
public class Tootle.MainWindow: Gtk.Window {
|
||||
public class Tootle.MainWindow: Gtk.Window, ISavedWindow {
|
||||
|
||||
private Overlay overlay;
|
||||
private Granite.Widgets.Toast toast;
|
||||
|
@ -89,6 +89,8 @@ public class Tootle.MainWindow: Gtk.Window {
|
|||
overlay.add_overlay (toast);
|
||||
overlay.set_size_request (450, 600);
|
||||
add (overlay);
|
||||
|
||||
restore_state ();
|
||||
show_all ();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
public class Tootle.Settings : Granite.Services.Settings {
|
||||
|
||||
|
||||
public int current_account { get; set; }
|
||||
public bool notifications { get; set; }
|
||||
public bool always_online { get; set; }
|
||||
|
@ -12,6 +12,11 @@ public class Tootle.Settings : Granite.Services.Settings {
|
|||
public string watched_users { get; set; }
|
||||
public string watched_hashtags { get; set; }
|
||||
|
||||
public int window_x { get; set; }
|
||||
public int window_y { get; set; }
|
||||
public int window_w { get; set; }
|
||||
public int window_h { get; set; }
|
||||
|
||||
public Settings () {
|
||||
base ("com.github.bleakgrey.tootle");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue