Skip to content

Commit

Permalink
Minor tray icon improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Oct 12, 2024
1 parent 4c31279 commit 78994c7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 11 deletions.
4 changes: 4 additions & 0 deletions GUI/Main/Main.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion GUI/Main/Main.cs
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,8 @@ private void CurrentInstanceUpdated()

Util.Invoke(this, () =>
{
Text = $"CKAN {Meta.GetVersion()} - {CurrentInstance.game.ShortName} {CurrentInstance.Version()} -- {Platform.FormatPath(CurrentInstance.GameDir())}";
Text = $"{Meta.GetProductName()} {Meta.GetVersion()} - {CurrentInstance.game.ShortName} {CurrentInstance.Version()} -- {Platform.FormatPath(CurrentInstance.GameDir())}";
minimizeNotifyIcon.Text = $"{Meta.GetProductName()} - {CurrentInstance.Name}";
UpdateStatusBar();
});

Expand Down
1 change: 0 additions & 1 deletion GUI/Main/Main.resx
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,6 @@
<data name="UnmanagedFilesTabPage.Text" xml:space="preserve"><value>Unmanaged Files</value></data>
<data name="InstallationHistoryTabPage.Text" xml:space="preserve"><value>Installation History</value></data>
<data name="minimizeNotifyIcon.Text" xml:space="preserve"><value>CKAN</value></data>
<data name="updatesToolStripMenuItem.Text" xml:space="preserve"><value>N available updates</value></data>
<data name="refreshToolStripMenuItem.Text" xml:space="preserve"><value>Refresh</value></data>
<data name="pauseToolStripMenuItem.Text" xml:space="preserve"><value>Pause</value></data>
<data name="openCKANToolStripMenuItem.Text" xml:space="preserve"><value>Open CKAN</value></data>
Expand Down
32 changes: 23 additions & 9 deletions GUI/Main/MainTrayIcon.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,13 @@ private void UpdateTrayState()
// Remove our taskbar entry
Hide();
}
openCKANToolStripMenuItem.Visible = true;
}
else
{
// Save the window state
configuration.IsWindowMaximised = WindowState == FormWindowState.Maximized;
openCKANToolStripMenuItem.Visible = false;
}
}
else
Expand All @@ -65,6 +67,8 @@ private void UpdateTrayInfo()
updatesToolStripMenuItem.Enabled = true;
updatesToolStripMenuItem.Text = string.Format(Properties.Resources.MainTrayUpdatesAvailable, count);
}
toolStripSeparator4.Visible = true;
updatesToolStripMenuItem.Visible = true;
}

/// <summary>
Expand All @@ -74,11 +78,23 @@ public void OpenWindow()
{
Show();
WindowState = configuration?.IsWindowMaximised ?? false ? FormWindowState.Maximized : FormWindowState.Normal;
openCKANToolStripMenuItem.Visible = false;
}

private void minimizeNotifyIcon_MouseClick(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
OpenWindow();
}
}

private void minimizeNotifyIcon_MouseDoubleClick(object sender, MouseEventArgs e)
{
OpenWindow();
if (e.Button == MouseButtons.Left)
{
OpenWindow();
}
}

private void updatesToolStripMenuItem_Click(object? sender, EventArgs? e)
Expand Down Expand Up @@ -134,9 +150,9 @@ private void minimizedContextMenuStrip_Opening(object? sender, CancelEventArgs?
{
// The menu location can be partly off-screen by default.
// Fix it.
minimizedContextMenuStrip.Location = Util.ClampedLocation(
minimizedContextMenuStrip.Location,
minimizedContextMenuStrip.Size);
minimizedContextMenuStrip.Location =
Util.ClampedLocation(minimizedContextMenuStrip.Location,
minimizedContextMenuStrip.Size);
}

private void minimizeNotifyIcon_BalloonTipClicked(object? sender, EventArgs? e)
Expand All @@ -149,11 +165,9 @@ private void minimizeNotifyIcon_BalloonTipClicked(object? sender, EventArgs? e)

// Install
Wait.StartWaiting(InstallMods, PostInstallMods, true,
new InstallArgument(
ManageMods.ComputeUserChangeSet()
.ToList(),
RelationshipResolverOptions.DependsOnlyOpts())
);
new InstallArgument(ManageMods.ComputeUserChangeSet()
.ToList(),
RelationshipResolverOptions.DependsOnlyOpts()));
}
#endregion
}
Expand Down

0 comments on commit 78994c7

Please sign in to comment.