Commit 3328c1d4 authored by Paolo Borelli's avatar Paolo Borelli Committed by Paolo Borelli

use the has-selection property of GtkTextBuffer 2.10.

2006-08-07  Paolo Borelli  <pborelli@katamail.com>

	* gedit/gedit-document.[ch]:
	* gedit/gedit-window.c:

	use the has-selection property of GtkTextBuffer 2.10.
parent 221b3d13
2006-08-07 Paolo Borelli <pborelli@katamail.com>
* gedit-view.c: use the indent-on-tab feature of sourceview 1.7.2
* gedit/gedit-document.[ch]:
* gedit/gedit-window.c:
use the has-selection property of GtkTextBuffer 2.10.
2006-08-07 Paolo Borelli <pborelli@katamail.com>
* gedit/gedit-view.c: use the indent-on-tab feature of sourceview 1.7.2
2006-08-07 Paolo Borelli <pborelli@katamail.com>
......
......@@ -111,11 +111,6 @@ GeditDocument
</para>
<!-- ##### ARG GeditDocument:has-selection ##### -->
<para>
</para>
<!-- ##### ARG GeditDocument:mime-type ##### -->
<para>
......
......@@ -46,3 +46,9 @@ GeditPageSetupDialog
GeditPreferencesDialog
<!-- ##### ARG GeditDocument:has-selection ##### -->
<para>
</para>
......@@ -94,7 +94,6 @@ struct _GeditDocumentPrivate
gint last_save_was_manually : 1;
gint language_set_by_user : 1;
gint is_saving_as : 1;
gint has_selection : 1;
gint stop_cursor_moved_emission : 1;
gchar *uri;
......@@ -138,7 +137,6 @@ enum {
PROP_READ_ONLY,
PROP_ENCODING,
PROP_CAN_SEARCH_AGAIN,
PROP_HAS_SELECTION,
PROP_ENABLE_SEARCH_HIGHLIGHTING
};
......@@ -297,11 +295,9 @@ gedit_document_get_property (GObject *object,
case PROP_CAN_SEARCH_AGAIN:
g_value_set_boolean (value, gedit_document_get_can_search_again (doc));
break;
case PROP_HAS_SELECTION:
g_value_set_boolean (value, doc->priv->has_selection);
break;
case PROP_ENABLE_SEARCH_HIGHLIGHTING:
g_value_set_boolean (value, gedit_document_get_enable_search_highlighting (doc));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
......@@ -350,22 +346,6 @@ gedit_document_mark_set (GtkTextBuffer *buffer,
iter,
mark);
if (mark == gtk_text_buffer_get_insert (buffer) ||
mark == gtk_text_buffer_get_selection_bound (buffer))
{
gboolean has_selection;
has_selection = gtk_text_buffer_get_selection_bounds (buffer,
NULL,
NULL);
if (has_selection != doc->priv->has_selection)
{
doc->priv->has_selection = has_selection;
g_object_notify (G_OBJECT (doc), "has-selection");
}
}
if (mark == gtk_text_buffer_get_insert (buffer))
{
emit_cursor_moved (doc);
......@@ -430,16 +410,6 @@ gedit_document_class_init (GeditDocumentClass *klass)
FALSE,
G_PARAM_READABLE));
/* This has been properly moved in GtkTextBuffer in gtk 2.10, so when
* we switch to 2.10 we can remove it and part of with gedit_document_mark_set.
*/
g_object_class_install_property (object_class, PROP_HAS_SELECTION,
g_param_spec_boolean ("has-selection",
"Has selection",
"Wheter the document has selected text",
FALSE,
G_PARAM_READABLE));
g_object_class_install_property (object_class, PROP_ENABLE_SEARCH_HIGHLIGHTING,
g_param_spec_boolean ("enable-search-highlighting",
"Enable Search Highlighting",
......@@ -612,7 +582,6 @@ gedit_document_init (GeditDocument *doc)
doc->priv->readonly = FALSE;
doc->priv->has_selection = FALSE;
doc->priv->stop_cursor_moved_emission = FALSE;
doc->priv->last_save_was_manually = TRUE;
......@@ -1246,14 +1215,6 @@ gedit_document_get_deleted (GeditDocument *doc)
return !gnome_vfs_uri_exists (doc->priv->vfs_uri);
}
gboolean
_gedit_document_get_has_selection (GeditDocument *doc)
{
g_return_val_if_fail (GEDIT_IS_DOCUMENT (doc), FALSE);
return doc->priv->has_selection;
}
/*
* If @line is bigger than the lines of the document, the cursor is moved
* to the last line and FALSE is returned.
......
......@@ -238,10 +238,6 @@ gboolean _gedit_document_is_saving_as (GeditDocument *doc);
glong _gedit_document_get_seconds_since_last_save_or_load
(GeditDocument *doc);
/* private because the property will move to gtk */
gboolean _gedit_document_get_has_selection
(GeditDocument *doc);
void _gedit_document_search_region (GeditDocument *doc,
const GtkTextIter *start,
const GtkTextIter *end);
......
......@@ -53,7 +53,6 @@
#include "gedit-languages-manager.h"
#include "gedit-prefs-manager-app.h"
#include "gedit-panel.h"
#include "gedit-recent.h"
#include "gedit-documents-panel.h"
#include "gedit-plugins-engine.h"
#include "gedit-enum-types.h"
......@@ -608,13 +607,13 @@ set_sensitivity_according_to_tab (GeditWindow *window,
"EditCut");
gtk_action_set_sensitive (action,
state_normal &&
_gedit_document_get_has_selection (doc));
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
action = gtk_action_group_get_action (window->priv->action_group,
"EditCopy");
gtk_action_set_sensitive (action,
state_normal &&
_gedit_document_get_has_selection (doc));
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
action = gtk_action_group_get_action (window->priv->action_group,
"EditPaste");
......@@ -625,7 +624,7 @@ set_sensitivity_according_to_tab (GeditWindow *window,
"EditDelete");
gtk_action_set_sensitive (action,
state_normal &&
_gedit_document_get_has_selection (doc));
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
action = gtk_action_group_get_action (window->priv->action_group,
"SearchFind");
......@@ -1023,7 +1022,6 @@ update_recent_files_menu (GeditWindow *window)
{
GeditWindowPrivate *p = window->priv;
gint max_recents;
guint merge_id;
GList *actions, *l, *items;
gint i;
......@@ -2322,19 +2320,19 @@ selection_changed (GeditDocument *doc,
"EditCut");
gtk_action_set_sensitive (action,
state_normal &&
_gedit_document_get_has_selection (doc));
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
action = gtk_action_group_get_action (window->priv->action_group,
"EditCopy");
gtk_action_set_sensitive (action,
state_normal &&
_gedit_document_get_has_selection (doc));
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
action = gtk_action_group_get_action (window->priv->action_group,
"EditDelete");
gtk_action_set_sensitive (action,
state_normal &&
_gedit_document_get_has_selection (doc));
gtk_text_buffer_get_has_selection (GTK_TEXT_BUFFER (doc)));
}
static void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment