Permalink
Browse files

Initial commit

  • Loading branch information...
0 parents commit e7023a1332823d80a3a9d10a488fb6f7d4f35305 @codebrainz committed Dec 14, 2010
Showing with 338 additions and 0 deletions.
  1. +76 −0 .gitignore
  2. +1 −0 AUTHORS
  3. +1 −0 COPYING
  4. 0 ChangeLog
  5. +1 −0 INSTALL
  6. +8 −0 Makefile.am
  7. 0 NEWS
  8. +19 −0 README
  9. +62 −0 config.h.in
  10. +29 −0 configure.ac
  11. +10 −0 geany-vte-hookup.patch
  12. +1 −0 m4/libtool.m4
  13. +1 −0 m4/ltoptions.m4
  14. +1 −0 m4/ltsugar.m4
  15. +1 −0 m4/ltversion.m4
  16. +1 −0 m4/lt~obsolete.m4
  17. +126 −0 sidebarterm.c
  18. BIN sidebarterm_screenshot.png
@@ -0,0 +1,76 @@
+#
+# .gitignore for geany-sidebarterm
+#
+
+# Compiled
+*.o
+*.os
+*.so
+*.a
+*.com
+*.class
+*.dll
+*.exe
+*.pyc
+*.lo
+*.la
+*.pc
+
+# Packages
+*.7z
+*.dmg
+*.gz
+*.iso
+*.jar
+*.rar
+*.tar
+*.tar.*
+*.zip
+
+# Logs and db
+*.log
+*.sql
+*.sqlite
+*.dblite
+
+# OS files
+.DS_Store?
+ehthumbs.db
+Icon?
+Thumbs.db
+
+# New sub-projects
+src/gtkcamera
+src/pyfg2
+
+# Autotools stuff
+
+*~
+
+Makefile
+Makefile.in
+
+aclocal.m4
+autom4te.cache/
+
+config.guess
+config.log
+config.status
+config.sub
+
+configure
+
+config.h
+stamp-h1
+
+install-sh
+libtool
+ltmain.sh
+missing
+depcomp
+
+.deps
+.libs
+
+# Misc
+*.original
@@ -0,0 +1 @@
+Matthew Brush <mbrush@leftclick.ca>
No changes.
@@ -0,0 +1,8 @@
+ACLOCAL_AMFLAGS = -I m4
+
+pkglibdir = $(libdir)/geany
+
+pkglib_LTLIBRARIES = sidebarterm.la
+sidebarterm_la_CFLAGS = $(GEANY_CFLAGS) -DG_LOG_DOMAIN=\""Sidebar Terminal"\"
+sidebarterm_la_SOURCES = sidebarterm.c
+sidebarterm_la_LDFLAGS = -module -avoid-version $(GEANY_LIBS)
0 NEWS
No changes.
19 README
@@ -0,0 +1,19 @@
+Geany Sidebar Terminal
+
+This is a very simple plugin for Geany fast and lightweight IDE to move the
+Terminal (VTE) from the bottom message window to the sidebar.
+
+The reason I wrote this was because I found myself always having a separate
+terminal window open directly to the right of Geany, stretched to the same
+height as the Geany window. Since most of my code wraps at or around 80
+characters, and having a widescreen display, this works out quite well.
+
+After activating the plugin, the Terminal tab moves into the sidebar. If you
+prefer to have the terminal to the right side as I do, move the sidebar position
+to the right side in the Geany Interface Preferences tab in the Preferences
+dialog.
+
+When the plugin is de-activated, the Terminal tab is moved back into the
+message window.
+
+Check out the sidebarterm_screenshot.png file to see what this looks like.
@@ -0,0 +1,62 @@
+/* config.h.in. Generated from configure.ac by autoheader. */
+
+/* Define to 1 if you have the <dlfcn.h> header file. */
+#undef HAVE_DLFCN_H
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to the sub-directory in which libtool stores uninstalled libraries.
+ */
+#undef LT_OBJDIR
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the home page for this package. */
+#undef PACKAGE_URL
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
@@ -0,0 +1,29 @@
+# -*- Autoconf -*-
+# Process this file with autoconf to produce a configure script.
+
+AC_PREREQ([2.68])
+AC_INIT([sidebarterm], [0.0.1], [mbrush@leftclick.ca])
+AC_CONFIG_SRCDIR([sidebarterm.c])
+AC_CONFIG_HEADERS([config.h])
+
+AC_CONFIG_MACRO_DIR([m4])
+
+AM_INIT_AUTOMAKE([sidebarterm], [0.0.1])
+LT_INIT([dlopen])
+
+# Checks for programs.
+AC_PROG_CC
+
+# Checks for libraries.
+
+# Checks for packages.
+PKG_CHECK_MODULES([GEANY], [geany])
+PKG_CHECK_MODULES([VTE], [vte])
+
+# Checks for header files.
+
+# Checks for typedefs, structures, and compiler characteristics.
+
+# Checks for library functions.
+
+AC_OUTPUT(Makefile)
@@ -0,0 +1,10 @@
+--- vte.c 2010-12-03 18:37:55.000000000 -0800
++++ vte-new.c 2010-12-14 00:47:33.980019383 -0800
+@@ -241,6 +241,7 @@
+ GTK_WIDGET_UNSET_FLAGS(scrollbar, GTK_CAN_FOCUS);
+
+ frame = gtk_frame_new(NULL);
++ ui_hookup_widget(main_widgets.window, frame, "vte_frame");
+
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_container_add(GTK_CONTAINER(frame), hbox);
@@ -0,0 +1,126 @@
+/*
+ * sidebarterm.c
+ *
+ * Copyright 2010 Matthew Brush <mbrush@leftclick.ca>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ */
+
+/*
+ * One "bug" I noticed but I'm not sure of why it happens is when Geany is
+ * opened without the plugin enabled, then it's enabled, it's almost like it
+ * presses Enter on the VTE so there are two lines.
+ * Pretty much a non-issue IMOP.
+ */
+
+#include "geanyplugin.h"
+
+GeanyPlugin *geany_plugin;
+GeanyData *geany_data;
+GeanyFunctions *geany_functions;
+
+PLUGIN_VERSION_CHECK(147)
+
+PLUGIN_SET_INFO("Sidebar Terminal", "Move the VTE terminal into the sidebar.",
+ "1.0", "Matthew Brush <mbrush@leftclick.ca>");
+
+static GtkNotebook *vte_old_home = NULL;
+static GtkNotebook *vte_new_home = NULL;
+static GtkWidget *vte_frame = NULL;
+static GtkWidget *vte_tab_label = NULL;
+
+/*
+ * is it better to add:
+ * ui_hookup_widget(main_widgets.window, frame, "vte_frame");
+ * to the create_vte() function in vte.c (~ line 244) ?
+ */
+static GtkWidget *get_vte_frame(void)
+{
+#ifdef VTE_HOOKUP_PATCH
+ /*
+ * run this code if vte.c is patched to add:
+ * ui_hookup_widget(main_widgets.window, frame, "vte_frame");
+ * to the create_vte() function (see vte-hookup.patch).
+ */
+ return ui_lookup_widget(
+ geany_data->main_widgets->window,
+ "vte_frame");
+#else
+ /* in theory, the Terminal tab should be the last tab */
+ GtkWidget *vfra = gtk_notebook_get_nth_page(
+ GTK_NOTEBOOK(
+ geany_data->main_widgets->message_window_notebook), -1);
+ /* get the label of the assumed Terminal tab */
+ const gchar *labeltxt = gtk_notebook_get_tab_label_text(
+ GTK_NOTEBOOK(geany_data->main_widgets->message_window_notebook),
+ vfra);
+ /* check if we have the wrong tab (hacky?) */
+ if (g_strcmp0(labeltxt, "Terminal") != 0)
+ return NULL;
+
+ return vfra;
+#endif
+}
+
+void plugin_init(GeanyData *data)
+{
+
+ /* get a handle on the frame that holds the vte stuff */
+ vte_frame = get_vte_frame();
+
+ if (vte_frame == NULL)
+ {
+ g_printerr("Geany does not contain a VTE terminal, bailing out.\n");
+ return;
+ }
+
+ /* store where the vte frame is going to go */
+ vte_new_home = GTK_NOTEBOOK(geany_data->main_widgets->sidebar_notebook);
+
+ /* store where the vte was so we can put it back */
+ vte_old_home = GTK_NOTEBOOK(gtk_widget_get_parent(vte_frame));
+
+ /* grab the notebook page label so we can set it on the new tab */
+ vte_tab_label = gtk_notebook_get_tab_label(vte_old_home, vte_frame);
+
+ /* increase the ref count so the label doesn't get destroy when we
+ * reparent the notebook child */
+ g_object_ref(G_OBJECT(vte_tab_label));
+
+ /* move the vte frame to the sidebar notebook */
+ gtk_widget_reparent(vte_frame, GTK_WIDGET(vte_new_home));
+
+ /* set the label again since it's gone somewhere */
+ gtk_notebook_set_tab_label(vte_new_home, GTK_WIDGET(vte_frame), vte_tab_label);
+
+ /* select the new vte tab (last tab) in the sidebar */
+ gtk_notebook_set_current_page(vte_new_home, -1);
+}
+
+void plugin_cleanup(void)
+{
+ /* move the vte frame back to where it was before */
+ gtk_widget_reparent(vte_frame, GTK_WIDGET(vte_old_home));
+
+ /* put the label back in the old notebook */
+ gtk_notebook_set_tab_label(vte_old_home, vte_frame, vte_tab_label);
+
+ /* we no longer to to hang on to a reference of the label */
+ g_object_unref(G_OBJECT(vte_tab_label));
+
+ /* select the vte tab (last tab) in the message window */
+ gtk_notebook_set_current_page(vte_old_home, -1);
+}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e7023a1

Please sign in to comment.