[Xfce4-commits] [apps/mousepad] 11/45: Remove uneeded code for view-line-numbers setting
noreply at xfce.org
noreply at xfce.org
Fri Jul 11 13:03:16 CEST 2014
This is an automated email from the git hooks/post-receive script.
mbrush pushed a commit to branch master
in repository apps/mousepad.
commit d6ac79f341aabf7b2d0581fab5b3cdbf97570ea4
Author: Matthew Brush <mbrush at codebrainz.ca>
Date: Sun Jul 6 16:57:33 2014 -0700
Remove uneeded code for view-line-numbers setting
Bind each textview's show-line-numbers property to the setting so that
the window code no longer needs to apply it manually. Remove pointless
mousepad_view_get/set_line_numbers() functions since the binding makes
it automatic and it can also be set through the GtkSourceView functions
where needed.
---
mousepad/mousepad-document.c | 4 +---
mousepad/mousepad-encoding-dialog.c | 2 +-
mousepad/mousepad-view.c | 21 ---------------------
mousepad/mousepad-view.h | 3 ---
mousepad/mousepad-window.c | 30 ++++++------------------------
5 files changed, 8 insertions(+), 52 deletions(-)
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index a707308..a25d413 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -176,7 +176,7 @@ static void
mousepad_document_init (MousepadDocument *document)
{
GtkTargetList *target_list;
- gboolean word_wrap, auto_indent, line_numbers, insert_spaces;
+ gboolean word_wrap, auto_indent, insert_spaces;
gchar *font_name, *color_scheme;
gint tab_size;
GtkSourceStyleScheme *scheme = NULL;
@@ -218,7 +218,6 @@ mousepad_document_init (MousepadDocument *document)
/* read all the default settings */
word_wrap = mousepad_settings_get_boolean ("view-word-wrap");
- line_numbers = mousepad_settings_get_boolean ("view-line-numbers");
auto_indent = mousepad_settings_get_boolean ("view-auto-indent");
font_name = mousepad_settings_get_string ("view-font-name");
tab_size = mousepad_settings_get_int ("view-tab-size");
@@ -228,7 +227,6 @@ mousepad_document_init (MousepadDocument *document)
/* set all the settings */
mousepad_document_set_word_wrap (document, word_wrap);
mousepad_document_set_font (document, font_name);
- mousepad_view_set_line_numbers (document->textview, line_numbers);
mousepad_view_set_auto_indent (document->textview, auto_indent);
mousepad_view_set_tab_size (document->textview, tab_size);
mousepad_view_set_insert_spaces (document->textview, insert_spaces);
diff --git a/mousepad/mousepad-encoding-dialog.c b/mousepad/mousepad-encoding-dialog.c
index 6828452..fae5e46 100644
--- a/mousepad/mousepad-encoding-dialog.c
+++ b/mousepad/mousepad-encoding-dialog.c
@@ -209,7 +209,7 @@ mousepad_encoding_dialog_init (MousepadEncodingDialog *dialog)
gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (dialog->document), TRUE, TRUE, 0);
gtk_text_view_set_editable (GTK_TEXT_VIEW (dialog->document->textview), FALSE);
gtk_text_view_set_cursor_visible (GTK_TEXT_VIEW (dialog->document->textview), FALSE);
- mousepad_view_set_line_numbers (dialog->document->textview, FALSE);
+ gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (dialog->document->textview), FALSE);
mousepad_document_set_word_wrap (dialog->document, FALSE);
gtk_widget_show (GTK_WIDGET (dialog->document));
}
diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index a8efa63..2b6edcc 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -2281,17 +2281,6 @@ mousepad_view_indent (MousepadView *view,
void
-mousepad_view_set_line_numbers (MousepadView *view,
- gboolean line_numbers)
-{
- mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
-
- gtk_source_view_set_show_line_numbers (GTK_SOURCE_VIEW (view), line_numbers);
-}
-
-
-
-void
mousepad_view_set_auto_indent (MousepadView *view,
gboolean auto_indent)
{
@@ -2365,16 +2354,6 @@ mousepad_view_get_selection_length (MousepadView *view,
gboolean
-mousepad_view_get_line_numbers (MousepadView *view)
-{
- mousepad_return_val_if_fail (MOUSEPAD_IS_VIEW (view), FALSE);
-
- return gtk_source_view_get_show_line_numbers (GTK_SOURCE_VIEW (view));
-}
-
-
-
-gboolean
mousepad_view_get_auto_indent (MousepadView *view)
{
mousepad_return_val_if_fail (MOUSEPAD_IS_VIEW (view), FALSE);
diff --git a/mousepad/mousepad-view.h b/mousepad/mousepad-view.h
index 109f7f0..0c6f4e4 100644
--- a/mousepad/mousepad-view.h
+++ b/mousepad/mousepad-view.h
@@ -92,9 +92,6 @@ void mousepad_view_duplicate (MousepadView *view
void mousepad_view_indent (MousepadView *view,
gint type);
-void mousepad_view_set_line_numbers (MousepadView *view,
- gboolean line_numbers);
-
void mousepad_view_set_auto_indent (MousepadView *view,
gboolean auto_indent);
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 94ec28e..d5dcbed 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2251,7 +2251,7 @@ mousepad_window_update_actions (MousepadWindow *window)
action = gtk_action_group_get_action (window->action_group, "word-wrap");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
- active = mousepad_view_get_line_numbers (document->textview);
+ active = mousepad_settings_get_boolean ("view-line-numbers");
action = gtk_action_group_get_action (window->action_group, "line-numbers");
gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), active);
@@ -4518,34 +4518,16 @@ static void
mousepad_window_action_line_numbers (GtkToggleAction *action,
MousepadWindow *window)
{
- gint page_num = 0;
- gboolean active;
- GtkWidget *page;
- MousepadDocument *document;
+ gboolean active;
mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (window->active));
- /* leave when menu updates are locked */
- if (lock_menu_updates == 0)
- {
- /* get the current state */
- active = gtk_toggle_action_get_active (action);
-
- /* save as the last used line number setting */
- mousepad_settings_set_boolean ("view-line-numbers", active);
+ /* get the current state */
+ active = gtk_toggle_action_get_active (action);
- /* apply line numbers setting to all open textviews */
- while ((page = gtk_notebook_get_nth_page (GTK_NOTEBOOK (window->notebook), page_num)))
- {
- if (G_LIKELY (MOUSEPAD_IS_DOCUMENT (page)))
- {
- document = MOUSEPAD_DOCUMENT (page);
- mousepad_view_set_line_numbers (document->textview, active);
- }
- page_num++;
- }
- }
+ /* save as the last used line number setting */
+ mousepad_settings_set_boolean ("view-line-numbers", active);
}
--
To stop receiving notification emails like this one, please contact
the administrator of this repository.
More information about the Xfce4-commits
mailing list