gnome ui: Use GtkApplication to manage instances and set titles and icon
This commit is contained in:
parent
81939b4bb9
commit
edee2eec69
|
@ -13,14 +13,14 @@ system_theme_icons = \
|
||||||
apps,sparkleshare-256.png \
|
apps,sparkleshare-256.png \
|
||||||
apps,sparkleshare-32.png \
|
apps,sparkleshare-32.png \
|
||||||
apps,sparkleshare-48.png \
|
apps,sparkleshare-48.png \
|
||||||
status,process-syncing-up-24.png \
|
status,process-syncing-up-24.png \
|
||||||
status,process-syncing-down-24.png \
|
status,process-syncing-down-24.png \
|
||||||
status,process-syncing-24.png \
|
status,process-syncing-24.png \
|
||||||
status,process-syncing-error-24.png \
|
status,process-syncing-error-24.png \
|
||||||
status,process-syncing-up-48.png \
|
status,process-syncing-up-48.png \
|
||||||
status,process-syncing-down-48.png \
|
status,process-syncing-down-48.png \
|
||||||
status,process-syncing-48.png \
|
status,process-syncing-48.png \
|
||||||
status,process-syncing-error-48.png
|
status,process-syncing-error-48.png
|
||||||
|
|
||||||
app_theme_icons = \
|
app_theme_icons = \
|
||||||
status,document-added-12.png \
|
status,document-added-12.png \
|
||||||
|
|
|
@ -29,7 +29,9 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleAbout () : base ("About SparkleShare")
|
public SparkleAbout () : base ("About SparkleShare")
|
||||||
{
|
{
|
||||||
IconName = "folder-sparkleshare";
|
SetWmclass ("SparkleShare", "SparkleShare");
|
||||||
|
|
||||||
|
IconName = "sparkleshare";
|
||||||
Resizable = false;
|
Resizable = false;
|
||||||
WindowPosition = WindowPosition.Center;
|
WindowPosition = WindowPosition.Center;
|
||||||
|
|
||||||
|
|
|
@ -42,10 +42,12 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleEventLog () : base ("Recent Changes")
|
public SparkleEventLog () : base ("Recent Changes")
|
||||||
{
|
{
|
||||||
|
SetWmclass ("SparkleShare", "SparkleShare");
|
||||||
|
|
||||||
Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0);
|
Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0);
|
||||||
SetSizeRequest (480, (int) (monitor_0_rect.Height * 0.8));
|
SetSizeRequest (480, (int) (monitor_0_rect.Height * 0.8));
|
||||||
|
|
||||||
IconName = "folder-sparkleshare";
|
IconName = "sparkleshare";
|
||||||
this.pos_x = (int) (monitor_0_rect.Width * 0.61);
|
this.pos_x = (int) (monitor_0_rect.Width * 0.61);
|
||||||
this.pos_y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5));
|
this.pos_y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5));
|
||||||
|
|
||||||
|
|
|
@ -35,12 +35,15 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public SparkleSetupWindow () : base ("SparkleShare Setup")
|
public SparkleSetupWindow () : base ("SparkleShare Setup")
|
||||||
{
|
{
|
||||||
IconName = "folder-sparkleshare";
|
SetWmclass ("SparkleShare", "SparkleShare");
|
||||||
|
|
||||||
|
IconName = "sparkleshare";
|
||||||
Resizable = false;
|
Resizable = false;
|
||||||
WindowPosition = WindowPosition.Center;
|
WindowPosition = WindowPosition.Center;
|
||||||
Deletable = false;
|
Deletable = false;
|
||||||
TypeHint = Gdk.WindowTypeHint.Dialog;
|
TypeHint = Gdk.WindowTypeHint.Dialog;
|
||||||
|
|
||||||
|
|
||||||
SetSizeRequest (680, 400);
|
SetSizeRequest (680, 400);
|
||||||
|
|
||||||
DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };
|
DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
|
|
||||||
|
using GLib;
|
||||||
using Gtk;
|
using Gtk;
|
||||||
using SparkleLib;
|
using SparkleLib;
|
||||||
|
|
||||||
|
@ -32,25 +33,45 @@ namespace SparkleShare {
|
||||||
|
|
||||||
public static string AssetsPath = Defines.INSTALL_DIR;
|
public static string AssetsPath = Defines.INSTALL_DIR;
|
||||||
|
|
||||||
|
private Gtk.Application application;
|
||||||
|
|
||||||
|
// TODO: port sparkleshare.in
|
||||||
public SparkleUI ()
|
public SparkleUI ()
|
||||||
{
|
{
|
||||||
Application.Init ();
|
application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);
|
||||||
|
|
||||||
Setup = new SparkleSetup ();
|
application.Register (null);
|
||||||
EventLog = new SparkleEventLog ();
|
application.Activated += ApplicationActivatedDelegate;
|
||||||
About = new SparkleAbout ();
|
|
||||||
Bubbles = new SparkleBubbles ();
|
|
||||||
StatusIcon = new SparkleStatusIcon ();
|
|
||||||
|
|
||||||
Program.Controller.UIHasLoaded ();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// Runs the application
|
|
||||||
public void Run ()
|
public void Run ()
|
||||||
|
{
|
||||||
|
(application as GLib.Application).Run (0, null);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private void ApplicationActivatedDelegate (object sender, EventArgs args)
|
||||||
{
|
{
|
||||||
Application.Run ();
|
if (application.Windows.Length > 0) {
|
||||||
|
foreach (Window window in application.Windows) {
|
||||||
|
if (window.Visible)
|
||||||
|
window.Present ();
|
||||||
|
}
|
||||||
|
|
||||||
|
} else {
|
||||||
|
Setup = new SparkleSetup ();
|
||||||
|
EventLog = new SparkleEventLog ();
|
||||||
|
About = new SparkleAbout ();
|
||||||
|
Bubbles = new SparkleBubbles ();
|
||||||
|
StatusIcon = new SparkleStatusIcon ();
|
||||||
|
|
||||||
|
Setup.Application = application;
|
||||||
|
EventLog.Application = application;
|
||||||
|
About.Application = application;
|
||||||
|
|
||||||
|
Program.Controller.UIHasLoaded ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue