gnome ui: Use GtkApplication to manage instances and set titles and icon

This commit is contained in:
Hylke Bons 2013-10-14 13:49:42 +02:00
parent 81939b4bb9
commit edee2eec69
5 changed files with 49 additions and 21 deletions

View file

@ -13,14 +13,14 @@ system_theme_icons = \
apps,sparkleshare-256.png \
apps,sparkleshare-32.png \
apps,sparkleshare-48.png \
status,process-syncing-up-24.png \
status,process-syncing-down-24.png \
status,process-syncing-24.png \
status,process-syncing-error-24.png \
status,process-syncing-up-48.png \
status,process-syncing-down-48.png \
status,process-syncing-48.png \
status,process-syncing-error-48.png
status,process-syncing-up-24.png \
status,process-syncing-down-24.png \
status,process-syncing-24.png \
status,process-syncing-error-24.png \
status,process-syncing-up-48.png \
status,process-syncing-down-48.png \
status,process-syncing-48.png \
status,process-syncing-error-48.png
app_theme_icons = \
status,document-added-12.png \

View file

@ -29,7 +29,9 @@ namespace SparkleShare {
public SparkleAbout () : base ("About SparkleShare")
{
IconName = "folder-sparkleshare";
SetWmclass ("SparkleShare", "SparkleShare");
IconName = "sparkleshare";
Resizable = false;
WindowPosition = WindowPosition.Center;

View file

@ -42,10 +42,12 @@ namespace SparkleShare {
public SparkleEventLog () : base ("Recent Changes")
{
SetWmclass ("SparkleShare", "SparkleShare");
Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0);
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_y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5));

View file

@ -35,12 +35,15 @@ namespace SparkleShare {
public SparkleSetupWindow () : base ("SparkleShare Setup")
{
IconName = "folder-sparkleshare";
SetWmclass ("SparkleShare", "SparkleShare");
IconName = "sparkleshare";
Resizable = false;
WindowPosition = WindowPosition.Center;
Deletable = false;
TypeHint = Gdk.WindowTypeHint.Dialog;
SetSizeRequest (680, 400);
DeleteEvent += delegate (object sender, DeleteEventArgs args) { args.RetVal = true; };

View file

@ -17,6 +17,7 @@
using System;
using GLib;
using Gtk;
using SparkleLib;
@ -32,25 +33,45 @@ namespace SparkleShare {
public static string AssetsPath = Defines.INSTALL_DIR;
private Gtk.Application application;
// TODO: port sparkleshare.in
public SparkleUI ()
{
Application.Init ();
application = new Gtk.Application ("org.sparkleshare.sparkleshare", 0);
Setup = new SparkleSetup ();
EventLog = new SparkleEventLog ();
About = new SparkleAbout ();
Bubbles = new SparkleBubbles ();
StatusIcon = new SparkleStatusIcon ();
Program.Controller.UIHasLoaded ();
application.Register (null);
application.Activated += ApplicationActivatedDelegate;
}
// Runs the application
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 ();
}
}
}
}