linux: Rename icons to work in AppIndicator

This commit is contained in:
Hylke Bons 2018-03-19 09:31:55 +00:00
parent da4f11d1f6
commit 31e5daf720
13 changed files with 37 additions and 57 deletions

View file

@ -11,21 +11,29 @@ foreach size : icon_sizes
install_dir: join_paths(theme_dir, icon_dir))
endforeach
# Install the symbolic icons
install_data(
sources: join_paths('hicolor', 'symbolic', 'apps', app_icon_name + '-symbolic.svg'),
install_dir: join_paths(theme_dir, 'symbolic', 'apps'))
symbolic_icons = ['syncing',
'syncing-up',
'syncing-down',
'syncing-error']
foreach icon : symbolic_icons
# Install the status icons
status_icons = ['syncing',
'syncing-up',
'syncing-down',
'syncing-error']
foreach icon : status_icons
install_data(
sources: join_paths('hicolor', 'symbolic', 'status', 'org.sparkleshare.SparkleShare-' + icon + '-symbolic.svg'),
install_dir: join_paths(theme_dir, 'symbolic', 'status'))
sources: join_paths('hicolor', '24x24', 'status', app_icon_name + '-' + icon + '.png'),
install_dir: join_paths(theme_dir, '24x24', 'apps'))
install_data(
sources: join_paths('hicolor', '48x48', 'status', app_icon_name + '-' + icon + '.png'),
install_dir: join_paths(theme_dir, '48x48', 'apps'))
install_data(
sources: join_paths('hicolor', 'symbolic', 'status', app_icon_name + '-' + icon + '-symbolic.svg'),
install_dir: join_paths(theme_dir, 'symbolic', 'apps'))
endforeach
@ -52,19 +60,3 @@ size = '16'
install_data(sources: join_paths('hicolor', size + 'x' + size, category, 'list-point.png'),
install_dir: join_paths(app_theme_dir, size + 'x' + size, category))
sizes = ['24', '48']
foreach size : sizes
install_data(sources: join_paths('hicolor', size + 'x' + size, category, 'process-syncing.png'),
install_dir: join_paths(app_theme_dir, size + 'x' + size, category))
install_data(sources: join_paths('hicolor', size + 'x' + size, category, 'process-syncing-up.png'),
install_dir: join_paths(app_theme_dir, size + 'x' + size, category))
install_data(sources: join_paths('hicolor', size + 'x' + size, category, 'process-syncing-down.png'),
install_dir: join_paths(app_theme_dir, size + 'x' + size, category))
install_data(sources: join_paths('hicolor', size + 'x' + size, category, 'process-syncing-error.png'),
install_dir: join_paths(app_theme_dir, size + 'x' + size, category))
endforeach

View file

@ -31,7 +31,7 @@ namespace SparkleShare {
public class StatusIcon {
public StatusIconController Controller = new StatusIconController ();
public static bool use_appindicator = true;
public static bool use_appindicator = true;
Gtk.StatusIcon status_icon;
@ -68,35 +68,27 @@ namespace SparkleShare {
Application.Invoke (delegate {
string icon_name = "org.sparkleshare.SparkleShare";
if (use_appindicator) {
#if HAVE_APP_INDICATOR
if (state == IconState.SyncingUp)
icon_name += "-syncing-up";
else if (state == IconState.SyncingDown)
icon_name += "-syncing-down";
else if (state == IconState.Syncing)
icon_name += "-syncing";
else if (state == IconState.Error)
icon_name += "-syncing-error";
if (state == IconState.SyncingUp)
icon_name += "-syncing-up";
else if (state == IconState.SyncingDown)
icon_name += "-syncing-down";
else if (state == IconState.Syncing)
icon_name += "-syncing";
else if (state == IconState.Error)
icon_name += "-syncing-error";
if (use_appindicator) {
icon_name += "-symbolic";
#if HAVE_APP_INDICATOR
indicator.IconName = icon_name;
// Force update of the status icon
// Hack to force update the status icon
indicator.Status = (int) IndicatorStatus.Attention;
indicator.Status = (int) IndicatorStatus.Active;
#endif
} else {
if (state == IconState.SyncingUp)
icon_name += "process-syncing-up";
else if (state == IconState.SyncingDown)
icon_name += "process-syncing-down";
else if (state == IconState.Syncing)
icon_name += "process-syncing";
else if (state == IconState.Error)
icon_name += "process-syncing-error";
this.status_icon.IconName = icon_name;
}
});

View file

@ -51,8 +51,7 @@ namespace SparkleShare
application.Register (null);
application.Activated += ApplicationActivatedDelegate;
//if (IconTheme.Default != null)
if (IconTheme.Default != null)
IconTheme.Default.AppendSearchPath (Path.Combine (UserInterface.AssetsPath, "icons"));
var label = new Label ();

View file

@ -18,8 +18,8 @@
using System;
using System.IO;
using Gtk;
using Sparkles;
using Gtk;
namespace SparkleShare {
@ -66,7 +66,7 @@ namespace SparkleShare {
(int) Math.Truncate (color.Blue / 256.00));
}
public static Gdk.Color RGBAToColor (Gdk.RGBA rgba) {
return new Gdk.Color () {
Red = (ushort) (rgba.Red * 65535),
@ -85,13 +85,11 @@ namespace SparkleShare {
public static Gdk.Color MixColors (Gdk.Color first_color, Gdk.Color second_color, double ratio)
{
return new Gdk.Color (
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) +
second_color.Red * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) +
second_color.Green * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) +
second_color.Blue * ratio))) / 65535)
Convert.ToByte ((255 * (Math.Min (65535, first_color.Red * (1.0 - ratio) + second_color.Red * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Green * (1.0 - ratio) + second_color.Green * ratio))) / 65535),
Convert.ToByte ((255 * (Math.Min (65535, first_color.Blue * (1.0 - ratio) + second_color.Blue * ratio))) / 65535)
);
}
}
}

View file

@ -335,7 +335,6 @@ namespace Sparkles.Git {
void InstallConfiguration ()
{
string [] settings = {
"advice.ignoredHook false",
"core.autocrlf input",
"core.quotepath false", // For commands to output Unicode characters "as is". e.g. '"h\303\251"' becomes 'hé'.
"core.precomposeunicode true", // Use the same Unicode form on all filesystems