linux statusicon: Rearrange menu
This commit is contained in:
parent
40bda9b126
commit
8191057748
|
@ -66,7 +66,7 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IsPaused)
|
if (IsPaused)
|
||||||
return "Syncing Paused";
|
return "Paused";
|
||||||
|
|
||||||
if (HasError) {
|
if (HasError) {
|
||||||
switch (repo.Error) {
|
switch (repo.Error) {
|
||||||
|
|
|
@ -48,11 +48,12 @@ namespace SparkleShare {
|
||||||
SetSizeRequest (480, 640);
|
SetSizeRequest (480, 640);
|
||||||
|
|
||||||
Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0);
|
Gdk.Rectangle monitor_0_rect = Gdk.Screen.Default.GetMonitorGeometry (0);
|
||||||
pos_x = (int) (monitor_0_rect.Width * 0.61);
|
|
||||||
pos_y = (int) (monitor_0_rect.Height * 0.5 - (HeightRequest * 0.5));
|
|
||||||
|
|
||||||
Resize (480, (int) (monitor_0_rect.Height * 0.8));
|
Resize (480, (int) (monitor_0_rect.Height * 0.8));
|
||||||
|
|
||||||
|
pos_x = (int) (monitor_0_rect.Width * 0.62);
|
||||||
|
pos_y = (int) ((monitor_0_rect.Height - (monitor_0_rect.Height * 0.8)) / 2);
|
||||||
|
|
||||||
this.size_label = new Label () { Xalign = 0, Markup = "<b>Size:</b> …" };
|
this.size_label = new Label () { Xalign = 0, Markup = "<b>Size:</b> …" };
|
||||||
this.history_label = new Label () { Xalign = 0, Markup = "<b>History:</b> …" };
|
this.history_label = new Label () { Xalign = 0, Markup = "<b>History:</b> …" };
|
||||||
|
|
||||||
|
|
|
@ -44,17 +44,17 @@ namespace SparkleShare {
|
||||||
Indicator indicator;
|
Indicator indicator;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
bool use_appindicator = true;
|
||||||
|
|
||||||
|
|
||||||
public StatusIcon ()
|
public StatusIcon ()
|
||||||
{
|
{
|
||||||
if (InstallationInfo.OperatingSystem == OS.Ubuntu) {
|
if (use_appindicator) {
|
||||||
#if HAVE_APP_INDICATOR
|
#if HAVE_APP_INDICATOR
|
||||||
indicator = new Indicator ("sparkleshare", "sparkleshare", (int) IndicatorCategory.ApplicationStatus) {
|
indicator = new Indicator ("sparkleshare", "sparkleshare", (int) IndicatorCategory.ApplicationStatus) {
|
||||||
IconName = "org.sparkleshare.SparkleShare",
|
IconName = "org.sparkleshare.SparkleShare-symbolic",
|
||||||
Status = (int) IndicatorStatus.Active
|
Status = (int) IndicatorStatus.Active
|
||||||
};
|
};
|
||||||
|
|
||||||
Console.WriteLine ("INDICATOR: " + indicator.IconName);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -67,11 +67,7 @@ namespace SparkleShare {
|
||||||
|
|
||||||
Controller.UpdateIconEvent += delegate (IconState state) {
|
Controller.UpdateIconEvent += delegate (IconState state) {
|
||||||
Application.Invoke (delegate {
|
Application.Invoke (delegate {
|
||||||
string icon_name = "org.sparkleshare.SparkleShare";
|
string icon_name = "org.sparkleshare.SparkleShare-symbolic";
|
||||||
|
|
||||||
// if (InstallationInfo.OperatingSystem == OS.Ubuntu) {
|
|
||||||
// icon_name = "process-syncing-idle";
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (state == IconState.SyncingUp)
|
if (state == IconState.SyncingUp)
|
||||||
icon_name = "process-syncing-up";
|
icon_name = "process-syncing-up";
|
||||||
|
@ -82,7 +78,7 @@ namespace SparkleShare {
|
||||||
else if (state == IconState.Error)
|
else if (state == IconState.Error)
|
||||||
icon_name = "process-syncing-error";
|
icon_name = "process-syncing-error";
|
||||||
|
|
||||||
if (InstallationInfo.OperatingSystem == OS.Ubuntu) {
|
if (use_appindicator) {
|
||||||
#if HAVE_APP_INDICATOR
|
#if HAVE_APP_INDICATOR
|
||||||
indicator.IconName = icon_name;
|
indicator.IconName = icon_name;
|
||||||
|
|
||||||
|
@ -129,8 +125,9 @@ namespace SparkleShare {
|
||||||
this.menu = new Menu ();
|
this.menu = new Menu ();
|
||||||
this.state_item = new MenuItem (Controller.StateText) { Sensitive = false };
|
this.state_item = new MenuItem (Controller.StateText) { Sensitive = false };
|
||||||
|
|
||||||
ImageMenuItem folder_item = new SparkleMenuItem ("Projects");
|
ImageMenuItem folder_item = new SparkleMenuItem ("SparkleShare");
|
||||||
folder_item.Image = new Image (UserInterfaceHelpers.GetIcon ("org.sparkleshare.SparkleShare", 16));
|
folder_item.Image = new Image (UserInterfaceHelpers.GetIcon ("org.sparkleshare.SparkleShare", 16));
|
||||||
|
folder_item.Submenu = new Menu ();
|
||||||
|
|
||||||
this.menu.Add (this.state_item);
|
this.menu.Add (this.state_item);
|
||||||
this.menu.Add (new SeparatorMenuItem ());
|
this.menu.Add (new SeparatorMenuItem ());
|
||||||
|
@ -150,6 +147,8 @@ namespace SparkleShare {
|
||||||
this.state_menu_items [i] = new SparkleMenuItem (project.StatusMessage) { Sensitive = false };
|
this.state_menu_items [i] = new SparkleMenuItem (project.StatusMessage) { Sensitive = false };
|
||||||
|
|
||||||
(item.Submenu as Menu).Add (this.state_menu_items [i]);
|
(item.Submenu as Menu).Add (this.state_menu_items [i]);
|
||||||
|
|
||||||
|
if (!use_appindicator)
|
||||||
(item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
(item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
||||||
|
|
||||||
if (project.IsPaused) {
|
if (project.IsPaused) {
|
||||||
|
@ -173,7 +172,9 @@ namespace SparkleShare {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!use_appindicator)
|
||||||
(item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
(item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
||||||
|
|
||||||
resume_item = new MenuItem ("Sync and Resume…");
|
resume_item = new MenuItem ("Sync and Resume…");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -200,14 +201,17 @@ namespace SparkleShare {
|
||||||
|
|
||||||
(item.Child as Label).UseUnderline = false;
|
(item.Child as Label).UseUnderline = false;
|
||||||
item.Image = new Image (folder_icon);
|
item.Image = new Image (folder_icon);
|
||||||
this.menu.Add (item);
|
(folder_item.Submenu as Menu).Add (item);
|
||||||
|
|
||||||
i++;
|
i++;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recent_events_item = new MenuItem ("History…");
|
this.recent_events_item = new MenuItem ("Recent Changes…");
|
||||||
this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled;
|
this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled;
|
||||||
|
(folder_item.Submenu as Menu).Add (this.recent_events_item);
|
||||||
|
|
||||||
|
|
||||||
this.quit_item = new MenuItem ("Quit") { Sensitive = Controller.QuitItemEnabled };
|
this.quit_item = new MenuItem ("Quit") { Sensitive = Controller.QuitItemEnabled };
|
||||||
MenuItem add_item = new MenuItem ("Sync Remote Project…");
|
MenuItem add_item = new MenuItem ("Sync Remote Project…");
|
||||||
|
|
||||||
|
@ -223,7 +227,10 @@ namespace SparkleShare {
|
||||||
copy_item.Activated += delegate { Controller.CopyToClipboardClicked (); };
|
copy_item.Activated += delegate { Controller.CopyToClipboardClicked (); };
|
||||||
|
|
||||||
(link_code_item.Submenu as Menu).Add (code_item);
|
(link_code_item.Submenu as Menu).Add (code_item);
|
||||||
|
|
||||||
|
if (!use_appindicator)
|
||||||
(link_code_item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
(link_code_item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
||||||
|
|
||||||
(link_code_item.Submenu as Menu).Add (copy_item);
|
(link_code_item.Submenu as Menu).Add (copy_item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,21 +241,16 @@ namespace SparkleShare {
|
||||||
this.recent_events_item.Activated += delegate { Controller.RecentEventsClicked (); };
|
this.recent_events_item.Activated += delegate { Controller.RecentEventsClicked (); };
|
||||||
this.quit_item.Activated += delegate { Controller.QuitClicked (); };
|
this.quit_item.Activated += delegate { Controller.QuitClicked (); };
|
||||||
|
|
||||||
folder_item.Submenu = new Menu ();
|
|
||||||
(folder_item.Submenu as Menu).Add (this.recent_events_item);
|
|
||||||
|
|
||||||
(folder_item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
|
||||||
(folder_item.Submenu as Menu).Add (link_code_item);
|
|
||||||
(folder_item.Submenu as Menu).Add (new SeparatorMenuItem ());
|
|
||||||
(folder_item.Submenu as Menu).Add (about_item);
|
|
||||||
|
|
||||||
this.menu.Add (new SeparatorMenuItem ());
|
this.menu.Add (new SeparatorMenuItem ());
|
||||||
this.menu.Add (add_item);
|
this.menu.Add (add_item);
|
||||||
|
this.menu.Add (link_code_item);
|
||||||
|
this.menu.Add (new SeparatorMenuItem ());
|
||||||
|
this.menu.Add (about_item);
|
||||||
this.menu.Add (new SeparatorMenuItem ());
|
this.menu.Add (new SeparatorMenuItem ());
|
||||||
this.menu.Add (this.quit_item);
|
this.menu.Add (this.quit_item);
|
||||||
this.menu.ShowAll ();
|
this.menu.ShowAll ();
|
||||||
|
|
||||||
if (InstallationInfo.OperatingSystem == OS.Ubuntu) {
|
if (use_appindicator) {
|
||||||
#if HAVE_APP_INDICATOR
|
#if HAVE_APP_INDICATOR
|
||||||
indicator.Menu = this.menu;
|
indicator.Menu = this.menu;
|
||||||
#endif
|
#endif
|
||||||
|
@ -279,4 +281,3 @@ namespace SparkleShare {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -132,4 +132,3 @@ namespace SparkleShare
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ namespace Sparkles {
|
||||||
operating_system = OS.Ubuntu;
|
operating_system = OS.Ubuntu;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
operating_system = OS.GNOME;
|
operating_system = OS.Ubuntu;
|
||||||
}
|
}
|
||||||
|
|
||||||
return operating_system;
|
return operating_system;
|
||||||
|
|
Loading…
Reference in a new issue