Skip to content

Instantly share code, notes, and snippets.

View codebrainz's full-sized avatar

Matthew Brush codebrainz

View GitHub Profile
@codebrainz
codebrainz / "Open in a New Tab" for Geany
Created November 22, 2010 23:14
Patch for notebook.c file in Geany to add an item to open the file in a new instance of Geany to the tabs' right-click menu when the tab contains a saved file.
--- geany-svn/src/notebook.c 2010-11-21 20:53:12.943333841 -0800
+++ geany-local/src/notebook.c 2010-11-21 20:54:20.836667216 -0800
@@ -193,10 +193,35 @@
}
+static void on_open_in_new_window_activate(GtkMenuItem *menuitem, gpointer user_data)
+{
+ gchar **argv;
+ gchar *doc_path;
/* large portions of this were taken from Geany's source code */
#include "geanyplugin.h"
#include <math.h>
GeanyPlugin *geany_plugin;
GeanyData *geany_data;
GeanyFunctions *geany_functions;
PLUGIN_VERSION_CHECK(147)
@codebrainz
codebrainz / persistent_gtk_notebooks.py
Created March 22, 2011 01:34
Test code to try and save and restore tabs inside two notebooks, including which notebook and order.
#!/usr/bin/env python
"""
Demo for storing tabs inside two detachable and re-orderable notebooks
to disk on close and reloading them in the correct notebook and in
order on load.
"""
import gtk
from ConfigParser import SafeConfigParser
diff --git a/plugins/splitwindow.c b/plugins/splitwindow.c
index ff67508..f5a2d8c 100644
--- a/plugins/splitwindow.c
+++ b/plugins/splitwindow.c
@@ -307,14 +307,25 @@ static void split_view(gboolean horizontal)
set_state(horizontal ? STATE_SPLIT_HORIZONTAL : STATE_SPLIT_VERTICAL);
+#ifndef G_OS_WIN32
/* temporarily put document notebook in main vbox (scintilla widgets must stay
@codebrainz
codebrainz / .fonts.conf
Created April 4, 2011 23:37
Font configuration file to override "emboldening" of fonts without a bold version.
<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!--
This overrides what's in /etc/fonts/conf.d/90-synthetic.conf for
"faking" bold fonts, but only for monospace fonts.
-->
<fontconfig>
<match target="font">
<test name="spacing" compare="eq">
@codebrainz
codebrainz / 0001-Add-basic-support-for-loading-binary-files.patch
Created May 11, 2011 00:56
Add basic support for loading binary files.
From 696cc02fa371f75390a6dc28f1551faf34759df0 Mon Sep 17 00:00:00 2001
From: Matthew Brush <matthewbrush(at)gmail(dot)com>
Date: Tue, 10 May 2011 16:53:21 -0700
Subject: [PATCH] Add basic support for loading binary files.
Read the entire file instead of only to the first nul byte, then,
if converting it to UTF-8 fails, assume it's binary, make it read-only,
warn the user and set the text in Scintilla anyway.
Add sci_set_text2() function (terrible name) to support setting
--- src/Makefile.am.old 2011-05-11 20:16:53.996766001 -0700
+++ src/Makefile.am 2011-05-11 20:32:45.116766001 -0700
@@ -603,6 +603,8 @@
noinst_LIBRARIES += libtomcrypt.a
+main_CPPFLAGS = -I$(top_srcdir)/extern/jsoncpp/include
+
main_SOURCES = $(PNG) \
$(Screens) \
changeset: 2603:b97cf584311b
tag: tip
parent: 2592:247816f97bea
user: Matthew Brush <matthewbrush@gmail.com>
date: Wed May 11 21:04:14 2011 -0700
summary: Add include to makefiles, remove trailing spaces after backslash.
diff -r 247816f97bea -r b97cf584311b src/Makefile.am
--- a/src/Makefile.am Wed May 11 22:48:19 2011 -0400
+++ b/src/Makefile.am Wed May 11 21:04:14 2011 -0700
@codebrainz
codebrainz / gist:985252
Created May 22, 2011 07:33
Add 'enum' keyword for Java 5.0
diff --git a/data/filetypes.java b/data/filetypes.java
index 57a4843..633daa9 100644
--- a/data/filetypes.java
+++ b/data/filetypes.java
@@ -26,7 +26,7 @@ globalclass=type
[keywords]
primary=abstract assert break case catch class const continue default do else extends final finally for future generic goto if implements import inner instanceof interface native new outer package private protected public rest return static super switch synchronized this throw throws transient try var volatile while true false null
-secondary=boolean byte char double float int long short void
+secondary=boolean byte char double float int long short void enum
@codebrainz
codebrainz / gist:1003959
Created June 2, 2011 05:02
Geany - Grab focus after opening each document (Scintilla Widgets).
diff --git a/src/keyfile.c b/src/keyfile.c
index ad6aea5..5577b39 100644
--- a/src/keyfile.c
+++ b/src/keyfile.c
@@ -1031,6 +1031,7 @@ static gboolean open_session_file(gchar **tmp, guint len)
editor_set_line_wrapping(doc->editor, line_wrapping);
doc->editor->line_breaking = line_breaking;
doc->editor->auto_indent = auto_indent;
+ gtk_widget_grab_focus(doc->editor->sci);
ret = TRUE;