summaryrefslogtreecommitdiff
path: root/pluma/dialogs
diff options
context:
space:
mode:
Diffstat (limited to 'pluma/dialogs')
-rwxr-xr-xpluma/dialogs/Makefile.am31
-rwxr-xr-xpluma/dialogs/pluma-close-confirmation-dialog.c790
-rwxr-xr-xpluma/dialogs/pluma-close-confirmation-dialog.h75
-rwxr-xr-xpluma/dialogs/pluma-encodings-dialog.c499
-rwxr-xr-xpluma/dialogs/pluma-encodings-dialog.h86
-rwxr-xr-xpluma/dialogs/pluma-encodings-dialog.ui256
-rwxr-xr-xpluma/dialogs/pluma-preferences-dialog.c1189
-rwxr-xr-xpluma/dialogs/pluma-preferences-dialog.h87
-rwxr-xr-xpluma/dialogs/pluma-preferences-dialog.ui1107
-rwxr-xr-xpluma/dialogs/pluma-search-dialog.c634
-rwxr-xr-xpluma/dialogs/pluma-search-dialog.h128
-rwxr-xr-xpluma/dialogs/pluma-search-dialog.ui255
12 files changed, 5137 insertions, 0 deletions
diff --git a/pluma/dialogs/Makefile.am b/pluma/dialogs/Makefile.am
new file mode 100755
index 00000000..c8a822cc
--- /dev/null
+++ b/pluma/dialogs/Makefile.am
@@ -0,0 +1,31 @@
+uidir = $(datadir)/pluma-2/ui/
+
+INCLUDES = \
+ -I$(top_srcdir) \
+ -I$(top_builddir) \
+ -I$(top_srcdir)/pluma \
+ -I$(top_builddir)/pluma \
+ $(PLUMA_CFLAGS) \
+ $(WARN_CFLAGS) \
+ $(DISABLE_DEPRECATED_CFLAGS)
+
+noinst_LTLIBRARIES = libdialogs.la
+
+libdialogs_la_SOURCES = \
+ pluma-preferences-dialog.h \
+ pluma-preferences-dialog.c \
+ pluma-close-confirmation-dialog.c \
+ pluma-close-confirmation-dialog.h \
+ pluma-encodings-dialog.c \
+ pluma-encodings-dialog.h \
+ pluma-search-dialog.h \
+ pluma-search-dialog.c
+
+ui_DATA = \
+ pluma-encodings-dialog.ui \
+ pluma-preferences-dialog.ui \
+ pluma-search-dialog.ui
+
+EXTRA_DIST = $(ui_DATA)
+
+-include $(top_srcdir)/git.mk
diff --git a/pluma/dialogs/pluma-close-confirmation-dialog.c b/pluma/dialogs/pluma-close-confirmation-dialog.c
new file mode 100755
index 00000000..6bb2bd0c
--- /dev/null
+++ b/pluma/dialogs/pluma-close-confirmation-dialog.c
@@ -0,0 +1,790 @@
+/*
+ * pluma-close-confirmation-dialog.c
+ * This file is part of pluma
+ *
+ * Copyright (C) 2004-2005 MATE Foundation
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2004-2005. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <glib/gi18n.h>
+
+#include "pluma-close-confirmation-dialog.h"
+#include <pluma/pluma-app.h>
+#include <pluma/pluma-utils.h>
+#include <pluma/pluma-window.h>
+
+
+/* Properties */
+enum
+{
+ PROP_0,
+ PROP_UNSAVED_DOCUMENTS,
+ PROP_LOGOUT_MODE
+};
+
+/* Mode */
+enum
+{
+ SINGLE_DOC_MODE,
+ MULTIPLE_DOCS_MODE
+};
+
+/* Columns */
+enum
+{
+ SAVE_COLUMN,
+ NAME_COLUMN,
+ DOC_COLUMN, /* a handy pointer to the document */
+ N_COLUMNS
+};
+
+struct _PlumaCloseConfirmationDialogPrivate
+{
+ gboolean logout_mode;
+
+ GList *unsaved_documents;
+
+ GList *selected_documents;
+
+ GtkTreeModel *list_store;
+
+ gboolean disable_save_to_disk;
+};
+
+#define PLUMA_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), \
+ PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG, \
+ PlumaCloseConfirmationDialogPrivate))
+
+#define GET_MODE(priv) (((priv->unsaved_documents != NULL) && \
+ (priv->unsaved_documents->next == NULL)) ? \
+ SINGLE_DOC_MODE : MULTIPLE_DOCS_MODE)
+
+G_DEFINE_TYPE(PlumaCloseConfirmationDialog, pluma_close_confirmation_dialog, GTK_TYPE_DIALOG)
+
+static void set_unsaved_document (PlumaCloseConfirmationDialog *dlg,
+ const GList *list);
+
+static GList *get_selected_docs (GtkTreeModel *store);
+
+/* Since we connect in the costructor we are sure this handler will be called
+ * before the user ones
+ */
+static void
+response_cb (PlumaCloseConfirmationDialog *dlg,
+ gint response_id,
+ gpointer data)
+{
+ PlumaCloseConfirmationDialogPrivate *priv;
+
+ g_return_if_fail (PLUMA_IS_CLOSE_CONFIRMATION_DIALOG (dlg));
+
+ priv = dlg->priv;
+
+ if (priv->selected_documents != NULL)
+ g_list_free (priv->selected_documents);
+
+ if (response_id == GTK_RESPONSE_YES)
+ {
+ if (GET_MODE (priv) == SINGLE_DOC_MODE)
+ {
+ priv->selected_documents =
+ g_list_copy (priv->unsaved_documents);
+ }
+ else
+ {
+ g_return_if_fail (priv->list_store);
+
+ priv->selected_documents =
+ get_selected_docs (priv->list_store);
+ }
+ }
+ else
+ priv->selected_documents = NULL;
+}
+
+static void
+set_logout_mode (PlumaCloseConfirmationDialog *dlg,
+ gboolean logout_mode)
+{
+ dlg->priv->logout_mode = logout_mode;
+
+ if (logout_mode)
+ {
+ gtk_dialog_add_button (GTK_DIALOG (dlg),
+ _("Log Out _without Saving"),
+ GTK_RESPONSE_NO);
+
+ pluma_dialog_add_button (GTK_DIALOG (dlg),
+ _("_Cancel Logout"),
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL);
+ }
+ else
+ {
+ gtk_dialog_add_button (GTK_DIALOG (dlg),
+ _("Close _without Saving"),
+ GTK_RESPONSE_NO);
+
+ gtk_dialog_add_button (GTK_DIALOG (dlg),
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL);
+ }
+
+ if (dlg->priv->disable_save_to_disk)
+ {
+ gtk_dialog_set_default_response (GTK_DIALOG (dlg),
+ GTK_RESPONSE_NO);
+ }
+ else
+ {
+ const gchar *stock_id = GTK_STOCK_SAVE;
+
+ if (GET_MODE (dlg->priv) == SINGLE_DOC_MODE)
+ {
+ PlumaDocument *doc;
+
+ doc = PLUMA_DOCUMENT (dlg->priv->unsaved_documents->data);
+
+ if (pluma_document_get_readonly (doc) ||
+ pluma_document_is_untitled (doc))
+ stock_id = GTK_STOCK_SAVE_AS;
+ }
+
+ gtk_dialog_add_button (GTK_DIALOG (dlg),
+ stock_id,
+ GTK_RESPONSE_YES);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dlg),
+ GTK_RESPONSE_YES);
+ }
+}
+
+static void
+pluma_close_confirmation_dialog_init (PlumaCloseConfirmationDialog *dlg)
+{
+ AtkObject *atk_obj;
+
+ dlg->priv = PLUMA_CLOSE_CONFIRMATION_DIALOG_GET_PRIVATE (dlg);
+
+ dlg->priv->disable_save_to_disk =
+ pluma_app_get_lockdown (pluma_app_get_default ())
+ & PLUMA_LOCKDOWN_SAVE_TO_DISK;
+
+ gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ 14);
+ gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+ gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+ gtk_window_set_skip_taskbar_hint (GTK_WINDOW (dlg), TRUE);
+
+ gtk_window_set_title (GTK_WINDOW (dlg), "");
+
+ gtk_window_set_modal (GTK_WINDOW (dlg), TRUE);
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
+
+ atk_obj = gtk_widget_get_accessible (GTK_WIDGET (dlg));
+ atk_object_set_role (atk_obj, ATK_ROLE_ALERT);
+ atk_object_set_name (atk_obj, _("Question"));
+
+ g_signal_connect (dlg,
+ "response",
+ G_CALLBACK (response_cb),
+ NULL);
+}
+
+static void
+pluma_close_confirmation_dialog_finalize (GObject *object)
+{
+ PlumaCloseConfirmationDialogPrivate *priv;
+
+ priv = PLUMA_CLOSE_CONFIRMATION_DIALOG (object)->priv;
+
+ if (priv->unsaved_documents != NULL)
+ g_list_free (priv->unsaved_documents);
+
+ if (priv->selected_documents != NULL)
+ g_list_free (priv->selected_documents);
+
+ /* Call the parent's destructor */
+ G_OBJECT_CLASS (pluma_close_confirmation_dialog_parent_class)->finalize (object);
+}
+
+static void
+pluma_close_confirmation_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaCloseConfirmationDialog *dlg;
+
+ dlg = PLUMA_CLOSE_CONFIRMATION_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_UNSAVED_DOCUMENTS:
+ set_unsaved_document (dlg, g_value_get_pointer (value));
+ break;
+
+ case PROP_LOGOUT_MODE:
+ set_logout_mode (dlg, g_value_get_boolean (value));
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+pluma_close_confirmation_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaCloseConfirmationDialogPrivate *priv;
+
+ priv = PLUMA_CLOSE_CONFIRMATION_DIALOG (object)->priv;
+
+ switch( prop_id )
+ {
+ case PROP_UNSAVED_DOCUMENTS:
+ g_value_set_pointer (value, priv->unsaved_documents);
+ break;
+
+ case PROP_LOGOUT_MODE:
+ g_value_set_boolean (value, priv->logout_mode);
+ break;
+
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+pluma_close_confirmation_dialog_class_init (PlumaCloseConfirmationDialogClass *klass)
+{
+ GObjectClass *gobject_class = G_OBJECT_CLASS (klass);
+
+ gobject_class->set_property = pluma_close_confirmation_dialog_set_property;
+ gobject_class->get_property = pluma_close_confirmation_dialog_get_property;
+ gobject_class->finalize = pluma_close_confirmation_dialog_finalize;
+
+ g_type_class_add_private (klass, sizeof (PlumaCloseConfirmationDialogPrivate));
+
+ g_object_class_install_property (gobject_class,
+ PROP_UNSAVED_DOCUMENTS,
+ g_param_spec_pointer ("unsaved_documents",
+ "Unsaved Documents",
+ "List of Unsaved Documents",
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY)));
+
+ g_object_class_install_property (gobject_class,
+ PROP_LOGOUT_MODE,
+ g_param_spec_boolean ("logout_mode",
+ "Logout Mode",
+ "Whether the dialog is in logout mode",
+ FALSE,
+ (G_PARAM_READWRITE |
+ G_PARAM_CONSTRUCT_ONLY)));
+}
+
+static GList *
+get_selected_docs (GtkTreeModel *store)
+{
+ GList *list;
+ gboolean valid;
+ GtkTreeIter iter;
+
+ list = NULL;
+ valid = gtk_tree_model_get_iter_first (store, &iter);
+
+ while (valid)
+ {
+ gboolean to_save;
+ PlumaDocument *doc;
+
+ gtk_tree_model_get (store, &iter,
+ SAVE_COLUMN, &to_save,
+ DOC_COLUMN, &doc,
+ -1);
+ if (to_save)
+ list = g_list_prepend (list, doc);
+
+ valid = gtk_tree_model_iter_next (store, &iter);
+ }
+
+ list = g_list_reverse (list);
+
+ return list;
+}
+
+GList *
+pluma_close_confirmation_dialog_get_selected_documents (PlumaCloseConfirmationDialog *dlg)
+{
+ g_return_val_if_fail (PLUMA_IS_CLOSE_CONFIRMATION_DIALOG (dlg), NULL);
+
+ return g_list_copy (dlg->priv->selected_documents);
+}
+
+GtkWidget *
+pluma_close_confirmation_dialog_new (GtkWindow *parent,
+ GList *unsaved_documents,
+ gboolean logout_mode)
+{
+ GtkWidget *dlg;
+ g_return_val_if_fail (unsaved_documents != NULL, NULL);
+
+ dlg = GTK_WIDGET (g_object_new (PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG,
+ "unsaved_documents", unsaved_documents,
+ "logout_mode", logout_mode,
+ NULL));
+ g_return_val_if_fail (dlg != NULL, NULL);
+
+ if (parent != NULL)
+ {
+ gtk_window_group_add_window (pluma_window_get_group (PLUMA_WINDOW (parent)),
+ GTK_WINDOW (dlg));
+
+ gtk_window_set_transient_for (GTK_WINDOW (dlg), parent);
+ }
+
+ return dlg;
+}
+
+GtkWidget *
+pluma_close_confirmation_dialog_new_single (GtkWindow *parent,
+ PlumaDocument *doc,
+ gboolean logout_mode)
+{
+ GtkWidget *dlg;
+ GList *unsaved_documents;
+ g_return_val_if_fail (doc != NULL, NULL);
+
+ unsaved_documents = g_list_prepend (NULL, doc);
+
+ dlg = pluma_close_confirmation_dialog_new (parent,
+ unsaved_documents,
+ logout_mode);
+
+ g_list_free (unsaved_documents);
+
+ return dlg;
+}
+
+static gchar *
+get_text_secondary_label (PlumaDocument *doc)
+{
+ glong seconds;
+ gchar *secondary_msg;
+
+ seconds = MAX (1, _pluma_document_get_seconds_since_last_save_or_load (doc));
+
+ if (seconds < 55)
+ {
+ secondary_msg = g_strdup_printf (
+ ngettext ("If you don't save, changes from the last %ld second "
+ "will be permanently lost.",
+ "If you don't save, changes from the last %ld seconds "
+ "will be permanently lost.",
+ seconds),
+ seconds);
+ }
+ else if (seconds < 75) /* 55 <= seconds < 75 */
+ {
+ secondary_msg = g_strdup (_("If you don't save, changes from the last minute "
+ "will be permanently lost."));
+ }
+ else if (seconds < 110) /* 75 <= seconds < 110 */
+ {
+ secondary_msg = g_strdup_printf (
+ ngettext ("If you don't save, changes from the last minute and %ld "
+ "second will be permanently lost.",
+ "If you don't save, changes from the last minute and %ld "
+ "seconds will be permanently lost.",
+ seconds - 60 ),
+ seconds - 60);
+ }
+ else if (seconds < 3600)
+ {
+ secondary_msg = g_strdup_printf (
+ ngettext ("If you don't save, changes from the last %ld minute "
+ "will be permanently lost.",
+ "If you don't save, changes from the last %ld minutes "
+ "will be permanently lost.",
+ seconds / 60),
+ seconds / 60);
+ }
+ else if (seconds < 7200)
+ {
+ gint minutes;
+ seconds -= 3600;
+
+ minutes = seconds / 60;
+ if (minutes < 5)
+ {
+ secondary_msg = g_strdup (_("If you don't save, changes from the last hour "
+ "will be permanently lost."));
+ }
+ else
+ {
+ secondary_msg = g_strdup_printf (
+ ngettext ("If you don't save, changes from the last hour and %d "
+ "minute will be permanently lost.",
+ "If you don't save, changes from the last hour and %d "
+ "minutes will be permanently lost.",
+ minutes),
+ minutes);
+ }
+ }
+ else
+ {
+ gint hours;
+
+ hours = seconds / 3600;
+
+ secondary_msg = g_strdup_printf (
+ ngettext ("If you don't save, changes from the last %d hour "
+ "will be permanently lost.",
+ "If you don't save, changes from the last %d hours "
+ "will be permanently lost.",
+ hours),
+ hours);
+ }
+
+ return secondary_msg;
+}
+
+static void
+build_single_doc_dialog (PlumaCloseConfirmationDialog *dlg)
+{
+ GtkWidget *hbox;
+ GtkWidget *vbox;
+ GtkWidget *primary_label;
+ GtkWidget *secondary_label;
+ GtkWidget *image;
+ PlumaDocument *doc;
+ gchar *doc_name;
+ gchar *str;
+ gchar *markup_str;
+
+ g_return_if_fail (dlg->priv->unsaved_documents->data != NULL);
+ doc = PLUMA_DOCUMENT (dlg->priv->unsaved_documents->data);
+
+ /* Image */
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
+ GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+
+ /* Primary label */
+ primary_label = gtk_label_new (NULL);
+ gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
+ gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
+ gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
+
+ doc_name = pluma_document_get_short_name_for_display (doc);
+
+ if (dlg->priv->disable_save_to_disk)
+ {
+ str = g_markup_printf_escaped (_("Changes to document \"%s\" will be permanently lost."),
+ doc_name);
+ }
+ else
+ {
+ str = g_markup_printf_escaped (_("Save changes to document \"%s\" before closing?"),
+ doc_name);
+ }
+
+ g_free (doc_name);
+
+ markup_str = g_strconcat ("<span weight=\"bold\" size=\"larger\">", str, "</span>", NULL);
+ g_free (str);
+
+ gtk_label_set_markup (GTK_LABEL (primary_label), markup_str);
+ g_free (markup_str);
+
+ /* Secondary label */
+ if (dlg->priv->disable_save_to_disk)
+ str = g_strdup (_("Saving has been disabled by the system administrator."));
+ else
+ str = get_text_secondary_label (doc);
+ secondary_label = gtk_label_new (str);
+ g_free (str);
+ gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (secondary_label), 0.0, 0.5);
+ gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
+
+ hbox = gtk_hbox_new (FALSE, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+
+ vbox = gtk_vbox_new (FALSE, 12);
+
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (vbox), primary_label, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (vbox), secondary_label, FALSE, FALSE, 0);
+
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ hbox,
+ FALSE,
+ FALSE,
+ 0);
+
+ gtk_widget_show_all (hbox);
+}
+
+static void
+populate_model (GtkTreeModel *store, GList *docs)
+{
+ GtkTreeIter iter;
+
+ while (docs != NULL)
+ {
+ PlumaDocument *doc;
+ gchar *name;
+
+ doc = PLUMA_DOCUMENT (docs->data);
+
+ name = pluma_document_get_short_name_for_display (doc);
+
+ gtk_list_store_append (GTK_LIST_STORE (store), &iter);
+ gtk_list_store_set (GTK_LIST_STORE (store), &iter,
+ SAVE_COLUMN, TRUE,
+ NAME_COLUMN, name,
+ DOC_COLUMN, doc,
+ -1);
+
+ g_free (name);
+
+ docs = g_list_next (docs);
+ }
+}
+
+static void
+save_toggled (GtkCellRendererToggle *renderer, gchar *path_str, GtkTreeModel *store)
+{
+ GtkTreePath *path = gtk_tree_path_new_from_string (path_str);
+ GtkTreeIter iter;
+ gboolean active;
+
+ gtk_tree_model_get_iter (store, &iter, path);
+ gtk_tree_model_get (store, &iter, SAVE_COLUMN, &active, -1);
+
+ active ^= 1;
+
+ gtk_list_store_set (GTK_LIST_STORE (store), &iter,
+ SAVE_COLUMN, active, -1);
+
+ gtk_tree_path_free (path);
+}
+
+static GtkWidget *
+create_treeview (PlumaCloseConfirmationDialogPrivate *priv)
+{
+ GtkListStore *store;
+ GtkWidget *treeview;
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+
+ treeview = gtk_tree_view_new ();
+ gtk_widget_set_size_request (treeview, 260, 120);
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
+ gtk_tree_view_set_enable_search (GTK_TREE_VIEW (treeview), FALSE);
+
+ /* Create and populate the model */
+ store = gtk_list_store_new (N_COLUMNS, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_POINTER);
+ populate_model (GTK_TREE_MODEL (store), priv->unsaved_documents);
+
+ /* Set model to the treeview */
+ gtk_tree_view_set_model (GTK_TREE_VIEW (treeview), GTK_TREE_MODEL (store));
+ g_object_unref (store);
+
+ priv->list_store = GTK_TREE_MODEL (store);
+
+ /* Add columns */
+ if (!priv->disable_save_to_disk)
+ {
+ renderer = gtk_cell_renderer_toggle_new ();
+ g_signal_connect (renderer, "toggled",
+ G_CALLBACK (save_toggled), store);
+
+ column = gtk_tree_view_column_new_with_attributes ("Save?",
+ renderer,
+ "active",
+ SAVE_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+ }
+
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes ("Name",
+ renderer,
+ "text",
+ NAME_COLUMN,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+ return treeview;
+}
+
+static void
+build_multiple_docs_dialog (PlumaCloseConfirmationDialog *dlg)
+{
+ PlumaCloseConfirmationDialogPrivate *priv;
+ GtkWidget *hbox;
+ GtkWidget *image;
+ GtkWidget *vbox;
+ GtkWidget *primary_label;
+ GtkWidget *vbox2;
+ GtkWidget *select_label;
+ GtkWidget *scrolledwindow;
+ GtkWidget *treeview;
+ GtkWidget *secondary_label;
+ gchar *str;
+ gchar *markup_str;
+
+ priv = dlg->priv;
+
+ hbox = gtk_hbox_new (FALSE, 12);
+ gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ hbox, TRUE, TRUE, 0);
+
+ /* Image */
+ image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING,
+ GTK_ICON_SIZE_DIALOG);
+ gtk_misc_set_alignment (GTK_MISC (image), 0.5, 0.0);
+ gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 0);
+
+ vbox = gtk_vbox_new (FALSE, 12);
+ gtk_box_pack_start (GTK_BOX (hbox), vbox, TRUE, TRUE, 0);
+
+ /* Primary label */
+ primary_label = gtk_label_new (NULL);
+ gtk_label_set_line_wrap (GTK_LABEL (primary_label), TRUE);
+ gtk_label_set_use_markup (GTK_LABEL (primary_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (primary_label), 0.0, 0.5);
+ gtk_label_set_selectable (GTK_LABEL (primary_label), TRUE);
+
+ if (priv->disable_save_to_disk)
+ str = g_strdup_printf (
+ ngettext ("Changes to %d document will be permanently lost.",
+ "Changes to %d documents will be permanently lost.",
+ g_list_length (priv->unsaved_documents)),
+ g_list_length (priv->unsaved_documents));
+ else
+ str = g_strdup_printf (
+ ngettext ("There is %d document with unsaved changes. "
+ "Save changes before closing?",
+ "There are %d documents with unsaved changes. "
+ "Save changes before closing?",
+ g_list_length (priv->unsaved_documents)),
+ g_list_length (priv->unsaved_documents));
+
+ markup_str = g_strconcat ("<span weight=\"bold\" size=\"larger\">", str, "</span>", NULL);
+ g_free (str);
+
+ gtk_label_set_markup (GTK_LABEL (primary_label), markup_str);
+ g_free (markup_str);
+ gtk_box_pack_start (GTK_BOX (vbox), primary_label, FALSE, FALSE, 0);
+
+ vbox2 = gtk_vbox_new (FALSE, 8);
+ gtk_box_pack_start (GTK_BOX (vbox), vbox2, FALSE, FALSE, 0);
+
+ if (priv->disable_save_to_disk)
+ select_label = gtk_label_new_with_mnemonic (_("Docum_ents with unsaved changes:"));
+ else
+ select_label = gtk_label_new_with_mnemonic (_("S_elect the documents you want to save:"));
+
+ gtk_box_pack_start (GTK_BOX (vbox2), select_label, FALSE, FALSE, 0);
+ gtk_label_set_line_wrap (GTK_LABEL (select_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (select_label), 0.0, 0.5);
+
+ scrolledwindow = gtk_scrolled_window_new (NULL, NULL);
+ gtk_box_pack_start (GTK_BOX (vbox2), scrolledwindow, TRUE, TRUE, 0);
+ gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow),
+ GTK_POLICY_AUTOMATIC,
+ GTK_POLICY_AUTOMATIC);
+ gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwindow),
+ GTK_SHADOW_IN);
+
+ treeview = create_treeview (priv);
+ gtk_container_add (GTK_CONTAINER (scrolledwindow), treeview);
+
+ /* Secondary label */
+ if (priv->disable_save_to_disk)
+ secondary_label = gtk_label_new (_("Saving has been disabled by the system administrator."));
+ else
+ secondary_label = gtk_label_new (_("If you don't save, "
+ "all your changes will be permanently lost."));
+
+ gtk_box_pack_start (GTK_BOX (vbox2), secondary_label, FALSE, FALSE, 0);
+ gtk_label_set_line_wrap (GTK_LABEL (secondary_label), TRUE);
+ gtk_misc_set_alignment (GTK_MISC (secondary_label), 0, 0.5);
+ gtk_label_set_selectable (GTK_LABEL (secondary_label), TRUE);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (select_label), treeview);
+
+ gtk_widget_show_all (hbox);
+}
+
+static void
+set_unsaved_document (PlumaCloseConfirmationDialog *dlg,
+ const GList *list)
+{
+ PlumaCloseConfirmationDialogPrivate *priv;
+
+ g_return_if_fail (list != NULL);
+
+ priv = dlg->priv;
+ g_return_if_fail (priv->unsaved_documents == NULL);
+
+ priv->unsaved_documents = g_list_copy ((GList *)list);
+
+ if (GET_MODE (priv) == SINGLE_DOC_MODE)
+ {
+ build_single_doc_dialog (dlg);
+ }
+ else
+ {
+ build_multiple_docs_dialog (dlg);
+ }
+}
+
+const GList *
+pluma_close_confirmation_dialog_get_unsaved_documents (PlumaCloseConfirmationDialog *dlg)
+{
+ g_return_val_if_fail (PLUMA_IS_CLOSE_CONFIRMATION_DIALOG (dlg), NULL);
+
+ return dlg->priv->unsaved_documents;
+}
diff --git a/pluma/dialogs/pluma-close-confirmation-dialog.h b/pluma/dialogs/pluma-close-confirmation-dialog.h
new file mode 100755
index 00000000..dfc027f4
--- /dev/null
+++ b/pluma/dialogs/pluma-close-confirmation-dialog.h
@@ -0,0 +1,75 @@
+/*
+ * pluma-close-confirmation-dialog.h
+ * This file is part of pluma
+ *
+ * Copyright (C) 2004-2005 MATE Foundation
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2004-2005. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ */
+
+#ifndef __PLUMA_CLOSE_CONFIRMATION_DIALOG_H__
+#define __PLUMA_CLOSE_CONFIRMATION_DIALOG_H__
+
+#include <glib.h>
+#include <gtk/gtk.h>
+
+#include <pluma/pluma-document.h>
+
+#define PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG (pluma_close_confirmation_dialog_get_type ())
+#define PLUMA_CLOSE_CONFIRMATION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG, PlumaCloseConfirmationDialog))
+#define PLUMA_CLOSE_CONFIRMATION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG, PlumaCloseConfirmationDialogClass))
+#define PLUMA_IS_CLOSE_CONFIRMATION_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG))
+#define PLUMA_IS_CLOSE_CONFIRMATION_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG))
+#define PLUMA_CLOSE_CONFIRMATION_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),PLUMA_TYPE_CLOSE_CONFIRMATION_DIALOG, PlumaCloseConfirmationDialogClass))
+
+typedef struct _PlumaCloseConfirmationDialog PlumaCloseConfirmationDialog;
+typedef struct _PlumaCloseConfirmationDialogClass PlumaCloseConfirmationDialogClass;
+typedef struct _PlumaCloseConfirmationDialogPrivate PlumaCloseConfirmationDialogPrivate;
+
+struct _PlumaCloseConfirmationDialog
+{
+ GtkDialog parent;
+
+ /*< private > */
+ PlumaCloseConfirmationDialogPrivate *priv;
+};
+
+struct _PlumaCloseConfirmationDialogClass
+{
+ GtkDialogClass parent_class;
+};
+
+GType pluma_close_confirmation_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget *pluma_close_confirmation_dialog_new (GtkWindow *parent,
+ GList *unsaved_documents,
+ gboolean logout_mode);
+GtkWidget *pluma_close_confirmation_dialog_new_single (GtkWindow *parent,
+ PlumaDocument *doc,
+ gboolean logout_mode);
+
+const GList *pluma_close_confirmation_dialog_get_unsaved_documents (PlumaCloseConfirmationDialog *dlg);
+
+GList *pluma_close_confirmation_dialog_get_selected_documents (PlumaCloseConfirmationDialog *dlg);
+
+#endif /* __PLUMA_CLOSE_CONFIRMATION_DIALOG_H__ */
+
diff --git a/pluma/dialogs/pluma-encodings-dialog.c b/pluma/dialogs/pluma-encodings-dialog.c
new file mode 100755
index 00000000..b64fe1d8
--- /dev/null
+++ b/pluma/dialogs/pluma-encodings-dialog.c
@@ -0,0 +1,499 @@
+/*
+ * pluma-encodings-dialog.c
+ * This file is part of pluma
+ *
+ * Copyright (C) 2002-2005 Paolo Maggi
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2002-2005. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+
+#include <glib.h>
+#include <glib/gi18n.h>
+#include <gtk/gtk.h>
+
+#include "pluma-encodings-dialog.h"
+#include "pluma-encodings.h"
+#include "pluma-prefs-manager.h"
+#include "pluma-utils.h"
+#include "pluma-debug.h"
+#include "pluma-help.h"
+#include "pluma-dirs.h"
+
+#define PLUMA_ENCODINGS_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ PLUMA_TYPE_ENCODINGS_DIALOG, \
+ PlumaEncodingsDialogPrivate))
+
+struct _PlumaEncodingsDialogPrivate
+{
+ GtkListStore *available_liststore;
+ GtkListStore *displayed_liststore;
+ GtkWidget *available_treeview;
+ GtkWidget *displayed_treeview;
+ GtkWidget *add_button;
+ GtkWidget *remove_button;
+
+ GSList *show_in_menu_list;
+};
+
+G_DEFINE_TYPE(PlumaEncodingsDialog, pluma_encodings_dialog, GTK_TYPE_DIALOG)
+
+static void
+pluma_encodings_dialog_finalize (GObject *object)
+{
+ PlumaEncodingsDialogPrivate *priv = PLUMA_ENCODINGS_DIALOG (object)->priv;
+
+ g_slist_free (priv->show_in_menu_list);
+
+ G_OBJECT_CLASS (pluma_encodings_dialog_parent_class)->finalize (object);
+}
+
+static void
+pluma_encodings_dialog_class_init (PlumaEncodingsDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ object_class->finalize = pluma_encodings_dialog_finalize;
+
+ g_type_class_add_private (object_class, sizeof (PlumaEncodingsDialogPrivate));
+}
+
+enum {
+ COLUMN_NAME,
+ COLUMN_CHARSET,
+ N_COLUMNS
+};
+
+static void
+count_selected_items_func (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ int *count = data;
+
+ *count += 1;
+}
+
+static void
+available_selection_changed_callback (GtkTreeSelection *selection,
+ PlumaEncodingsDialog *dialogs)
+{
+ int count;
+
+ count = 0;
+ gtk_tree_selection_selected_foreach (selection,
+ count_selected_items_func,
+ &count);
+
+ gtk_widget_set_sensitive (dialogs->priv->add_button, count > 0);
+}
+
+static void
+displayed_selection_changed_callback (GtkTreeSelection *selection,
+ PlumaEncodingsDialog *dialogs)
+{
+ int count;
+
+ count = 0;
+ gtk_tree_selection_selected_foreach (selection,
+ count_selected_items_func,
+ &count);
+
+ gtk_widget_set_sensitive (dialogs->priv->remove_button, count > 0);
+}
+
+static void
+get_selected_encodings_func (GtkTreeModel *model,
+ GtkTreePath *path,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ GSList **list = data;
+ gchar *charset;
+ const PlumaEncoding *enc;
+
+ charset = NULL;
+ gtk_tree_model_get (model, iter, COLUMN_CHARSET, &charset, -1);
+
+ enc = pluma_encoding_get_from_charset (charset);
+ g_free (charset);
+
+ *list = g_slist_prepend (*list, (gpointer)enc);
+}
+
+static void
+update_shown_in_menu_tree_model (GtkListStore *store,
+ GSList *list)
+{
+ GtkTreeIter iter;
+
+ gtk_list_store_clear (store);
+
+ while (list != NULL)
+ {
+ const PlumaEncoding *enc;
+
+ enc = (const PlumaEncoding*) list->data;
+
+ gtk_list_store_append (store, &iter);
+ gtk_list_store_set (store, &iter,
+ COLUMN_CHARSET,
+ pluma_encoding_get_charset (enc),
+ COLUMN_NAME,
+ pluma_encoding_get_name (enc), -1);
+
+ list = g_slist_next (list);
+ }
+}
+
+static void
+add_button_clicked_callback (GtkWidget *button,
+ PlumaEncodingsDialog *dialog)
+{
+ GtkTreeSelection *selection;
+ GSList *encodings;
+ GSList *tmp;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->priv->available_treeview));
+
+ encodings = NULL;
+ gtk_tree_selection_selected_foreach (selection,
+ get_selected_encodings_func,
+ &encodings);
+
+ tmp = encodings;
+ while (tmp != NULL)
+ {
+ if (g_slist_find (dialog->priv->show_in_menu_list, tmp->data) == NULL)
+ dialog->priv->show_in_menu_list = g_slist_prepend (dialog->priv->show_in_menu_list,
+ tmp->data);
+
+ tmp = g_slist_next (tmp);
+ }
+
+ g_slist_free (encodings);
+
+ update_shown_in_menu_tree_model (GTK_LIST_STORE (dialog->priv->displayed_liststore),
+ dialog->priv->show_in_menu_list);
+}
+
+static void
+remove_button_clicked_callback (GtkWidget *button,
+ PlumaEncodingsDialog *dialog)
+{
+ GtkTreeSelection *selection;
+ GSList *encodings;
+ GSList *tmp;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dialog->priv->displayed_treeview));
+
+ encodings = NULL;
+ gtk_tree_selection_selected_foreach (selection,
+ get_selected_encodings_func,
+ &encodings);
+
+ tmp = encodings;
+ while (tmp != NULL)
+ {
+ dialog->priv->show_in_menu_list = g_slist_remove (dialog->priv->show_in_menu_list,
+ tmp->data);
+
+ tmp = g_slist_next (tmp);
+ }
+
+ g_slist_free (encodings);
+
+ update_shown_in_menu_tree_model (GTK_LIST_STORE (dialog->priv->displayed_liststore),
+ dialog->priv->show_in_menu_list);
+}
+
+static void
+init_shown_in_menu_tree_model (PlumaEncodingsDialog *dialog)
+{
+ GtkTreeIter iter;
+ GSList *list, *tmp;
+
+ /* add data to the list store */
+ list = pluma_prefs_manager_get_shown_in_menu_encodings ();
+
+ tmp = list;
+
+ while (tmp != NULL)
+ {
+ const PlumaEncoding *enc;
+
+ enc = (const PlumaEncoding *) tmp->data;
+
+ dialog->priv->show_in_menu_list = g_slist_prepend (dialog->priv->show_in_menu_list,
+ tmp->data);
+
+ gtk_list_store_append (dialog->priv->displayed_liststore,
+ &iter);
+ gtk_list_store_set (dialog->priv->displayed_liststore,
+ &iter,
+ COLUMN_CHARSET,
+ pluma_encoding_get_charset (enc),
+ COLUMN_NAME,
+ pluma_encoding_get_name (enc), -1);
+
+ tmp = g_slist_next (tmp);
+ }
+
+ g_slist_free (list);
+}
+
+static void
+response_handler (GtkDialog *dialog,
+ gint response_id,
+ PlumaEncodingsDialog *dlg)
+{
+ if (response_id == GTK_RESPONSE_HELP)
+ {
+ pluma_help_display (GTK_WINDOW (dialog), "pluma", NULL);
+ g_signal_stop_emission_by_name (dialog, "response");
+ return;
+ }
+
+ if (response_id == GTK_RESPONSE_OK)
+ {
+ g_return_if_fail (pluma_prefs_manager_shown_in_menu_encodings_can_set ());
+ pluma_prefs_manager_set_shown_in_menu_encodings (dlg->priv->show_in_menu_list);
+ }
+}
+
+static void
+pluma_encodings_dialog_init (PlumaEncodingsDialog *dlg)
+{
+ GtkWidget *content;
+ GtkCellRenderer *cell_renderer;
+ GtkTreeModel *sort_model;
+ GtkTreeViewColumn *column;
+ GtkTreeIter parent_iter;
+ GtkTreeSelection *selection;
+ const PlumaEncoding *enc;
+ GtkWidget *error_widget;
+ int i;
+ gboolean ret;
+ gchar *file;
+ gchar *root_objects[] = {
+ "encodings-dialog-contents",
+ NULL
+ };
+
+ dlg->priv = PLUMA_ENCODINGS_DIALOG_GET_PRIVATE (dlg);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (dlg),
+ GTK_STOCK_CANCEL,
+ GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK,
+ GTK_RESPONSE_OK,
+ GTK_STOCK_HELP,
+ GTK_RESPONSE_HELP,
+ NULL);
+
+ gtk_window_set_title (GTK_WINDOW (dlg), _("Character Encodings"));
+ gtk_window_set_default_size (GTK_WINDOW (dlg), 650, 400);
+ gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+
+ /* HIG defaults */
+ gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 6);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dlg),
+ GTK_RESPONSE_OK);
+
+ g_signal_connect (dlg,
+ "response",
+ G_CALLBACK (response_handler),
+ dlg);
+
+ file = pluma_dirs_get_ui_file ("pluma-encodings-dialog.ui");
+ ret = pluma_utils_get_ui_objects (file,
+ root_objects,
+ &error_widget,
+ "encodings-dialog-contents", &content,
+ "add-button", &dlg->priv->add_button,
+ "remove-button", &dlg->priv->remove_button,
+ "available-treeview", &dlg->priv->available_treeview,
+ "displayed-treeview", &dlg->priv->displayed_treeview,
+ NULL);
+ g_free (file);
+
+ if (!ret)
+ {
+ gtk_widget_show (error_widget);
+
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ error_widget,
+ TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (error_widget), 5);
+
+ return;
+ }
+
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ content, TRUE, TRUE, 0);
+ g_object_unref (content);
+ gtk_container_set_border_width (GTK_CONTAINER (content), 5);
+
+ g_signal_connect (dlg->priv->add_button,
+ "clicked",
+ G_CALLBACK (add_button_clicked_callback),
+ dlg);
+ g_signal_connect (dlg->priv->remove_button,
+ "clicked",
+ G_CALLBACK (remove_button_clicked_callback),
+ dlg);
+
+ /* Tree view of available encodings */
+ dlg->priv->available_liststore = gtk_list_store_new (N_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ cell_renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("_Description"),
+ cell_renderer,
+ "text", COLUMN_NAME,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->priv->available_treeview),
+ column);
+ gtk_tree_view_column_set_sort_column_id (column, COLUMN_NAME);
+
+ cell_renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("_Encoding"),
+ cell_renderer,
+ "text",
+ COLUMN_CHARSET,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->priv->available_treeview),
+ column);
+ gtk_tree_view_column_set_sort_column_id (column, COLUMN_CHARSET);
+
+ /* Add the data */
+ i = 0;
+ while ((enc = pluma_encoding_get_from_index (i)) != NULL)
+ {
+ gtk_list_store_append (dlg->priv->available_liststore,
+ &parent_iter);
+ gtk_list_store_set (dlg->priv->available_liststore,
+ &parent_iter,
+ COLUMN_CHARSET,
+ pluma_encoding_get_charset (enc),
+ COLUMN_NAME,
+ pluma_encoding_get_name (enc), -1);
+
+ ++i;
+ }
+
+ /* Sort model */
+ sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (dlg->priv->available_liststore));
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (sort_model),
+ COLUMN_NAME,
+ GTK_SORT_ASCENDING);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->priv->available_treeview),
+ sort_model);
+ g_object_unref (G_OBJECT (dlg->priv->available_liststore));
+ g_object_unref (G_OBJECT (sort_model));
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->priv->available_treeview));
+ gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
+ GTK_SELECTION_MULTIPLE);
+
+ available_selection_changed_callback (selection, dlg);
+ g_signal_connect (selection,
+ "changed",
+ G_CALLBACK (available_selection_changed_callback),
+ dlg);
+
+ /* Tree view of selected encodings */
+ dlg->priv->displayed_liststore = gtk_list_store_new (N_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ cell_renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("_Description"),
+ cell_renderer,
+ "text", COLUMN_NAME,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->priv->displayed_treeview),
+ column);
+ gtk_tree_view_column_set_sort_column_id (column, COLUMN_NAME);
+
+ cell_renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new_with_attributes (_("_Encoding"),
+ cell_renderer,
+ "text",
+ COLUMN_CHARSET,
+ NULL);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->priv->displayed_treeview),
+ column);
+ gtk_tree_view_column_set_sort_column_id (column, COLUMN_CHARSET);
+
+ /* Add the data */
+ init_shown_in_menu_tree_model (dlg);
+
+ /* Sort model */
+ sort_model = gtk_tree_model_sort_new_with_model (GTK_TREE_MODEL (dlg->priv->displayed_liststore));
+
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE
+ (sort_model), COLUMN_NAME,
+ GTK_SORT_ASCENDING);
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->priv->displayed_treeview),
+ sort_model);
+ g_object_unref (G_OBJECT (sort_model));
+ g_object_unref (G_OBJECT (dlg->priv->displayed_liststore));
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->priv->displayed_treeview));
+ gtk_tree_selection_set_mode (GTK_TREE_SELECTION (selection),
+ GTK_SELECTION_MULTIPLE);
+
+ displayed_selection_changed_callback (selection, dlg);
+ g_signal_connect (selection,
+ "changed",
+ G_CALLBACK (displayed_selection_changed_callback),
+ dlg);
+}
+
+GtkWidget *
+pluma_encodings_dialog_new (void)
+{
+ GtkWidget *dlg;
+
+ dlg = GTK_WIDGET (g_object_new (PLUMA_TYPE_ENCODINGS_DIALOG, NULL));
+
+ return dlg;
+}
+
diff --git a/pluma/dialogs/pluma-encodings-dialog.h b/pluma/dialogs/pluma-encodings-dialog.h
new file mode 100755
index 00000000..a9aeed65
--- /dev/null
+++ b/pluma/dialogs/pluma-encodings-dialog.h
@@ -0,0 +1,86 @@
+/*
+ * pluma-encodings-dialog.h
+ * This file is part of pluma
+ *
+ * Copyright (C) 2003-2005 Paolo Maggi
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2003-2005. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifndef __PLUMA_ENCODINGS_DIALOG_H__
+#define __PLUMA_ENCODINGS_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define PLUMA_TYPE_ENCODINGS_DIALOG (pluma_encodings_dialog_get_type())
+#define PLUMA_ENCODINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_ENCODINGS_DIALOG, PlumaEncodingsDialog))
+#define PLUMA_ENCODINGS_DIALOG_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_ENCODINGS_DIALOG, PlumaEncodingsDialog const))
+#define PLUMA_ENCODINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_ENCODINGS_DIALOG, PlumaEncodingsDialogClass))
+#define PLUMA_IS_ENCODINGS_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_ENCODINGS_DIALOG))
+#define PLUMA_IS_ENCODINGS_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_ENCODINGS_DIALOG))
+#define PLUMA_ENCODINGS_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_ENCODINGS_DIALOG, PlumaEncodingsDialogClass))
+
+
+/* Private structure type */
+typedef struct _PlumaEncodingsDialogPrivate PlumaEncodingsDialogPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _PlumaEncodingsDialog PlumaEncodingsDialog;
+
+struct _PlumaEncodingsDialog
+{
+ GtkDialog dialog;
+
+ /*< private > */
+ PlumaEncodingsDialogPrivate *priv;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _PlumaEncodingsDialogClass PlumaEncodingsDialogClass;
+
+struct _PlumaEncodingsDialogClass
+{
+ GtkDialogClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType pluma_encodings_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget *pluma_encodings_dialog_new (void);
+
+G_END_DECLS
+
+#endif /* __PLUMA_ENCODINGS_DIALOG_H__ */
+
diff --git a/pluma/dialogs/pluma-encodings-dialog.ui b/pluma/dialogs/pluma-encodings-dialog.ui
new file mode 100755
index 00000000..0f37b432
--- /dev/null
+++ b/pluma/dialogs/pluma-encodings-dialog.ui
@@ -0,0 +1,256 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+ <object class="GtkDialog" id="encodings-dialog">
+ <property name="width_request">650</property>
+ <property name="height_request">400</property>
+ <property name="title" translatable="yes">Character encodings</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">True</property>
+ <property name="resizable">True</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area3">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_END</property>
+ <child>
+ <object class="GtkButton" id="helpbutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-help</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="closebutton1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-cancel</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="button1">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-ok</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="encodings-dialog-contents">
+ <property name="border_width">6</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkVBox" id="vbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="available-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">A_vailable encodings:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">available-treeview</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <child>
+ <object class="GtkTreeView" id="available-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox6">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+ <child>
+ <object class="GtkButton" id="add-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-add</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox7">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="displayed-label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">E_ncodings shown in menu:</property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="mnemonic_widget">displayed-treeview</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow3">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="vscrollbar_policy">GTK_POLICY_AUTOMATIC</property>
+ <property name="shadow_type">GTK_SHADOW_ETCHED_IN</property>
+ <property name="window_placement">GTK_CORNER_TOP_LEFT</property>
+ <child>
+ <object class="GtkTreeView" id="displayed-treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="headers_visible">True</property>
+ <property name="rules_hint">True</property>
+ <property name="reorderable">False</property>
+ <property name="enable_search">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox8">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">0</property>
+ <child>
+ <object class="GtkButton" id="remove-button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-remove</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">helpbutton1</action-widget>
+ <action-widget response="-6">closebutton1</action-widget>
+ <action-widget response="-5">button1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/pluma/dialogs/pluma-preferences-dialog.c b/pluma/dialogs/pluma-preferences-dialog.c
new file mode 100755
index 00000000..e14cb83d
--- /dev/null
+++ b/pluma/dialogs/pluma-preferences-dialog.c
@@ -0,0 +1,1189 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * pluma-preferences-dialog.c
+ * This file is part of pluma
+ *
+ * Copyright (C) 2001-2005 Paolo Maggi
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2001-2003. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+
+#include <glib/gi18n.h>
+#include <mateconf/mateconf-client.h>
+
+#include <pluma/pluma-prefs-manager.h>
+
+#include "pluma-preferences-dialog.h"
+#include "pluma-utils.h"
+#include "pluma-debug.h"
+#include "pluma-document.h"
+#include "pluma-style-scheme-manager.h"
+#include "pluma-plugin-manager.h"
+#include "pluma-help.h"
+#include "pluma-dirs.h"
+
+/*
+ * pluma-preferences dialog is a singleton since we don't
+ * want two dialogs showing an inconsistent state of the
+ * preferences.
+ * When pluma_show_preferences_dialog is called and there
+ * is already a prefs dialog dialog open, it is reparented
+ * and shown.
+ */
+
+static GtkWidget *preferences_dialog = NULL;
+
+
+enum
+{
+ ID_COLUMN = 0,
+ NAME_COLUMN,
+ DESC_COLUMN,
+ NUM_COLUMNS
+};
+
+
+#define PLUMA_PREFERENCES_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ PLUMA_TYPE_PREFERENCES_DIALOG, \
+ PlumaPreferencesDialogPrivate))
+
+struct _PlumaPreferencesDialogPrivate
+{
+ GtkWidget *notebook;
+
+ /* Font */
+ GtkWidget *default_font_checkbutton;
+ GtkWidget *font_button;
+ GtkWidget *font_hbox;
+
+ /* Style Scheme */
+ GtkListStore *schemes_treeview_model;
+ GtkWidget *schemes_treeview;
+ GtkWidget *install_scheme_button;
+ GtkWidget *uninstall_scheme_button;
+
+ GtkWidget *install_scheme_file_schooser;
+
+ /* Tabs */
+ GtkWidget *tabs_width_spinbutton;
+ GtkWidget *insert_spaces_checkbutton;
+ GtkWidget *tabs_width_hbox;
+
+ /* Auto indentation */
+ GtkWidget *auto_indent_checkbutton;
+
+ /* Text Wrapping */
+ GtkWidget *wrap_text_checkbutton;
+ GtkWidget *split_checkbutton;
+
+ /* File Saving */
+ GtkWidget *backup_copy_checkbutton;
+ GtkWidget *auto_save_checkbutton;
+ GtkWidget *auto_save_spinbutton;
+ GtkWidget *autosave_hbox;
+
+ /* Line numbers */
+ GtkWidget *display_line_numbers_checkbutton;
+
+ /* Highlight current line */
+ GtkWidget *highlight_current_line_checkbutton;
+
+ /* Highlight matching bracket */
+ GtkWidget *bracket_matching_checkbutton;
+
+ /* Right margin */
+ GtkWidget *right_margin_checkbutton;
+ GtkWidget *right_margin_position_spinbutton;
+ GtkWidget *right_margin_position_hbox;
+
+ /* Plugins manager */
+ GtkWidget *plugin_manager_place_holder;
+
+ /* Style Scheme editor dialog */
+ GtkWidget *style_scheme_dialog;
+};
+
+
+G_DEFINE_TYPE(PlumaPreferencesDialog, pluma_preferences_dialog, GTK_TYPE_DIALOG)
+
+
+static void
+pluma_preferences_dialog_class_init (PlumaPreferencesDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+
+ g_type_class_add_private (object_class, sizeof (PlumaPreferencesDialogPrivate));
+}
+
+static void
+dialog_response_handler (GtkDialog *dlg,
+ gint res_id)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ switch (res_id)
+ {
+ case GTK_RESPONSE_HELP:
+ pluma_help_display (GTK_WINDOW (dlg),
+ NULL,
+ "pluma-prefs");
+
+ g_signal_stop_emission_by_name (dlg, "response");
+
+ break;
+
+ default:
+ gtk_widget_destroy (GTK_WIDGET(dlg));
+ }
+}
+
+static void
+tabs_width_spinbutton_value_changed (GtkSpinButton *spin_button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (spin_button == GTK_SPIN_BUTTON (dlg->priv->tabs_width_spinbutton));
+
+ pluma_prefs_manager_set_tabs_size (gtk_spin_button_get_value_as_int (spin_button));
+}
+
+static void
+insert_spaces_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->insert_spaces_checkbutton));
+
+ pluma_prefs_manager_set_insert_spaces (gtk_toggle_button_get_active (button));
+}
+
+static void
+auto_indent_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->auto_indent_checkbutton));
+
+ pluma_prefs_manager_set_auto_indent (gtk_toggle_button_get_active (button));
+}
+
+static void
+auto_save_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->auto_save_checkbutton));
+
+ if (gtk_toggle_button_get_active (button))
+ {
+ gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton,
+ pluma_prefs_manager_auto_save_interval_can_set());
+
+ pluma_prefs_manager_set_auto_save (TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton, FALSE);
+ pluma_prefs_manager_set_auto_save (FALSE);
+ }
+}
+
+static void
+backup_copy_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->backup_copy_checkbutton));
+
+ pluma_prefs_manager_set_create_backup_copy (gtk_toggle_button_get_active (button));
+}
+
+static void
+auto_save_spinbutton_value_changed (GtkSpinButton *spin_button,
+ PlumaPreferencesDialog *dlg)
+{
+ g_return_if_fail (spin_button == GTK_SPIN_BUTTON (dlg->priv->auto_save_spinbutton));
+
+ pluma_prefs_manager_set_auto_save_interval (
+ MAX (1, gtk_spin_button_get_value_as_int (spin_button)));
+}
+
+static void
+setup_editor_page (PlumaPreferencesDialog *dlg)
+{
+ gboolean auto_save;
+ gint auto_save_interval;
+
+ pluma_debug (DEBUG_PREFS);
+
+ /* Set initial state */
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->tabs_width_spinbutton),
+ (guint) pluma_prefs_manager_get_tabs_size ());
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->insert_spaces_checkbutton),
+ pluma_prefs_manager_get_insert_spaces ());
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->auto_indent_checkbutton),
+ pluma_prefs_manager_get_auto_indent ());
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->backup_copy_checkbutton),
+ pluma_prefs_manager_get_create_backup_copy ());
+
+ auto_save = pluma_prefs_manager_get_auto_save ();
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->auto_save_checkbutton),
+ auto_save);
+
+ auto_save_interval = pluma_prefs_manager_get_auto_save_interval ();
+ if (auto_save_interval <= 0)
+ auto_save_interval = GPM_DEFAULT_AUTO_SAVE_INTERVAL;
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->auto_save_spinbutton),
+ auto_save_interval);
+
+ /* Set widget sensitivity */
+ gtk_widget_set_sensitive (dlg->priv->tabs_width_hbox,
+ pluma_prefs_manager_tabs_size_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->insert_spaces_checkbutton,
+ pluma_prefs_manager_insert_spaces_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->auto_indent_checkbutton,
+ pluma_prefs_manager_auto_indent_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->backup_copy_checkbutton,
+ pluma_prefs_manager_create_backup_copy_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->autosave_hbox,
+ pluma_prefs_manager_auto_save_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->auto_save_spinbutton,
+ auto_save &&
+ pluma_prefs_manager_auto_save_interval_can_set ());
+
+ /* Connect signal */
+ g_signal_connect (dlg->priv->tabs_width_spinbutton,
+ "value_changed",
+ G_CALLBACK (tabs_width_spinbutton_value_changed),
+ dlg);
+ g_signal_connect (dlg->priv->insert_spaces_checkbutton,
+ "toggled",
+ G_CALLBACK (insert_spaces_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->auto_indent_checkbutton,
+ "toggled",
+ G_CALLBACK (auto_indent_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->auto_save_checkbutton,
+ "toggled",
+ G_CALLBACK (auto_save_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->backup_copy_checkbutton,
+ "toggled",
+ G_CALLBACK (backup_copy_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->auto_save_spinbutton,
+ "value_changed",
+ G_CALLBACK (auto_save_spinbutton_value_changed),
+ dlg);
+}
+
+static void
+display_line_numbers_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ g_return_if_fail (button ==
+ GTK_TOGGLE_BUTTON (dlg->priv->display_line_numbers_checkbutton));
+
+ pluma_prefs_manager_set_display_line_numbers (gtk_toggle_button_get_active (button));
+}
+
+static void
+highlight_current_line_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ g_return_if_fail (button ==
+ GTK_TOGGLE_BUTTON (dlg->priv->highlight_current_line_checkbutton));
+
+ pluma_prefs_manager_set_highlight_current_line (gtk_toggle_button_get_active (button));
+}
+
+static void
+bracket_matching_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ g_return_if_fail (button ==
+ GTK_TOGGLE_BUTTON (dlg->priv->bracket_matching_checkbutton));
+
+ pluma_prefs_manager_set_bracket_matching (
+ gtk_toggle_button_get_active (button));
+}
+
+static gboolean split_button_state = TRUE;
+
+static void
+wrap_mode_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ if (!gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dlg->priv->wrap_text_checkbutton)))
+ {
+ pluma_prefs_manager_set_wrap_mode (GTK_WRAP_NONE);
+
+ gtk_widget_set_sensitive (dlg->priv->split_checkbutton,
+ FALSE);
+ gtk_toggle_button_set_inconsistent (
+ GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (dlg->priv->split_checkbutton,
+ TRUE);
+
+ gtk_toggle_button_set_inconsistent (
+ GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), FALSE);
+
+
+ if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton)))
+ {
+ split_button_state = TRUE;
+
+ pluma_prefs_manager_set_wrap_mode (GTK_WRAP_WORD);
+ }
+ else
+ {
+ split_button_state = FALSE;
+
+ pluma_prefs_manager_set_wrap_mode (GTK_WRAP_CHAR);
+ }
+ }
+}
+
+static void
+right_margin_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ gboolean active;
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->right_margin_checkbutton));
+
+ active = gtk_toggle_button_get_active (button);
+
+ pluma_prefs_manager_set_display_right_margin (active);
+
+ gtk_widget_set_sensitive (dlg->priv->right_margin_position_hbox,
+ active &&
+ pluma_prefs_manager_right_margin_position_can_set ());
+}
+
+static void
+right_margin_position_spinbutton_value_changed (GtkSpinButton *spin_button,
+ PlumaPreferencesDialog *dlg)
+{
+ gint value;
+
+ g_return_if_fail (spin_button == GTK_SPIN_BUTTON (dlg->priv->right_margin_position_spinbutton));
+
+ value = CLAMP (gtk_spin_button_get_value_as_int (spin_button), 1, 160);
+
+ pluma_prefs_manager_set_right_margin_position (value);
+}
+
+static void
+setup_view_page (PlumaPreferencesDialog *dlg)
+{
+ GtkWrapMode wrap_mode;
+ gboolean display_right_margin;
+ gboolean wrap_mode_can_set;
+
+ pluma_debug (DEBUG_PREFS);
+
+ /* Set initial state */
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->display_line_numbers_checkbutton),
+ pluma_prefs_manager_get_display_line_numbers ());
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->highlight_current_line_checkbutton),
+ pluma_prefs_manager_get_highlight_current_line ());
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->bracket_matching_checkbutton),
+ pluma_prefs_manager_get_bracket_matching ());
+
+ wrap_mode = pluma_prefs_manager_get_wrap_mode ();
+ switch (wrap_mode )
+ {
+ case GTK_WRAP_WORD:
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->wrap_text_checkbutton), TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), TRUE);
+ break;
+ case GTK_WRAP_CHAR:
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->wrap_text_checkbutton), TRUE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), FALSE);
+ break;
+ default:
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->wrap_text_checkbutton), FALSE);
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), split_button_state);
+ gtk_toggle_button_set_inconsistent (
+ GTK_TOGGLE_BUTTON (dlg->priv->split_checkbutton), TRUE);
+
+ }
+
+ display_right_margin = pluma_prefs_manager_get_display_right_margin ();
+
+ gtk_toggle_button_set_active (
+ GTK_TOGGLE_BUTTON (dlg->priv->right_margin_checkbutton),
+ display_right_margin);
+
+ gtk_spin_button_set_value (
+ GTK_SPIN_BUTTON (dlg->priv->right_margin_position_spinbutton),
+ (guint)CLAMP (pluma_prefs_manager_get_right_margin_position (), 1, 160));
+
+ /* Set widgets sensitivity */
+ gtk_widget_set_sensitive (dlg->priv->display_line_numbers_checkbutton,
+ pluma_prefs_manager_display_line_numbers_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->highlight_current_line_checkbutton,
+ pluma_prefs_manager_highlight_current_line_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->bracket_matching_checkbutton,
+ pluma_prefs_manager_bracket_matching_can_set ());
+ wrap_mode_can_set = pluma_prefs_manager_wrap_mode_can_set ();
+ gtk_widget_set_sensitive (dlg->priv->wrap_text_checkbutton,
+ wrap_mode_can_set);
+ gtk_widget_set_sensitive (dlg->priv->split_checkbutton,
+ wrap_mode_can_set &&
+ (wrap_mode != GTK_WRAP_NONE));
+ gtk_widget_set_sensitive (dlg->priv->right_margin_checkbutton,
+ pluma_prefs_manager_display_right_margin_can_set ());
+ gtk_widget_set_sensitive (dlg->priv->right_margin_position_hbox,
+ display_right_margin &&
+ pluma_prefs_manager_right_margin_position_can_set ());
+
+ /* Connect signals */
+ g_signal_connect (dlg->priv->display_line_numbers_checkbutton,
+ "toggled",
+ G_CALLBACK (display_line_numbers_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->highlight_current_line_checkbutton,
+ "toggled",
+ G_CALLBACK (highlight_current_line_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->bracket_matching_checkbutton,
+ "toggled",
+ G_CALLBACK (bracket_matching_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->wrap_text_checkbutton,
+ "toggled",
+ G_CALLBACK (wrap_mode_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->split_checkbutton,
+ "toggled",
+ G_CALLBACK (wrap_mode_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->right_margin_checkbutton,
+ "toggled",
+ G_CALLBACK (right_margin_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->right_margin_position_spinbutton,
+ "value_changed",
+ G_CALLBACK (right_margin_position_spinbutton_value_changed),
+ dlg);
+}
+
+static void
+default_font_font_checkbutton_toggled (GtkToggleButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (button == GTK_TOGGLE_BUTTON (dlg->priv->default_font_checkbutton));
+
+ if (gtk_toggle_button_get_active (button))
+ {
+ gtk_widget_set_sensitive (dlg->priv->font_hbox, FALSE);
+ pluma_prefs_manager_set_use_default_font (TRUE);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (dlg->priv->font_hbox,
+ pluma_prefs_manager_editor_font_can_set ());
+ pluma_prefs_manager_set_use_default_font (FALSE);
+ }
+}
+
+static void
+editor_font_button_font_set (GtkFontButton *font_button,
+ PlumaPreferencesDialog *dlg)
+{
+ const gchar *font_name;
+
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (font_button == GTK_FONT_BUTTON (dlg->priv->font_button));
+
+ /* FIXME: Can this fail? Gtk docs are a bit terse... 21-02-2004 pbor */
+ font_name = gtk_font_button_get_font_name (font_button);
+ if (!font_name)
+ {
+ g_warning ("Could not get font name");
+ return;
+ }
+
+ pluma_prefs_manager_set_editor_font (font_name);
+}
+
+static void
+setup_font_colors_page_font_section (PlumaPreferencesDialog *dlg)
+{
+ gboolean use_default_font;
+ gchar *editor_font = NULL;
+ gchar *label;
+
+ pluma_debug (DEBUG_PREFS);
+
+ gtk_widget_set_tooltip_text (dlg->priv->font_button,
+ _("Click on this button to select the font to be used by the editor"));
+
+ pluma_utils_set_atk_relation (dlg->priv->font_button,
+ dlg->priv->default_font_checkbutton,
+ ATK_RELATION_CONTROLLED_BY);
+ pluma_utils_set_atk_relation (dlg->priv->default_font_checkbutton,
+ dlg->priv->font_button,
+ ATK_RELATION_CONTROLLER_FOR);
+
+ editor_font = pluma_prefs_manager_get_system_font ();
+ label = g_strdup_printf(_("_Use the system fixed width font (%s)"),
+ editor_font);
+ gtk_button_set_label (GTK_BUTTON (dlg->priv->default_font_checkbutton),
+ label);
+ g_free (editor_font);
+ g_free (label);
+
+ /* read current config and setup initial state */
+ use_default_font = pluma_prefs_manager_get_use_default_font ();
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->default_font_checkbutton),
+ use_default_font);
+
+ editor_font = pluma_prefs_manager_get_editor_font ();
+ if (editor_font != NULL)
+ {
+ gtk_font_button_set_font_name (GTK_FONT_BUTTON (dlg->priv->font_button),
+ editor_font);
+ g_free (editor_font);
+ }
+
+ /* Connect signals */
+ g_signal_connect (dlg->priv->default_font_checkbutton,
+ "toggled",
+ G_CALLBACK (default_font_font_checkbutton_toggled),
+ dlg);
+ g_signal_connect (dlg->priv->font_button,
+ "font_set",
+ G_CALLBACK (editor_font_button_font_set),
+ dlg);
+
+ /* Set initial widget sensitivity */
+ gtk_widget_set_sensitive (dlg->priv->default_font_checkbutton,
+ pluma_prefs_manager_use_default_font_can_set ());
+
+ if (use_default_font)
+ gtk_widget_set_sensitive (dlg->priv->font_hbox, FALSE);
+ else
+ gtk_widget_set_sensitive (dlg->priv->font_hbox,
+ pluma_prefs_manager_editor_font_can_set ());
+}
+
+static void
+set_buttons_sensisitivity_according_to_scheme (PlumaPreferencesDialog *dlg,
+ const gchar *scheme_id)
+{
+ gboolean editable;
+
+ editable = (scheme_id != NULL) &&
+ _pluma_style_scheme_manager_scheme_is_pluma_user_scheme (
+ pluma_get_style_scheme_manager (),
+ scheme_id);
+
+ gtk_widget_set_sensitive (dlg->priv->uninstall_scheme_button,
+ editable);
+}
+
+static void
+style_scheme_changed (GtkWidget *treeview,
+ PlumaPreferencesDialog *dlg)
+{
+ GtkTreePath *path;
+ GtkTreeIter iter;
+ gchar *id;
+
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (dlg->priv->schemes_treeview), &path, NULL);
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (dlg->priv->schemes_treeview_model),
+ &iter, path);
+ gtk_tree_path_free (path);
+ gtk_tree_model_get (GTK_TREE_MODEL (dlg->priv->schemes_treeview_model),
+ &iter, ID_COLUMN, &id, -1);
+
+ pluma_prefs_manager_set_source_style_scheme (id);
+
+ set_buttons_sensisitivity_according_to_scheme (dlg, id);
+
+ g_free (id);
+}
+
+static const gchar *
+ensure_color_scheme_id (const gchar *id)
+{
+ GtkSourceStyleScheme *scheme = NULL;
+ GtkSourceStyleSchemeManager *manager = pluma_get_style_scheme_manager ();
+
+ if (id == NULL)
+ {
+ gchar *pref_id;
+
+ pref_id = pluma_prefs_manager_get_source_style_scheme ();
+ scheme = gtk_source_style_scheme_manager_get_scheme (manager,
+ pref_id);
+ g_free (pref_id);
+ }
+ else
+ {
+ scheme = gtk_source_style_scheme_manager_get_scheme (manager,
+ id);
+ }
+
+ if (scheme == NULL)
+ {
+ /* Fall-back to classic style scheme */
+ scheme = gtk_source_style_scheme_manager_get_scheme (manager,
+ "classic");
+ }
+
+ if (scheme == NULL)
+ {
+ /* Cannot determine default style scheme -> broken GtkSourceView installation */
+ return NULL;
+ }
+
+ return gtk_source_style_scheme_get_id (scheme);
+}
+
+/* If def_id is NULL, use the default scheme as returned by
+ * pluma_style_scheme_manager_get_default_scheme. If this one returns NULL
+ * use the first available scheme as default */
+static const gchar *
+populate_color_scheme_list (PlumaPreferencesDialog *dlg, const gchar *def_id)
+{
+ GSList *schemes;
+ GSList *l;
+
+ gtk_list_store_clear (dlg->priv->schemes_treeview_model);
+
+ def_id = ensure_color_scheme_id (def_id);
+ if (def_id == NULL)
+ {
+ g_warning ("Cannot build the list of available color schemes.\n"
+ "Please check your GtkSourceView installation.");
+ return NULL;
+ }
+
+ schemes = pluma_style_scheme_manager_list_schemes_sorted (pluma_get_style_scheme_manager ());
+ l = schemes;
+ while (l != NULL)
+ {
+ GtkSourceStyleScheme *scheme;
+ const gchar *id;
+ const gchar *name;
+ const gchar *description;
+ GtkTreeIter iter;
+
+ scheme = GTK_SOURCE_STYLE_SCHEME (l->data);
+
+ id = gtk_source_style_scheme_get_id (scheme);
+ name = gtk_source_style_scheme_get_name (scheme);
+ description = gtk_source_style_scheme_get_description (scheme);
+
+ gtk_list_store_append (dlg->priv->schemes_treeview_model, &iter);
+ gtk_list_store_set (dlg->priv->schemes_treeview_model,
+ &iter,
+ ID_COLUMN, id,
+ NAME_COLUMN, name,
+ DESC_COLUMN, description,
+ -1);
+
+ g_return_val_if_fail (def_id != NULL, NULL);
+ if (strcmp (id, def_id) == 0)
+ {
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->priv->schemes_treeview));
+ gtk_tree_selection_select_iter (selection, &iter);
+ }
+
+ l = g_slist_next (l);
+ }
+
+ g_slist_free (schemes);
+
+ return def_id;
+}
+
+static void
+add_scheme_chooser_response_cb (GtkDialog *chooser,
+ gint res_id,
+ PlumaPreferencesDialog *dlg)
+{
+ gchar* filename;
+ const gchar *scheme_id;
+
+ if (res_id != GTK_RESPONSE_ACCEPT)
+ {
+ gtk_widget_hide (GTK_WIDGET (chooser));
+ return;
+ }
+
+ filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (chooser));
+ if (filename == NULL)
+ return;
+
+ gtk_widget_hide (GTK_WIDGET (chooser));
+
+ scheme_id = _pluma_style_scheme_manager_install_scheme (
+ pluma_get_style_scheme_manager (),
+ filename);
+ g_free (filename);
+
+ if (scheme_id == NULL)
+ {
+ pluma_warning (GTK_WINDOW (dlg),
+ _("The selected color scheme cannot be installed."));
+
+ return;
+ }
+
+ pluma_prefs_manager_set_source_style_scheme (scheme_id);
+
+ scheme_id = populate_color_scheme_list (dlg, scheme_id);
+
+ set_buttons_sensisitivity_according_to_scheme (dlg, scheme_id);
+}
+
+static void
+install_scheme_clicked (GtkButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ GtkWidget *chooser;
+ GtkFileFilter *filter;
+
+ if (dlg->priv->install_scheme_file_schooser != NULL) {
+ gtk_window_present (GTK_WINDOW (dlg->priv->install_scheme_file_schooser));
+ gtk_widget_grab_focus (dlg->priv->install_scheme_file_schooser);
+ return;
+ }
+
+ chooser = gtk_file_chooser_dialog_new (_("Add Scheme"),
+ GTK_WINDOW (dlg),
+ GTK_FILE_CHOOSER_ACTION_OPEN,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ NULL);
+
+ pluma_dialog_add_button (GTK_DIALOG (chooser),
+ _("A_dd Scheme"),
+ GTK_STOCK_ADD,
+ GTK_RESPONSE_ACCEPT);
+
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (chooser), TRUE);
+
+ /* Filters */
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("Color Scheme Files"));
+ gtk_file_filter_add_pattern (filter, "*.xml");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ gtk_file_chooser_set_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ filter = gtk_file_filter_new ();
+ gtk_file_filter_set_name (filter, _("All Files"));
+ gtk_file_filter_add_pattern (filter, "*");
+ gtk_file_chooser_add_filter (GTK_FILE_CHOOSER (chooser), filter);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (chooser), GTK_RESPONSE_ACCEPT);
+
+ g_signal_connect (chooser,
+ "response",
+ G_CALLBACK (add_scheme_chooser_response_cb),
+ dlg);
+
+ dlg->priv->install_scheme_file_schooser = chooser;
+
+ g_object_add_weak_pointer (G_OBJECT (chooser),
+ (gpointer) &dlg->priv->install_scheme_file_schooser);
+
+ gtk_widget_show (chooser);
+}
+
+static void
+uninstall_scheme_clicked (GtkButton *button,
+ PlumaPreferencesDialog *dlg)
+{
+ GtkTreeSelection *selection;
+ GtkTreeModel *model;
+ GtkTreeIter iter;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->priv->schemes_treeview));
+ model = GTK_TREE_MODEL (dlg->priv->schemes_treeview_model);
+
+ if (gtk_tree_selection_get_selected (selection,
+ &model,
+ &iter))
+ {
+ gchar *id;
+ gchar *name;
+
+ gtk_tree_model_get (model, &iter,
+ ID_COLUMN, &id,
+ NAME_COLUMN, &name,
+ -1);
+
+ if (!_pluma_style_scheme_manager_uninstall_scheme (pluma_get_style_scheme_manager (), id))
+ {
+ pluma_warning (GTK_WINDOW (dlg),
+ _("Could not remove color scheme \"%s\"."),
+ name);
+ }
+ else
+ {
+ const gchar *real_new_id;
+ gchar *new_id = NULL;
+ GtkTreePath *path;
+ GtkTreeIter new_iter;
+ gboolean new_iter_set = FALSE;
+
+ /* If the removed style scheme is the last of the list,
+ * set as new default style scheme the previous one,
+ * otherwise set the next one.
+ * To make this possible, we need to get the id of the
+ * new default style scheme before re-populating the list.
+ * Fall back to "classic" if it is not possible to get
+ * the id
+ */
+ path = gtk_tree_model_get_path (model, &iter);
+
+ /* Try to move to the next path */
+ gtk_tree_path_next (path);
+ if (!gtk_tree_model_get_iter (model, &new_iter, path))
+ {
+ /* It seems the removed style scheme was the
+ * last of the list. Try to move to the
+ * previous one */
+ gtk_tree_path_free (path);
+
+ path = gtk_tree_model_get_path (model, &iter);
+
+ gtk_tree_path_prev (path);
+ if (gtk_tree_model_get_iter (model, &new_iter, path))
+ new_iter_set = TRUE;
+ }
+ else
+ new_iter_set = TRUE;
+
+ gtk_tree_path_free (path);
+
+ if (new_iter_set)
+ gtk_tree_model_get (model, &new_iter,
+ ID_COLUMN, &new_id,
+ -1);
+
+ real_new_id = populate_color_scheme_list (dlg, new_id);
+ g_free (new_id);
+
+ set_buttons_sensisitivity_according_to_scheme (dlg, real_new_id);
+
+ if (real_new_id != NULL)
+ pluma_prefs_manager_set_source_style_scheme (real_new_id);
+ }
+
+ g_free (id);
+ g_free (name);
+ }
+}
+
+static void
+scheme_description_cell_data_func (GtkTreeViewColumn *column,
+ GtkCellRenderer *renderer,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+{
+ gchar *name;
+ gchar *desc;
+ gchar *text;
+
+ gtk_tree_model_get (model, iter,
+ NAME_COLUMN, &name,
+ DESC_COLUMN, &desc,
+ -1);
+
+ if (desc != NULL)
+ {
+ text = g_markup_printf_escaped ("<b>%s</b> - %s",
+ name,
+ desc);
+ }
+ else
+ {
+ text = g_markup_printf_escaped ("<b>%s</b>",
+ name);
+ }
+
+ g_free (name);
+ g_free (desc);
+
+ g_object_set (G_OBJECT (renderer),
+ "markup",
+ text,
+ NULL);
+
+ g_free (text);
+}
+
+static void
+setup_font_colors_page_style_scheme_section (PlumaPreferencesDialog *dlg)
+{
+ GtkCellRenderer *renderer;
+ GtkTreeViewColumn *column;
+ GtkTreeSelection *selection;
+ const gchar *def_id;
+
+ pluma_debug (DEBUG_PREFS);
+
+ /* Create GtkListStore for styles & setup treeview. */
+ dlg->priv->schemes_treeview_model = gtk_list_store_new (NUM_COLUMNS,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_STRING);
+
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (dlg->priv->schemes_treeview_model),
+ 0,
+ GTK_SORT_ASCENDING);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (dlg->priv->schemes_treeview),
+ GTK_TREE_MODEL (dlg->priv->schemes_treeview_model));
+
+ column = gtk_tree_view_column_new ();
+
+ renderer = gtk_cell_renderer_text_new ();
+ g_object_set (renderer, "ellipsize", PANGO_ELLIPSIZE_END, NULL);
+ gtk_tree_view_column_pack_start (column, renderer, TRUE);
+ gtk_tree_view_column_set_cell_data_func (column,
+ renderer,
+ scheme_description_cell_data_func,
+ dlg,
+ NULL);
+
+ gtk_tree_view_append_column (GTK_TREE_VIEW (dlg->priv->schemes_treeview),
+ column);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (dlg->priv->schemes_treeview));
+ gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
+
+ def_id = populate_color_scheme_list (dlg, NULL);
+
+ /* Connect signals */
+ g_signal_connect (dlg->priv->schemes_treeview,
+ "cursor-changed",
+ G_CALLBACK (style_scheme_changed),
+ dlg);
+ g_signal_connect (dlg->priv->install_scheme_button,
+ "clicked",
+ G_CALLBACK (install_scheme_clicked),
+ dlg);
+ g_signal_connect (dlg->priv->uninstall_scheme_button,
+ "clicked",
+ G_CALLBACK (uninstall_scheme_clicked),
+ dlg);
+
+ /* Set initial widget sensitivity */
+ set_buttons_sensisitivity_according_to_scheme (dlg, def_id);
+}
+
+static void
+setup_font_colors_page (PlumaPreferencesDialog *dlg)
+{
+ setup_font_colors_page_font_section (dlg);
+ setup_font_colors_page_style_scheme_section (dlg);
+}
+
+static void
+setup_plugins_page (PlumaPreferencesDialog *dlg)
+{
+ GtkWidget *page_content;
+
+ pluma_debug (DEBUG_PREFS);
+
+ page_content = pluma_plugin_manager_new ();
+ g_return_if_fail (page_content != NULL);
+
+ gtk_box_pack_start (GTK_BOX (dlg->priv->plugin_manager_place_holder),
+ page_content,
+ TRUE,
+ TRUE,
+ 0);
+
+ gtk_widget_show_all (page_content);
+}
+
+static void
+pluma_preferences_dialog_init (PlumaPreferencesDialog *dlg)
+{
+ GtkWidget *error_widget;
+ gboolean ret;
+ gchar *file;
+ gchar *root_objects[] = {
+ "notebook",
+ "adjustment1",
+ "adjustment2",
+ "adjustment3",
+ "install_scheme_image",
+ NULL
+ };
+
+ pluma_debug (DEBUG_PREFS);
+
+ dlg->priv = PLUMA_PREFERENCES_DIALOG_GET_PRIVATE (dlg);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (dlg),
+ GTK_STOCK_CLOSE,
+ GTK_RESPONSE_CLOSE,
+ GTK_STOCK_HELP,
+ GTK_RESPONSE_HELP,
+ NULL);
+
+ gtk_window_set_title (GTK_WINDOW (dlg), _("pluma Preferences"));
+ gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+ gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
+
+ /* HIG defaults */
+ gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))), 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))), 6);
+
+ g_signal_connect (dlg,
+ "response",
+ G_CALLBACK (dialog_response_handler),
+ NULL);
+
+ file = pluma_dirs_get_ui_file ("pluma-preferences-dialog.ui");
+ ret = pluma_utils_get_ui_objects (file,
+ root_objects,
+ &error_widget,
+
+ "notebook", &dlg->priv->notebook,
+
+ "display_line_numbers_checkbutton", &dlg->priv->display_line_numbers_checkbutton,
+ "highlight_current_line_checkbutton", &dlg->priv->highlight_current_line_checkbutton,
+ "bracket_matching_checkbutton", &dlg->priv->bracket_matching_checkbutton,
+ "wrap_text_checkbutton", &dlg->priv->wrap_text_checkbutton,
+ "split_checkbutton", &dlg->priv->split_checkbutton,
+
+ "right_margin_checkbutton", &dlg->priv->right_margin_checkbutton,
+ "right_margin_position_spinbutton", &dlg->priv->right_margin_position_spinbutton,
+ "right_margin_position_hbox", &dlg->priv->right_margin_position_hbox,
+
+ "tabs_width_spinbutton", &dlg->priv->tabs_width_spinbutton,
+ "tabs_width_hbox", &dlg->priv->tabs_width_hbox,
+ "insert_spaces_checkbutton", &dlg->priv->insert_spaces_checkbutton,
+
+ "auto_indent_checkbutton", &dlg->priv->auto_indent_checkbutton,
+
+ "autosave_hbox", &dlg->priv->autosave_hbox,
+ "backup_copy_checkbutton", &dlg->priv->backup_copy_checkbutton,
+ "auto_save_checkbutton", &dlg->priv->auto_save_checkbutton,
+ "auto_save_spinbutton", &dlg->priv->auto_save_spinbutton,
+
+ "default_font_checkbutton", &dlg->priv->default_font_checkbutton,
+ "font_button", &dlg->priv->font_button,
+ "font_hbox", &dlg->priv->font_hbox,
+
+ "schemes_treeview", &dlg->priv->schemes_treeview,
+ "install_scheme_button", &dlg->priv->install_scheme_button,
+ "uninstall_scheme_button", &dlg->priv->uninstall_scheme_button,
+
+ "plugin_manager_place_holder", &dlg->priv->plugin_manager_place_holder,
+
+ NULL);
+ g_free (file);
+
+ if (!ret)
+ {
+ gtk_widget_show (error_widget);
+
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ error_widget,
+ TRUE, TRUE, 0);
+
+ return;
+ }
+
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ dlg->priv->notebook, FALSE, FALSE, 0);
+ g_object_unref (dlg->priv->notebook);
+ gtk_container_set_border_width (GTK_CONTAINER (dlg->priv->notebook), 5);
+
+ setup_editor_page (dlg);
+ setup_view_page (dlg);
+ setup_font_colors_page (dlg);
+ setup_plugins_page (dlg);
+}
+
+void
+pluma_show_preferences_dialog (PlumaWindow *parent)
+{
+ pluma_debug (DEBUG_PREFS);
+
+ g_return_if_fail (PLUMA_IS_WINDOW (parent));
+
+ if (preferences_dialog == NULL)
+ {
+ preferences_dialog = GTK_WIDGET (g_object_new (PLUMA_TYPE_PREFERENCES_DIALOG, NULL));
+ g_signal_connect (preferences_dialog,
+ "destroy",
+ G_CALLBACK (gtk_widget_destroyed),
+ &preferences_dialog);
+ }
+
+ if (GTK_WINDOW (parent) != gtk_window_get_transient_for (GTK_WINDOW (preferences_dialog)))
+ {
+ gtk_window_set_transient_for (GTK_WINDOW (preferences_dialog),
+ GTK_WINDOW (parent));
+ }
+
+ gtk_window_present (GTK_WINDOW (preferences_dialog));
+}
diff --git a/pluma/dialogs/pluma-preferences-dialog.h b/pluma/dialogs/pluma-preferences-dialog.h
new file mode 100755
index 00000000..d66a79d7
--- /dev/null
+++ b/pluma/dialogs/pluma-preferences-dialog.h
@@ -0,0 +1,87 @@
+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
+/*
+ * pluma-preferences-dialog.c
+ * This file is part of pluma
+ *
+ * Copyright (C) 2001-2005 Paolo Maggi
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2003. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifndef __PLUMA_PREFERENCES_DIALOG_H__
+#define __PLUMA_PREFERENCES_DIALOG_H__
+
+#include "pluma-window.h"
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define PLUMA_TYPE_PREFERENCES_DIALOG (pluma_preferences_dialog_get_type())
+#define PLUMA_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_PREFERENCES_DIALOG, PlumaPreferencesDialog))
+#define PLUMA_PREFERENCES_DIALOG_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_PREFERENCES_DIALOG, PlumaPreferencesDialog const))
+#define PLUMA_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_PREFERENCES_DIALOG, PlumaPreferencesDialogClass))
+#define PLUMA_IS_PREFERENCES_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_PREFERENCES_DIALOG))
+#define PLUMA_IS_PREFERENCES_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_PREFERENCES_DIALOG))
+#define PLUMA_PREFERENCES_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_PREFERENCES_DIALOG, PlumaPreferencesDialogClass))
+
+
+/* Private structure type */
+typedef struct _PlumaPreferencesDialogPrivate PlumaPreferencesDialogPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _PlumaPreferencesDialog PlumaPreferencesDialog;
+
+struct _PlumaPreferencesDialog
+{
+ GtkDialog dialog;
+
+ /*< private > */
+ PlumaPreferencesDialogPrivate *priv;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _PlumaPreferencesDialogClass PlumaPreferencesDialogClass;
+
+struct _PlumaPreferencesDialogClass
+{
+ GtkDialogClass parent_class;
+};
+
+/*
+ * Public methods
+ */
+GType pluma_preferences_dialog_get_type (void) G_GNUC_CONST;
+
+void pluma_show_preferences_dialog (PlumaWindow *parent);
+
+G_END_DECLS
+
+#endif /* __PLUMA_PREFERENCES_DIALOG_H__ */
+
diff --git a/pluma/dialogs/pluma-preferences-dialog.ui b/pluma/dialogs/pluma-preferences-dialog.ui
new file mode 100755
index 00000000..42d41e31
--- /dev/null
+++ b/pluma/dialogs/pluma-preferences-dialog.ui
@@ -0,0 +1,1107 @@
+<?xml version="1.0"?>
+<interface>
+ <requires lib="gtk+" version="2.16"/>
+ <!-- interface-naming-policy toplevel-contextual -->
+ <object class="GtkAdjustment" id="adjustment1">
+ <property name="value">80</property>
+ <property name="lower">1</property>
+ <property name="upper">160</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment2">
+ <property name="value">8</property>
+ <property name="lower">1</property>
+ <property name="upper">24</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">4</property>
+ </object>
+ <object class="GtkAdjustment" id="adjustment3">
+ <property name="value">8</property>
+ <property name="lower">1</property>
+ <property name="upper">100</property>
+ <property name="step_increment">1</property>
+ <property name="page_increment">10</property>
+ </object>
+ <object class="GtkImage" id="install_scheme_image">
+ <property name="stock">gtk-add</property>
+ </object>
+ <object class="GtkDialog" id="preferences_dialog">
+ <property name="title" translatable="yes">Preferences</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">True</property>
+ <property name="type_hint">dialog</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkNotebook" id="notebook">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="border_width">6</property>
+ <child>
+ <object class="GtkVBox" id="vbox228">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkVBox" id="vbox226">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label848">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Text Wrapping</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox142">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label849">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="wrap_mode_frame">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="wrap_text_checkbutton">
+ <property name="label" translatable="yes">Enable text _wrapping</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="split_checkbutton">
+ <property name="label" translatable="yes">Do not _split words over two lines</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox217">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label854">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Line Numbers</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox137">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label843">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox222">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="display_line_numbers_checkbutton">
+ <property name="label" translatable="yes">_Display line numbers</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox244">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label876">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Current Line</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox161">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label877">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox245">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="highlight_current_line_checkbutton">
+ <property name="label" translatable="yes">Highlight current _line</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox230">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label855">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Right Margin</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox145">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label856">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox231">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="right_margin_checkbutton">
+ <property name="label" translatable="yes">Display right _margin</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="right_margin_position_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label857">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">_Right margin at column:</property>
+ <property name="use_underline">True</property>
+ <property name="mnemonic_widget">right_margin_position_spinbutton</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="right_margin_position_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment1</property>
+ <property name="climb_rate">1</property>
+ <property name="snap_to_ticks">True</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox249">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label881">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Bracket Matching</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox163">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label882">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox250">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="bracket_matching_checkbutton">
+ <property name="label" translatable="yes">Highlight matching _bracket</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label853">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">View</property>
+ </object>
+ <packing>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox224">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkVBox" id="vbox225">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label846">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Tab Stops</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox141">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label847">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox205">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkHBox" id="tabs_width_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label98">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Tab width:</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">tabs_width_spinbutton</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="tabs_width_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment2</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="insert_spaces_checkbutton">
+ <property name="label" translatable="yes">Insert _spaces instead of tabs</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox227">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label851">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Automatic Indentation</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox143">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label852">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="auto_indent_checkbutton">
+ <property name="label" translatable="yes">_Enable automatic indentation</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox232">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label859">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">File Saving</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox147">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label860">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox187">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="backup_copy_checkbutton">
+ <property name="label" translatable="yes">Create a _backup copy of files before saving</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="autosave_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="auto_save_checkbutton">
+ <property name="label" translatable="yes">_Autosave files every</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkSpinButton" id="auto_save_spinbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="adjustment">adjustment3</property>
+ <property name="climb_rate">1</property>
+ <property name="numeric">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="label97">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_minutes</property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">auto_save_spinbutton</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label829">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Editor</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox202">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkVBox" id="vbox185">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label819">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Font</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox116">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label800">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox183">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkCheckButton" id="default_font_checkbutton">
+ <property name="label">_Use the system fixed width font (%s)</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="font_hbox">
+ <property name="visible">True</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="font_label">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Editor _font: </property>
+ <property name="use_underline">True</property>
+ <property name="justify">center</property>
+ <property name="mnemonic_widget">font_button</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkFontButton" id="font_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="title" translatable="yes">Pick the editor font</property>
+ <property name="use_font">True</property>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox14">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkLabel" id="label798">
+ <property name="visible">True</property>
+ <property name="xalign">0</property>
+ <property name="label" translatable="yes">Color Scheme</property>
+ <attributes>
+ <attribute name="weight" value="bold"/>
+ </attributes>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHBox" id="hbox115">
+ <property name="visible">True</property>
+ <child>
+ <object class="GtkLabel" id="label797">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes"> </property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox1">
+ <property name="visible">True</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow2">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">automatic</property>
+ <property name="vscrollbar_policy">automatic</property>
+ <property name="shadow_type">etched-in</property>
+ <child>
+ <object class="GtkTreeView" id="schemes_treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="events">GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK</property>
+ <property name="headers_visible">False</property>
+ <property name="rules_hint">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkHButtonBox" id="hbuttonbox1">
+ <property name="visible">True</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="install_scheme_button">
+ <property name="label" translatable="yes">_Add...</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="image">install_scheme_image</property>
+ <property name="use_underline">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="uninstall_scheme_button">
+ <property name="label">gtk-remove</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label830">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Font &amp; Colors</property>
+ </object>
+ <packing>
+ <property name="position">2</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="plugin_manager_place_holder">
+ <property name="visible">True</property>
+ <property name="border_width">12</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child type="tab">
+ <object class="GtkLabel" id="label868">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Plugins</property>
+ </object>
+ <packing>
+ <property name="position">3</property>
+ <property name="tab_fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area">
+ <property name="visible">True</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="helpbutton1">
+ <property name="label">gtk-help</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="closebutton1">
+ <property name="label">gtk-close</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="can_default">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-11">helpbutton1</action-widget>
+ <action-widget response="-7">closebutton1</action-widget>
+ </action-widgets>
+ </object>
+</interface>
diff --git a/pluma/dialogs/pluma-search-dialog.c b/pluma/dialogs/pluma-search-dialog.c
new file mode 100755
index 00000000..af1b3795
--- /dev/null
+++ b/pluma/dialogs/pluma-search-dialog.c
@@ -0,0 +1,634 @@
+/*
+ * pluma-search-dialog.c
+ * This file is part of pluma
+ *
+ * Copyright (C) 2005 Paolo Maggi
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2005. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <string.h>
+#include <glib/gi18n.h>
+#include <gdk/gdkkeysyms.h>
+
+#include "pluma-search-dialog.h"
+#include "pluma-history-entry.h"
+#include "pluma-utils.h"
+#include "pluma-marshal.h"
+#include "pluma-dirs.h"
+
+#define PLUMA_SEARCH_DIALOG_GET_PRIVATE(object)(G_TYPE_INSTANCE_GET_PRIVATE ((object), \
+ PLUMA_TYPE_SEARCH_DIALOG, \
+ PlumaSearchDialogPrivate))
+
+/* Signals */
+enum
+{
+ SHOW_REPLACE,
+ LAST_SIGNAL
+};
+
+static guint dialog_signals [LAST_SIGNAL] = { 0 };
+
+struct _PlumaSearchDialogPrivate
+{
+ gboolean show_replace;
+
+ GtkWidget *table;
+ GtkWidget *search_label;
+ GtkWidget *search_entry;
+ GtkWidget *search_text_entry;
+ GtkWidget *replace_label;
+ GtkWidget *replace_entry;
+ GtkWidget *replace_text_entry;
+ GtkWidget *match_case_checkbutton;
+ GtkWidget *entire_word_checkbutton;
+ GtkWidget *backwards_checkbutton;
+ GtkWidget *wrap_around_checkbutton;
+ GtkWidget *find_button;
+ GtkWidget *replace_button;
+ GtkWidget *replace_all_button;
+
+ gboolean ui_error;
+};
+
+G_DEFINE_TYPE(PlumaSearchDialog, pluma_search_dialog, GTK_TYPE_DIALOG)
+
+enum
+{
+ PROP_0,
+ PROP_SHOW_REPLACE
+};
+
+static void
+pluma_search_dialog_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaSearchDialog *dlg = PLUMA_SEARCH_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_SHOW_REPLACE:
+ pluma_search_dialog_set_show_replace (dlg,
+ g_value_get_boolean (value));
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+static void
+pluma_search_dialog_get_property (GObject *object,
+ guint prop_id,
+ GValue *value,
+ GParamSpec *pspec)
+{
+ PlumaSearchDialog *dlg = PLUMA_SEARCH_DIALOG (object);
+
+ switch (prop_id)
+ {
+ case PROP_SHOW_REPLACE:
+ g_value_set_boolean (value, dlg->priv->show_replace);
+ break;
+ default:
+ G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
+ break;
+ }
+}
+
+void
+pluma_search_dialog_present_with_time (PlumaSearchDialog *dialog,
+ guint32 timestamp)
+{
+ g_return_if_fail (PLUMA_SEARCH_DIALOG (dialog));
+
+ gtk_window_present_with_time (GTK_WINDOW (dialog), timestamp);
+
+ gtk_widget_grab_focus (dialog->priv->search_text_entry);
+}
+
+static gboolean
+show_replace (PlumaSearchDialog *dlg)
+{
+ pluma_search_dialog_set_show_replace (dlg, TRUE);
+
+ return TRUE;
+}
+
+static void
+pluma_search_dialog_class_init (PlumaSearchDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkBindingSet *binding_set;
+
+ object_class->set_property = pluma_search_dialog_set_property;
+ object_class->get_property = pluma_search_dialog_get_property;
+
+ klass->show_replace = show_replace;
+
+ dialog_signals[SHOW_REPLACE] =
+ g_signal_new ("show_replace",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (PlumaSearchDialogClass, show_replace),
+ NULL, NULL,
+ pluma_marshal_BOOLEAN__NONE,
+ G_TYPE_BOOLEAN, 0);
+
+ g_object_class_install_property (object_class, PROP_SHOW_REPLACE,
+ g_param_spec_boolean ("show-replace",
+ "Show Replace",
+ "Whether the dialog is used for Search&Replace",
+ FALSE,
+ G_PARAM_READWRITE));
+
+ g_type_class_add_private (object_class, sizeof (PlumaSearchDialogPrivate));
+
+ binding_set = gtk_binding_set_by_class (klass);
+
+ /* Note: we cannot use the keyval/modifier associated with the
+ * GTK_STOCK_FIND_AND_REPLACE stock item since MATE HIG suggests Ctrl+h
+ * for Replace while gtk+ uses Ctrl+r */
+ gtk_binding_entry_add_signal (binding_set, GDK_h, GDK_CONTROL_MASK, "show_replace", 0);
+ gtk_binding_entry_add_signal (binding_set, GDK_H, GDK_CONTROL_MASK, "show_replace", 0);
+}
+
+static void
+insert_text_handler (GtkEditable *editable,
+ const gchar *text,
+ gint length,
+ gint *position,
+ gpointer data)
+{
+ static gboolean insert_text = FALSE;
+ gchar *escaped_text;
+ gint new_len;
+
+ /* To avoid recursive behavior */
+ if (insert_text)
+ return;
+
+ escaped_text = pluma_utils_escape_search_text (text);
+
+ new_len = strlen (escaped_text);
+
+ if (new_len == length)
+ {
+ g_free (escaped_text);
+ return;
+ }
+
+ insert_text = TRUE;
+
+ g_signal_stop_emission_by_name (editable, "insert_text");
+
+ gtk_editable_insert_text (editable, escaped_text, new_len, position);
+
+ insert_text = FALSE;
+
+ g_free (escaped_text);
+}
+
+static void
+search_text_entry_changed (GtkEditable *editable,
+ PlumaSearchDialog *dialog)
+{
+ const gchar *search_string;
+
+ search_string = gtk_entry_get_text (GTK_ENTRY (editable));
+ g_return_if_fail (search_string != NULL);
+
+ if (*search_string != '\0')
+ {
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ PLUMA_SEARCH_DIALOG_FIND_RESPONSE, TRUE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE, TRUE);
+ }
+ else
+ {
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ PLUMA_SEARCH_DIALOG_FIND_RESPONSE, FALSE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ PLUMA_SEARCH_DIALOG_REPLACE_RESPONSE, FALSE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE, FALSE);
+ }
+}
+
+static void
+response_handler (PlumaSearchDialog *dialog,
+ gint response_id,
+ gpointer data)
+{
+ const gchar *str;
+
+ switch (response_id)
+ {
+ case PLUMA_SEARCH_DIALOG_REPLACE_RESPONSE:
+ case PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE:
+ str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->replace_text_entry));
+ if (*str != '\0')
+ {
+ gchar *text;
+
+ text = pluma_utils_unescape_search_text (str);
+ pluma_history_entry_prepend_text
+ (PLUMA_HISTORY_ENTRY (dialog->priv->replace_entry),
+ text);
+
+ g_free (text);
+ }
+ /* fall through, so that we also save the find entry */
+ case PLUMA_SEARCH_DIALOG_FIND_RESPONSE:
+ str = gtk_entry_get_text (GTK_ENTRY (dialog->priv->search_text_entry));
+ if (*str != '\0')
+ {
+ gchar *text;
+
+ text = pluma_utils_unescape_search_text (str);
+ pluma_history_entry_prepend_text
+ (PLUMA_HISTORY_ENTRY (dialog->priv->search_entry),
+ text);
+
+ g_free (text);
+ }
+ }
+}
+
+static void
+show_replace_widgets (PlumaSearchDialog *dlg,
+ gboolean show_replace)
+{
+ if (show_replace)
+ {
+ gtk_widget_show (dlg->priv->replace_label);
+ gtk_widget_show (dlg->priv->replace_entry);
+ gtk_widget_show (dlg->priv->replace_all_button);
+ gtk_widget_show (dlg->priv->replace_button);
+
+ gtk_table_set_row_spacings (GTK_TABLE (dlg->priv->table), 12);
+
+ gtk_window_set_title (GTK_WINDOW (dlg), _("Replace"));
+ }
+ else
+ {
+ gtk_widget_hide (dlg->priv->replace_label);
+ gtk_widget_hide (dlg->priv->replace_entry);
+ gtk_widget_hide (dlg->priv->replace_all_button);
+ gtk_widget_hide (dlg->priv->replace_button);
+
+ gtk_table_set_row_spacings (GTK_TABLE (dlg->priv->table), 0);
+
+ gtk_window_set_title (GTK_WINDOW (dlg), _("Find"));
+ }
+
+ gtk_widget_show (dlg->priv->find_button);
+}
+
+static void
+pluma_search_dialog_init (PlumaSearchDialog *dlg)
+{
+ GtkWidget *content;
+ GtkWidget *error_widget;
+ gboolean ret;
+ gchar *file;
+ gchar *root_objects[] = {
+ "search_dialog_content",
+ NULL
+ };
+
+ dlg->priv = PLUMA_SEARCH_DIALOG_GET_PRIVATE (dlg);
+
+ gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE);
+ gtk_dialog_set_has_separator (GTK_DIALOG (dlg), FALSE);
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg), TRUE);
+
+ gtk_dialog_add_buttons (GTK_DIALOG (dlg),
+ GTK_STOCK_CLOSE, GTK_RESPONSE_CANCEL,
+ NULL);
+
+ /* HIG defaults */
+ gtk_container_set_border_width (GTK_CONTAINER (dlg), 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 5);
+ gtk_box_set_spacing (GTK_BOX (gtk_dialog_get_action_area (GTK_DIALOG (dlg))),
+ 6);
+
+ file = pluma_dirs_get_ui_file ("pluma-search-dialog.ui");
+ ret = pluma_utils_get_ui_objects (file,
+ root_objects,
+ &error_widget,
+ "search_dialog_content", &content,
+ "table", &dlg->priv->table,
+ "search_label", &dlg->priv->search_label,
+ "replace_with_label", &dlg->priv->replace_label,
+ "match_case_checkbutton", &dlg->priv->match_case_checkbutton,
+ "entire_word_checkbutton", &dlg->priv->entire_word_checkbutton,
+ "search_backwards_checkbutton", &dlg->priv->backwards_checkbutton,
+ "wrap_around_checkbutton", &dlg->priv->wrap_around_checkbutton,
+ NULL);
+ g_free (file);
+
+ if (!ret)
+ {
+ gtk_widget_show (error_widget);
+
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ error_widget,
+ TRUE, TRUE, 0);
+ gtk_container_set_border_width (GTK_CONTAINER (error_widget),
+ 5);
+
+ dlg->priv->ui_error = TRUE;
+
+ return;
+ }
+
+ dlg->priv->search_entry = pluma_history_entry_new ("pluma2_search_for_entry",
+ TRUE);
+ gtk_widget_set_size_request (dlg->priv->search_entry, 300, -1);
+ pluma_history_entry_set_escape_func
+ (PLUMA_HISTORY_ENTRY (dlg->priv->search_entry),
+ (PlumaHistoryEntryEscapeFunc) pluma_utils_escape_search_text);
+
+ dlg->priv->search_text_entry = pluma_history_entry_get_entry
+ (PLUMA_HISTORY_ENTRY (dlg->priv->search_entry));
+ gtk_entry_set_activates_default (GTK_ENTRY (dlg->priv->search_text_entry),
+ TRUE);
+ gtk_widget_show (dlg->priv->search_entry);
+ gtk_table_attach_defaults (GTK_TABLE (dlg->priv->table),
+ dlg->priv->search_entry,
+ 1, 2, 0, 1);
+
+ dlg->priv->replace_entry = pluma_history_entry_new ("pluma2_replace_with_entry",
+ TRUE);
+ pluma_history_entry_set_escape_func
+ (PLUMA_HISTORY_ENTRY (dlg->priv->replace_entry),
+ (PlumaHistoryEntryEscapeFunc) pluma_utils_escape_search_text);
+
+ dlg->priv->replace_text_entry = pluma_history_entry_get_entry
+ (PLUMA_HISTORY_ENTRY (dlg->priv->replace_entry));
+ gtk_entry_set_activates_default (GTK_ENTRY (dlg->priv->replace_text_entry),
+ TRUE);
+ gtk_widget_show (dlg->priv->replace_entry);
+ gtk_table_attach_defaults (GTK_TABLE (dlg->priv->table),
+ dlg->priv->replace_entry,
+ 1, 2, 1, 2);
+
+ gtk_label_set_mnemonic_widget (GTK_LABEL (dlg->priv->search_label),
+ dlg->priv->search_entry);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (dlg->priv->replace_label),
+ dlg->priv->replace_entry);
+
+ dlg->priv->find_button = gtk_button_new_from_stock (GTK_STOCK_FIND);
+ dlg->priv->replace_all_button = gtk_button_new_with_mnemonic (_("Replace _All"));
+ dlg->priv->replace_button = pluma_gtk_button_new_with_stock_icon (_("_Replace"),
+ GTK_STOCK_FIND_AND_REPLACE);
+
+ gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
+ dlg->priv->replace_all_button,
+ PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE);
+ gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
+ dlg->priv->replace_button,
+ PLUMA_SEARCH_DIALOG_REPLACE_RESPONSE);
+ gtk_dialog_add_action_widget (GTK_DIALOG (dlg),
+ dlg->priv->find_button,
+ PLUMA_SEARCH_DIALOG_FIND_RESPONSE);
+ g_object_set (G_OBJECT (dlg->priv->find_button),
+ "can-default", TRUE,
+ NULL);
+
+ gtk_dialog_set_default_response (GTK_DIALOG (dlg),
+ PLUMA_SEARCH_DIALOG_FIND_RESPONSE);
+
+ /* insensitive by default */
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dlg),
+ PLUMA_SEARCH_DIALOG_FIND_RESPONSE,
+ FALSE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dlg),
+ PLUMA_SEARCH_DIALOG_REPLACE_RESPONSE,
+ FALSE);
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dlg),
+ PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE,
+ FALSE);
+
+ gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dlg))),
+ content, FALSE, FALSE, 0);
+ g_object_unref (content);
+ gtk_container_set_border_width (GTK_CONTAINER (content), 5);
+
+ g_signal_connect (dlg->priv->search_text_entry,
+ "insert_text",
+ G_CALLBACK (insert_text_handler),
+ NULL);
+ g_signal_connect (dlg->priv->replace_text_entry,
+ "insert_text",
+ G_CALLBACK (insert_text_handler),
+ NULL);
+ g_signal_connect (dlg->priv->search_text_entry,
+ "changed",
+ G_CALLBACK (search_text_entry_changed),
+ dlg);
+
+ g_signal_connect (dlg,
+ "response",
+ G_CALLBACK (response_handler),
+ NULL);
+}
+
+GtkWidget *
+pluma_search_dialog_new (GtkWindow *parent,
+ gboolean show_replace)
+{
+ PlumaSearchDialog *dlg;
+
+ dlg = g_object_new (PLUMA_TYPE_SEARCH_DIALOG,
+ "show-replace", show_replace,
+ NULL);
+
+ if (parent != NULL)
+ {
+ gtk_window_set_transient_for (GTK_WINDOW (dlg),
+ parent);
+
+ gtk_window_set_destroy_with_parent (GTK_WINDOW (dlg),
+ TRUE);
+ }
+
+ return GTK_WIDGET (dlg);
+}
+
+gboolean
+pluma_search_dialog_get_show_replace (PlumaSearchDialog *dialog)
+{
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), FALSE);
+
+ return dialog->priv->show_replace;
+}
+
+void
+pluma_search_dialog_set_show_replace (PlumaSearchDialog *dialog,
+ gboolean show_replace)
+{
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+
+ if (dialog->priv->ui_error)
+ return;
+
+ dialog->priv->show_replace = show_replace != FALSE;
+ show_replace_widgets (dialog, dialog->priv->show_replace);
+
+ g_object_notify (G_OBJECT (dialog), "show-replace");
+}
+
+void
+pluma_search_dialog_set_search_text (PlumaSearchDialog *dialog,
+ const gchar *text)
+{
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+ g_return_if_fail (text != NULL);
+
+ gtk_entry_set_text (GTK_ENTRY (dialog->priv->search_text_entry),
+ text);
+
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ PLUMA_SEARCH_DIALOG_FIND_RESPONSE,
+ (text != '\0'));
+
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog),
+ PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE,
+ (text != '\0'));
+}
+
+/*
+ * The text must be unescaped before searching.
+ */
+const gchar *
+pluma_search_dialog_get_search_text (PlumaSearchDialog *dialog)
+{
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), NULL);
+
+ return gtk_entry_get_text (GTK_ENTRY (dialog->priv->search_text_entry));
+}
+
+void
+pluma_search_dialog_set_replace_text (PlumaSearchDialog *dialog,
+ const gchar *text)
+{
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+ g_return_if_fail (text != NULL);
+
+ gtk_entry_set_text (GTK_ENTRY (dialog->priv->replace_text_entry),
+ text);
+}
+
+const gchar *
+pluma_search_dialog_get_replace_text (PlumaSearchDialog *dialog)
+{
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), NULL);
+
+ return gtk_entry_get_text (GTK_ENTRY (dialog->priv->replace_text_entry));
+}
+
+void
+pluma_search_dialog_set_match_case (PlumaSearchDialog *dialog,
+ gboolean match_case)
+{
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->match_case_checkbutton),
+ match_case);
+}
+
+gboolean
+pluma_search_dialog_get_match_case (PlumaSearchDialog *dialog)
+{
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), FALSE);
+
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->match_case_checkbutton));
+}
+
+void
+pluma_search_dialog_set_entire_word (PlumaSearchDialog *dialog,
+ gboolean entire_word)
+{
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->entire_word_checkbutton),
+ entire_word);
+}
+
+gboolean
+pluma_search_dialog_get_entire_word (PlumaSearchDialog *dialog)
+{
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), FALSE);
+
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->entire_word_checkbutton));
+}
+
+void
+pluma_search_dialog_set_backwards (PlumaSearchDialog *dialog,
+ gboolean backwards)
+{
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->backwards_checkbutton),
+ backwards);
+}
+
+gboolean
+pluma_search_dialog_get_backwards (PlumaSearchDialog *dialog)
+{
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), FALSE);
+
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->backwards_checkbutton));
+}
+
+void
+pluma_search_dialog_set_wrap_around (PlumaSearchDialog *dialog,
+ gboolean wrap_around)
+{
+ g_return_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog));
+
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->wrap_around_checkbutton),
+ wrap_around);
+}
+
+gboolean
+pluma_search_dialog_get_wrap_around (PlumaSearchDialog *dialog)
+{
+ g_return_val_if_fail (PLUMA_IS_SEARCH_DIALOG (dialog), FALSE);
+
+ return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (dialog->priv->wrap_around_checkbutton));
+}
diff --git a/pluma/dialogs/pluma-search-dialog.h b/pluma/dialogs/pluma-search-dialog.h
new file mode 100755
index 00000000..f45672a3
--- /dev/null
+++ b/pluma/dialogs/pluma-search-dialog.h
@@ -0,0 +1,128 @@
+/*
+ * pluma-search-dialog.h
+ * This file is part of pluma
+ *
+ * Copyright (C) 2005 Paolo Maggi
+ *
+ * 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., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ */
+
+/*
+ * Modified by the pluma Team, 2005. See the AUTHORS file for a
+ * list of people on the pluma Team.
+ * See the ChangeLog files for a list of changes.
+ *
+ * $Id$
+ */
+
+#ifndef __PLUMA_SEARCH_DIALOG_H__
+#define __PLUMA_SEARCH_DIALOG_H__
+
+#include <gtk/gtk.h>
+
+G_BEGIN_DECLS
+
+/*
+ * Type checking and casting macros
+ */
+#define PLUMA_TYPE_SEARCH_DIALOG (pluma_search_dialog_get_type())
+#define PLUMA_SEARCH_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_SEARCH_DIALOG, PlumaSearchDialog))
+#define PLUMA_SEARCH_DIALOG_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), PLUMA_TYPE_SEARCH_DIALOG, PlumaSearchDialog const))
+#define PLUMA_SEARCH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), PLUMA_TYPE_SEARCH_DIALOG, PlumaSearchDialogClass))
+#define PLUMA_IS_SEARCH_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj), PLUMA_TYPE_SEARCH_DIALOG))
+#define PLUMA_IS_SEARCH_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLUMA_TYPE_SEARCH_DIALOG))
+#define PLUMA_SEARCH_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), PLUMA_TYPE_SEARCH_DIALOG, PlumaSearchDialogClass))
+
+/* Private structure type */
+typedef struct _PlumaSearchDialogPrivate PlumaSearchDialogPrivate;
+
+/*
+ * Main object structure
+ */
+typedef struct _PlumaSearchDialog PlumaSearchDialog;
+
+struct _PlumaSearchDialog
+{
+ GtkDialog dialog;
+
+ /*< private > */
+ PlumaSearchDialogPrivate *priv;
+};
+
+/*
+ * Class definition
+ */
+typedef struct _PlumaSearchDialogClass PlumaSearchDialogClass;
+
+struct _PlumaSearchDialogClass
+{
+ GtkDialogClass parent_class;
+
+ /* Key bindings */
+ gboolean (* show_replace) (PlumaSearchDialog *dlg);
+};
+
+enum
+{
+ PLUMA_SEARCH_DIALOG_FIND_RESPONSE = 100,
+ PLUMA_SEARCH_DIALOG_REPLACE_RESPONSE,
+ PLUMA_SEARCH_DIALOG_REPLACE_ALL_RESPONSE
+};
+
+/*
+ * Public methods
+ */
+GType pluma_search_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget *pluma_search_dialog_new (GtkWindow *parent,
+ gboolean show_replace);
+
+void pluma_search_dialog_present_with_time (PlumaSearchDialog *dialog,
+ guint32 timestamp);
+
+gboolean pluma_search_dialog_get_show_replace (PlumaSearchDialog *dialog);
+
+void pluma_search_dialog_set_show_replace (PlumaSearchDialog *dialog,
+ gboolean show_replace);
+
+
+void pluma_search_dialog_set_search_text (PlumaSearchDialog *dialog,
+ const gchar *text);
+const gchar *pluma_search_dialog_get_search_text (PlumaSearchDialog *dialog);
+
+void pluma_search_dialog_set_replace_text (PlumaSearchDialog *dialog,
+ const gchar *text);
+const gchar *pluma_search_dialog_get_replace_text (PlumaSearchDialog *dialog);
+
+void pluma_search_dialog_set_match_case (PlumaSearchDialog *dialog,
+ gboolean match_case);
+gboolean pluma_search_dialog_get_match_case (PlumaSearchDialog *dialog);
+
+void pluma_search_dialog_set_entire_word (PlumaSearchDialog *dialog,
+ gboolean entire_word);
+gboolean pluma_search_dialog_get_entire_word (PlumaSearchDialog *dialog);
+
+void pluma_search_dialog_set_backwards (PlumaSearchDialog *dialog,
+ gboolean backwards);
+gboolean pluma_search_dialog_get_backwards (PlumaSearchDialog *dialog);
+
+void pluma_search_dialog_set_wrap_around (PlumaSearchDialog *dialog,
+ gboolean wrap_around);
+gboolean pluma_search_dialog_get_wrap_around (PlumaSearchDialog *dialog);
+
+G_END_DECLS
+
+#endif /* __PLUMA_SEARCH_DIALOG_H__ */
diff --git a/pluma/dialogs/pluma-search-dialog.ui b/pluma/dialogs/pluma-search-dialog.ui
new file mode 100755
index 00000000..35b6c390
--- /dev/null
+++ b/pluma/dialogs/pluma-search-dialog.ui
@@ -0,0 +1,255 @@
+<?xml version="1.0"?>
+<!--*- mode: xml -*-->
+<interface>
+ <object class="GtkDialog" id="dialog">
+ <property name="title" translatable="yes">Replace</property>
+ <property name="type">GTK_WINDOW_TOPLEVEL</property>
+ <property name="window_position">GTK_WIN_POS_NONE</property>
+ <property name="modal">False</property>
+ <property name="resizable">False</property>
+ <property name="destroy_with_parent">False</property>
+ <property name="decorated">True</property>
+ <property name="skip_taskbar_hint">False</property>
+ <property name="skip_pager_hint">False</property>
+ <property name="type_hint">GDK_WINDOW_TYPE_HINT_DIALOG</property>
+ <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
+ <property name="focus_on_map">True</property>
+ <property name="urgency_hint">False</property>
+ <property name="has_separator">False</property>
+ <child internal-child="vbox">
+ <object class="GtkVBox" id="dialog-vbox1">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">8</property>
+ <child internal-child="action_area">
+ <object class="GtkHButtonBox" id="dialog-action_area1">
+ <property name="visible">True</property>
+ <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
+ <child>
+ <object class="GtkButton" id="close_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-close</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="replace_all_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Replace All</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="replace_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Replace</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
+ <child>
+ <object class="GtkButton" id="find_next_button">
+ <property name="visible">True</property>
+ <property name="can_default">True</property>
+ <property name="can_focus">True</property>
+ <property name="label">gtk-find</property>
+ <property name="use_stock">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">GTK_PACK_END</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="search_dialog_content">
+ <property name="border_width">5</property>
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">18</property>
+ <child>
+ <object class="GtkTable" id="table">
+ <property name="visible">True</property>
+ <property name="n_rows">2</property>
+ <property name="n_columns">2</property>
+ <property name="homogeneous">False</property>
+ <property name="row_spacing">12</property>
+ <property name="column_spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="search_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">_Search for: </property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">0</property>
+ <property name="bottom_attach">1</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="replace_with_label">
+ <property name="visible">True</property>
+ <property name="label" translatable="yes">Replace _with: </property>
+ <property name="use_underline">True</property>
+ <property name="use_markup">False</property>
+ <property name="justify">GTK_JUSTIFY_LEFT</property>
+ <property name="wrap">False</property>
+ <property name="selectable">False</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0.5</property>
+ <property name="xpad">0</property>
+ <property name="ypad">0</property>
+ <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+ <property name="width_chars">-1</property>
+ <property name="single_line_mode">False</property>
+ <property name="angle">0</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="right_attach">1</property>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ <property name="x_options">fill</property>
+ <property name="y_options"/>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkVBox" id="vbox3">
+ <property name="visible">True</property>
+ <property name="homogeneous">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkCheckButton" id="match_case_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Match case</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="entire_word_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Match _entire word only</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="search_backwards_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">Search _backwards</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">False</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkCheckButton" id="wrap_around_checkbutton">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="label" translatable="yes">_Wrap around</property>
+ <property name="use_underline">True</property>
+ <property name="relief">GTK_RELIEF_NORMAL</property>
+ <property name="focus_on_click">True</property>
+ <property name="active">True</property>
+ <property name="inconsistent">False</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="padding">0</property>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="0">close_button</action-widget>
+ <action-widget response="0">replace_all_button</action-widget>
+ <action-widget response="0">replace_button</action-widget>
+ <action-widget response="0">find_next_button</action-widget>
+ </action-widgets>
+ </object>
+</interface>