public void UpdateContent(string html) { string pixmaps_path = IO.Path.Combine(UserInterface.AssetsPath, "pixmaps"); string icons_path = IO.Path.Combine(UserInterface.AssetsPath, "icons", "hicolor", "12x12", "status"); html = html.Replace("<!-- $a-hover-color -->", "#009ff8"); html = html.Replace("<!-- $a-color -->", "#0085cf"); html = html.Replace("<!-- $body-font-family -->", StyleContext.GetFont(StateFlags.Normal).Family); html = html.Replace("<!-- $body-font-size -->", (double)(StyleContext.GetFont(StateFlags.Normal).Size / 1024 + 3) + "px"); html = html.Replace("<!-- $body-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Normal))); html = html.Replace("<!-- $body-background-color -->", UserInterfaceHelpers.RGBAToHex(new TreeView().StyleContext.GetBackgroundColor(StateFlags.Normal))); html = html.Replace("<!-- $day-entry-header-font-size -->", (StyleContext.GetFont(StateFlags.Normal).Size / 1024 + 3) + "px"); html = html.Replace("<!-- $day-entry-header-background-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetBackgroundColor(StateFlags.Normal))); html = html.Replace("<!-- $secondary-font-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Insensitive))); html = html.Replace("<!-- $small-color -->", UserInterfaceHelpers.RGBAToHex(StyleContext.GetColor(StateFlags.Insensitive))); html = html.Replace("<!-- $small-font-size -->", "90%"); html = html.Replace("<!-- $pixmaps-path -->", pixmaps_path); html = html.Replace("<!-- $document-added-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-added.png")); html = html.Replace("<!-- $document-edited-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-edited.png")); html = html.Replace("<!-- $document-deleted-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-deleted.png")); html = html.Replace("<!-- $document-moved-background-image -->", "file://" + IO.Path.Combine(icons_path, "document-moved.png")); this.spinner.Stop(); this.scrolled_window.Remove(this.scrolled_window.Child); this.web_view.LoadHtml(html, "file:///"); this.scrolled_window.Add(this.web_view); this.content_wrapper.Remove(this.content_wrapper.Child); this.content_wrapper.Add(this.scrolled_window); this.scrolled_window.ShowAll(); }
public UserInterface() { string gtk_version = string.Format("{0}.{1}.{2}", Global.MajorVersion, Global.MinorVersion, Global.MicroVersion); Logger.LogInfo("Environment", "GTK+ " + gtk_version); application = new Application("org.sparkleshare.SparkleShare", GLib.ApplicationFlags.None); application.Register(null); application.Activated += ApplicationActivatedDelegate; IconTheme.Default.AppendSearchPath(Path.Combine(UserInterface.AssetsPath, "icons")); var label = new Label(); Gdk.Color color = UserInterfaceHelpers.RGBAToColor(label.StyleContext.GetColor(StateFlags.Insensitive)); SecondaryTextColor = UserInterfaceHelpers.ColorToHex(color); var tree_view = new TreeView(); color = UserInterfaceHelpers.MixColors( UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetColor(StateFlags.Selected)), UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetBackgroundColor(StateFlags.Selected)), 0.39); SecondaryTextColorSelected = UserInterfaceHelpers.ColorToHex(color); }
public About() { Title = "About SparkleShare"; ResizeMode = ResizeMode.NoResize; Height = 288; Width = 720; Icon = UserInterfaceHelpers.GetImageSource("sparkleshare-app", "ico"); WindowStartupLocation = WindowStartupLocation.CenterScreen; Closing += Close; CreateAbout(); Controller.ShowWindowEvent += delegate { Dispatcher.BeginInvoke((Action) delegate { Show(); Activate(); BringIntoView(); }); }; Controller.HideWindowEvent += delegate { Dispatcher.BeginInvoke((Action) delegate { Hide(); }); }; Controller.UpdateLabelEvent += delegate(string text) { Dispatcher.BeginInvoke((Action) delegate { this.updates.Content = text; this.updates.UpdateLayout(); }); }; }
public Spinner(int size) : base() { if (DesignerProperties.GetIsInDesignMode(this)) { return; } Width = size; Height = size; int current_frame = 0; BitmapSource spinner_gallery = UserInterfaceHelpers.GetImageSource("process-working-22"); int frames_in_width = spinner_gallery.PixelWidth / size; int frames_in_height = spinner_gallery.PixelHeight / size; int frame_count = (frames_in_width * frames_in_height) - 1; Image [] frames = new Image [frame_count]; int i = 0; for (int y = 0; y < frames_in_height; y++) { for (int x = 0; x < frames_in_width; x++) { if (!(y == 0 && x == 0)) { CroppedBitmap crop = new CroppedBitmap(spinner_gallery, new Int32Rect(size * x, size * y, size, size)); frames [i] = new Image(); frames [i].Source = crop; i++; } } } this.timer = new Timer() { Interval = 400 / frame_count }; this.timer.Elapsed += delegate { Dispatcher.BeginInvoke((Action) delegate { if (current_frame < frame_count - 1) { current_frame++; } else { current_frame = 0; } Source = frames [current_frame].Source; }); }; }
void DetectTextColors() { Gdk.Color text_color = UserInterfaceHelpers.RGBAToColor(new Label().StyleContext.GetColor(StateFlags.Insensitive)); var tree_view_style = new TreeView().StyleContext; Gdk.Color text_color_selected = UserInterfaceHelpers.MixColors( UserInterfaceHelpers.RGBAToColor(tree_view_style.GetColor(StateFlags.Selected)), UserInterfaceHelpers.RGBAToColor(tree_view_style.GetBackgroundColor(StateFlags.Selected)), 0.2); SecondaryTextColor = UserInterfaceHelpers.ColorToHex(text_color); SecondaryTextColorSelected = UserInterfaceHelpers.ColorToHex(text_color_selected); }
public Note() { InitializeComponent(); Background = new SolidColorBrush(Color.FromRgb(240, 240, 240)); AllowsTransparency = false; Icon = UserInterfaceHelpers.GetImageSource("sparkleshare-app", "ico"); WindowStartupLocation = WindowStartupLocation.CenterScreen; Closing += this.OnClosing; Controller.ShowWindowEvent += delegate { Dispatcher.BeginInvoke((Action)(() => { Show(); Activate(); CreateNote(); BringIntoView(); })); }; Controller.HideWindowEvent += delegate { Dispatcher.BeginInvoke((Action)(() => { Hide(); this.balloon_text_field.Clear(); })); }; this.cancel_button.Click += delegate { Dispatcher.BeginInvoke((Action)(() => { Controller.CancelClicked(); })); }; this.sync_button.Click += delegate { Dispatcher.BeginInvoke((Action)(() => { string note = this.balloon_text_field.Text; if (note.Equals(default_text, StringComparison.InvariantCultureIgnoreCase)) { note = String.Empty; } Controller.SyncClicked(note); })); }; this.balloon_text_field.GotFocus += OnTextBoxGotFocus; this.balloon_text_field.LostFocus += OnTextBoxLostFocus; CreateNote(); }
private void CreateNote() { ImageSource avatar = UserInterfaceHelpers.GetImageSource("user-icon-default"); if (File.Exists(Controller.AvatarFilePath)) { avatar = UserInterfaceHelpers.GetImage(Controller.AvatarFilePath); } this.user_image.ImageSource = avatar; this.Title = Controller.CurrentProject ?? "Add Note"; this.user_name_text_block.Text = SparkleShare.Controller.CurrentUser.Name; this.user_email_text_field.Text = SparkleShare.Controller.CurrentUser.Email; this.balloon_text_field.Text = default_text; ElementHost.EnableModelessKeyboardInterop(this); }
public UserInterface() { application = new Application("org.sparkleshare.SparkleShare", GLib.ApplicationFlags.None); application.Register(null); application.Activated += ApplicationActivatedDelegate; Gdk.Color color = UserInterfaceHelpers.RGBAToColor(new Label().StyleContext.GetColor(StateFlags.Insensitive)); SecondaryTextColor = UserInterfaceHelpers.ColorToHex(color); var tree_view = new TreeView(); color = UserInterfaceHelpers.MixColors( UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetColor(StateFlags.Selected)), UserInterfaceHelpers.RGBAToColor(tree_view.StyleContext.GetBackgroundColor(StateFlags.Selected)), 0.39); SecondaryTextColorSelected = UserInterfaceHelpers.ColorToHex(color); }
private void WriteOutImages() { string tmp_path = Sparkles.Configuration.DefaultConfiguration.TmpPath; string pixmaps_path = System.IO.Path.Combine(tmp_path, "Images"); if (!Directory.Exists(pixmaps_path)) { Directory.CreateDirectory(pixmaps_path); File.SetAttributes(tmp_path, File.GetAttributes(tmp_path) | FileAttributes.Hidden); } BitmapSource image = UserInterfaceHelpers.GetImageSource("user-icon-default"); string file_path = System.IO.Path.Combine(pixmaps_path, "user-icon-default.png"); using (FileStream stream = new FileStream(file_path, FileMode.Create)) { BitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(image)); encoder.Save(stream); } string[] actions = new string[] { "added", "deleted", "edited", "moved" }; foreach (string action in actions) { image = UserInterfaceHelpers.GetImageSource("document-" + action + "-12"); file_path = System.IO.Path.Combine(pixmaps_path, "document-" + action + "-12.png"); using (FileStream stream = new FileStream(file_path, FileMode.Create)) { BitmapEncoder encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(image)); encoder.Save(stream); } } }
public void ShowPage(PageType type, string [] warnings) { if (type == PageType.Setup) { Header = "Welcome to SparkleShare!"; Description = "First off, what’s your name and email?\n(visible only to team members)"; Table table = new Table(2, 3, true) { RowSpacing = 6, ColumnSpacing = 6 }; Label name_label = new Label("<b>" + "Your Name:" + "</b>") { UseMarkup = true, Xalign = 1 }; Entry name_entry = new Entry() { Xalign = 0, ActivatesDefault = true }; try { UnixUserInfo user_info = UnixUserInfo.GetRealUser(); if (user_info != null && user_info.RealName != null) { // Some systems append a series of "," for some reason, TODO: Report upstream name_entry.Text = user_info.RealName.TrimEnd(",".ToCharArray()); } } catch (ArgumentException) { // No username, not a big deal } Entry email_entry = new Entry() { Xalign = 0, ActivatesDefault = true }; Label email_label = new Label("<b>" + "Email:" + "</b>") { UseMarkup = true, Xalign = 1 }; table.Attach(name_label, 0, 1, 0, 1); table.Attach(name_entry, 1, 2, 0, 1); table.Attach(email_label, 0, 1, 1, 2); table.Attach(email_entry, 1, 2, 1, 2); VBox wrapper = new VBox(false, 9); wrapper.PackStart(table, true, false, 0); Button cancel_button = new Button("Cancel"); Button continue_button = new Button("Continue") { Sensitive = false }; Controller.UpdateSetupContinueButtonEvent += delegate(bool button_enabled) { Application.Invoke(delegate { continue_button.Sensitive = button_enabled; }); }; name_entry.Changed += delegate { Controller.CheckSetupPage(name_entry.Text, email_entry.Text); }; email_entry.Changed += delegate { Controller.CheckSetupPage(name_entry.Text, email_entry.Text); }; cancel_button.Clicked += delegate { Controller.SetupPageCancelled(); }; continue_button.Clicked += delegate { Controller.SetupPageCompleted(name_entry.Text, email_entry.Text); }; AddButton(cancel_button); AddButton(continue_button); Add(wrapper); Controller.CheckSetupPage(name_entry.Text, email_entry.Text); if (name_entry.Text.Equals("")) { name_entry.GrabFocus(); } else { email_entry.GrabFocus(); } } if (type == PageType.Add) { Header = "Where’s your project hosted?"; VBox layout_vertical = new VBox(false, 16); HBox layout_fields = new HBox(true, 32); VBox layout_address = new VBox(true, 0); VBox layout_path = new VBox(true, 0); ListStore store = new ListStore(typeof(string), typeof(Gdk.Pixbuf), typeof(string), typeof(Preset)); SparkleTreeView tree_view = new SparkleTreeView(store) { HeadersVisible = false, SearchColumn = -1, EnableSearch = false }; ScrolledWindow scrolled_window = new ScrolledWindow() { ShadowType = ShadowType.In }; scrolled_window.SetPolicy(PolicyType.Never, PolicyType.Automatic); // Padding column tree_view.AppendColumn("Padding", new Gtk.CellRendererText(), "text", 0); tree_view.Columns [0].Cells [0].Xpad = 4; // Icon column tree_view.AppendColumn("Icon", new Gtk.CellRendererPixbuf(), "pixbuf", 1); tree_view.Columns [1].Cells [0].Xpad = 4; // Service column TreeViewColumn service_column = new TreeViewColumn() { Title = "Service" }; CellRendererText service_cell = new CellRendererText() { Ypad = 8 }; service_column.PackStart(service_cell, true); service_column.SetCellDataFunc(service_cell, new TreeCellDataFunc(RenderServiceColumn)); foreach (Preset preset in Controller.Presets) { store.AppendValues("", new Gdk.Pixbuf(preset.ImagePath), "<span size=\"small\"><b>" + preset.Name + "</b>\n" + "<span fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + preset.Description + "</span>" + "</span>", preset); } tree_view.AppendColumn(service_column); scrolled_window.Add(tree_view); Entry address_entry = new Entry() { Text = Controller.PreviousAddress, Sensitive = (Controller.SelectedPreset.Address == null), ActivatesDefault = true }; Entry path_entry = new Entry() { Text = Controller.PreviousPath, Sensitive = (Controller.SelectedPreset.Path == null), ActivatesDefault = true }; tree_view.ButtonReleaseEvent += delegate { path_entry.GrabFocus(); }; Label address_example = new Label() { Xalign = 0, UseMarkup = true, Markup = "<span size=\"small\" fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.AddressExample + "</span>" }; Label path_example = new Label() { Xalign = 0, UseMarkup = true, Markup = "<span size=\"small\" fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + Controller.SelectedPreset.PathExample + "</span>" }; TreeSelection default_selection = tree_view.Selection; TreePath default_path = new TreePath("" + Controller.SelectedPresetIndex); default_selection.SelectPath(default_path); tree_view.Model.Foreach(new TreeModelForeachFunc( delegate(ITreeModel model, TreePath path, TreeIter iter) { string address; try { address = (model.GetValue(iter, 2) as Preset).Address; } catch (NullReferenceException) { address = ""; } if (!string.IsNullOrEmpty(address) && address.Equals(Controller.PreviousAddress)) { tree_view.SetCursor(path, service_column, false); Preset preset = (Preset)model.GetValue(iter, 2); if (preset.Address != null) { address_entry.Sensitive = false; } if (preset.Path != null) { path_entry.Sensitive = false; } return(true); } else { return(false); } } )); layout_address.PackStart(new Label() { Markup = "<b>" + "Address" + "</b>", Xalign = 0 }, true, true, 0); layout_address.PackStart(address_entry, false, false, 0); layout_address.PackStart(address_example, false, false, 0); path_entry.Changed += delegate { Controller.CheckAddPage(address_entry.Text, path_entry.Text, tree_view.SelectedRow); }; layout_path.PackStart(new Label() { Markup = "<b>" + "Remote Path" + "</b>", Xalign = 0 }, true, true, 0); layout_path.PackStart(path_entry, false, false, 0); layout_path.PackStart(path_example, false, false, 0); layout_fields.PackStart(layout_address, true, true, 0); layout_fields.PackStart(layout_path, true, true, 0); layout_vertical.PackStart(scrolled_window, true, true, 0); layout_vertical.PackStart(layout_fields, false, false, 0); tree_view.ScrollToCell(new TreePath("" + Controller.SelectedPresetIndex), null, true, 0, 0); Add(layout_vertical); if (string.IsNullOrEmpty(path_entry.Text)) { address_entry.GrabFocus(); address_entry.Position = -1; } else { path_entry.GrabFocus(); path_entry.Position = -1; } Button cancel_button = new Button("Cancel"); Button add_button = new Button("Add") { Sensitive = false }; Controller.ChangeAddressFieldEvent += delegate(string text, string example_text, FieldState state) { Application.Invoke(delegate { address_entry.Text = text; address_entry.Sensitive = (state == FieldState.Enabled); address_example.Markup = "<span size=\"small\" fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + example_text + "</span>"; }); }; Controller.ChangePathFieldEvent += delegate(string text, string example_text, FieldState state) { Application.Invoke(delegate { path_entry.Text = text; path_entry.Sensitive = (state == FieldState.Enabled); path_example.Markup = "<span size=\"small\" fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + example_text + "</span>"; }); }; Controller.UpdateAddProjectButtonEvent += delegate(bool button_enabled) { Application.Invoke(delegate { add_button.Sensitive = button_enabled; }); }; tree_view.CursorChanged += delegate(object sender, EventArgs e) { Controller.SelectedPresetChanged(tree_view.SelectedRow); }; address_entry.Changed += delegate { Controller.CheckAddPage(address_entry.Text, path_entry.Text, tree_view.SelectedRow); }; cancel_button.Clicked += delegate { Controller.PageCancelled(); }; add_button.Clicked += delegate { Controller.AddPageCompleted(address_entry.Text, path_entry.Text); }; CheckButton check_button = new CheckButton("Fetch prior revisions") { Active = false }; check_button.Toggled += delegate { Controller.HistoryItemChanged(check_button.Active); }; AddOption(check_button); AddButton(cancel_button); AddButton(add_button); Controller.HistoryItemChanged(check_button.Active); Controller.CheckAddPage(address_entry.Text, path_entry.Text, 1); } if (type == PageType.Invite) { Header = "You’ve received an invite!"; Description = "Do you want to add this project to SparkleShare?"; Table table = new Table(2, 3, true) { RowSpacing = 6, ColumnSpacing = 6 }; Label address_label = new Label("Address:") { Xalign = 1 }; Label path_label = new Label("Remote Path:") { Xalign = 1 }; Label address_value = new Label("<b>" + Controller.PendingInvite.Address + "</b>") { UseMarkup = true, Xalign = 0 }; Label path_value = new Label("<b>" + Controller.PendingInvite.RemotePath + "</b>") { UseMarkup = true, Xalign = 0 }; table.Attach(address_label, 0, 1, 0, 1); table.Attach(address_value, 1, 2, 0, 1); table.Attach(path_label, 0, 1, 1, 2); table.Attach(path_value, 1, 2, 1, 2); VBox wrapper = new VBox(false, 9); wrapper.PackStart(table, true, false, 0); Button cancel_button = new Button("Cancel"); Button add_button = new Button("Add"); cancel_button.Clicked += delegate { Controller.PageCancelled(); }; add_button.Clicked += delegate { Controller.InvitePageCompleted(); }; AddButton(cancel_button); AddButton(add_button); Add(wrapper); } if (type == PageType.Syncing) { Header = String.Format("Adding project ‘{0}’…", Controller.SyncingFolder); Description = "This may take a while for large projects.\nIsn’t it coffee-o’clock?"; ProgressBar progress_bar = new ProgressBar(); progress_bar.Fraction = Controller.ProgressBarPercentage / 100; Button cancel_button = new Button() { Label = "Cancel" }; Button finish_button = new Button("Finish") { Sensitive = false }; Label progress_label = new Label("Preparing to fetch files…") { Justify = Justification.Right, Xalign = 1 }; Controller.UpdateProgressBarEvent += delegate(double percentage, string speed) { Application.Invoke(delegate { progress_bar.Fraction = percentage / 100; progress_label.Text = speed; }); }; cancel_button.Clicked += delegate { Controller.SyncingCancelled(); }; VBox bar_wrapper = new VBox(false, 0); bar_wrapper.PackStart(progress_bar, false, false, 21); bar_wrapper.PackStart(progress_label, false, true, 0); Add(bar_wrapper); AddButton(cancel_button); AddButton(finish_button); } if (type == PageType.Error) { Header = "Oops! Something went wrong" + "…"; VBox points = new VBox(false, 0); Image list_point_one = new Image(UserInterfaceHelpers.GetIcon("list-point", 16)); Image list_point_two = new Image(UserInterfaceHelpers.GetIcon("list-point", 16)); Image list_point_three = new Image(UserInterfaceHelpers.GetIcon("list-point", 16)); Label label_one = new Label() { Markup = "<b>" + Controller.PreviousUrl + "</b> is the address we’ve compiled. " + "Does this look alright?", Wrap = true, Xalign = 0 }; Label label_two = new Label() { Text = "Is this computer’s Client ID known by the host?", Wrap = true, Xalign = 0 }; points.PackStart(new Label("Please check the following:") { Xalign = 0 }, false, false, 6); HBox point_one = new HBox(false, 0); point_one.PackStart(list_point_one, false, false, 0); point_one.PackStart(label_one, true, true, 12); points.PackStart(point_one, false, false, 12); HBox point_two = new HBox(false, 0); point_two.PackStart(list_point_two, false, false, 0); point_two.PackStart(label_two, true, true, 12); points.PackStart(point_two, false, false, 12); if (warnings.Length > 0) { string warnings_markup = ""; foreach (string warning in warnings) { warnings_markup += "\n<b>" + warning + "</b>"; } Label label_three = new Label() { Markup = "Here’s the raw error message:" + warnings_markup, Wrap = true, Xalign = 0 }; HBox point_three = new HBox(false, 0); point_three.PackStart(list_point_three, false, false, 0); point_three.PackStart(label_three, true, true, 12); points.PackStart(point_three, false, false, 12); } points.PackStart(new Label(""), true, true, 0); Button cancel_button = new Button("Cancel"); Button try_again_button = new Button("Retry") { Sensitive = true }; cancel_button.Clicked += delegate { Controller.PageCancelled(); }; try_again_button.Clicked += delegate { Controller.ErrorPageCompleted(); }; AddButton(cancel_button); AddButton(try_again_button); Add(points); } if (type == PageType.StorageSetup) { Header = string.Format("Storage type for ‘{0}’", Controller.SyncingFolder); Description = "What type of storage would you like to use?"; VBox layout_vertical = new VBox(false, 0); VBox layout_radio_buttons = new VBox(false, 0) { BorderWidth = 12 }; foreach (StorageTypeInfo storage_type in SparkleShare.Controller.FetcherAvailableStorageTypes) { RadioButton radio_button = new RadioButton(null, storage_type.Name + "\n" + storage_type.Description); (radio_button.Child as Label).Markup = string.Format( "<b>{0}</b>\n<span fgcolor=\"{1}\">{2}</span>", storage_type.Name, SparkleShare.UI.SecondaryTextColor, storage_type.Description); (radio_button.Child as Label).Xpad = 9; layout_radio_buttons.PackStart(radio_button, false, false, 9); radio_button.Group = (layout_radio_buttons.Children [0] as RadioButton).Group; } layout_vertical.PackStart(new Label(""), true, true, 0); layout_vertical.PackStart(layout_radio_buttons, false, false, 0); layout_vertical.PackStart(new Label(""), true, true, 0); Add(layout_vertical); Button cancel_button = new Button("Cancel"); Button continue_button = new Button("Continue"); continue_button.Clicked += delegate { int checkbox_index = 0; foreach (RadioButton radio_button in layout_radio_buttons.Children) { if (radio_button.Active) { StorageTypeInfo selected_storage_type = SparkleShare.Controller.FetcherAvailableStorageTypes [checkbox_index]; Controller.StoragePageCompleted(selected_storage_type.Type); return; } checkbox_index++; } }; cancel_button.Clicked += delegate { Controller.SyncingCancelled(); }; AddButton(cancel_button); AddButton(continue_button); } if (type == PageType.CryptoSetup || type == PageType.CryptoPassword) { if (type == PageType.CryptoSetup) { Header = string.Format("Encryption password for ‘{0}’", Controller.SyncingFolder); Description = "Please a provide a strong password that you don’t use elsewhere."; } else { Header = string.Format("‘{0}’ contains encrypted files", Controller.SyncingFolder); Description = "Please enter the password to see their contents."; } Label password_label = new Label("<b>" + "Password" + "</b>") { UseMarkup = true, Xalign = 1 }; Entry password_entry = new Entry() { Xalign = 0, Visibility = false, ActivatesDefault = true }; CheckButton show_password_check_button = new CheckButton("Make visible") { Active = false, Xalign = 0, }; Table table = new Table(2, 3, true) { RowSpacing = 6, ColumnSpacing = 6 }; table.Attach(password_label, 0, 1, 0, 1); table.Attach(password_entry, 1, 2, 0, 1); table.Attach(show_password_check_button, 1, 2, 1, 2); VBox wrapper = new VBox(false, 9); wrapper.PackStart(table, true, false, 0); Image warning_image = new Image( UserInterfaceHelpers.GetIcon("dialog-information", 24)); Label warning_label = new Label() { Xalign = 0, Wrap = true, Text = "This password can’t be changed later, and your files can’t be recovered if it’s forgotten." }; HBox warning_layout = new HBox(false, 0); warning_layout.PackStart(warning_image, false, false, 15); warning_layout.PackStart(warning_label, true, true, 0); VBox warning_wrapper = new VBox(false, 0); warning_wrapper.PackStart(warning_layout, false, false, 15); if (type == PageType.CryptoSetup) { wrapper.PackStart(warning_wrapper, false, false, 0); } Button cancel_button = new Button("Cancel"); Button continue_button = new Button("Continue") { Sensitive = false }; Controller.UpdateCryptoSetupContinueButtonEvent += delegate(bool button_enabled) { Application.Invoke(delegate { continue_button.Sensitive = button_enabled; }); }; Controller.UpdateCryptoPasswordContinueButtonEvent += delegate(bool button_enabled) { Application.Invoke(delegate { continue_button.Sensitive = button_enabled; }); }; show_password_check_button.Toggled += delegate { password_entry.Visibility = !password_entry.Visibility; }; password_entry.Changed += delegate { if (type == PageType.CryptoSetup) { Controller.CheckCryptoSetupPage(password_entry.Text); } else { Controller.CheckCryptoPasswordPage(password_entry.Text); } }; cancel_button.Clicked += delegate { Controller.CryptoPageCancelled(); }; continue_button.Clicked += delegate { if (type == PageType.CryptoSetup) { Controller.CryptoSetupPageCompleted(password_entry.Text); } else { Controller.CryptoPasswordPageCompleted(password_entry.Text); } }; Add(wrapper); AddButton(cancel_button); AddButton(continue_button); password_entry.GrabFocus(); } if (type == PageType.Finished) { Header = "Your shared project is ready!"; Description = "You can find the files in your SparkleShare folder."; UrgencyHint = true; Button show_files_button = new Button("Show Files"); Button finish_button = new Button("Finish"); show_files_button.Clicked += delegate { Controller.ShowFilesClicked(); }; finish_button.Clicked += delegate { Controller.FinishPageCompleted(); }; if (warnings.Length > 0) { Image warning_image = new Image(UserInterfaceHelpers.GetIcon("dialog-information", 24)); Label warning_label = new Label(warnings [0]) { Xalign = 0, Wrap = true }; HBox warning_layout = new HBox(false, 0); warning_layout.PackStart(warning_image, false, false, 15); warning_layout.PackStart(warning_label, true, true, 0); VBox warning_wrapper = new VBox(false, 0); warning_wrapper.PackStart(warning_layout, false, false, 0); Add(warning_wrapper); } else { Add(null); } AddButton(show_files_button); AddButton(finish_button); } }
public SetupWindow() { Title = "SparkleShare Setup"; Width = 640; Height = 440; ResizeMode = ResizeMode.NoResize; Background = new SolidColorBrush(Colors.WhiteSmoke); Icon = UserInterfaceHelpers.GetImageSource("sparkleshare-app", "ico"); TaskbarItemInfo = new TaskbarItemInfo() { Description = "SparkleShare" }; WindowStartupLocation = WindowStartupLocation.CenterScreen; Content = ContentCanvas; // Remove the close button Closing += Close; SourceInitialized += delegate { const int gwl_style = -16; const int ws_sysmenu = 0x00080000; WindowInteropHelper helper = new WindowInteropHelper(this); int style = GetWindowLong(helper.Handle, gwl_style); SetWindowLong(helper.Handle, gwl_style, style & ~ws_sysmenu); }; this.bar = new Rectangle() { Width = Width, Height = 40, Fill = new SolidColorBrush(Color.FromRgb(240, 240, 240)) }; this.line = new Rectangle() { Width = Width, Height = 1, Fill = new SolidColorBrush(Color.FromRgb(223, 223, 223)) }; this.side_splash = new Image() { Width = 150, Height = 482 }; this.side_splash.Source = UserInterfaceHelpers.GetImageSource("side-splash"); ContentCanvas.Children.Add(this.bar); Canvas.SetRight(bar, 0); Canvas.SetBottom(bar, 0); ContentCanvas.Children.Add(this.line); Canvas.SetRight(this.line, 0); Canvas.SetBottom(this.line, 40); ContentCanvas.Children.Add(this.side_splash); Canvas.SetLeft(this.side_splash, 0); Canvas.SetBottom(this.side_splash, 0); }
void CreateAbout() { CssProvider window_css_provider = new CssProvider(); Image image = UserInterfaceHelpers.GetImage("about.png"); window_css_provider.LoadFromData("window, GtkWindow {" + " background-image: url(\"/app/share/sparkleshare/pixmaps/about.png\");" + " background-repeat: no-repeat;" + " background-position: left bottom;" + "}"); StyleContext.AddProvider(window_css_provider, 800); var layout_vertical = new VBox(false, 0); var links_layout = new HBox(false, 16); CssProvider label_css_provider = new CssProvider(); label_css_provider.LoadFromData("label { color: #fff; font-size: 14pt; background-color: rgba(0, 0, 0, 0); }"); CssProvider label_highlight_css_provider = new CssProvider(); label_highlight_css_provider.LoadFromData("label { color: #a8bbcf; font-size: 12pt; }"); var version = new Label { Text = "version " + Controller.RunningVersion, Xalign = 0, Xpad = 0 }; if (InstallationInfo.Directory.StartsWith("/app", StringComparison.InvariantCulture)) { version.Text += " (Flatpak)"; } updates = new Label("Checking for updates…") { Xalign = 0, Xpad = 0 }; var copyright = new Label { Markup = string.Format("Copyright © 2010–{0} Hylke Bons and others", DateTime.Now.Year), Xalign = 0, Xpad = 0 }; var license = new Label("SparkleShare is Open Source and you’re free to use,\n" + "change, and share it under the GNU GPLv3") { Xalign = 0, Xpad = 0 }; license.StyleContext.AddProvider(label_css_provider, 800); updates.StyleContext.AddProvider(label_highlight_css_provider, 800); version.StyleContext.AddProvider(label_css_provider, 800); copyright.StyleContext.AddProvider(label_css_provider, 800); var website_link = new Link("Website", Controller.WebsiteLinkAddress); var credits_link = new Link("Credits", Controller.CreditsLinkAddress); var report_problem_link = new Link("Report a problem", Controller.ReportProblemLinkAddress); var debug_log_link = new Link("Debug log", Controller.DebugLogLinkAddress); layout_vertical.PackStart(new Label(""), true, true, 0); layout_vertical.PackStart(version, false, false, 0); layout_vertical.PackStart(updates, false, false, 0); layout_vertical.PackStart(copyright, false, false, 6); layout_vertical.PackStart(license, false, false, 6); layout_vertical.PackStart(links_layout, false, false, 16); links_layout.PackStart(website_link, false, false, 0); links_layout.PackStart(credits_link, false, false, 0); links_layout.PackStart(report_problem_link, false, false, 0); links_layout.PackStart(debug_log_link, false, false, 0); var layout_horizontal = new HBox(false, 0); layout_horizontal.PackStart(new Label(""), false, false, 149); layout_horizontal.PackStart(layout_vertical, false, false, 0); Add(layout_horizontal); }
public void CreateMenu() { this.context_menu = new ContextMenu(); this.state_item = new SparkleMenuItem { Header = Controller.StateText, IsEnabled = false }; Image folder_image = new Image { Source = UserInterfaceHelpers.GetImageSource("sparkleshare-folder"), Width = 16, Height = 16 }; SparkleMenuItem folder_item = new SparkleMenuItem { Header = "SparkleShare", Icon = folder_image }; SparkleMenuItem add_item = new SparkleMenuItem { Header = "Add hosted project…" }; this.log_item = new SparkleMenuItem { Header = "Recent changes…", IsEnabled = Controller.RecentEventsItemEnabled }; SparkleMenuItem link_code_item = new SparkleMenuItem { Header = "Client ID" }; if (Controller.LinkCodeItemEnabled) { SparkleMenuItem code_item = new SparkleMenuItem { Header = SparkleShare.Controller.UserAuthenticationInfo.PublicKey.Substring(0, 20) + "..." }; SparkleMenuItem copy_item = new SparkleMenuItem { Header = "Copy to Clipboard" }; copy_item.Click += delegate { Controller.CopyToClipboardClicked(); }; link_code_item.Items.Add(code_item); link_code_item.Items.Add(new Separator()); link_code_item.Items.Add(copy_item); } CheckBox notify_check_box = new CheckBox { Margin = new Thickness(6, 0, 0, 0), IsChecked = SparkleShare.Controller.NotificationsEnabled }; SparkleMenuItem notify_item = new SparkleMenuItem { Header = "Notifications", Icon = notify_check_box }; SparkleMenuItem about_item = new SparkleMenuItem { Header = "About SparkleShare" }; this.exit_item = new SparkleMenuItem { Header = "Exit" }; add_item.Click += delegate { Controller.AddHostedProjectClicked(); }; this.log_item.Click += delegate { Controller.RecentEventsClicked(); }; about_item.Click += delegate { Controller.AboutClicked(); }; notify_check_box.Click += delegate { this.context_menu.IsOpen = false; SparkleShare.Controller.ToggleNotifications(); notify_check_box.IsChecked = SparkleShare.Controller.NotificationsEnabled; }; notify_item.Click += delegate { SparkleShare.Controller.ToggleNotifications(); notify_check_box.IsChecked = SparkleShare.Controller.NotificationsEnabled; }; this.exit_item.Click += delegate { this.notify_icon.Dispose(); Controller.QuitClicked(); }; this.context_menu.Items.Add(this.state_item); this.context_menu.Items.Add(new Separator()); this.context_menu.Items.Add(folder_item); state_menu_items = new SparkleMenuItem[Controller.Projects.Length]; if (Controller.Projects.Length > 0) { int i = 0; foreach (ProjectInfo project in Controller.Projects) { SparkleMenuItem subfolder_item = new SparkleMenuItem { Header = project.Name.Replace("_", "__"), Icon = new Image { Source = UserInterfaceHelpers.GetImageSource("folder"), Width = 16, Height = 16 } }; state_menu_items[i] = new SparkleMenuItem { Header = project.StatusMessage, IsEnabled = false }; subfolder_item.Items.Add(state_menu_items[i]); subfolder_item.Items.Add(new Separator()); SparkleMenuItem open_item = new SparkleMenuItem { Header = "Open folder", Icon = new Image { Source = UserInterfaceHelpers.GetImageSource("folder"), Width = 16, Height = 16 } }; open_item.Click += new RoutedEventHandler(Controller.OpenFolderDelegate(project.Name)); subfolder_item.Items.Add(open_item); subfolder_item.Items.Add(new Separator()); if (project.IsPaused) { SparkleMenuItem resume_item; if (project.UnsyncedChangesInfo.Count > 0) { foreach (KeyValuePair <string, string> pair in project.UnsyncedChangesInfo) { subfolder_item.Items.Add(new SparkleMenuItem { Header = pair.Key, // TODO image IsEnabled = false }); } if (!string.IsNullOrEmpty(project.MoreUnsyncedChanges)) { subfolder_item.Items.Add(new SparkleMenuItem { Header = project.MoreUnsyncedChanges, IsEnabled = false }); } subfolder_item.Items.Add(new Separator()); resume_item = new SparkleMenuItem { Header = "Sync and Resume…" }; } else { resume_item = new SparkleMenuItem { Header = "Resume" }; } resume_item.Click += (sender, e) => Controller.ResumeDelegate(project.Name)(sender, e); subfolder_item.Items.Add(resume_item); } else { if (Controller.Projects[i].HasError) { subfolder_item.Icon = new Image { Source = Imaging.CreateBitmapSourceFromHIcon( Drawing.SystemIcons.Exclamation.Handle, Int32Rect.Empty, BitmapSizeOptions.FromWidthAndHeight(16, 16)) }; SparkleMenuItem try_again_item = new SparkleMenuItem { Header = "Retry Sync" }; try_again_item.Click += (sender, e) => Controller.TryAgainDelegate(project.Name)(sender, e); subfolder_item.Items.Add(try_again_item); } else { SparkleMenuItem pause_item = new SparkleMenuItem { Header = "Pause" }; pause_item.Click += (sender, e) => Controller.PauseDelegate(project.Name)(sender, e); subfolder_item.Items.Add(pause_item); } } this.context_menu.Items.Add(subfolder_item); i++; } ; } folder_item.Items.Add(this.log_item); folder_item.Items.Add(add_item); folder_item.Items.Add(new Separator()); folder_item.Items.Add(notify_item); folder_item.Items.Add(new Separator()); folder_item.Items.Add(link_code_item); folder_item.Items.Add(new Separator()); folder_item.Items.Add(about_item); this.context_menu.Items.Add(new Separator()); this.context_menu.Items.Add(this.exit_item); this.notify_icon.ContextMenu = this.context_menu; }
public void CreateMenu() { this.menu = new Menu(); this.state_item = new MenuItem(Controller.StateText) { Sensitive = false }; ImageMenuItem folder_item = new SparkleMenuItem("SparkleShare"); folder_item.Image = new Image(UserInterfaceHelpers.GetIcon("org.sparkleshare.SparkleShare", 16)); this.menu.Add(this.state_item); this.menu.Add(new SeparatorMenuItem()); this.menu.Add(folder_item); this.state_menu_items = new SparkleMenuItem [Controller.Projects.Length]; if (Controller.Projects.Length > 0) { int i = 0; foreach (ProjectInfo project in Controller.Projects) { SparkleMenuItem item = new SparkleMenuItem(project.Name); Gdk.Pixbuf folder_icon = UserInterfaceHelpers.GetIcon("folder", 16); item.Submenu = new Menu(); 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(new SeparatorMenuItem()); if (project.IsPaused) { MenuItem resume_item; if (project.UnsyncedChangesInfo.Count > 0) { string icons_path = Path.Combine(UserInterface.AssetsPath, "icons", "hicolor", "12x12", "status"); foreach (KeyValuePair <string, string> pair in project.UnsyncedChangesInfo) { string icon_path = Path.Combine(icons_path, pair.Value.Replace("-12", "")); (item.Submenu as Menu).Add(new SparkleMenuItem(pair.Key) { Image = new Image(icon_path), Sensitive = false }); } if (!string.IsNullOrEmpty(project.MoreUnsyncedChanges)) { (item.Submenu as Menu).Add(new MenuItem(project.MoreUnsyncedChanges) { Sensitive = false }); } (item.Submenu as Menu).Add(new SeparatorMenuItem()); resume_item = new MenuItem("Sync and Resume…"); } else { resume_item = new MenuItem("Resume"); } resume_item.Activated += Controller.ResumeDelegate(project.Name); (item.Submenu as Menu).Add(resume_item); } else { if (Controller.Projects [i].HasError) { folder_icon = IconTheme.Default.LoadIcon("dialog-warning", 16, IconLookupFlags.GenericFallback); MenuItem try_again_item = new MenuItem("Retry Sync"); try_again_item.Activated += Controller.TryAgainDelegate(project.Name); (item.Submenu as Menu).Add(try_again_item); } else { MenuItem pause_item = new MenuItem("Pause"); pause_item.Activated += Controller.PauseDelegate(project.Name); (item.Submenu as Menu).Add(pause_item); } } (item.Child as Label).UseUnderline = false; item.Image = new Image(folder_icon); this.menu.Add(item); i++; } ; } this.recent_events_item = new MenuItem("History…"); this.recent_events_item.Sensitive = Controller.RecentEventsItemEnabled; this.quit_item = new MenuItem("Quit") { Sensitive = Controller.QuitItemEnabled }; MenuItem add_item = new MenuItem("Sync Remote Project…"); MenuItem link_code_item = new MenuItem("Computer ID"); if (Controller.LinkCodeItemEnabled) { link_code_item.Submenu = new Menu(); string link_code = SparkleShare.Controller.UserAuthenticationInfo.PublicKey.Substring(0, 20) + "..."; MenuItem code_item = new MenuItem(link_code) { Sensitive = false }; MenuItem copy_item = new MenuItem("Copy to Clipboard"); copy_item.Activated += delegate { Controller.CopyToClipboardClicked(); }; (link_code_item.Submenu as Menu).Add(code_item); (link_code_item.Submenu as Menu).Add(new SeparatorMenuItem()); (link_code_item.Submenu as Menu).Add(copy_item); } MenuItem about_item = new MenuItem("About SparkleShare"); about_item.Activated += delegate { Controller.AboutClicked(); }; add_item.Activated += delegate { Controller.AddHostedProjectClicked(); }; this.recent_events_item.Activated += delegate { Controller.RecentEventsClicked(); }; this.quit_item.Activated += delegate { Controller.QuitClicked(); }; folder_item.Submenu = new Menu(); (folder_item.Submenu as Menu).Add(this.recent_events_item); if (InstallationInfo.OperatingSystem == OS.Ubuntu) { MenuItem notify_item; if (SparkleShare.Controller.NotificationsEnabled) { notify_item = new MenuItem("Turn Notifications Off"); } else { notify_item = new MenuItem("Turn Notifications On"); } notify_item.Activated += delegate { SparkleShare.Controller.ToggleNotifications(); Application.Invoke(delegate { if (SparkleShare.Controller.NotificationsEnabled) { (notify_item.Child as Label).Text = "Turn Notifications Off"; } else { (notify_item.Child as Label).Text = "Turn Notifications On"; } }); }; (folder_item.Submenu as Menu).Add(new SeparatorMenuItem()); (folder_item.Submenu as Menu).Add(notify_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(add_item); this.menu.Add(new SeparatorMenuItem()); this.menu.Add(this.quit_item); this.menu.ShowAll(); if (InstallationInfo.OperatingSystem == OS.Ubuntu) { #if HAVE_APP_INDICATOR indicator.Menu = this.menu; #endif } }
private void CreateAbout() { Image image = new Image() { Width = 720, Height = 260 }; image.Source = UserInterfaceHelpers.GetImageSource("about"); Label version = new Label() { Content = "version " + Controller.RunningVersion, FontSize = 11, Foreground = new SolidColorBrush(Colors.White) }; this.updates = new Label() { Content = "Checking for updates...", FontSize = 11, Foreground = new SolidColorBrush(Color.FromArgb(128, 255, 255, 255)) }; TextBlock credits = new TextBlock() { FontSize = 11, Foreground = new SolidColorBrush(Colors.White), Text = "Copyright © 2010–" + DateTime.Now.Year + " Hylke Bons and others.\n" + "\n" + "SparkleShare is Open Source software. You are free to use, modify, " + "and redistribute it under the GNU General Public License version 3 or later.", TextWrapping = TextWrapping.Wrap, Width = 318 }; SparkleLink website_link = new SparkleLink("Website", Controller.WebsiteLinkAddress); SparkleLink credits_link = new SparkleLink("Credits", Controller.CreditsLinkAddress); SparkleLink report_problem_link = new SparkleLink("Report a problem", Controller.ReportProblemLinkAddress); SparkleLink debug_log_link = new SparkleLink("Debug log", Controller.DebugLogLinkAddress); Canvas canvas = new Canvas(); canvas.Children.Add(image); Canvas.SetLeft(image, 0); Canvas.SetTop(image, 0); canvas.Children.Add(version); Canvas.SetLeft(version, 289); Canvas.SetTop(version, 92); canvas.Children.Add(this.updates); Canvas.SetLeft(this.updates, 289); Canvas.SetTop(this.updates, 109); canvas.Children.Add(credits); Canvas.SetLeft(credits, 294); Canvas.SetTop(credits, 142); canvas.Children.Add(website_link); Canvas.SetLeft(website_link, 289); Canvas.SetTop(website_link, 222); canvas.Children.Add(credits_link); Canvas.SetLeft(credits_link, 289 + website_link.ActualWidth + 60); Canvas.SetTop(credits_link, 222); canvas.Children.Add(report_problem_link); Canvas.SetLeft(report_problem_link, 289 + website_link.ActualWidth + credits_link.ActualWidth + 115); Canvas.SetTop(report_problem_link, 222); canvas.Children.Add(debug_log_link); Canvas.SetLeft(debug_log_link, 289 + website_link.ActualWidth + credits_link.ActualWidth + report_problem_link.ActualWidth + 220); Canvas.SetTop(debug_log_link, 222); Content = canvas; }
public EventLog() { CreateEventLog(); Background = new SolidColorBrush(Color.FromRgb(240, 240, 240)); AllowsTransparency = false; Icon = UserInterfaceHelpers.GetImageSource("sparkleshare-app", "ico"); WindowStartupLocation = WindowStartupLocation.CenterScreen; WriteOutImages(); this.label_Size.Content = "Size: " + Controller.Size; this.label_History.Content = "History: " + Controller.HistorySize; this.webbrowser.ObjectForScripting = new SparkleScriptingObject(); // Disable annoying IE clicking sound CoInternetSetFeatureEnabled(21, 0x00000002, true); Closing += this.OnClosing; Controller.ShowWindowEvent += delegate { Dispatcher.BeginInvoke((Action)(() => { Show(); Activate(); BringIntoView(); })); }; Controller.HideWindowEvent += delegate { Dispatcher.BeginInvoke((Action)(() => { Hide(); this.spinner.Visibility = Visibility.Visible; this.webbrowser.Visibility = Visibility.Collapsed; })); }; Controller.UpdateSizeInfoEvent += delegate(string size, string history_size) { Dispatcher.BeginInvoke((Action)(() => { this.label_Size.Content = "Size: " + size; this.label_History.Content = "History: " + history_size; })); }; Controller.UpdateChooserEvent += delegate(string[] folders) { Dispatcher.BeginInvoke((Action)(() => UpdateChooser(folders)) ); }; Controller.UpdateChooserEnablementEvent += delegate(bool enabled) { Dispatcher.BeginInvoke((Action)(() => this.combobox.IsEnabled = enabled )); }; Controller.UpdateContentEvent += delegate(string html) { Dispatcher.BeginInvoke((Action)(() => { UpdateContent(html); this.spinner.Visibility = Visibility.Collapsed; this.webbrowser.Visibility = Visibility.Visible; })); }; Controller.ContentLoadingEvent += () => this.Dispatcher.BeginInvoke( (Action)(() => { this.spinner.Visibility = Visibility.Visible; this.spinner.Start(); this.webbrowser.Visibility = Visibility.Collapsed; })); Controller.ShowSaveDialogEvent += delegate(string file_name, string target_folder_path) { Dispatcher.BeginInvoke((Action)(() => { SaveFileDialog dialog = new SaveFileDialog() { FileName = file_name, InitialDirectory = target_folder_path, Title = "Restore from History", DefaultExt = "." + System.IO.Path.GetExtension(file_name), Filter = "All Files|*.*" }; bool?result = dialog.ShowDialog(this); if (result == true) { Controller.SaveDialogCompleted(dialog.FileName); } else { Controller.SaveDialogCancelled(); } })); }; }
private void CreateNote() { Image user_image; if (File.Exists(Controller.AvatarFilePath)) { user_image = new Image(Controller.AvatarFilePath); } else { user_image = UserInterfaceHelpers.GetImage("user-icon-default.png"); } /* TODO: Style the entry neatly, multiple lines, and add placeholder text * string balloon_image_path = new string [] { UserInterface.AssetsPath, "pixmaps", "text-balloon.png" }.Combine (); * Image balloon_image = new Image (balloon_image_path); * CssProvider balloon_css_provider = new CssProvider (); * * balloon_css_provider.LoadFromData ("GtkEntry {" + * "background-image: url('" + balloon_image_path + "');" + * "background-repeat: no-repeat;" + * "background-position: left top;" + * "}"); * * balloon.StyleContext.AddProvider (balloon_css_provider, 800); */ var balloon_label = new Label("<b>Anything to add?</b>") { Xalign = 0, UseMarkup = true }; var balloon = new Entry { MaxLength = 144 }; var cancel_button = new Button("Cancel"); var sync_button = new Button("Sync") { CanDefault = true }; sync_button.StyleContext.AddClass("suggested-action"); cancel_button.Clicked += delegate { Controller.CancelClicked(); }; sync_button.Clicked += delegate { Controller.SyncClicked(balloon.Buffer.Text); }; var layout_vertical = new VBox(false, 16); var layout_horizontal = new HBox(false, 16); var buttons = new HBox { Homogeneous = false, Spacing = 6 }; var user_label = new Label { Markup = "<b>" + SparkleShare.Controller.CurrentUser.Name + "</b>\n" + "<span fgcolor=\"" + SparkleShare.UI.SecondaryTextColor + "\">" + SparkleShare.Controller.CurrentUser.Email + "</span>" }; layout_horizontal.PackStart(user_image, false, false, 0); layout_horizontal.PackStart(user_label, false, false, 0); buttons.PackStart(new Label(""), true, true, 0); buttons.PackStart(cancel_button, false, false, 0); buttons.PackStart(sync_button, false, false, 0); layout_vertical.PackStart(layout_horizontal, false, false, 0); layout_vertical.PackStart(balloon_label, false, false, 0); layout_vertical.PackStart(balloon, false, false, 0); layout_vertical.PackStart(buttons, false, false, 0); Default = sync_button; Add(layout_vertical); }