[gedit/wip/redesign] Add Highlight mode dialog
- From: Ignacio Casal Quinteiro <icq src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/redesign] Add Highlight mode dialog
- Date: Thu, 9 May 2013 20:18:01 +0000 (UTC)
commit 8cf7f87ece6f9ec3d8e0500644033a27230d4353
Author: Ignacio Casal Quinteiro <icq gnome org>
Date: Tue May 7 16:56:54 2013 +0200
Add Highlight mode dialog
gedit/Makefile.am | 5 +-
gedit/gedit-commands-view.c | 31 +++
gedit/gedit-commands.h | 3 +
gedit/gedit-highlight-mode-dialog.c | 345 ++++++++++++++++++++++++++++++++++
gedit/gedit-highlight-mode-dialog.h | 66 +++++++
gedit/gedit-highlight-mode-dialog.ui | 158 ++++++++++++++++
gedit/gedit-preferences-dialog.ui | 1 -
gedit/gedit-window.c | 10 +-
gedit/gedit-window.ui | 6 +
gedit/gedit.gresource.xml | 1 +
10 files changed, 622 insertions(+), 4 deletions(-)
---
diff --git a/gedit/Makefile.am b/gedit/Makefile.am
index 6a01932..27ec4d9 100644
--- a/gedit/Makefile.am
+++ b/gedit/Makefile.am
@@ -103,6 +103,7 @@ NOINST_H_FILES = \
gedit-documents-panel.h \
gedit-encodings-dialog.h \
gedit-file-chooser-dialog.h \
+ gedit-highlight-mode-dialog.h \
gedit-history-entry.h \
gedit-io-error-info-bar.h \
gedit-multi-notebook.h \
@@ -183,6 +184,7 @@ libgedit_c_files = \
gedit-encodings-combo-box.c \
gedit-encodings-dialog.c \
gedit-file-chooser-dialog.c \
+ gedit-highlight-mode-dialog.c \
gedit-history-entry.c \
gedit-io-error-info-bar.c \
gedit-message-bus.c \
@@ -262,7 +264,8 @@ EXTRA_DIST = \
gedit-progress-info-bar.ui \
gedit-status-menu-button.ui \
gedit-view-frame.ui \
- gedit-window.ui
+ gedit-window.ui \
+ gedit-highlight-mode-dialog.ui
CLEANFILES = $(BUILT_SOURCES) $(BUILT_SOURCES_PRIVATE)
diff --git a/gedit/gedit-commands-view.c b/gedit/gedit-commands-view.c
index af9befa..44159e8 100644
--- a/gedit/gedit-commands-view.c
+++ b/gedit/gedit-commands-view.c
@@ -40,6 +40,7 @@
#include "gedit-debug.h"
#include "gedit-window.h"
#include "gedit-window-private.h"
+#include "gedit-highlight-mode-dialog.h"
void
_gedit_cmd_view_toggle_fullscreen_mode (GSimpleAction *action,
@@ -66,4 +67,34 @@ _gedit_cmd_view_leave_fullscreen_mode (GSimpleAction *action,
_gedit_window_unfullscreen (window);
}
+static void
+on_language_selected (GeditHighlightModeDialog *dlg,
+ GtkSourceLanguage *language,
+ GeditWindow *window)
+{
+ GeditDocument *doc;
+
+ doc = gedit_window_get_active_document (window);
+
+ if (!doc)
+ return;
+
+ gedit_document_set_language (doc, language);
+}
+
+void
+_gedit_cmd_view_highlight_mode (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data)
+{
+ GtkWindow *window = GTK_WINDOW (user_data);
+ GtkWidget *dlg;
+
+ dlg = gedit_highlight_mode_dialog_new (window);
+ g_signal_connect (dlg, "language-selected",
+ G_CALLBACK (on_language_selected), window);
+
+ gtk_widget_show (GTK_WIDGET (dlg));
+}
+
/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-commands.h b/gedit/gedit-commands.h
index 416c157..9f3a6b2 100644
--- a/gedit/gedit-commands.h
+++ b/gedit/gedit-commands.h
@@ -137,6 +137,9 @@ void _gedit_cmd_view_toggle_fullscreen_mode (GSimpleAction *action,
void _gedit_cmd_view_leave_fullscreen_mode (GSimpleAction *action,
GVariant *parameter,
gpointer user_data);
+void _gedit_cmd_view_highlight_mode (GSimpleAction *action,
+ GVariant *parameter,
+ gpointer user_data);
void _gedit_cmd_search_find (GSimpleAction *action,
GVariant *parameter,
diff --git a/gedit/gedit-highlight-mode-dialog.c b/gedit/gedit-highlight-mode-dialog.c
new file mode 100644
index 0000000..02ba355
--- /dev/null
+++ b/gedit/gedit-highlight-mode-dialog.c
@@ -0,0 +1,345 @@
+/*
+ * gedit-highlight-mode-dialog.c
+ * This file is part of gedit
+ *
+ * Copyright (C) 2013 - Ignacio Casal Quinteiro
+ *
+ * gedit 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.
+ *
+ * gedit 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 gedit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#include "gedit-highlight-mode-dialog.h"
+
+#include <gdk/gdkkeysyms.h>
+#include <glib/gi18n.h>
+#include <string.h>
+
+enum
+{
+ COLUMN_NAME,
+ COLUMN_LANG,
+ N_COLUMNS
+};
+
+struct _GeditHighlightModeDialogPrivate
+{
+ GtkWidget *treeview;
+ GtkWidget *entry;
+ GtkListStore *liststore;
+ GtkTreeModelFilter *treemodelfilter;
+ GtkTreeSelection *treeview_selection;
+};
+
+/* Signals */
+enum
+{
+ LANGUAGE_SELECTED,
+ LAST_SIGNAL
+};
+
+static guint signals[LAST_SIGNAL] = { 0 };
+
+G_DEFINE_TYPE (GeditHighlightModeDialog, gedit_highlight_mode_dialog, GTK_TYPE_DIALOG)
+
+static void
+gedit_highlight_mode_dialog_finalize (GObject *object)
+{
+ G_OBJECT_CLASS (gedit_highlight_mode_dialog_parent_class)->finalize (object);
+}
+
+static void
+gedit_highlight_mode_dialog_response (GtkDialog *dialog,
+ gint response_id)
+{
+ GeditHighlightModeDialogPrivate *priv = GEDIT_HIGHLIGHT_MODE_DIALOG (dialog)->priv;
+
+ if (response_id == GTK_RESPONSE_OK)
+ {
+ GtkSourceLanguage *lang;
+ GtkTreeIter iter;
+
+ if (gtk_tree_selection_get_selected (priv->treeview_selection, NULL, &iter))
+ {
+ gtk_tree_model_get (GTK_TREE_MODEL (priv->treemodelfilter), &iter,
+ COLUMN_LANG, &lang,
+ -1);
+ }
+
+ g_signal_emit (G_OBJECT (dialog), signals[LANGUAGE_SELECTED], 0, lang);
+
+ if (lang)
+ {
+ g_object_unref (lang);
+ }
+ }
+
+ gtk_widget_destroy (GTK_WIDGET (dialog));
+}
+
+static void
+gedit_highlight_mode_dialog_class_init (GeditHighlightModeDialogClass *klass)
+{
+ GObjectClass *object_class = G_OBJECT_CLASS (klass);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass);
+ GtkDialogClass *dialog_class = GTK_DIALOG_CLASS (klass);
+
+ object_class->finalize = gedit_highlight_mode_dialog_finalize;
+
+ dialog_class->response = gedit_highlight_mode_dialog_response;
+
+ signals[LANGUAGE_SELECTED] =
+ g_signal_new ("language-selected",
+ G_TYPE_FROM_CLASS (object_class),
+ G_SIGNAL_RUN_LAST | G_SIGNAL_ACTION,
+ G_STRUCT_OFFSET (GeditHighlightModeDialogClass, language_selected),
+ NULL, NULL,
+ g_cclosure_marshal_VOID__OBJECT,
+ G_TYPE_NONE,
+ 1,
+ GTK_SOURCE_TYPE_LANGUAGE);
+
+ /* Bind class to template */
+ gtk_widget_class_set_template_from_resource (widget_class,
+ "/org/gnome/gedit/ui/gedit-highlight-mode-dialog.ui");
+ gtk_widget_class_bind_child (widget_class, GeditHighlightModeDialogPrivate, treeview);
+ gtk_widget_class_bind_child (widget_class, GeditHighlightModeDialogPrivate, entry);
+ gtk_widget_class_bind_child (widget_class, GeditHighlightModeDialogPrivate, liststore);
+ gtk_widget_class_bind_child (widget_class, GeditHighlightModeDialogPrivate, treemodelfilter);
+ gtk_widget_class_bind_child (widget_class, GeditHighlightModeDialogPrivate, treeview_selection);
+
+ g_type_class_add_private (object_class, sizeof (GeditHighlightModeDialogPrivate));
+}
+
+static gboolean
+visible_func (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GeditHighlightModeDialog *dlg)
+{
+ const gchar *entry_text;
+ gchar *name;
+ gchar *name_lower;
+ gchar *text_lower;
+ gboolean visible = FALSE;
+
+ entry_text = gtk_entry_get_text (GTK_ENTRY (dlg->priv->entry));
+
+ if (*entry_text == '\0')
+ {
+ return TRUE;
+ }
+
+ gtk_tree_model_get (model, iter, COLUMN_NAME, &name, -1);
+
+ name_lower = g_utf8_strdown (name, -1);
+ g_free (name);
+
+ text_lower = g_utf8_strdown (entry_text, -1);
+
+ if (strstr (name_lower, text_lower) != NULL)
+ {
+ visible = TRUE;
+ }
+
+ g_free (name_lower);
+ g_free (text_lower);
+
+ return visible;
+}
+
+static void
+on_entry_changed (GtkEntry *entry,
+ GeditHighlightModeDialog *dlg)
+{
+ GtkTreeIter iter;
+
+ gtk_tree_model_filter_refilter (dlg->priv->treemodelfilter);
+
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dlg->priv->treemodelfilter), &iter))
+ {
+ gtk_tree_selection_select_iter (dlg->priv->treeview_selection, &iter);
+ }
+}
+
+static gboolean
+move_selection (GeditHighlightModeDialog *dlg,
+ gint howmany)
+{
+ GtkTreeIter iter;
+ GtkTreePath *path;
+ gint *indices;
+ gint ret = FALSE;
+
+ if (!gtk_tree_selection_get_selected (dlg->priv->treeview_selection, NULL, &iter) &&
+ !gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dlg->priv->treemodelfilter), &iter))
+ {
+ return FALSE;
+ }
+
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (dlg->priv->treemodelfilter), &iter);
+ indices = gtk_tree_path_get_indices (path);
+
+ if (indices)
+ {
+ gint num;
+ gint idx;
+ GtkTreePath *new_path;
+
+ idx = indices[0];
+ num = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (dlg->priv->treemodelfilter), NULL);
+
+ if ((idx + howmany) < 0)
+ {
+ idx = 0;
+ }
+ else if ((idx + howmany) >= num)
+ {
+ idx = num - 1;
+ }
+ else
+ {
+ idx = idx + howmany;
+ }
+
+ new_path = gtk_tree_path_new_from_indices (idx, -1);
+ gtk_tree_selection_select_path (dlg->priv->treeview_selection, new_path);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (dlg->priv->treeview),
+ new_path, NULL, TRUE, 0.5, 0);
+ gtk_tree_path_free (new_path);
+
+ ret = TRUE;
+ }
+
+ gtk_tree_path_free (path);
+
+ return ret;
+}
+
+static gboolean
+on_entry_key_press_event (GtkWidget *entry,
+ GdkEventKey *event,
+ GeditHighlightModeDialog *dlg)
+{
+ if (event->keyval == GDK_KEY_Down)
+ {
+ return move_selection (dlg, 1);
+ }
+ else if (event->keyval == GDK_KEY_Up)
+ {
+ return move_selection (dlg, -1);
+ }
+ else if (event->keyval == GDK_KEY_Page_Down)
+ {
+ return move_selection (dlg, 5);
+ }
+ else if (event->keyval == GDK_KEY_Page_Up)
+ {
+ return move_selection (dlg, -5);
+ }
+
+ return FALSE;
+}
+
+static void
+on_selection_changed (GtkTreeSelection *selection,
+ GeditHighlightModeDialog *dlg)
+{
+ gtk_dialog_set_response_sensitive (GTK_DIALOG (dlg),
+ GTK_RESPONSE_OK,
+ gtk_tree_selection_get_selected (selection, NULL, NULL));
+}
+
+static void
+on_row_activated (GtkTreeView *tree_view,
+ GtkTreePath *path,
+ GtkTreeViewColumn *column,
+ GeditHighlightModeDialog *dlg)
+{
+ gtk_window_activate_default (GTK_WINDOW (dlg));
+}
+
+static void
+gedit_highlight_mode_dialog_init (GeditHighlightModeDialog *dlg)
+{
+ GeditHighlightModeDialogPrivate *priv;
+ GtkSourceLanguageManager *lm;
+ const gchar * const *ids;
+ gint i;
+ GtkTreeIter iter;
+
+ dlg->priv = G_TYPE_INSTANCE_GET_PRIVATE (dlg,
+ GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG,
+ GeditHighlightModeDialogPrivate);
+ priv = dlg->priv;
+
+ gtk_widget_init_template (GTK_WIDGET (dlg));
+ gtk_dialog_set_default_response(GTK_DIALOG (dlg), GTK_RESPONSE_OK);
+
+ gtk_tree_model_filter_set_visible_func (priv->treemodelfilter,
+ (GtkTreeModelFilterVisibleFunc)visible_func,
+ dlg,
+ NULL);
+
+ g_signal_connect (priv->entry, "changed",
+ G_CALLBACK (on_entry_changed), dlg);
+ g_signal_connect (priv->entry, "key-press-event",
+ G_CALLBACK (on_entry_key_press_event), dlg);
+
+ g_signal_connect (priv->treeview_selection, "changed",
+ G_CALLBACK (on_selection_changed), dlg);
+
+ g_signal_connect (priv->treeview, "row-activated",
+ G_CALLBACK (on_row_activated), dlg);
+
+ /* Populate tree model */
+ gtk_list_store_append (priv->liststore, &iter);
+ gtk_list_store_set (priv->liststore, &iter,
+ COLUMN_NAME, _("Plain Text"),
+ COLUMN_LANG, NULL,
+ -1);
+
+ lm = gtk_source_language_manager_get_default ();
+ ids = gtk_source_language_manager_get_language_ids (lm);
+
+ for (i = 0; ids[i] != NULL; i++)
+ {
+ GtkSourceLanguage *lang;
+
+ lang = gtk_source_language_manager_get_language (lm, ids[i]);
+
+ if (!gtk_source_language_get_hidden (lang))
+ {
+ gtk_list_store_append (priv->liststore, &iter);
+ gtk_list_store_set (priv->liststore, &iter,
+ COLUMN_NAME, gtk_source_language_get_name (lang),
+ COLUMN_LANG, lang,
+ -1);
+ }
+ }
+
+ /* select first item */
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dlg->priv->treemodelfilter), &iter))
+ {
+ gtk_tree_selection_select_iter (dlg->priv->treeview_selection, &iter);
+ }
+}
+
+GtkWidget *
+gedit_highlight_mode_dialog_new (GtkWindow *parent)
+{
+ return GTK_WIDGET (g_object_new (GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG,
+ "transient-for", parent,
+ NULL));
+}
+
+/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-highlight-mode-dialog.h b/gedit/gedit-highlight-mode-dialog.h
new file mode 100644
index 0000000..65cb7d5
--- /dev/null
+++ b/gedit/gedit-highlight-mode-dialog.h
@@ -0,0 +1,66 @@
+/*
+ * gedit-highlight-mode-dialog.h
+ * This file is part of gedit
+ *
+ * Copyright (C) 2013 - Ignacio Casal Quinteiro
+ *
+ * gedit 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.
+ *
+ * gedit 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 gedit. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+
+#ifndef __GEDIT_HIGHLIGHT_MODE_DIALOG_H__
+#define __GEDIT_HIGHLIGHT_MODE_DIALOG_H__
+
+#include <glib-object.h>
+#include <gtksourceview/gtksource.h>
+#include "gedit-window.h"
+
+G_BEGIN_DECLS
+
+#define GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG (gedit_highlight_mode_dialog_get_type ())
+#define GEDIT_HIGHLIGHT_MODE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG, GeditHighlightModeDialog))
+#define GEDIT_HIGHLIGHT_MODE_DIALOG_CONST(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj),
GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG, GeditHighlightModeDialog const))
+#define GEDIT_HIGHLIGHT_MODE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG, GeditHighlightModeDialogClass))
+#define GEDIT_IS_HIGHLIGHT_MODE_DIALOG(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj),
GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG))
+#define GEDIT_IS_HIGHLIGHT_MODE_DIALOG_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass),
GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG))
+#define GEDIT_HIGHLIGHT_MODE_DIALOG_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj),
GEDIT_TYPE_HIGHLIGHT_MODE_DIALOG, GeditHighlightModeDialogClass))
+
+typedef struct _GeditHighlightModeDialog GeditHighlightModeDialog;
+typedef struct _GeditHighlightModeDialogClass GeditHighlightModeDialogClass;
+typedef struct _GeditHighlightModeDialogPrivate GeditHighlightModeDialogPrivate;
+
+struct _GeditHighlightModeDialog
+{
+ GtkDialog parent;
+
+ GeditHighlightModeDialogPrivate *priv;
+};
+
+struct _GeditHighlightModeDialogClass
+{
+ GtkDialogClass parent_class;
+
+ void (* language_selected) (GeditHighlightModeDialog *dialog,
+ GtkSourceLanguage *language);
+};
+
+GType gedit_highlight_mode_dialog_get_type (void) G_GNUC_CONST;
+
+GtkWidget *gedit_highlight_mode_dialog_new (GtkWindow *parent);
+
+G_END_DECLS
+
+#endif /* __GEDIT_HIGHLIGHT_MODE_DIALOG_H__ */
+
+/* ex:set ts=8 noet: */
diff --git a/gedit/gedit-highlight-mode-dialog.ui b/gedit/gedit-highlight-mode-dialog.ui
new file mode 100644
index 0000000..eb43035
--- /dev/null
+++ b/gedit/gedit-highlight-mode-dialog.ui
@@ -0,0 +1,158 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface>
+ <!-- interface-requires gtk+ 3.8 -->
+ <object class="GtkListStore" id="liststore">
+ <columns>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name lang -->
+ <column type="GtkSourceLanguage"/>
+ </columns>
+ </object>
+ <object class="GtkTreeModelFilter" id="treemodelfilter">
+ <property name="child_model">liststore</property>
+ </object>
+ <template class="GeditHighlightModeDialog" parent="GtkDialog">
+ <property name="width_request">300</property>
+ <property name="height_request">400</property>
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="title" translatable="yes">Highlight Mode</property>
+ <property name="type_hint">dialog</property>
+ <property name="modal">True</property>
+ <child internal-child="vbox">
+ <object class="GtkBox" id="dialog-vbox1">
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">2</property>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="dialog-action_area1">
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="layout_style">end</property>
+ <child>
+ <object class="GtkButton" id="cancel_button">
+ <property name="label">gtk-cancel</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="ok_button">
+ <property name="label">gtk-ok</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="receives_default">True</property>
+ <property name="use_stock">True</property>
+ <property name="can_default">True</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkGrid" id="grid">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="row_spacing">3</property>
+ <child>
+ <object class="GtkSearchEntry" id="entry">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="activates_default">True</property>
+ <property name="placeholder_text" translatable="yes">Search highlight mode...</property>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">0</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkScrolledWindow" id="scrolledwindow1">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="hexpand">True</property>
+ <property name="vexpand">True</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="treeview">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_focus">False</property>
+ <property name="is_focus">False</property>
+ <property name="model">treemodelfilter</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="enable_search">False</property>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview_selection"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="left_attach">0</property>
+ <property name="top_attach">1</property>
+ <property name="width">1</property>
+ <property name="height">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ </child>
+ <action-widgets>
+ <action-widget response="-6">cancel_button</action-widget>
+ <action-widget response="-5">ok_button</action-widget>
+ </action-widgets>
+ </template>
+</interface>
diff --git a/gedit/gedit-preferences-dialog.ui b/gedit/gedit-preferences-dialog.ui
index 209fb96..780256f 100644
--- a/gedit/gedit-preferences-dialog.ui
+++ b/gedit/gedit-preferences-dialog.ui
@@ -777,7 +777,6 @@
</child>
<child>
<object class="GtkTreeViewColumn" id="schemes_column">
- <property name="title" translatable="yes">column</property>
<child>
<object class="GtkCellRendererText" id="schemes_renderer">
<property name="ellipsize">end</property>
diff --git a/gedit/gedit-window.c b/gedit/gedit-window.c
index 62fb730..997bea7 100644
--- a/gedit/gedit-window.c
+++ b/gedit/gedit-window.c
@@ -703,7 +703,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
(state_normal ||
state == GEDIT_TAB_STATE_EXTERNALLY_MODIFIED_NOTIFICATION));
- action = g_action_map_lookup_action (G_ACTION_MAP (window), "hightlight_mode");
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "highlight_mode");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
(state != GEDIT_TAB_STATE_CLOSING) &&
enable_syntax_highlighting);
@@ -1785,6 +1785,9 @@ set_sensitivity_according_to_window_state (GeditWindow *window)
action = g_action_map_lookup_action (G_ACTION_MAP (window), "move_to_new_window");
g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 1);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "highlight_mode");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
action = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
if (!g_action_get_enabled (action))
{
@@ -2493,6 +2496,9 @@ update_sensitivity_according_to_open_tabs (GeditWindow *window,
g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
num_notebooks > 1);
+ action = g_action_map_lookup_action (G_ACTION_MAP (window), "highlight_mode");
+ g_simple_action_set_enabled (G_SIMPLE_ACTION (action), num_tabs > 0);
+
/* Do not set close action insensitive on OS X */
#ifndef OS_OSX
action = g_action_map_lookup_action (G_ACTION_MAP (window), "close");
@@ -3124,7 +3130,7 @@ static GActionEntry win_entries[] = {
{ "paste", _gedit_cmd_edit_paste },
{ "delete", _gedit_cmd_edit_delete },
{ "select_all", _gedit_cmd_edit_select_all },
- { "hightlight_mode", NULL }
+ { "highlight_mode", _gedit_cmd_view_highlight_mode }
};
static void
diff --git a/gedit/gedit-window.ui b/gedit/gedit-window.ui
index 278caf4..5ebd416 100644
--- a/gedit/gedit-window.ui
+++ b/gedit/gedit-window.ui
@@ -98,6 +98,12 @@
</section>
<section>
<item>
+ <attribute name="label" translatable="yes">_Highlight Mode</attribute>
+ <attribute name="action">win.highlight_mode</attribute>
+ </item>
+ </section>
+ <section>
+ <item>
<attribute name="label" translatable="yes">_Close</attribute>
<attribute name="action">win.close</attribute>
<attribute name="accel"><Primary>w</attribute>
diff --git a/gedit/gedit.gresource.xml b/gedit/gedit.gresource.xml
index 1c2bb7c..247d4aa 100644
--- a/gedit/gedit.gresource.xml
+++ b/gedit/gedit.gresource.xml
@@ -13,5 +13,6 @@
<file preprocess="xml-stripblanks">gedit-status-menu-button.ui</file>
<file preprocess="xml-stripblanks">gedit-view-frame.ui</file>
<file preprocess="xml-stripblanks">gedit-window.ui</file>
+ <file preprocess="xml-stripblanks">gedit-highlight-mode-dialog.ui</file>
</gresource>
</gresources>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]