Removed console plugin from the main dist, it's fine in a python plugin
parent
911f068cfd
commit
c0cc4cbc16
|
@ -50,7 +50,7 @@ GtkWidget *_moo_app_create_prefs_dialog (MooApp *app)
|
|||
g_free (title);
|
||||
|
||||
#ifdef MOO_BUILD_TERM
|
||||
moo_prefs_dialog_append_page (dialog, moo_term_prefs_page_new ());
|
||||
// moo_prefs_dialog_append_page (dialog, moo_term_prefs_page_new ());
|
||||
#endif
|
||||
|
||||
#ifdef MOO_BUILD_EDIT
|
||||
|
|
|
@ -53,8 +53,7 @@ mooedit_plugins_built_sources = \
|
|||
|
||||
mooedit_plugins_extra_dist = \
|
||||
$(mooedit_plugins)/moofind.glade \
|
||||
$(mooedit_plugins)/moofind-glade.h \
|
||||
$(mooedit_plugins)/console.c
|
||||
$(mooedit_plugins)/moofind-glade.h
|
||||
|
||||
$(mooedit_plugins)/moofind-glade.h: $(mooedit_plugins)/moofind.glade
|
||||
mkdir -p $(mooedit_plugins)
|
||||
|
@ -66,10 +65,6 @@ mooedit_plugins_unix_sources = \
|
|||
$(mooedit_plugins)/moofind-glade.h \
|
||||
$(mooedit_plugins)/fileselector.c
|
||||
|
||||
if MOO_BUILD_TERM
|
||||
mooedit_plugins_unix_sources += $(mooedit_plugins)/console.c
|
||||
endif
|
||||
|
||||
mooedit_plugins_sources = \
|
||||
$(mooedit_plugins)/activestrings.c \
|
||||
$(mooedit_plugins)/mooeditplugins.h
|
||||
|
|
|
@ -895,9 +895,6 @@ moo_plugin_init_builtin (void)
|
|||
#ifndef __WIN32__
|
||||
moo_find_plugin_init ();
|
||||
moo_file_selector_plugin_init ();
|
||||
#ifdef MOO_BUILD_TERM
|
||||
moo_console_plugin_init ();
|
||||
#endif
|
||||
#endif
|
||||
moo_active_strings_plugin_init ();
|
||||
}
|
||||
|
|
|
@ -1,177 +0,0 @@
|
|||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4; coding: utf-8 -*-
|
||||
*
|
||||
* moofind.c
|
||||
*
|
||||
* Copyright (C) 2004-2005 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* See COPYING file that comes with this distribution.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#ifndef MOO_VERSION
|
||||
#define MOO_VERSION NULL
|
||||
#endif
|
||||
|
||||
#include "mooedit/mooplugin-macro.h"
|
||||
#include "mooedit/plugins/mooeditplugins.h"
|
||||
#include "mooterm/mooterm.h"
|
||||
#include "mooutils/moostock.h"
|
||||
#include <string.h>
|
||||
#include <sys/wait.h>
|
||||
#include <errno.h>
|
||||
#include <signal.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#define CONSOLE_PLUGIN_ID "Console"
|
||||
|
||||
enum {
|
||||
CMD_GREP = 1,
|
||||
CMD_FIND
|
||||
};
|
||||
|
||||
typedef struct {
|
||||
MooPlugin parent;
|
||||
guint ui_merge_id;
|
||||
} ConsolePlugin;
|
||||
|
||||
typedef struct {
|
||||
MooWinPlugin parent;
|
||||
MooTerm *terminal;
|
||||
MooEditWindow *window;
|
||||
} ConsoleWindowPlugin;
|
||||
|
||||
#define WindowStuff ConsoleWindowPlugin
|
||||
|
||||
|
||||
static void
|
||||
console_start (WindowStuff *stuff)
|
||||
{
|
||||
if (!moo_term_child_alive (stuff->terminal))
|
||||
{
|
||||
moo_term_soft_reset (stuff->terminal);
|
||||
moo_term_start_default_profile (stuff->terminal, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
console_window_plugin_create (WindowStuff *stuff)
|
||||
{
|
||||
GtkWidget *swin;
|
||||
MooPaneLabel *label;
|
||||
MooEditWindow *window = MOO_WIN_PLUGIN(stuff)->window;
|
||||
|
||||
stuff->window = window;
|
||||
|
||||
label = moo_pane_label_new (MOO_STOCK_TERMINAL, NULL, NULL,
|
||||
"Console", "Console");
|
||||
|
||||
stuff->terminal = g_object_new (MOO_TYPE_TERM, NULL);
|
||||
/* XXX */
|
||||
g_signal_connect_swapped (stuff->terminal, "child_died",
|
||||
G_CALLBACK (console_start), stuff);
|
||||
console_start (stuff);
|
||||
|
||||
swin = gtk_scrolled_window_new (NULL, NULL);
|
||||
gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin),
|
||||
GTK_SHADOW_ETCHED_IN);
|
||||
gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
|
||||
GTK_POLICY_AUTOMATIC,
|
||||
GTK_POLICY_AUTOMATIC);
|
||||
gtk_container_add (GTK_CONTAINER (swin), GTK_WIDGET (stuff->terminal));
|
||||
gtk_widget_show_all (swin);
|
||||
|
||||
moo_edit_window_add_pane (window, CONSOLE_PLUGIN_ID,
|
||||
swin, label, MOO_PANE_POS_BOTTOM);
|
||||
moo_pane_label_free (label);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
show_console_cb (MooEditWindow *window)
|
||||
{
|
||||
GtkWidget *pane;
|
||||
pane = moo_edit_window_get_pane (window, CONSOLE_PLUGIN_ID);
|
||||
moo_big_paned_present_pane (window->paned, pane);
|
||||
}
|
||||
|
||||
|
||||
static gboolean
|
||||
console_plugin_init (ConsolePlugin *plugin)
|
||||
{
|
||||
MooWindowClass *klass = g_type_class_ref (MOO_TYPE_EDIT_WINDOW);
|
||||
MooEditor *editor = moo_editor_instance ();
|
||||
MooUIXML *xml = moo_editor_get_ui_xml (editor);
|
||||
|
||||
g_return_val_if_fail (klass != NULL, FALSE);
|
||||
g_return_val_if_fail (editor != NULL, FALSE);
|
||||
|
||||
moo_window_class_new_action (klass, "ShowConsole",
|
||||
"name", "Show Console",
|
||||
"label", "Show Console",
|
||||
"tooltip", "Show Console",
|
||||
"icon-stock-id", MOO_STOCK_TERMINAL,
|
||||
"closure::callback", show_console_cb,
|
||||
NULL);
|
||||
|
||||
plugin->ui_merge_id = moo_ui_xml_new_merge_id (xml);
|
||||
|
||||
moo_ui_xml_add_item (xml, plugin->ui_merge_id,
|
||||
"Editor/Menubar/View",
|
||||
"ShowConsole",
|
||||
"ShowConsole", -1);
|
||||
|
||||
g_type_class_unref (klass);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
console_plugin_deinit (ConsolePlugin *plugin)
|
||||
{
|
||||
MooWindowClass *klass = g_type_class_ref (MOO_TYPE_EDIT_WINDOW);
|
||||
MooEditor *editor = moo_editor_instance ();
|
||||
MooUIXML *xml = moo_editor_get_ui_xml (editor);
|
||||
|
||||
moo_window_class_remove_action (klass, "ShowConsole");
|
||||
|
||||
if (plugin->ui_merge_id)
|
||||
moo_ui_xml_remove_ui (xml, plugin->ui_merge_id);
|
||||
plugin->ui_merge_id = 0;
|
||||
|
||||
g_type_class_unref (klass);
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
console_window_plugin_destroy (WindowStuff *stuff)
|
||||
{
|
||||
moo_edit_window_remove_pane (stuff->window, CONSOLE_PLUGIN_ID);
|
||||
}
|
||||
|
||||
|
||||
MOO_WIN_PLUGIN_DEFINE (Console, console,
|
||||
console_window_plugin_create,
|
||||
console_window_plugin_destroy);
|
||||
MOO_PLUGIN_DEFINE_INFO (console, CONSOLE_PLUGIN_ID,
|
||||
"Console", "Console",
|
||||
"Yevgen Muntyan <muntyan@tamu.edu>",
|
||||
MOO_VERSION);
|
||||
MOO_PLUGIN_DEFINE_FULL (Console, console,
|
||||
console_plugin_init, console_plugin_deinit,
|
||||
NULL, NULL, NULL, NULL, NULL,
|
||||
console_window_plugin_get_type (), 0);
|
||||
|
||||
|
||||
gboolean
|
||||
moo_console_plugin_init (void)
|
||||
{
|
||||
return moo_plugin_register (console_plugin_get_type ());
|
||||
}
|
|
@ -20,7 +20,6 @@ G_BEGIN_DECLS
|
|||
#ifndef __WIN32__
|
||||
gboolean moo_find_plugin_init (void);
|
||||
gboolean moo_file_selector_plugin_init (void);
|
||||
gboolean moo_console_plugin_init (void);
|
||||
#endif
|
||||
|
||||
gboolean moo_active_strings_plugin_init (void);
|
||||
|
|
|
@ -5,6 +5,9 @@
|
|||
moopython = $(moo_prefix)/moopython
|
||||
moopython_srcdir = $(srcdir)/$(moopython)
|
||||
|
||||
moopython_plugins = \
|
||||
$(moopython)/plugins/console.py
|
||||
|
||||
moopython_sources = \
|
||||
$(moopython)/moo-pygtk.c \
|
||||
$(moopython)/moo-pygtk.h \
|
||||
|
@ -32,6 +35,7 @@ mooedit_defs_files = \
|
|||
# $(moopython_srcdir)/moowindow.override
|
||||
|
||||
moopython_extra_dist = \
|
||||
$(moopython_plugins) \
|
||||
$(moopython)/moo-mod.py \
|
||||
$(moopython)/moo-pygtk.c \
|
||||
$(moopython)/mooapp-mod.py \
|
||||
|
|
|
@ -1410,7 +1410,7 @@
|
|||
(return-type "none")
|
||||
)
|
||||
|
||||
(define-function _window_class_remove_action
|
||||
(define-function window_class_remove_action
|
||||
(c-name "moo_window_class_remove_action")
|
||||
(return-type "none")
|
||||
(parameters
|
||||
|
|
|
@ -159,7 +159,28 @@ _wrap_moo_window_class_add_action (G_GNUC_UNUSED PyObject *self, PyObject *args)
|
|||
%%
|
||||
override moo_window_class_remove_action kwargs
|
||||
static PyObject *
|
||||
_wrap_moo_window_class_remove_action (G_GNUC_UNUSED PyObject *self, G_GNUC_UNUSED PyObject *args, G_GNUC_UNUSED PyObject *kwargs)
|
||||
_wrap_moo_window_class_remove_action (G_GNUC_UNUSED PyObject *self, PyObject *args, PyObject *kwargs)
|
||||
{
|
||||
static char *kwlist[] = {(char*) "class", (char*) "id", NULL};
|
||||
PyObject *py_type;
|
||||
GType type;
|
||||
const char *action_id;
|
||||
MooWindowClass *klass;
|
||||
|
||||
if (!PyArg_ParseTupleAndKeywords (args, kwargs, (char*) "Os:window_class_remove_action", kwlist, &py_type, &action_id))
|
||||
return NULL;
|
||||
|
||||
type = pyg_type_from_object (py_type);
|
||||
|
||||
if (!type)
|
||||
return NULL;
|
||||
|
||||
if (!g_type_is_a (type, MOO_TYPE_WINDOW))
|
||||
return_TypeErr ("type must be derived from MooWindow");
|
||||
|
||||
klass = g_type_class_ref (type);
|
||||
moo_window_class_remove_action (klass, action_id);
|
||||
g_type_class_unref (klass);
|
||||
|
||||
return_None;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,77 @@
|
|||
import moo
|
||||
import gtk
|
||||
|
||||
CONSOLE_PLUGIN_ID = "Console"
|
||||
|
||||
class Plugin(object):
|
||||
def get_info(self):
|
||||
return {
|
||||
"id" : CONSOLE_PLUGIN_ID,
|
||||
"name" : "Console",
|
||||
"description" : "Console",
|
||||
"author" : "Yevgen Muntyan <muntyan@math.tamu.edu>",
|
||||
"version" : "3.1415926",
|
||||
"enabled" : True,
|
||||
"visible" : True
|
||||
}
|
||||
|
||||
def init(self):
|
||||
editor = moo.edit.editor_instance()
|
||||
xml = editor.get_ui_xml()
|
||||
moo.utils.window_class_add_action (moo.utils.Window, "ShowConsole",
|
||||
name="Show Console",
|
||||
label="Show Console",
|
||||
icon_stock_id=moo.utils.STOCK_TERMINAL,
|
||||
callback=self.show_console)
|
||||
self.ui_merge_id = xml.new_merge_id()
|
||||
xml.add_item(self.ui_merge_id, "Editor/Menubar/View",
|
||||
"ShowConsole", "ShowConsole", -1)
|
||||
return True
|
||||
|
||||
def deinit(self):
|
||||
editor = moo.edit.editor_instance()
|
||||
xml = editor.get_ui_xml()
|
||||
|
||||
moo.utils.window_class_remove_action(moo.utils.Window, "ShowConsole");
|
||||
|
||||
if self.ui_merge_id:
|
||||
xml.remove_ui(self.ui_merge_id)
|
||||
self.ui_merge_id = 0
|
||||
|
||||
def show_console(self, window):
|
||||
pane = window.get_pane(CONSOLE_PLUGIN_ID)
|
||||
window.paned.present_pane(pane)
|
||||
|
||||
|
||||
class WinPlugin(object):
|
||||
def start(self, *whatever):
|
||||
if not self.terminal.child_alive():
|
||||
self.terminal.soft_reset()
|
||||
self.terminal.start_default_profile()
|
||||
|
||||
def create(self, window):
|
||||
self.window = window
|
||||
|
||||
label = moo.utils.PaneLabel(icon_stock_id = moo.utils.STOCK_TERMINAL,
|
||||
label = "Console",
|
||||
window_title = "Console")
|
||||
|
||||
self.terminal = moo.term.Term()
|
||||
self.terminal.connect("child_died", self.start)
|
||||
self.start()
|
||||
|
||||
swin = gtk.ScrolledWindow()
|
||||
swin.set_shadow_type(gtk.SHADOW_ETCHED_IN)
|
||||
swin.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
|
||||
swin.add(self.terminal)
|
||||
swin.show_all()
|
||||
|
||||
window.add_pane(CONSOLE_PLUGIN_ID, swin, label, moo.utils.PANE_POS_BOTTOM)
|
||||
|
||||
return True
|
||||
|
||||
def destroy(self, window):
|
||||
window.remove_pane(CONSOLE_PLUGIN_ID)
|
||||
|
||||
|
||||
moo.edit.plugin_register(Plugin, WinPlugin)
|
Loading…
Reference in New Issue