2006-08-16 18:27:19 -07:00
|
|
|
/*
|
|
|
|
* moousertools-prefs.c
|
|
|
|
*
|
2007-04-07 01:21:52 -07:00
|
|
|
* Copyright (C) 2004-2007 by Yevgen Muntyan <muntyan@math.tamu.edu>
|
2006-08-16 18:27:19 -07:00
|
|
|
*
|
2007-06-24 10:56:20 -07:00
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
2006-08-16 18:27:19 -07:00
|
|
|
*
|
|
|
|
* See COPYING file that comes with this distribution.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "mooedit/moousertools-prefs.h"
|
|
|
|
#include "mooedit/moousertools.h"
|
|
|
|
#include "mooedit/mooedittools-glade.h"
|
|
|
|
#include "mooedit/moocommand.h"
|
2006-08-16 22:08:49 -07:00
|
|
|
#include "mooedit/moocommanddisplay.h"
|
2006-08-16 18:27:19 -07:00
|
|
|
#include "mooutils/mooprefsdialogpage.h"
|
|
|
|
#include "mooutils/mooi18n.h"
|
|
|
|
#include "mooutils/mooutils-treeview.h"
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define GET_WID(name) (moo_glade_xml_get_widget (page->xml, (name)))
|
|
|
|
|
|
|
|
enum {
|
2006-08-17 21:53:34 -07:00
|
|
|
COLUMN_INFO,
|
2006-08-16 18:27:19 -07:00
|
|
|
N_COLUMNS
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
static MooUserToolType
|
|
|
|
page_get_type (MooPrefsDialogPage *page)
|
|
|
|
{
|
|
|
|
return GPOINTER_TO_INT (g_object_get_data (G_OBJECT (page), "moo-user-tool-type"));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
page_set_type (MooPrefsDialogPage *page,
|
|
|
|
MooUserToolType type)
|
|
|
|
{
|
|
|
|
g_object_set_data (G_OBJECT (page), "moo-user-tool-type", GINT_TO_POINTER (type));
|
|
|
|
}
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
get_changed (MooPrefsDialogPage *page)
|
|
|
|
{
|
|
|
|
return g_object_get_data (G_OBJECT (page), "moo-changed") != NULL;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
set_changed (MooPrefsDialogPage *page,
|
|
|
|
gboolean changed)
|
|
|
|
{
|
2006-08-17 21:53:34 -07:00
|
|
|
g_object_set_data (G_OBJECT (page), "moo-changed", GINT_TO_POINTER (changed));
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-16 22:08:49 -07:00
|
|
|
static MooCommandDisplay *
|
|
|
|
get_helper (MooPrefsDialogPage *page)
|
2006-08-16 18:27:19 -07:00
|
|
|
{
|
2006-08-16 22:08:49 -07:00
|
|
|
return g_object_get_data (G_OBJECT (page), "moo-tree-helper");
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2006-08-18 22:21:29 -07:00
|
|
|
populate_store (GtkListStore *store,
|
|
|
|
MooUserToolType type)
|
2006-08-16 18:27:19 -07:00
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
2006-08-18 22:21:29 -07:00
|
|
|
GSList *list;
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-18 22:21:29 -07:00
|
|
|
list = _moo_edit_parse_user_tools (type);
|
|
|
|
|
|
|
|
while (list)
|
2006-08-17 21:53:34 -07:00
|
|
|
{
|
2006-08-18 22:21:29 -07:00
|
|
|
MooUserToolInfo *info = list->data;
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-18 22:21:29 -07:00
|
|
|
if (info->os_type == MOO_USER_TOOL_THIS_OS)
|
|
|
|
{
|
|
|
|
gtk_list_store_append (store, &iter);
|
|
|
|
gtk_list_store_set (store, &iter, COLUMN_INFO, info, -1);
|
|
|
|
}
|
|
|
|
|
|
|
|
_moo_user_tool_info_unref (info);
|
|
|
|
list = g_slist_delete_link (list, list);
|
|
|
|
}
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
new_row (MooPrefsDialogPage *page,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreePath *path)
|
|
|
|
{
|
|
|
|
GtkTreeIter iter;
|
2006-08-17 21:53:34 -07:00
|
|
|
MooUserToolInfo *info;
|
2006-08-18 22:21:29 -07:00
|
|
|
GtkTreeViewColumn *column;
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
info = _moo_user_tool_info_new ();
|
2007-02-27 20:23:57 -08:00
|
|
|
info->cmd_factory = moo_command_factory_lookup ("moo-script");
|
|
|
|
info->cmd_data = info->cmd_factory ? moo_command_data_new (info->cmd_factory->n_keys) : NULL;
|
2006-08-20 01:49:33 -07:00
|
|
|
info->name = g_strdup (_("New Command"));
|
|
|
|
info->options = g_strdup ("need-doc");
|
2006-08-17 21:53:34 -07:00
|
|
|
info->enabled = TRUE;
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
set_changed (page, TRUE);
|
|
|
|
gtk_list_store_insert (GTK_LIST_STORE (model), &iter,
|
|
|
|
gtk_tree_path_get_indices(path)[0]);
|
2006-08-17 21:53:34 -07:00
|
|
|
gtk_list_store_set (GTK_LIST_STORE (model), &iter, COLUMN_INFO, info, -1);
|
|
|
|
|
2006-08-18 22:21:29 -07:00
|
|
|
column = gtk_tree_view_get_column (GET_WID ("treeview"), 0);
|
|
|
|
gtk_tree_view_set_cursor (GET_WID ("treeview"), path, column, TRUE);
|
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
_moo_user_tool_info_unref (info);
|
2006-08-16 18:27:19 -07:00
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
|
2006-08-23 00:39:03 -07:00
|
|
|
static gboolean
|
2006-08-23 00:40:45 -07:00
|
|
|
delete_row (MooPrefsDialogPage *page)
|
2006-08-23 00:39:03 -07:00
|
|
|
{
|
|
|
|
set_changed (page, TRUE);
|
2006-08-23 00:40:45 -07:00
|
|
|
return FALSE;
|
|
|
|
}
|
|
|
|
|
|
|
|
static gboolean
|
|
|
|
move_row (MooPrefsDialogPage *page)
|
|
|
|
{
|
|
|
|
set_changed (page, TRUE);
|
|
|
|
return FALSE;
|
2006-08-23 00:39:03 -07:00
|
|
|
}
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
static void
|
|
|
|
set_text (MooPrefsDialogPage *page,
|
|
|
|
const char *name,
|
|
|
|
const char *text)
|
|
|
|
{
|
|
|
|
gtk_entry_set_text (GET_WID (name), text ? text : "");
|
|
|
|
}
|
|
|
|
|
2006-08-16 18:27:19 -07:00
|
|
|
static void
|
|
|
|
update_widgets (MooPrefsDialogPage *page,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreePath *path,
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
{
|
2006-08-16 22:08:49 -07:00
|
|
|
MooCommandDisplay *helper;
|
|
|
|
|
|
|
|
helper = get_helper (page);
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
if (path)
|
|
|
|
{
|
2006-08-17 21:53:34 -07:00
|
|
|
MooUserToolInfo *info;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, iter, COLUMN_INFO, &info, -1);
|
|
|
|
g_return_if_fail (info != NULL);
|
|
|
|
|
2007-02-27 20:23:57 -08:00
|
|
|
_moo_command_display_set (helper, info->cmd_factory, info->cmd_data);
|
2006-08-17 21:53:34 -07:00
|
|
|
|
|
|
|
gtk_toggle_button_set_active (GET_WID ("enabled"), info->enabled);
|
|
|
|
set_text (page, "langs", info->langs);
|
|
|
|
set_text (page, "options", info->options);
|
|
|
|
|
|
|
|
_moo_user_tool_info_unref (info);
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2006-08-17 21:53:34 -07:00
|
|
|
gtk_toggle_button_set_active (GET_WID ("enabled"), FALSE);
|
|
|
|
set_text (page, "langs", NULL);
|
|
|
|
set_text (page, "options", NULL);
|
2006-08-16 22:08:49 -07:00
|
|
|
_moo_command_display_set (helper, NULL, NULL);
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
2006-08-17 21:53:34 -07:00
|
|
|
|
|
|
|
gtk_widget_set_sensitive (GET_WID ("tool_vbox"), path != NULL);
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
2006-08-17 21:53:34 -07:00
|
|
|
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
static gboolean
|
2006-08-17 21:53:34 -07:00
|
|
|
get_text (MooPrefsDialogPage *page,
|
|
|
|
const char *name,
|
|
|
|
char **dest)
|
2006-08-16 18:27:19 -07:00
|
|
|
{
|
2006-08-17 21:53:34 -07:00
|
|
|
const char *text = gtk_entry_get_text (GET_WID (name));
|
|
|
|
|
|
|
|
if (strcmp (*dest ? *dest : "", text) != 0)
|
|
|
|
{
|
|
|
|
g_free (*dest);
|
|
|
|
*dest = text[0] ? g_strdup (text) : NULL;
|
|
|
|
return TRUE;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
return FALSE;
|
|
|
|
}
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
update_model (MooPrefsDialogPage *page,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
G_GNUC_UNUSED GtkTreePath *path,
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
{
|
2006-08-16 22:08:49 -07:00
|
|
|
MooCommandDisplay *helper;
|
2007-02-27 20:23:57 -08:00
|
|
|
MooCommandFactory *factory;
|
2006-08-16 18:27:19 -07:00
|
|
|
MooCommandData *data;
|
2006-08-17 21:53:34 -07:00
|
|
|
MooUserToolInfo *info;
|
|
|
|
gboolean changed = FALSE;
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-16 22:08:49 -07:00
|
|
|
helper = get_helper (page);
|
2006-08-17 21:53:34 -07:00
|
|
|
gtk_tree_model_get (model, iter, COLUMN_INFO, &info, -1);
|
|
|
|
g_return_if_fail (info != NULL);
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2007-02-27 20:23:57 -08:00
|
|
|
if (_moo_command_display_get (helper, &factory, &data))
|
2006-08-16 18:27:19 -07:00
|
|
|
{
|
2006-08-17 21:53:34 -07:00
|
|
|
moo_command_data_unref (info->cmd_data);
|
|
|
|
info->cmd_data = moo_command_data_ref (data);
|
2007-02-27 20:23:57 -08:00
|
|
|
info->cmd_factory = factory;
|
2006-08-17 21:53:34 -07:00
|
|
|
gtk_list_store_set (GTK_LIST_STORE (model), iter, COLUMN_INFO, info, -1);
|
|
|
|
changed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (gtk_toggle_button_get_active (GET_WID ("enabled")) != info->enabled)
|
|
|
|
{
|
|
|
|
info->enabled = gtk_toggle_button_get_active (GET_WID ("enabled"));
|
|
|
|
changed = TRUE;
|
|
|
|
}
|
|
|
|
|
|
|
|
changed = get_text (page, "langs", &info->langs) || changed;
|
|
|
|
changed = get_text (page, "options", &info->options) || changed;
|
|
|
|
|
|
|
|
if (changed)
|
|
|
|
{
|
|
|
|
g_print ("page changed\n");
|
2006-08-16 18:27:19 -07:00
|
|
|
set_changed (page, TRUE);
|
|
|
|
}
|
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
_moo_user_tool_info_unref (info);
|
2006-08-16 18:27:19 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2006-08-17 21:53:34 -07:00
|
|
|
name_data_func (G_GNUC_UNUSED GtkTreeViewColumn *column,
|
|
|
|
GtkCellRenderer *cell,
|
|
|
|
GtkTreeModel *model,
|
|
|
|
GtkTreeIter *iter)
|
|
|
|
{
|
|
|
|
MooUserToolInfo *info = NULL;
|
|
|
|
|
|
|
|
gtk_tree_model_get (model, iter, COLUMN_INFO, &info, -1);
|
|
|
|
g_return_if_fail (info != NULL);
|
|
|
|
|
|
|
|
g_object_set (cell, "text", info->name, NULL);
|
|
|
|
|
|
|
|
_moo_user_tool_info_unref (info);
|
|
|
|
}
|
|
|
|
|
2006-08-18 22:21:29 -07:00
|
|
|
static void
|
|
|
|
name_cell_edited (MooPrefsDialogPage *page,
|
|
|
|
char *path_string,
|
|
|
|
char *text)
|
|
|
|
{
|
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreePath *path;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
MooUserToolInfo *info = NULL;
|
|
|
|
|
|
|
|
path = gtk_tree_path_new_from_string (path_string);
|
|
|
|
model = gtk_tree_view_get_model (GET_WID ("treeview"));
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter (model, &iter, path))
|
|
|
|
{
|
|
|
|
gtk_tree_model_get (model, &iter, COLUMN_INFO, &info, -1);
|
|
|
|
g_return_if_fail (info != NULL);
|
|
|
|
|
|
|
|
if (strcmp (info->name ? info->name : "", text) != 0)
|
|
|
|
{
|
|
|
|
set_changed (page, TRUE);
|
|
|
|
g_free (info->name);
|
|
|
|
info->name = g_strdup (text);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
gtk_tree_path_free (path);
|
|
|
|
}
|
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
static void
|
|
|
|
command_page_init (MooPrefsDialogPage *page,
|
|
|
|
MooUserToolType type)
|
2006-08-16 18:27:19 -07:00
|
|
|
{
|
|
|
|
GtkTreeView *treeview;
|
|
|
|
GtkListStore *store;
|
|
|
|
GtkTreeViewColumn *column;
|
|
|
|
GtkCellRenderer *cell;
|
2006-08-16 22:08:49 -07:00
|
|
|
MooCommandDisplay *helper;
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
page_set_type (page, type);
|
|
|
|
|
2006-08-16 18:27:19 -07:00
|
|
|
treeview = moo_glade_xml_get_widget (page->xml, "treeview");
|
2006-08-17 21:53:34 -07:00
|
|
|
store = gtk_list_store_new (N_COLUMNS, MOO_TYPE_USER_TOOL_INFO);
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
cell = gtk_cell_renderer_text_new ();
|
2006-08-17 21:53:34 -07:00
|
|
|
column = gtk_tree_view_column_new ();
|
|
|
|
gtk_tree_view_column_pack_start (column, cell, TRUE);
|
|
|
|
gtk_tree_view_column_set_cell_data_func (column, cell,
|
|
|
|
(GtkTreeCellDataFunc) name_data_func,
|
|
|
|
NULL, NULL);
|
2006-08-16 18:27:19 -07:00
|
|
|
gtk_tree_view_append_column (treeview, column);
|
2006-08-18 22:21:29 -07:00
|
|
|
g_object_set (cell, "editable", TRUE, NULL);
|
|
|
|
g_signal_connect_swapped (cell, "edited", G_CALLBACK (name_cell_edited), page);
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
populate_store (store, type);
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-16 22:08:49 -07:00
|
|
|
helper = _moo_command_display_new (GET_WID ("type_combo"),
|
|
|
|
GET_WID ("notebook"),
|
|
|
|
GTK_WIDGET (treeview),
|
|
|
|
GET_WID ("new"),
|
|
|
|
GET_WID ("delete"),
|
|
|
|
GET_WID ("up"),
|
|
|
|
GET_WID ("down"));
|
2006-08-16 18:27:19 -07:00
|
|
|
g_object_set_data_full (G_OBJECT (page), "moo-tree-helper", helper, g_object_unref);
|
|
|
|
g_signal_connect_swapped (page, "destroy", G_CALLBACK (gtk_object_destroy), helper);
|
|
|
|
|
|
|
|
g_signal_connect_swapped (helper, "new-row", G_CALLBACK (new_row), page);
|
2006-08-23 00:39:03 -07:00
|
|
|
g_signal_connect_swapped (helper, "delete-row", G_CALLBACK (delete_row), page);
|
2006-08-23 00:40:45 -07:00
|
|
|
g_signal_connect_swapped (helper, "move-row", G_CALLBACK (move_row), page);
|
2006-08-16 18:27:19 -07:00
|
|
|
g_signal_connect_swapped (helper, "update-widgets", G_CALLBACK (update_widgets), page);
|
|
|
|
g_signal_connect_swapped (helper, "update-model", G_CALLBACK (update_model), page);
|
|
|
|
|
2007-06-14 00:18:35 -07:00
|
|
|
gtk_tree_view_set_model (treeview, GTK_TREE_MODEL (store));
|
|
|
|
|
2006-08-16 22:08:49 -07:00
|
|
|
_moo_tree_view_select_first (treeview);
|
|
|
|
_moo_tree_helper_update_widgets (MOO_TREE_HELPER (helper));
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
g_object_unref (store);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
2006-08-17 21:53:34 -07:00
|
|
|
command_page_apply (MooPrefsDialogPage *page)
|
2006-08-16 18:27:19 -07:00
|
|
|
{
|
|
|
|
MooTreeHelper *helper;
|
2006-08-17 21:53:34 -07:00
|
|
|
GtkTreeModel *model;
|
|
|
|
GtkTreeIter iter;
|
|
|
|
GSList *list = NULL;
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
helper = g_object_get_data (G_OBJECT (page), "moo-tree-helper");
|
|
|
|
_moo_tree_helper_update_model (helper, NULL, NULL);
|
|
|
|
|
|
|
|
if (!get_changed (page))
|
|
|
|
return;
|
|
|
|
|
|
|
|
g_print ("apply\n");
|
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
model = gtk_tree_view_get_model (GET_WID ("treeview"));
|
|
|
|
|
|
|
|
if (gtk_tree_model_get_iter_first (model, &iter))
|
|
|
|
{
|
|
|
|
do
|
|
|
|
{
|
|
|
|
MooUserToolInfo *info;
|
|
|
|
gtk_tree_model_get (model, &iter, COLUMN_INFO, &info, -1);
|
|
|
|
list = g_slist_prepend (list, info);
|
|
|
|
}
|
|
|
|
while (gtk_tree_model_iter_next (model, &iter));
|
|
|
|
}
|
|
|
|
|
|
|
|
list = g_slist_reverse (list);
|
|
|
|
|
|
|
|
_moo_edit_save_user_tools (page_get_type (page), list);
|
|
|
|
_moo_edit_load_user_tools (page_get_type (page));
|
|
|
|
|
|
|
|
g_slist_foreach (list, (GFunc) _moo_user_tool_info_unref, NULL);
|
|
|
|
g_slist_free (list);
|
|
|
|
|
2006-08-16 18:27:19 -07:00
|
|
|
set_changed (page, FALSE);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
static void
|
|
|
|
main_page_init (MooPrefsDialogPage *main_page)
|
|
|
|
{
|
|
|
|
MooPrefsDialogPage *page_context, *page_menu;
|
|
|
|
|
|
|
|
page_menu = moo_glade_xml_get_widget (main_page->xml, "page_menu");
|
|
|
|
page_context = moo_glade_xml_get_widget (main_page->xml, "page_context");
|
|
|
|
|
|
|
|
command_page_init (page_menu, MOO_USER_TOOL_MENU);
|
|
|
|
command_page_init (page_context, MOO_USER_TOOL_CONTEXT);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
static void
|
|
|
|
main_page_apply (MooPrefsDialogPage *main_page)
|
|
|
|
{
|
|
|
|
MooPrefsDialogPage *page_context, *page_menu;
|
|
|
|
|
|
|
|
page_menu = moo_glade_xml_get_widget (main_page->xml, "page_menu");
|
|
|
|
page_context = moo_glade_xml_get_widget (main_page->xml, "page_context");
|
|
|
|
|
|
|
|
command_page_apply (page_menu);
|
|
|
|
command_page_apply (page_context);
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2006-08-16 18:27:19 -07:00
|
|
|
GtkWidget *
|
2006-08-16 22:08:49 -07:00
|
|
|
_moo_user_tools_prefs_page_new (void)
|
2006-08-16 18:27:19 -07:00
|
|
|
{
|
|
|
|
MooPrefsDialogPage *page;
|
2006-08-17 21:53:34 -07:00
|
|
|
MooPrefsDialogPage *page_menu, *page_context;
|
2006-08-16 18:27:19 -07:00
|
|
|
MooGladeXML *xml;
|
|
|
|
|
|
|
|
xml = moo_glade_xml_new_empty (GETTEXT_PACKAGE);
|
2006-08-17 21:53:34 -07:00
|
|
|
moo_glade_xml_map_id (xml, "page_menu", MOO_TYPE_PREFS_DIALOG_PAGE);
|
|
|
|
moo_glade_xml_map_id (xml, "page_context", MOO_TYPE_PREFS_DIALOG_PAGE);
|
2006-08-16 18:27:19 -07:00
|
|
|
page = moo_prefs_dialog_page_new_from_xml (_("Tools"), GTK_STOCK_EXECUTE,
|
2007-07-11 22:54:41 -07:00
|
|
|
xml, mooedittools_glade_xml,
|
2006-08-16 18:27:19 -07:00
|
|
|
"page", NULL);
|
2006-08-17 21:53:34 -07:00
|
|
|
g_signal_connect (page, "init", G_CALLBACK (main_page_init), NULL);
|
|
|
|
g_signal_connect (page, "apply", G_CALLBACK (main_page_apply), NULL);
|
|
|
|
|
|
|
|
page_menu = moo_glade_xml_get_widget (xml, "page_menu");
|
2007-07-11 22:54:41 -07:00
|
|
|
moo_prefs_dialog_page_fill_from_xml (page_menu, NULL, mooedittools_glade_xml,
|
2006-08-17 21:53:34 -07:00
|
|
|
"page_command", NULL);
|
2006-08-16 18:27:19 -07:00
|
|
|
|
2006-08-17 21:53:34 -07:00
|
|
|
page_context = moo_glade_xml_get_widget (xml, "page_context");
|
2007-07-11 22:54:41 -07:00
|
|
|
moo_prefs_dialog_page_fill_from_xml (page_context, NULL, mooedittools_glade_xml,
|
2006-08-17 21:53:34 -07:00
|
|
|
"page_command", NULL);
|
2006-08-16 18:27:19 -07:00
|
|
|
|
|
|
|
g_object_unref (xml);
|
|
|
|
return GTK_WIDGET (page);
|
|
|
|
}
|