bool OnLinkTagActivated(NoteTag sender, NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { return(OpenOrCreateLink(start, end)); }
protected override bool OnActivate (NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { if (BugUrl != string.Empty) { Logger.Debug ("Opening url '{0}'...", BugUrl); try { Services.NativeApplication.OpenUrl (BugUrl, editor.Screen); } catch (Exception e) { GuiUtils.ShowOpeningLocationError (null, BugUrl, e.Message); } } return true; }
bool OnUrlTagActivated(NoteTag sender, NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { string url = GetUrl(start, end); try { OpenUrl(url); } catch (GLib.GException e) { GuiUtils.ShowOpeningLocationError(Window, url, e.Message); } // Kill the middle button paste... return(true); }
protected virtual bool OnActivate(NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { bool retval = false; if (Activated != null) { foreach (Delegate d in Activated.GetInvocationList()) { TagActivatedHandler handler = (TagActivatedHandler)d; retval |= handler(this, editor, start, end); } } return(retval); }
protected override bool OnTextEvent(GLib.Object sender, Gdk.Event ev, Gtk.TextIter iter) { NoteEditor editor = (NoteEditor)sender; Gtk.TextIter start, end; if (!CanActivate) { return(false); } switch (ev.Type) { case Gdk.EventType.ButtonPress: Gdk.EventButton button_ev = new Gdk.EventButton(ev.Handle); // Do not insert selected text when activating links with // middle mouse button if (button_ev.Button == 2) { allow_middle_activate = true; return(true); } return(false); case Gdk.EventType.ButtonRelease: button_ev = new Gdk.EventButton(ev.Handle); if (button_ev.Button != 1 && button_ev.Button != 2) { return(false); } /* Don't activate if Shift or Control is pressed */ if ((int)(button_ev.State & (Gdk.ModifierType.ShiftMask | Gdk.ModifierType.ControlMask)) != 0) { return(false); } // Prevent activation when selecting links with the mouse if (editor.Buffer.HasSelection) { return(false); } // Don't activate if the link has just been pasted with the // middle mouse button (no preceding ButtonPress event) if (button_ev.Button == 2 && !allow_middle_activate) { return(false); } else { allow_middle_activate = false; } GetExtents(iter, out start, out end); bool success = OnActivate(editor, start, end); // Hide note if link is activated with middle mouse button if (success && button_ev.Button == 2) { Gtk.Widget widget = (Gtk.Widget)sender; widget.Toplevel.Hide(); } return(false); case Gdk.EventType.KeyPress: Gdk.EventKey key_ev = new Gdk.EventKey(ev.Handle); // Control-Enter activates the link at point... if ((int)(key_ev.State & Gdk.ModifierType.ControlMask) == 0) { return(false); } if (key_ev.Key != Gdk.Key.Return && key_ev.Key != Gdk.Key.KP_Enter) { return(false); } GetExtents(iter, out start, out end); return(OnActivate(editor, start, end)); } return(false); }
protected override bool OnActivate(NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { Process p = new Process(); p.StartInfo.FileName = "gitg"; p.StartInfo.Arguments = "--select " + Treeish; p.StartInfo.WorkingDirectory = RepositoryPath; p.StartInfo.UseShellExecute = false; try { p.Start(); } catch(Exception ee) { string message = String.Format("Error running Gitg: {0}", ee.Message); Logger.Error(message); HIGMessageDialog dialog = new HIGMessageDialog(editor.Toplevel as Gtk.Window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Catalog.GetString("Cannot open Git repository browser"), message); dialog.Run(); dialog.Destroy(); } return true; }
protected virtual bool OnActivate (NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { bool retval = false; if (Activated != null) { foreach (Delegate d in Activated.GetInvocationList()) { TagActivatedHandler handler = (TagActivatedHandler) d; retval |= handler (this, editor, start, end); } } return retval; }
bool OnLinkTagActivated (NoteTag sender, NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { return OpenOrCreateLink (start, end); }
bool OnUrlTagActivated (NoteTag sender, NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { string url = GetUrl (start, end); try { OpenUrl (url); } catch (GLib.GException e) { GuiUtils.ShowOpeningLocationError (Window, url, e.Message); } // Kill the middle button paste... return true; }
protected override bool OnActivate(NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { Process p = new Process(); p.StartInfo.FileName = "claws-mail"; p.StartInfo.Arguments = "--select '" + EmailUri + "'"; p.StartInfo.UseShellExecute = false; try { p.Start(); } catch(Exception ee) { string message = String.Format("Error running Claws Mail: {0}", ee.Message); Logger.Error(message); HIGMessageDialog dialog = new HIGMessageDialog(editor.Toplevel as Gtk.Window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, Catalog.GetString("Cannot open email"), message); dialog.Run(); dialog.Destroy(); } return true; }
protected override bool OnActivate (NoteEditor editor, Gtk.TextIter start, Gtk.TextIter end) { string persona = start.GetText (end); PersonLink plink = (PersonLink) galago.Trie.Lookup (persona); try { plink.SendMessage (); } catch (Exception e) { string title = Catalog.GetString ("Cannot contact '{0}'"); title = String.Format (title, persona); string message = Catalog.GetString ("Error running gaim-remote: {0}"); message = String.Format (message, e.Message); Logger.Log (message); HIGMessageDialog dialog = new HIGMessageDialog (editor.Toplevel as Gtk.Window, Gtk.DialogFlags.DestroyWithParent, Gtk.MessageType.Info, Gtk.ButtonsType.Ok, title, message); dialog.Run (); dialog.Destroy (); } return true; }