[Xfce4-commits] Fix string with inverted meaning about external modifications

2012-07-02 Thread Matthew Brush
Updating branch refs/heads/master
 to 02594e84b3fdf0bc475f90d12f63c252106ca5ea (commit)
   from b980d8101f64c1986904f12f4db590e44ca67c60 (commit)

commit 02594e84b3fdf0bc475f90d12f63c252106ca5ea
Author: Matthew Brush 
Date:   Mon Jul 2 09:50:31 2012 -0700

Fix string with inverted meaning about external modifications

 mousepad/mousepad-dialogs.c |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index 524fcc7..f5d4ccd 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -407,7 +407,8 @@ mousepad_dialogs_externally_modified (GtkWindow *parent)
GTK_MESSAGE_WARNING, GTK_BUTTONS_NONE,
_("The document has been externally 
modified. Do you want to continue saving?"));
   gtk_window_set_title (GTK_WINDOW (dialog), _("Externally Modified"));
-  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog), _("If 
you don't save the document, all the external changes will be lost."));
+  gtk_message_dialog_format_secondary_text (GTK_MESSAGE_DIALOG (dialog),
+_("If you save the document, all 
of the external changes will be lost."));
   gtk_dialog_add_buttons (GTK_DIALOG (dialog),
   GTK_STOCK_CANCEL, MOUSEPAD_RESPONSE_CANCEL,
   GTK_STOCK_SAVE_AS, MOUSEPAD_RESPONSE_SAVE_AS,
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Replace access to sealed members of GtkTextView

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 9a4649bf7e679e69c5fa60f372546ba839f42cff (commit)
   from 22a56bbcec640f55b21dc1a02ff4549708b2c038 (commit)

commit 9a4649bf7e679e69c5fa60f372546ba839f42cff
Author: Mark Trompell 
Date:   Tue Apr 24 10:27:12 2012 +0200

Replace access to sealed members of GtkTextView

Signed-off-by: Matthew Brush 

 mousepad/mousepad-view.c |   36 +++-
 1 files changed, 19 insertions(+), 17 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 9bb4ace..c72f649 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -30,7 +30,7 @@
 
 
 
-#define mousepad_view_get_buffer(view) (GTK_TEXT_VIEW (view)->buffer)
+#define mousepad_view_get_buffer(view) (gtk_text_view_get_buffer 
(GTK_TEXT_VIEW (view)))
 
 
 
@@ -258,7 +258,7 @@ mousepad_view_key_press_event (GtkWidget   *widget,
   buffer = mousepad_view_get_buffer (view);
 
   /* whether the textview is editable */
-  is_editable = GTK_TEXT_VIEW (view)->editable;
+  is_editable = gtk_text_view_get_editable(GTK_TEXT_VIEW (view));
 
   /* handle the key event */
   switch (event->keyval)
@@ -407,9 +407,7 @@ mousepad_view_button_press_event (GtkWidget  *widget,
   && event->type == GDK_BUTTON_PRESS)
 {
   /* set the vertical selection start position, including textview offset 
*/
-  view->selection_start_x = event->x + textview->xoffset;
-  view->selection_start_y = event->y + textview->yoffset;
-
+  
gtk_text_view_window_to_buffer_coords(textview,GTK_TEXT_WINDOW_TEXT,event->x,event->y,&view->selection_start_x,&view->selection_start_y);
   /* hide cursor */
   gtk_text_view_set_cursor_visible (textview, FALSE);
 
@@ -422,9 +420,10 @@ mousepad_view_button_press_event (GtkWidget  *widget,
   else if (event->type == GDK_2BUTTON_PRESS && event->button == 1)
 {
   /* get the iter under the cursor */
+  gint x,y;
+  
gtk_text_view_window_to_buffer_coords(textview,GTK_TEXT_WINDOW_TEXT,event->x,event->y,&x,&y);
   gtk_text_view_get_iter_at_location (GTK_TEXT_VIEW (view), &iter,
-  event->x + textview->xoffset,
-  event->y + textview->yoffset);
+  x,y);
 
   /* try to select a whole word or space */
   if (mousepad_view_selection_word_range (&iter, &start_iter, &end_iter))
@@ -734,8 +733,11 @@ mousepad_view_selection_draw (MousepadView *view,
   /* get the visible area */
   if (G_LIKELY (append == FALSE))
 {
+  gint xoffset,yoffset;
+  gtk_text_view_window_to_buffer_coords(textview,GTK_TEXT_WINDOW_TEXT,
+   0,0,&xoffset,&yoffset);
   visible_start_y = MIN (y_begin, y_end);
-  visible_start_y = MAX (visible_start_y, textview->yoffset);
+  visible_start_y = MAX (visible_start_y, yoffset);
 }
 
   /* walk the lines inside the selection area */
@@ -761,12 +763,12 @@ mousepad_view_selection_draw (MousepadView *view,
   gtk_text_view_get_iter_location (textview, &end_iter, &rect);
 
   /* calculate line cooridinates */
-  line_x = rect.x - textview->xoffset;
-  line_y = rect.y - textview->yoffset;
+  
gtk_text_view_buffer_to_window_coords(textview,GTK_TEXT_WINDOW_TEXT,
+rect.x,rect.y, 
&line_x,&line_y);
 
   /* draw a line in front of the iter */
   gdk_draw_line (GDK_DRAWABLE (window),
- GTK_WIDGET 
(view)->style->base_gc[GTK_STATE_SELECTED],
+ gtk_widget_get_style(GTK_WIDGET 
(view))->base_gc[GTK_STATE_SELECTED],
  line_x, line_y, line_x, line_y + rect.height - 1);
 }
   else if (!gtk_text_iter_equal (&start_iter, &end_iter))
@@ -816,12 +818,12 @@ mousepad_view_selection_draw (MousepadView *view,
   gtk_text_view_get_iter_location (textview, &start_iter, &rect);
 
   /* calculate line coordinates */
-  line_x = rect.x - textview->xoffset;
-  line_y = rect.y - textview->yoffset;
-
+  
gtk_text_view_buffer_to_window_coords(textview,GTK_TEXT_WINDOW_TEXT,
+rect.x,rect.y, 
&line_x,&line_y);
+
   /* draw a line in front of the iter */
   gdk_draw_line (GDK_DRAWABLE (window),
- GTK_WIDGET 
(view)->style->base_gc[GTK_STATE_SELECTED],
+ gtk_widget_get_style(GTK_WIDGET 
(view))->base_gc[GTK_STATE

[Xfce4-commits] Remove use of deprecated GTK_DIALOG_NO_SEPARATOR flag

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 3170a17667ed9b654cdc300bd370951bd7c71813 (commit)
   from 9a4649bf7e679e69c5fa60f372546ba839f42cff (commit)

commit 3170a17667ed9b654cdc300bd370951bd7c71813
Author: Mark Trompell 
Date:   Tue Apr 24 10:28:14 2012 +0200

Remove use of deprecated GTK_DIALOG_NO_SEPARATOR flag

Signed-off-by: Matthew Brush 

 mousepad/mousepad-dialogs.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index b0cb34e..524fcc7 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -142,7 +142,7 @@ mousepad_dialogs_other_tab_size (GtkWindow *parent,
   /* build dialog */
   dialog = gtk_dialog_new_with_buttons (_("Select Tab Size"),
 parent,
-GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT,
 GTK_STOCK_CANCEL, 
MOUSEPAD_RESPONSE_CANCEL,
 GTK_STOCK_OK, MOUSEPAD_RESPONSE_OK,
 NULL);
@@ -223,7 +223,7 @@ mousepad_dialogs_go_to (GtkWindow *parent,
   /* build the dialog */
   dialog = gtk_dialog_new_with_buttons (_("Go To"),
 parent,
-GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR,
+GTK_DIALOG_MODAL | 
GTK_DIALOG_DESTROY_WITH_PARENT,
 GTK_STOCK_CANCEL, 
MOUSEPAD_RESPONSE_CANCEL,
 GTK_STOCK_JUMP_TO, 
MOUSEPAD_RESPONSE_JUMP_TO,
 NULL);
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Remove unused variable

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to e1d3efc8b2b7461ffbe7764eb185942b650a7931 (commit)
   from 3170a17667ed9b654cdc300bd370951bd7c71813 (commit)

commit e1d3efc8b2b7461ffbe7764eb185942b650a7931
Author: Matthew Brush 
Date:   Fri May 4 21:00:51 2012 -0700

Remove unused variable

 mousepad/mousepad-view.c |5 -
 1 files changed, 0 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index c72f649..a123241 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -854,7 +854,6 @@ mousepad_view_selection_timeout (gpointer user_data)
   MousepadView  *view = MOUSEPAD_VIEW (user_data);
   GtkTextView   *textview = GTK_TEXT_VIEW (view);
   gint   pointer_x, pointer_y;
-  gint   selection_start_x, selection_start_y;
   GtkTextBuffer *buffer;
   GtkTextIteriter, cursor;
 
@@ -875,10 +874,6 @@ mousepad_view_selection_timeout (gpointer user_data)
   view->selection_end_x = pointer_x;
   view->selection_end_y = pointer_y;
 
-  /* backup start coordinates */
-  selection_start_x = view->selection_start_x;
-  selection_start_y = view->selection_start_y;
-
   /* get the text buffer */
   buffer = mousepad_view_get_buffer (view);
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Replace deprecated GTK+ symbols

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 8d562e62c9496a8d8f012665d2dec416086db91a (commit)
   from 75d0fbb5e30af2b9e94700c55be9289e77a4d3d1 (commit)

commit 8d562e62c9496a8d8f012665d2dec416086db91a
Author: Mark Trompell 
Date:   Thu Jan 26 11:40:56 2012 +0100

Replace deprecated GTK+ symbols

Signed-off-by: Matthew Brush 

 configure.ac.in |2 +-
 mousepad/mousepad-document.c|3 ++-
 mousepad/mousepad-encoding-dialog.c |2 +-
 mousepad/mousepad-print.c   |2 +-
 mousepad/mousepad-search-bar.c  |2 +-
 mousepad/mousepad-window.c  |8 
 6 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index 9c820c6..228515a 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -82,7 +82,7 @@ dnl *** Check for required packages ***
 dnl ***
 XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.12.0])
-XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
+XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.18.0])
 XDT_CHECK_PACKAGE([GTKSOURCEVIEW], [gtksourceview-2.0])
 
 dnl **
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index a3d9099..d248dc9 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -578,7 +578,8 @@ mousepad_document_get_tab_label (MousepadDocument *document)
   button = gtk_button_new ();
   gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
   gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE);
-  GTK_WIDGET_UNSET_FLAGS (button, GTK_CAN_DEFAULT | GTK_CAN_FOCUS);
+  gtk_widget_set_can_default(GTK_WIDGET(button), FALSE);
+  gtk_widget_set_can_focus(GTK_WIDGET(button), FALSE);
 
   /* make button a bit smaller */
   style = gtk_rc_style_new ();
diff --git a/mousepad/mousepad-encoding-dialog.c 
b/mousepad/mousepad-encoding-dialog.c
index 7d4ce76..ec73960 100644
--- a/mousepad/mousepad-encoding-dialog.c
+++ b/mousepad/mousepad-encoding-dialog.c
@@ -457,7 +457,7 @@ mousepad_encoding_dialog_combo_changed (GtkComboBox 
   *combo,
   gintid;
 
   /* get the selected item */
-  if (GTK_WIDGET_SENSITIVE (combo) && gtk_combo_box_get_active_iter (combo, 
&iter))
+  if (gtk_widget_get_sensitive (GTK_WIDGET(combo)) && 
gtk_combo_box_get_active_iter (combo, &iter))
 {
   /* get the id */
   gtk_tree_model_get (GTK_TREE_MODEL (dialog->store), &iter, COLUMN_ID, 
&id, -1);
diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index e647ae1..d9b398f 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -469,7 +469,7 @@ mousepad_print_page_setup_dialog (GtkWidget *button,
 
   /* get the toplevel of the button */
   toplevel = gtk_widget_get_toplevel (button);
-  if (G_UNLIKELY (!GTK_WIDGET_TOPLEVEL (toplevel)))
+  if (G_UNLIKELY (!gtk_widget_is_toplevel (toplevel)))
 toplevel = NULL;
 
   /* get the print settings */
diff --git a/mousepad/mousepad-search-bar.c b/mousepad/mousepad-search-bar.c
index 4158d02..ab97fec 100644
--- a/mousepad/mousepad-search-bar.c
+++ b/mousepad/mousepad-search-bar.c
@@ -475,7 +475,7 @@ mousepad_search_bar_highlight_timeout (gpointer user_data)
 GtkEditable *
 mousepad_search_bar_entry (MousepadSearchBar *bar)
 {
-  if (bar && GTK_WIDGET_HAS_FOCUS (bar->entry))
+  if (bar && gtk_widget_has_focus (bar->entry))
 return GTK_EDITABLE (bar->entry);
   else
 return NULL;
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 3067788..b64135b 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -105,7 +105,7 @@ static void  
mousepad_window_statusbar_filetype_toggled   (GtkCheckM
 
 /* notebook signals */
 static void  mousepad_window_notebook_switch_page 
(GtkNotebook*notebook,
-   
GtkNotebookPage*page,
+   
GtkWidget  *page,
guint   
page_num,

MousepadWindow *window);
 static void  mousepad_window_notebook_reordered   
(GtkNotebook*notebook,
@@ -787,7 +787,7 @@ mousepad_window_configure_event (GtkWidget *widget,
 g_source_remove (window->save_geometry_timer_id);
 
   /* check if we should schedule another save timer */
-  if (GTK_WIDGET_VISIBLE (widget))
+  if (gtk_widget_get_visible (widget))
 {
   /* save the geometry one second after the last configure event */
   window->save_geometry_timer_id = g_timeout_add_full (G_PRIORITY_LOW, 
1000, mousepad_window_save_geome

[Xfce4-commits] Replace sealed access to GtkDialog's vbox (content-area) member

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 22a56bbcec640f55b21dc1a02ff4549708b2c038 (commit)
   from 8d562e62c9496a8d8f012665d2dec416086db91a (commit)

commit 22a56bbcec640f55b21dc1a02ff4549708b2c038
Author: Mark Trompell 
Date:   Tue Apr 24 07:44:49 2012 +0200

Replace sealed access to GtkDialog's vbox (content-area) member

Signed-off-by: Matthew Brush 

 mousepad/mousepad-dialogs.c |4 ++--
 mousepad/mousepad-encoding-dialog.c |2 +-
 mousepad/mousepad-replace-dialog.c  |2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index 5093024..b0cb34e 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -154,7 +154,7 @@ mousepad_dialogs_other_tab_size (GtkWindow *parent,
   gtk_scale_set_digits (GTK_SCALE (scale), 0);
   gtk_scale_set_draw_value (GTK_SCALE (scale), TRUE);
   gtk_scale_set_value_pos (GTK_SCALE (scale), GTK_POS_TOP);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), scale, TRUE, TRUE, 
0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area 
(GTK_DIALOG(dialog))), scale, TRUE, TRUE, 0);
   gtk_widget_show (scale);
 
   /* run the dialog */
@@ -231,7 +231,7 @@ mousepad_dialogs_go_to (GtkWindow *parent,
   gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE);
 
   vbox = gtk_vbox_new (FALSE, 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, TRUE, TRUE, 
0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area 
(GTK_DIALOG(dialog))), vbox, TRUE, TRUE, 0);
   gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
   gtk_widget_show (vbox);
 
diff --git a/mousepad/mousepad-encoding-dialog.c 
b/mousepad/mousepad-encoding-dialog.c
index ec73960..31d1c0d 100644
--- a/mousepad/mousepad-encoding-dialog.c
+++ b/mousepad/mousepad-encoding-dialog.c
@@ -136,7 +136,7 @@ mousepad_encoding_dialog_init (MousepadEncodingDialog 
*dialog)
 
   /* dialog vbox */
   vbox = gtk_vbox_new (FALSE, 6);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, TRUE, TRUE, 
0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG 
(dialog))), vbox, TRUE, TRUE, 0);
   gtk_widget_show (vbox);
 
   hbox = gtk_hbox_new (FALSE, 6);
diff --git a/mousepad/mousepad-replace-dialog.c 
b/mousepad/mousepad-replace-dialog.c
index a3a171e..8911b5a 100644
--- a/mousepad/mousepad-replace-dialog.c
+++ b/mousepad/mousepad-replace-dialog.c
@@ -178,7 +178,7 @@ mousepad_replace_dialog_init (MousepadReplaceDialog *dialog)
 
   /* create main vertical box */
   vbox = g_object_new (GTK_TYPE_VBOX, "border-width", 6, "spacing", 4, NULL);
-  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), vbox, TRUE, TRUE, 
0);
+  gtk_box_pack_start (GTK_BOX (gtk_dialog_get_content_area(GTK_DIALOG 
(dialog))), vbox, TRUE, TRUE, 0);
   gtk_widget_show (vbox);
 
   /* horizontal box for search string */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add .gitignore file

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 551173dcfac7ec4ae8c7e0a2baa4ea147c92253a (commit)
   from 4783ee11ebd8b90e70923d83a7468351d6fedb80 (commit)

commit 551173dcfac7ec4ae8c7e0a2baa4ea147c92253a
Author: Matthew Brush 
Date:   Sat Mar 31 13:24:21 2012 -0700

Add .gitignore file

 .gitignore |   37 +
 1 files changed, 37 insertions(+), 0 deletions(-)

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 000..3e3e61d
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,37 @@
+*.o
+Makefile
+Makefile.in
+Makefile.in.in
+Mousepad.desktop
+MousepadHelp
+aclocal.m4
+autom4te.cache/
+compile
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+configure.ac
+depcomp
+docs/manual/C/Mousepad.xml
+install-sh
+intltool-extract.in
+intltool-merge.in
+intltool-update.in
+libtool
+ltmain.sh
+missing
+mkinstalldirs
+mousepad/.deps/
+mousepad/mousepad
+mousepad/mousepad-dbus-infos.h
+mousepad/mousepad-marshal.c
+mousepad/mousepad-marshal.h
+mousepad/mousepad-window-ui.h
+po/.intltool-merge-cache
+po/POTFILES
+po/stamp-it
+stamp-h1
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Use monospace font by default, using the system default size

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 75d0fbb5e30af2b9e94700c55be9289e77a4d3d1 (commit)
   from f4e0ab82dc019b13f2167dabadb67d9cfd16ab2c (commit)

commit 75d0fbb5e30af2b9e94700c55be9289e77a4d3d1
Author: Matthew Brush 
Date:   Sat Mar 31 13:59:16 2012 -0700

Use monospace font by default, using the system default size

Closes bug #2720 which was previously addressed by not setting the
default font at all, but this usually ends up using a non-monospaced
font, which is probably not a good default for a plain text editor.

 mousepad/mousepad-preferences.c |2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-preferences.c b/mousepad/mousepad-preferences.c
index 740b281..90a84d6 100644
--- a/mousepad/mousepad-preferences.c
+++ b/mousepad/mousepad-preferences.c
@@ -180,7 +180,7 @@ mousepad_preferences_class_init (MousepadPreferencesClass 
*klass)
g_param_spec_string ("view-font-name",
 "ViewFontName",
 NULL,
-NULL,
+"Monospace",
 
MOUSEPAD_PARAM_READWRITE));
 
   g_object_class_install_property (gobject_class,
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add myself to the about dialog

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to f4e0ab82dc019b13f2167dabadb67d9cfd16ab2c (commit)
   from dafbfc876426ecc221a353fd586488a35e063a9f (commit)

commit f4e0ab82dc019b13f2167dabadb67d9cfd16ab2c
Author: Matthew Brush 
Date:   Sat Mar 31 13:55:41 2012 -0700

Add myself to the about dialog

 mousepad/mousepad-dialogs.c |1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/mousepad/mousepad-dialogs.c b/mousepad/mousepad-dialogs.c
index 28271d2..5093024 100644
--- a/mousepad/mousepad-dialogs.c
+++ b/mousepad/mousepad-dialogs.c
@@ -31,6 +31,7 @@ mousepad_dialogs_show_about (GtkWindow *parent)
   {
 "Nick Schermer ",
 "Erik Harrison ",
+"Matthew Brush ",
 NULL
   };
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add filetype selection popup menu to statusbar.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 34cb31bbed2aef45bf0f85d34a87aea9d4eb0846 (commit)
   from adf4ea822a98376362f812ae1ff6488148218380 (commit)

commit 34cb31bbed2aef45bf0f85d34a87aea9d4eb0846
Author: Matthew Brush 
Date:   Fri Oct 7 05:45:14 2011 -0700

Add filetype selection popup menu to statusbar.

 mousepad/mousepad-statusbar.c |   75 +--
 mousepad/mousepad-window.c|   99 +
 2 files changed, 170 insertions(+), 4 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index bdeac76..0967ebc 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -25,15 +25,20 @@
 
 
 
-static gboolean  mousepad_statusbar_overwrite_clicked 
(GtkWidget  *widget,
-   
GdkEventButton *event,
-   
MousepadStatusbar  *statusbar);
+static gboolean mousepad_statusbar_overwrite_clicked (GtkWidget 
*widget,
+  GdkEventButton*event,
+  MousepadStatusbar 
*statusbar);
+
+static gboolean mousepad_statusbar_filetype_clicked  (GtkWidget 
*widget,
+  GdkEventButton*event,
+  MousepadStatusbar 
*statusbar);
 
 
 
 enum
 {
   ENABLE_OVERWRITE,
+  POPULATE_FILETYPE_POPUP,
   LAST_SIGNAL,
 };
 
@@ -87,6 +92,14 @@ mousepad_statusbar_class_init (MousepadStatusbarClass *klass)
   0, NULL, NULL,
   g_cclosure_marshal_VOID__BOOLEAN,
   G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+  statusbar_signals[POPULATE_FILETYPE_POPUP] =
+g_signal_new (I_("populate-filetype-popup"),
+  G_TYPE_FROM_CLASS (gobject_class),
+  G_SIGNAL_RUN_LAST,
+  0, NULL, NULL,
+  g_cclosure_marshal_VOID__OBJECT,
+  G_TYPE_NONE, 1, GTK_TYPE_MENU);
 }
 
 
@@ -121,9 +134,17 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
+  /* language/filetype event box */
+  ebox = gtk_event_box_new ();
+  gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
+  gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
+  mousepad_widget_set_tooltip_text (ebox, _("Choose a filetype"));
+  g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK 
(mousepad_statusbar_filetype_clicked), statusbar);
+  gtk_widget_show (ebox);
+
   /* language/filetype */
   statusbar->language = gtk_label_new (_("Filetype: None"));
-  gtk_box_pack_start (GTK_BOX (box), statusbar->language, FALSE, TRUE, 0);
+  gtk_container_add (GTK_CONTAINER (ebox), statusbar->language);
   gtk_widget_show (statusbar->language);
 
   /* separator */
@@ -179,6 +200,52 @@ mousepad_statusbar_overwrite_clicked (GtkWidget 
*widget,
 
 
 
+static gboolean
+mousepad_statusbar_filetype_clicked (GtkWidget *widget,
+ GdkEventButton*event,
+ MousepadStatusbar *statusbar)
+{
+  GtkMenu *menu;
+  GList   *children;
+  gint n_children = 0;
+
+  mousepad_return_val_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar), FALSE);
+
+  /* only respond on the left button click */
+  if (event->type != GDK_BUTTON_PRESS || event->button != 1)
+return FALSE;
+
+  /* create the popup menu */
+  menu = GTK_MENU (gtk_menu_new ());
+
+  /* send the signal to fill the menu */
+  g_signal_emit (G_OBJECT (statusbar), 
statusbar_signals[POPULATE_FILETYPE_POPUP], 0, menu);
+
+  /* get the number of items in the menu */
+  children = gtk_container_get_children (GTK_CONTAINER (menu));
+  n_children = g_list_length (children);
+  g_list_free (children);
+
+  /* make sure there's at least one item in the menu */
+  if (n_children)
+{
+  /* cleanup the menu once a selection is made or the menu is cancelled */
+  g_signal_connect (menu, "selection-done", G_CALLBACK 
(gtk_widget_destroy), NULL);
+
+  /* show the menu */
+  gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, 
event->time);
+}
+  else
+  {
+/* since the menu wasn't shown, just destroy it straight-away */
+gtk_widget_destroy (GTK_WIDGET (menu));
+  }
+
+  return TRUE;
+}
+
+
+
 void
 mousepad_statusbar_set_language (MousepadStatusbar *statusbar,
  GtkSourceLanguage *language)
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index db3a69e..3067788 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -97,6 +97,11 @@ stati

[Xfce4-commits] Fix a couple minor issues from last couple commits.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 4783ee11ebd8b90e70923d83a7468351d6fedb80 (commit)
   from 34cb31bbed2aef45bf0f85d34a87aea9d4eb0846 (commit)

commit 4783ee11ebd8b90e70923d83a7468351d6fedb80
Author: Matthew Brush 
Date:   Fri Oct 7 05:58:04 2011 -0700

Fix a couple minor issues from last couple commits.

 README|2 +-
 mousepad/mousepad-statusbar.c |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 92fa148..0c53e33 100644
--- a/README
+++ b/README
@@ -21,7 +21,7 @@ Required packages
 
 Mousepad depends on the following packages:
 
- - Gtk+ 2.10.0 or above
+ - Gtk+ 2.20.0 or above
  - Libxfce4util 4.4.0 or above
  - GtkSourceView 2.2.2 or above
 
diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 0967ebc..e69a494 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -236,10 +236,10 @@ mousepad_statusbar_filetype_clicked (GtkWidget 
*widget,
   gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, 
event->time);
 }
   else
-  {
-/* since the menu wasn't shown, just destroy it straight-away */
-gtk_widget_destroy (GTK_WIDGET (menu));
-  }
+{
+  /* since the menu wasn't shown, just destroy it straight-away */
+  gtk_widget_destroy (GTK_WIDGET (menu));
+}
 
   return TRUE;
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Make Filetype separate in the Document menu.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to ab93fe61fe7317e61ee6ec804e3d266bc1e50980 (commit)
   from 4777a405afb12e26853328a9131c2c3f131014ec (commit)

commit ab93fe61fe7317e61ee6ec804e3d266bc1e50980
Author: Matthew Brush 
Date:   Fri Oct 7 02:15:21 2011 -0700

Make Filetype separate in the Document menu.

 mousepad/mousepad-window-ui.xml |7 ++-
 mousepad/mousepad-window.c  |   78 +++---
 2 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index bf49fd5..f960bc6 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -102,9 +102,6 @@
 
 
   
-  
-
-  
   
 
 
@@ -118,6 +115,10 @@
   
   
   
+  
+  
+
+  
 
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 1ababb9..db3a69e 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -317,8 +317,6 @@ static void  
mousepad_window_action_decrease_indent   (GtkAction

MousepadWindow *window);
 static void  mousepad_window_action_auto_indent   
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_language  
(GtkToggleAction*action,
-   
MousepadWindow *window);
 static void  mousepad_window_action_line_ending   
(GtkRadioAction *action,

GtkRadioAction *current,

MousepadWindow *window);
@@ -328,6 +326,8 @@ static void  mousepad_window_action_word_wrap   
  (GtkToggle

MousepadWindow *window);
 static void  mousepad_window_action_write_bom 
(GtkToggleAction*action,

MousepadWindow *window);
+static void  mousepad_window_action_language  
(GtkToggleAction*action,
+   
MousepadWindow *window);
 static void  mousepad_window_action_insert_spaces 
(GtkToggleAction*action,

MousepadWindow *window);
 static void  mousepad_window_action_prev_tab  
(GtkAction  *action,
@@ -450,9 +450,9 @@ static const GtkActionEntry action_entries[] =
 { "decrease-indent", GTK_STOCK_UNINDENT, N_("_Decrease Indent"), NULL, 
N_("Decrease the indentation of the selection or current line"), G_CALLBACK 
(mousepad_window_action_decrease_indent), },
 
   { "document-menu", NULL, N_("_Document"), NULL, NULL, NULL, },
-{ "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
 { "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
 { "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
+{ "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
 
   { "navigation-menu", NULL, N_("_Navigation"), NULL, },
 { "back", GTK_STOCK_GO_BACK, N_("_Previous Tab"), "Page_Up", 
N_("Select the previous tab"), G_CALLBACK (mousepad_window_action_prev_tab), },
@@ -4722,42 +4722,6 @@ mousepad_window_action_auto_indent (GtkToggleAction 
*action,
 
 
 static void
-mousepad_window_action_language (GtkToggleAction *action,
- MousepadWindow  *window)
-{
-  guint lang_hash;
-  const gchar *const   *lang_id;
-  GtkSourceLanguage*language;
-  GtkSourceLanguageManager *manager;
-  GtkSourceBuffer  *buffer;
-
-  lang_hash = (guint) gtk_radio_action_get_current_value (GTK_RADIO_ACTION 
(action));
-  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW 
(window->active->textview)));
-
-  if (lang_hash == g_str_hash ("none"))
-{
-  gtk_source_buffer_set_language (buffer, NULL);
-  return;
-}
-
-  manager = gtk_source_language_manager_get_default ();
-  lang_id = gtk_source_language_manager_get_language_ids (manager);
-
-  while (*lang_id)
-{
-  if (g_str_hash (*lang_id) == lang_hash)
-{
-  language = gtk_source_language_manager_get_language (manager, 
*l

[Xfce4-commits] Update a few documentation files.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to adf4ea822a98376362f812ae1ff6488148218380 (commit)
   from ab93fe61fe7317e61ee6ec804e3d266bc1e50980 (commit)

commit adf4ea822a98376362f812ae1ff6488148218380
Author: Matthew Brush 
Date:   Fri Oct 7 03:24:38 2011 -0700

Update a few documentation files.

 AUTHORS |1 +
 NEWS|   18 +++---
 README  |1 +
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index e39278b..fefc28d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,4 @@
 Erik Harrison 
 Nick Schermer 
 Benedikt Meurer 
+Matthew Brush 
diff --git a/NEWS b/NEWS
index dcfac04..b1dc310 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,11 @@ Highlights:
 - Run multiple windows in one instance. We also invoke a running
   instance with DBus (optional), this is needed for tab DND between
   windows.
-- Support for multiple tabs in one window.
+- Drag and Drop support for text inside a document, between tabs and
+  between windows.  Also supports opening a file by dragging it into
+  the window.
+- Support for multiple tabs in one window which are both reorderable
+  and detachable.
 - Load multiple files at once from both the open dialog and the command
   line.
 - Type-ahead find and highlight feature like Firefox.
@@ -14,9 +18,11 @@ Highlights:
 - Reimplemented recent file support. You can cleanup the Mousepad history
   and a file is removed from the history when Mousepad was unable to open
   it.
+- Syntax highlighting of many filetypes (including printing).
 - Various hidden settings.
-- Statusbar with cursor location and whether overwrite is actived.
-- Mousepad depends on GTK+ 2.10.
+- Statusbar with filetype, cursor location and whether overwrite is
+  actived.
+- Mousepad depends on GTK+ 2.20.
 
 Bug fixes:
 - Save button is now default response in the dialog (Bug #2941).
@@ -28,3 +34,9 @@ Bug fixes:
 - The MousepadPreferences object uses XfceRc for saving the
   settings (Bug #2786).
 - No segfault when there is no rc file (Bug #2784).
+- Support syntax highlighting using GtkSourceView (Bug #3228 & #5803).
+- Proper Drag and Drop support (Bug #2055).
+- Fix recent files support (Bug #5635, #3850 & #7890).
+- Use GTK+ printing (Bug #4477).
+- Settings saved in Find (and Replace) dialogs (Bug #7246).
+- No deprecated dependencies (Bug #7259).
diff --git a/README b/README
index 839b458..92fa148 100644
--- a/README
+++ b/README
@@ -23,6 +23,7 @@ Mousepad depends on the following packages:
 
  - Gtk+ 2.10.0 or above
  - Libxfce4util 4.4.0 or above
+ - GtkSourceView 2.2.2 or above
 
 The following packages are optional:
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Reorder action entry arrays (forgotten in last commit).

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 4777a405afb12e26853328a9131c2c3f131014ec (commit)
   from 143b6ba6c2a8e024057bfca7e96deeb6bc3e765f (commit)

commit 4777a405afb12e26853328a9131c2c3f131014ec
Author: Matthew Brush 
Date:   Fri Oct 7 01:05:09 2011 -0700

Reorder action entry arrays (forgotten in last commit).

 mousepad/mousepad-window.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 7524a39..1ababb9 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -450,9 +450,9 @@ static const GtkActionEntry action_entries[] =
 { "decrease-indent", GTK_STOCK_UNINDENT, N_("_Decrease Indent"), NULL, 
N_("Decrease the indentation of the selection or current line"), G_CALLBACK 
(mousepad_window_action_decrease_indent), },
 
   { "document-menu", NULL, N_("_Document"), NULL, NULL, NULL, },
-{ "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
-{ "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
 { "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
+{ "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
+{ "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
 
   { "navigation-menu", NULL, N_("_Navigation"), NULL, },
 { "back", GTK_STOCK_GO_BACK, N_("_Previous Tab"), "Page_Up", 
N_("Select the previous tab"), G_CALLBACK (mousepad_window_action_prev_tab), },
@@ -466,12 +466,12 @@ static const GtkActionEntry action_entries[] =
 
 static const GtkToggleActionEntry toggle_action_entries[] =
 {
-  { "statusbar", NULL, N_("St_atusbar"), NULL, N_("Change the visibility of 
the statusbar"), G_CALLBACK (mousepad_window_action_statusbar), FALSE, },
   { "line-numbers", NULL, N_("Line N_umbers"), NULL, N_("Show line numbers"), 
G_CALLBACK (mousepad_window_action_line_numbers), FALSE, },
+  { "statusbar", NULL, N_("St_atusbar"), NULL, N_("Change the visibility of 
the statusbar"), G_CALLBACK (mousepad_window_action_statusbar), FALSE, },
   { "auto-indent", NULL, N_("_Auto Indent"), NULL, N_("Auto indent a new 
line"), G_CALLBACK (mousepad_window_action_auto_indent), FALSE, },
+  { "insert-spaces", NULL, N_("Insert _Spaces"), NULL, N_("Insert spaces when 
the tab button is pressed"), G_CALLBACK (mousepad_window_action_insert_spaces), 
FALSE, },
   { "word-wrap", NULL, N_("_Word Wrap"), NULL, N_("Toggle breaking lines in 
between words"), G_CALLBACK (mousepad_window_action_word_wrap), FALSE, },
-  { "write-bom", NULL, N_("Write Unicode _BOM"), NULL, N_("Store the 
byte-order mark in the file"), G_CALLBACK (mousepad_window_action_write_bom), 
FALSE, },
-  { "insert-spaces", NULL, N_("Insert _Spaces"), NULL, N_("Insert spaces when 
the tab button is pressed"), G_CALLBACK (mousepad_window_action_insert_spaces), 
FALSE, }
+  { "write-bom", NULL, N_("Write Unicode _BOM"), NULL, N_("Store the 
byte-order mark in the file"), G_CALLBACK (mousepad_window_action_write_bom), 
FALSE, }
 };
 
 static const GtkRadioActionEntry radio_action_entries[] =
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Cleanup View and Document menus.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 143b6ba6c2a8e024057bfca7e96deeb6bc3e765f (commit)
   from 5c88d180a1e20cb51737990948bb041529a97357 (commit)

commit 143b6ba6c2a8e024057bfca7e96deeb6bc3e765f
Author: Matthew Brush 
Date:   Fri Oct 7 00:52:59 2011 -0700

Cleanup View and Document menus.

* Move "Line Numbers" from Document to View menu and apply it to all
  of the currently open textviews.
* Re-order View and Document menu items, mostly sorted alphabetically.
* Remove extra separators between related items.
* Re-arrange action handler functions to be in the same order as their
  items appear in the XML file.

 mousepad/mousepad-window-ui.xml |   27 ++--
 mousepad/mousepad-window.c  |  335 ---
 2 files changed, 185 insertions(+), 177 deletions(-)

diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index f782f96..bf49fd5 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -67,11 +67,12 @@
 
   
   
-  
-  
   
 
   
+  
+  
+  
 
 
 
@@ -100,27 +101,23 @@
 
 
 
-  
-  
-  
   
-  
-  
-  
-  
-
-
-
+  
+
   
   
 
 
 
   
-  
-  
-
+  
+
+
+
   
+  
+  
+  
 
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 118e7e9..7524a39 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -281,12 +281,14 @@ static void  mousepad_window_action_replace   
(GtkAction

MousepadWindow *window);
 static void  mousepad_window_action_select_font   
(GtkAction  *action,

MousepadWindow *window);
+static void  mousepad_window_action_color_scheme  
(GtkToggleAction*action,
+   
MousepadWindow *window);
+static void  mousepad_window_action_line_numbers  
(GtkToggleAction*action,
+   
MousepadWindow *window);
 static void  mousepad_window_action_statusbar_overwrite   
(MousepadWindow *window,

gbooleanoverwrite);
 static void  mousepad_window_action_statusbar 
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_color_scheme  
(GtkToggleAction*action,
-   
MousepadWindow *window);
 static void  mousepad_window_action_lowercase 
(GtkAction  *action,

MousepadWindow *window);
 static void  mousepad_window_action_uppercase 
(GtkAction  *action,
@@ -313,22 +315,20 @@ static void  
mousepad_window_action_increase_indent   (GtkAction

MousepadWindow *window);
 static void  mousepad_window_action_decrease_indent   
(GtkAction  *action,

MousepadWindow *window);
-static void  mousepad_window_action_line_numbers  
(GtkToggleAction*action,
-   
MousepadWindow *window);
-static void  mousepad_window_action_word_wrap 
(GtkToggleAction*action,
+static void  mousepad_window_action_auto_indent   
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_write_bom 
(GtkToggleAction*action,
+static void  mousepad_window_action_language  
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_auto_indent   
(GtkToggleAction*action,
+static void  mousepad_window_action_line_ending   
(GtkRadioAction *action,
+   
GtkR

[Xfce4-commits] Switch to GtkSourcePrintCompositor for printing.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to c45ed8da1ae2ed17fb291084cebae1275d33f7c8 (commit)
   from 029bef60746206eaf08dc11c89afd59db186db8d (commit)

commit c45ed8da1ae2ed17fb291084cebae1275d33f7c8
Author: Matthew Brush 
Date:   Thu Oct 6 19:23:13 2011 -0700

Switch to GtkSourcePrintCompositor for printing.

* Add printing option for syntax highlighting.
* Some of the page footer code implemented in #if 0 blocks.
* Remove mousepad_print_end_print() function.

 mousepad/mousepad-print.c   |  444 +--
 mousepad/mousepad-private.h |1 +
 2 files changed, 137 insertions(+), 308 deletions(-)

diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index c2ae215..35f31f8 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -42,8 +42,6 @@ static void   mousepad_print_begin_print   
(GtkPrintOperation
 static void   mousepad_print_draw_page (GtkPrintOperation  
 *operation,
 GtkPrintContext
 *context,
 gint   
  page_nr);
-static void   mousepad_print_end_print (GtkPrintOperation  
 *operation,
-GtkPrintContext
 *context);
 static void   mousepad_print_page_setup_dialog (GtkWidget  
 *button,
 GtkPrintOperation  
 *operation);
 static void   mousepad_print_button_toggled(GtkWidget  
 *button,
@@ -68,31 +66,17 @@ struct _MousepadPrint
   GtkPrintOperation __parent__;
 
   /* the document we're going to print */
-  MousepadDocument *document;
-
-  /* pango layout containing all text */
-  PangoLayout  *layout;
-
-  /* array with the lines drawn on each page */
-  GArray   *lines;
-
-  /* drawing offsets */
-  gint  x_offset;
-  gint  y_offset;
-
-  /* page line number counter */
-  gint  line_number;
+  MousepadDocument*document;
 
   /* print dialog widgets */
-  GtkWidget*widget_page_headers;
-  GtkWidget*widget_line_numbers;
-  GtkWidget*widget_text_wrapping;
-
-  /* settings */
-  guint print_page_headers : 1;
-  guint print_line_numbers : 1;
-  guint text_wrapping : 1;
-  gchar*font_name;
+  GtkWidget*widget_page_headers;
+  GtkWidget*widget_page_footers;
+  GtkWidget*widget_line_numbers;
+  GtkWidget*widget_text_wrapping;
+  GtkWidget*widget_syntax_highlighting;
+
+  /* source view print compositor */
+  GtkSourcePrintCompositor *compositor;
 };
 
 
@@ -113,7 +97,6 @@ mousepad_print_class_init (MousepadPrintClass *klass)
   gtkprintoperation_class = GTK_PRINT_OPERATION_CLASS (klass);
   gtkprintoperation_class->begin_print = mousepad_print_begin_print;
   gtkprintoperation_class->draw_page = mousepad_print_draw_page;
-  gtkprintoperation_class->end_print = mousepad_print_end_print;
   gtkprintoperation_class->create_custom_widget = 
mousepad_print_create_custom_widget;
   gtkprintoperation_class->status_changed = mousepad_print_status_changed;
   gtkprintoperation_class->done = mousepad_print_done;
@@ -125,13 +108,7 @@ static void
 mousepad_print_init (MousepadPrint *print)
 {
   /* init */
-  print->print_page_headers = FALSE;
-  print->print_line_numbers = FALSE;
-  print->text_wrapping = FALSE;
-  print->x_offset = 0;
-  print->y_offset = 0;
-  print->line_number = 0;
-  print->font_name = NULL;
+  print->compositor = NULL;
 
   /* set a custom tab label */
   gtk_print_operation_set_custom_tab_label (GTK_PRINT_OPERATION (print), 
_("Document Settings"));
@@ -145,7 +122,7 @@ mousepad_print_finalize (GObject *object)
   MousepadPrint *print = MOUSEPAD_PRINT (object);
 
   /* cleanup */
-  g_free (print->font_name);
+  g_object_unref (print->compositor);
 
   (*G_OBJECT_CLASS (mousepad_print_parent_class)->finalize) (object);
 }
@@ -163,6 +140,7 @@ mousepad_print_settings_load (GtkPrintOperation *operation)
   gint   i;
   gchar *key;
   gchar *value;
+  gchar *font_name = NULL;
   GtkPageSetup  *page_setup;
   GtkPaperSize  *paper_size;
   PangoContext  *context;
@@ -248,23 +226,49 @@ mousepad_print_settings_load (GtkPrintOperation 
*operation)
 }
 
   /* restore print settings */
-  print->print_page_headers = gtk_print_settings_get_bool (settings, 
"print-page-headers");
-  print->print_line_numbers = gtk_print_settings_get_bool (settings, 
"print-line-numbers");
-  print->text_wrapping = gtk_print_settings_ge

[Xfce4-commits] Add extra settings to custom print dialog tab.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 5c88d180a1e20cb51737990948bb041529a97357 (commit)
   from ba85e8dae9ae1c478242b3c678389191dd8e1e87 (commit)

commit 5c88d180a1e20cb51737990948bb041529a97357
Author: Matthew Brush 
Date:   Thu Oct 6 22:37:00 2011 -0700

Add extra settings to custom print dialog tab.

* Add line number increment setting.
* Add separate font settings for header, body and line numbers.

 mousepad/mousepad-print.c |  211 +
 1 files changed, 156 insertions(+), 55 deletions(-)

diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index c7bc53d..e647ae1 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -74,6 +74,15 @@ struct _MousepadPrint
   GtkWidget*widget_line_numbers;
   GtkWidget*widget_text_wrapping;
   GtkWidget*widget_syntax_highlighting;
+  GtkWidget*widget_header_font;
+  GtkWidget*widget_line_numbers_font;
+  GtkWidget*widget_body_font;
+  GtkWidget*widget_line_numbers_spin;
+  GtkWidget*widget_line_numbers_hbox;
+
+  /* settings */
+  gboolean  print_line_numbers;
+  gint  line_number_increment;
 
   /* source view print compositor */
   GtkSourcePrintCompositor *compositor;
@@ -108,6 +117,8 @@ static void
 mousepad_print_init (MousepadPrint *print)
 {
   /* init */
+  print->print_line_numbers = FALSE;
+  print->line_number_increment = 1;
   print->compositor = NULL;
 
   /* set a custom tab label */
@@ -140,7 +151,9 @@ mousepad_print_settings_load (GtkPrintOperation *operation)
   gint   i;
   gchar *key;
   gchar *value;
-  gchar *font_name = NULL;
+  gchar *body_font = NULL;
+  gchar *header_font = NULL;
+  gchar *line_numbers_font = NULL;
   GtkPageSetup  *page_setup;
   GtkPaperSize  *paper_size;
   PangoContext  *context;
@@ -229,46 +242,54 @@ mousepad_print_settings_load (GtkPrintOperation 
*operation)
   g_object_set (print->compositor,
 "print-header",
 gtk_print_settings_get_bool (settings, "print-header"),
-#if 0
-"print-footer",
-gtk_print_settings_get_bool (settings, "print-footer"),
-#endif
 "print-line-numbers",
-gtk_print_settings_get_bool (settings, 
"print-line-numbers"),
+gtk_print_settings_get_int (settings, 
"line-numbers-increment"),
 "wrap-mode",
 gtk_print_settings_get_bool (settings, "text-wrapping") ? 
GTK_WRAP_WORD : GTK_WRAP_NONE,
 "highlight-syntax",
 gtk_print_settings_get_bool (settings, "highlight-syntax"),
 NULL);
 
-  /* font-name setting sets the header, footer, line numbers and body 
fonts */
-  font_name = g_strdup (gtk_print_settings_get (settings, "font-name"));
+  print->print_line_numbers = gtk_print_settings_get_bool (settings, 
"print-line-numbers");
+  print->line_number_increment = gtk_print_settings_get_int (settings, 
"line-numbers-increment");
+
+  /* get the saved fonts, if set */
+  body_font = g_strdup (gtk_print_settings_get (settings, 
"body-font-name"));
+  header_font = g_strdup (gtk_print_settings_get (settings, 
"header-font-name"));
+  line_numbers_font = g_strdup (gtk_print_settings_get (settings, 
"line-numbers-font-name"));
 
   /* release reference */
   g_object_unref (G_OBJECT (settings));
 }
 
 /* if no font name is set, get the one used in the widget */
-if (G_UNLIKELY (font_name == NULL))
+if (G_UNLIKELY (body_font == NULL))
   {
 /* get the font description from the context and convert it into a 
string */
 context = gtk_widget_get_pango_context (GTK_WIDGET 
(print->document->textview));
 font_desc = pango_context_get_font_description (context);
-font_name = pango_font_description_to_string (font_desc);
+body_font = pango_font_description_to_string (font_desc);
   }
 
-/* set the same font for all the various parts of the pages the same */
-g_object_set (print->compositor,
-  "body-font-name", font_name,
-  "line-numbers-font-name", font_name,
-  "header-font-name", font_name,
-#if 0
-  "footer-font-name", font_name,
-#endif
-  NULL);
+/* set the restored body font or the one from the textview */
+gtk_source_print_compositor_set_bo

[Xfce4-commits] Use GtkSourcePrintCompositor property names in config file.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to ba85e8dae9ae1c478242b3c678389191dd8e1e87 (commit)
   from c45ed8da1ae2ed17fb291084cebae1275d33f7c8 (commit)

commit ba85e8dae9ae1c478242b3c678389191dd8e1e87
Author: Matthew Brush 
Date:   Thu Oct 6 19:35:30 2011 -0700

Use GtkSourcePrintCompositor property names in config file.

 mousepad/mousepad-print.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index 35f31f8..c7bc53d 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -228,17 +228,17 @@ mousepad_print_settings_load (GtkPrintOperation 
*operation)
   /* restore print settings */
   g_object_set (print->compositor,
 "print-header",
-gtk_print_settings_get_bool (settings, 
"print-page-headers"),
+gtk_print_settings_get_bool (settings, "print-header"),
 #if 0
 "print-footer",
-gtk_print_settings_get_bool (settings, 
"print-page-footers"),
+gtk_print_settings_get_bool (settings, "print-footer"),
 #endif
 "print-line-numbers",
 gtk_print_settings_get_bool (settings, 
"print-line-numbers"),
 "wrap-mode",
 gtk_print_settings_get_bool (settings, "text-wrapping") ? 
GTK_WRAP_WORD : GTK_WRAP_NONE,
 "highlight-syntax",
-gtk_print_settings_get_bool (settings, 
"syntax-highlighting"),
+gtk_print_settings_get_bool (settings, "highlight-syntax"),
 NULL);
 
   /* font-name setting sets the header, footer, line numbers and body 
fonts */
@@ -344,11 +344,11 @@ mousepad_print_settings_save (GtkPrintOperation 
*operation)
 
   /* set print settings */
   gtk_print_settings_set_bool (settings,
-   "print-page-headers",
+   "print-header",

gtk_source_print_compositor_get_print_header (print->compositor));
 #if 0
   gtk_print_settings_set_bool (settings,
-   "print-page-footers",
+   "print-footer",

gtk_source_print_compositor_get_print_footer (print->compositor));
 #endif
   gtk_print_settings_set_bool (settings,
@@ -360,7 +360,7 @@ mousepad_print_settings_save (GtkPrintOperation *operation)

gtk_source_print_compositor_get_wrap_mode (print->compositor) == GTK_WRAP_NONE 
? FALSE : TRUE);
 
   gtk_print_settings_set_bool (settings,
-   "syntax-highlighting",
+   "highlight-syntax",

gtk_source_print_compositor_get_highlight_syntax (print->compositor));
 
   gtk_print_settings_set (settings,
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Merge branch 'nick_0_3' into gtksourceview

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 029bef60746206eaf08dc11c89afd59db186db8d (commit)
   from 05b3c46c8b9877fa62b07fd6a04b1b82fc5576ed (commit)

commit 029bef60746206eaf08dc11c89afd59db186db8d
Merge: 05b3c46 52e5c6a
Author: Matthew Brush 
Date:   Thu Oct 6 04:05:33 2011 -0700

Merge branch 'nick_0_3' into gtksourceview

commit 52e5c6a0051cd456802d6b50b85b9190a33d62cf
Author: Matthew Brush 
Date:   Thu Oct 6 03:56:42 2011 -0700

Prevent segfault when opening more that 100 files.

Reported by Mark_T on #xfce-dev IRC.

 mousepad/mousepad-window.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 5897108..118e7e9 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2213,9 +2213,9 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   const gchar  *title;
   const gchar  *tooltip;
   gchar accelerator[7];
-  GtkAction*action;
   GtkRadioAction   *radio_action;
   GSList   *group = NULL;
+  GList*actions, *iter;
 
   mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
 
@@ -2233,14 +2233,14 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   gtk_ui_manager_remove_ui (window->ui_manager, window->gomenu_merge_id);
 
   /* drop all the old recent items from the menu */
-  for (n = 0; n < 100 /* arbitrary */; n++)
+  actions = gtk_action_group_list_actions (window->action_group);
+  for (iter = actions; iter != NULL; iter = g_list_next (iter))
 {
-  g_snprintf (name, sizeof (name), "mousepad-tab-%d", n);
-  action = gtk_action_group_get_action (window->action_group, name);
-  if (G_UNLIKELY (action == NULL))
-break;
-  gtk_action_group_remove_action (window->action_group, action);
+  /* match only actions starting with "mousepad-tab-" */
+  if (g_str_has_prefix (gtk_action_get_name (iter->data), 
"mousepad-tab-"))
+gtk_action_group_remove_action (window->action_group, iter->data);
 }
+  g_list_free (actions);
 }
 
   /* create a new merge id */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Prevent segfault when opening more that 100 files.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 52e5c6a0051cd456802d6b50b85b9190a33d62cf (commit)
   from b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)

commit 52e5c6a0051cd456802d6b50b85b9190a33d62cf
Author: Matthew Brush 
Date:   Thu Oct 6 03:56:42 2011 -0700

Prevent segfault when opening more that 100 files.

Reported by Mark_T on #xfce-dev IRC.

 mousepad/mousepad-window.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index b84ab6c..b14dabe 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2144,9 +2144,9 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   const gchar  *title;
   const gchar  *tooltip;
   gchar accelerator[7];
-  GtkAction*action;
   GtkRadioAction   *radio_action;
   GSList   *group = NULL;
+  GList*actions, *iter;
 
   mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
 
@@ -2164,14 +2164,14 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   gtk_ui_manager_remove_ui (window->ui_manager, window->gomenu_merge_id);
 
   /* drop all the old recent items from the menu */
-  for (n = 0; n < 100 /* arbitrary */; n++)
+  actions = gtk_action_group_list_actions (window->action_group);
+  for (iter = actions; iter != NULL; iter = g_list_next (iter))
 {
-  g_snprintf (name, sizeof (name), "mousepad-tab-%d", n);
-  action = gtk_action_group_get_action (window->action_group, name);
-  if (G_UNLIKELY (action == NULL))
-break;
-  gtk_action_group_remove_action (window->action_group, action);
+  /* match only actions starting with "mousepad-tab-" */
+  if (g_str_has_prefix (gtk_action_get_name (iter->data), 
"mousepad-tab-"))
+gtk_action_group_remove_action (window->action_group, iter->data);
 }
+  g_list_free (actions);
 }
 
   /* create a new merge id */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Select filetype radio menu item when detecting filetype.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 05b3c46c8b9877fa62b07fd6a04b1b82fc5576ed (commit)
   from 66a2d472174195507aa00ae8287ff4c1b62c6604 (commit)

commit 05b3c46c8b9877fa62b07fd6a04b1b82fc5576ed
Author: Matthew Brush 
Date:   Thu Oct 6 03:11:18 2011 -0700

Select filetype radio menu item when detecting filetype.

Fix setting filetype to None.

 mousepad/mousepad-window.c |   37 -
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 313ec76..5897108 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -1687,6 +1687,34 @@ mousepad_window_language_changed (MousepadDocument  
*document,
   GtkSourceLanguage *language,
   MousepadWindow*window)
 {
+  gchar *path;
+  GtkWidget *item;
+
+  if (!GTK_IS_SOURCE_LANGUAGE (language))
+goto set_none;
+
+  path = g_strdup_printf ("/main-menu/document-menu/language-menu/"
+  "placeholder-language-section-items/"
+  "language-section-%s/language-%s",
+  gtk_source_language_get_section (language),
+  gtk_source_language_get_id (language));
+  item = gtk_ui_manager_get_widget (window->ui_manager, path);
+  g_free (path);
+
+  /* activate the appropriate menu item for the new language */
+  if (GTK_IS_CHECK_MENU_ITEM (item))
+{
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
+  goto set_statusbar;
+}
+
+set_none:
+  item = gtk_ui_manager_get_widget (window->ui_manager,
+
"/main-menu/document-menu/language-menu/language-none");
+  if (GTK_IS_CHECK_MENU_ITEM (item))
+gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
+
+set_statusbar:
   /* set the filetype in the statusbar */
   if (window->statusbar)
 mousepad_statusbar_set_language (MOUSEPAD_STATUSBAR (window->statusbar), 
language);
@@ -4835,6 +4863,14 @@ mousepad_window_action_language (GtkToggleAction *action,
   GtkSourceBuffer  *buffer;
 
   lang_hash = (guint) gtk_radio_action_get_current_value (GTK_RADIO_ACTION 
(action));
+  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW 
(window->active->textview)));
+
+  if (lang_hash == g_str_hash ("none"))
+{
+  gtk_source_buffer_set_language (buffer, NULL);
+  return;
+}
+
   manager = gtk_source_language_manager_get_default ();
   lang_id = gtk_source_language_manager_get_language_ids (manager);
 
@@ -4843,7 +4879,6 @@ mousepad_window_action_language (GtkToggleAction *action,
   if (g_str_hash (*lang_id) == lang_hash)
 {
   language = gtk_source_language_manager_get_language (manager, 
*lang_id);
-  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW 
(window->active->textview)));
   gtk_source_buffer_set_language (buffer, language);
   break;
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Cleanup and refactor some code from the last few commits.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 6ceb27df8efb7b23acc73c147511721cbea45b20 (commit)
   from 92b22bcb38d66f63b5ce69d9df7d3f14e60ac15a (commit)

commit 6ceb27df8efb7b23acc73c147511721cbea45b20
Author: Matthew Brush 
Date:   Wed Oct 5 15:49:10 2011 -0700

Cleanup and refactor some code from the last few commits.

* Move colour scheme and language utility functions to mousepad-util.[ch].
* Rename colour scheme and language utility functions with better names.
* Put colour scheme action func/proto in the correct order of appearance.

 mousepad/mousepad-util.c   |  129 +
 mousepad/mousepad-util.h   |   86 ---
 mousepad/mousepad-window.c |  267 +++-
 3 files changed, 243 insertions(+), 239 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index f9abdf6..8e4bfa4 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -1066,3 +1066,132 @@ mousepad_util_search (GtkTextBuffer   *buffer,
 
   return counter;
 }
+
+
+
+/**
+ * Colour scheme functions
+ */
+gint
+mousepad_util_color_schemes_name_compare (gconstpointer a,
+  gconstpointer b)
+{
+  const gchar *name_a, *name_b;
+
+  if (G_UNLIKELY (!a))
+return -(a != b);
+  if (G_UNLIKELY (!b))
+return a != b;
+
+  name_a = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (a));
+  name_b = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (b));
+
+  return g_utf8_collate (name_a, name_b);
+}
+
+
+
+GList *
+mousepad_util_color_schemes_get_sorted (void)
+{
+  GList*list = NULL;
+  const gchar * const  *schemes;
+  GtkSourceStyleScheme *scheme;
+
+  schemes = gtk_source_style_scheme_manager_get_scheme_ids (
+  gtk_source_style_scheme_manager_get_default ());
+
+  while (*schemes)
+{
+  scheme = gtk_source_style_scheme_manager_get_scheme (
+gtk_source_style_scheme_manager_get_default (), *schemes);
+  list = g_list_prepend (list, scheme);
+  schemes++;
+}
+
+  return g_list_sort (list, mousepad_util_color_schemes_name_compare);
+}
+
+
+
+/**
+ * Language/filetype functions
+ */
+gint
+mousepad_util_languages_name_compare (gconstpointer a,
+  gconstpointer b)
+{
+  const gchar *name_a, *name_b;
+
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (a)))
+return -(a != b);
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (b)))
+return a != b;
+
+  name_a = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (a));
+  name_b = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (b));
+
+  return g_utf8_collate (name_a, name_b);
+}
+
+
+
+GSList *
+mousepad_util_language_sections_get_sorted (void)
+{
+  GSList   *list = NULL;
+  const gchar *const   *languages;
+  GtkSourceLanguage*language;
+  GtkSourceLanguageManager *manager;
+
+  manager = gtk_source_language_manager_get_default ();
+  languages = gtk_source_language_manager_get_language_ids (manager);
+
+  while (*languages)
+{
+  language = gtk_source_language_manager_get_language (manager, 
*languages);
+  if (G_LIKELY (GTK_IS_SOURCE_LANGUAGE (language)))
+{
+  /* ensure no duplicates in list */
+  if (!g_slist_find_custom (list,
+gtk_source_language_get_section (language),
+(GCompareFunc)g_strcmp0))
+{
+  list = g_slist_prepend (list, (gchar 
*)gtk_source_language_get_section (language));
+}
+}
+  languages++;
+}
+
+  return g_slist_sort (list, (GCompareFunc)g_strcmp0);
+}
+
+
+
+GSList *
+mousepad_util_languages_get_sorted_for_section (const gchar *section)
+{
+  GSList   *list = NULL;
+  const gchar *const   *languages;
+  GtkSourceLanguage*language;
+  GtkSourceLanguageManager *manager;
+
+  mousepad_return_val_if_fail (section != NULL, NULL);
+
+  manager = gtk_source_language_manager_get_default ();
+  languages = gtk_source_language_manager_get_language_ids (manager);
+
+  while (*languages)
+{
+  language = gtk_source_language_manager_get_language (manager, 
*languages);
+  if (G_LIKELY (GTK_IS_SOURCE_LANGUAGE (language)))
+{
+  /* only get languages in the specified section */
+  if (g_strcmp0 (gtk_source_language_get_section (language), section) 
== 0)
+list = g_slist_prepend (list, language);
+}
+  languages++;
+}
+
+  return g_slist_sort(list, 
(GCompareFunc)mousepad_util_languages_name_compare);
+}
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index 0aa6513..bdf22d1 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -55,69 +55,77 @@ enum _MousepadSearchFlags
   MOUSEPAD_SEARCH_FLAGS_ACTION_REPLACE= 1 << 17, /* replace the match */
 };
 
-gboolean   mousepad_util_iter_start

[Xfce4-commits] Cleanup colour scheme util functions a bit.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 66a2d472174195507aa00ae8287ff4c1b62c6604 (commit)
   from 5d74b7018dd0f821f6f37a0293868466a9b836b3 (commit)

commit 66a2d472174195507aa00ae8287ff4c1b62c6604
Author: Matthew Brush 
Date:   Thu Oct 6 01:35:14 2011 -0700

Cleanup colour scheme util functions a bit.

 mousepad/mousepad-util.c   |   17 +
 mousepad/mousepad-util.h   |2 ++
 mousepad/mousepad-window.c |2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 31bac40..05ed8af 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -1078,9 +1078,9 @@ mousepad_util_color_schemes_name_compare (gconstpointer a,
 {
   const gchar *name_a, *name_b;
 
-  if (G_UNLIKELY (!a))
+  if (G_UNLIKELY (!GTK_IS_SOURCE_STYLE_SCHEME (a)))
 return -(a != b);
-  if (G_UNLIKELY (!b))
+  if (G_UNLIKELY (!GTK_IS_SOURCE_STYLE_SCHEME (b)))
 return a != b;
 
   name_a = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (a));
@@ -1092,7 +1092,7 @@ mousepad_util_color_schemes_name_compare (gconstpointer a,
 
 
 GSList *
-mousepad_util_color_schemes_get_sorted (void)
+mousepad_util_color_schemes_get (void)
 {
   GSList   *list = NULL;
   const gchar * const  *schemes;
@@ -1109,7 +1109,16 @@ mousepad_util_color_schemes_get_sorted (void)
   schemes++;
 }
 
-  return g_slist_sort (list, mousepad_util_color_schemes_name_compare);
+  return list;
+}
+
+
+
+GSList *
+mousepad_util_color_schemes_get_sorted (void)
+{
+  return g_slist_sort (mousepad_util_color_schemes_get (),
+   mousepad_util_color_schemes_name_compare);
 }
 
 
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index 539e11e..dbafd81 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -122,6 +122,8 @@ gint   mousepad_util_search   
(GtkTextBuffer   *
 gint   mousepad_util_color_schemes_name_compare   (gconstpointer   
 a,
gconstpointer   
 b);
 
+GSList*mousepad_util_color_schemes_get(void);
+
 GSList*mousepad_util_color_schemes_get_sorted (void);
 
 gint   mousepad_util_languages_name_compare   (gconstpointer   
 a,
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index e2d51db..313ec76 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -4428,7 +4428,7 @@ mousepad_window_action_color_scheme (GtkToggleAction 
*action,
   if (scheme_id_hash != g_str_hash ("none"))
 {
   /* lookup the scheme from the id hash */
-  schemes = mousepad_util_color_schemes_get_sorted ();
+  schemes = mousepad_util_color_schemes_get ();
   for (iter = schemes; iter != NULL; iter = g_slist_next (iter))
 {
   if (scheme_id_hash == g_str_hash (gtk_source_style_scheme_get_id 
(iter->data)))
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Change mousepad_util_color_schemes_get_sorted to use GSList.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 5d74b7018dd0f821f6f37a0293868466a9b836b3 (commit)
   from 81eb018689978502e6a128436ed4cb8ab5de77cf (commit)

commit 5d74b7018dd0f821f6f37a0293868466a9b836b3
Author: Matthew Brush 
Date:   Wed Oct 5 20:50:06 2011 -0700

Change mousepad_util_color_schemes_get_sorted to use GSList.

Also add some comments and set default value on selected_color_scheme in
mousepad_window_menu_color_schemes.

 mousepad/mousepad-util.c   |8 
 mousepad/mousepad-util.h   |6 +-
 mousepad/mousepad-window.c |   16 
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 8e4bfa4..31bac40 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -1091,10 +1091,10 @@ mousepad_util_color_schemes_name_compare (gconstpointer 
a,
 
 
 
-GList *
+GSList *
 mousepad_util_color_schemes_get_sorted (void)
 {
-  GList*list = NULL;
+  GSList   *list = NULL;
   const gchar * const  *schemes;
   GtkSourceStyleScheme *scheme;
 
@@ -1105,11 +1105,11 @@ mousepad_util_color_schemes_get_sorted (void)
 {
   scheme = gtk_source_style_scheme_manager_get_scheme (
 gtk_source_style_scheme_manager_get_default (), *schemes);
-  list = g_list_prepend (list, scheme);
+  list = g_slist_prepend (list, scheme);
   schemes++;
 }
 
-  return g_list_sort (list, mousepad_util_color_schemes_name_compare);
+  return g_slist_sort (list, mousepad_util_color_schemes_name_compare);
 }
 
 
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index bdf22d1..539e11e 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -121,10 +121,14 @@ gint   mousepad_util_search   
(GtkTextBuffer   *
 
 gint   mousepad_util_color_schemes_name_compare   (gconstpointer   
 a,
gconstpointer   
 b);
-GList *mousepad_util_color_schemes_get_sorted (void);
+
+GSList*mousepad_util_color_schemes_get_sorted (void);
+
 gint   mousepad_util_languages_name_compare   (gconstpointer   
 a,
gconstpointer   
 b);
+
 GSList*mousepad_util_language_sections_get_sorted (void);
+
 GSList*mousepad_util_languages_get_sorted_for_section (const gchar 
*section);
 
 G_END_DECLS
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 07fddfe..e2d51db 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -3077,10 +3077,9 @@ static void
 mousepad_window_menu_color_schemes (MousepadWindow *window)
 {
   GtkRadioAction   *action;
-  GSList   *group = NULL;
-  GList*schemes, *iter;
+  GSList   *group = NULL, *schemes, *iter;
   gint  merge_id;
-  gchar*name, *selected_color_scheme;
+  gchar*name, *selected_color_scheme = NULL;
 
   /* lock menu updates */
   lock_menu_updates++;
@@ -3119,11 +3118,12 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
  "color-scheme-separator", NULL, 
GTK_UI_MANAGER_SEPARATOR, FALSE);
 
   /* add the color schemes to the menu */
-  for (iter = schemes; iter != NULL; iter = g_list_next (iter))
+  for (iter = schemes; iter != NULL; iter = g_slist_next (iter))
 {
   /* create action name */
   name = g_strdup_printf ("color-scheme_%s", 
gtk_source_style_scheme_get_id (iter->data));
 
+  /* create action for colour scheme */
   action = gtk_radio_action_new (name,
  gtk_source_style_scheme_get_name 
(iter->data),
  gtk_source_style_scheme_get_description 
(iter->data),
@@ -3151,7 +3151,7 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
 }
 
   /* cleanup the list */
-  g_list_free (schemes);
+  g_slist_free (schemes);
 
   /* unlock */
   lock_menu_updates--;
@@ -4413,7 +4413,7 @@ mousepad_window_action_color_scheme (GtkToggleAction 
*action,
   GtkTextBuffer*buffer;
   GtkSourceStyleScheme *scheme = NULL;
   MousepadDocument *document;
-  GList*schemes, *iter;
+  GSList   *schemes, *iter;
 
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
 
@@ -4429,7 +4429,7 @@ mousepad_window_action_color_scheme (GtkToggleAction 
*action,
 {
   /* lookup the scheme from the id hash */
   schemes = mousepad_util_color_schemes_get_sorted ();
-  for (iter = schemes; iter != NULL; iter = g_list_next (iter))
+  for (iter = schemes; iter != NULL; iter = g_slist_next (iter))
 {
   if (scheme_id_hash == g_str_hash (gtk_source_style_scheme_get_id 
(iter->data)))
 

[Xfce4-commits] Select the last saved colour scheme in the menu on application start.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 81eb018689978502e6a128436ed4cb8ab5de77cf (commit)
   from 6ceb27df8efb7b23acc73c147511721cbea45b20 (commit)

commit 81eb018689978502e6a128436ed4cb8ab5de77cf
Author: Matthew Brush 
Date:   Wed Oct 5 15:59:11 2011 -0700

Select the last saved colour scheme in the menu on application start.

 mousepad/mousepad-window.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 445ef66..07fddfe 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -3080,11 +3080,14 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
   GSList   *group = NULL;
   GList*schemes, *iter;
   gint  merge_id;
-  gchar*name;
+  gchar*name, *selected_color_scheme;
 
   /* lock menu updates */
   lock_menu_updates++;
 
+  /* get the previously saved colour scheme name */
+  g_object_get (window->preferences, "view-color-scheme", 
&selected_color_scheme, NULL);
+
   /* get list of schemes */
   schemes = mousepad_util_color_schemes_get_sorted ();
 
@@ -3131,6 +3134,10 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
   g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK 
(mousepad_window_action_color_scheme), window);
   gtk_action_group_add_action_with_accel (window->action_group, GTK_ACTION 
(action), "");
 
+  /* activate the radio button if it was the last saved colour scheme */
+  if (g_strcmp0 (gtk_source_style_scheme_get_id (iter->data), 
selected_color_scheme) == 0)
+  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+
   /* release the action */
   g_object_unref (G_OBJECT (action));
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add menu to manually select filetype/language.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 92b22bcb38d66f63b5ce69d9df7d3f14e60ac15a (commit)
   from c5ac3ceeff8979a20d60e40f62f0b04d0ea67b9f (commit)

commit 92b22bcb38d66f63b5ce69d9df7d3f14e60ac15a
Author: Matthew Brush 
Date:   Wed Oct 5 15:05:43 2011 -0700

Add menu to manually select filetype/language.

This code needs to be reviewed and cleaned up more.
Thanks to "cavalier" on #xfce-dev IRC for help getting this working.

 mousepad/mousepad-window-ui.xml |4 +
 mousepad/mousepad-window.c  |  256 +++
 2 files changed, 260 insertions(+), 0 deletions(-)

diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index 2fd1c3f..f782f96 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -117,6 +117,10 @@
 
 
   
+  
+  
+
+  
 
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 06f9a9f..97e84f2 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -180,6 +180,7 @@ static gboolean  mousepad_window_update_gomenu_idle 
  (gpointer
 static void  mousepad_window_update_gomenu_idle_destroy   
(gpointeruser_data);
 static void  mousepad_window_update_gomenu
(MousepadWindow *window);
 static void  mousepad_window_menu_color_schemes   
(MousepadWindow *window);
+static void  mousepad_window_menu_languages   
(MousepadWindow *window);
 
 /* recent functions */
 static void  mousepad_window_recent_add   
(MousepadWindow *window,
@@ -332,6 +333,8 @@ static void  
mousepad_window_action_insert_spaces (GtkToggle
 static void  mousepad_window_action_line_ending   
(GtkRadioAction *action,

GtkRadioAction *current,

MousepadWindow *window);
+static void  mousepad_window_action_language  
(GtkToggleAction*action,
+   
MousepadWindow *window);
 static void  mousepad_window_action_prev_tab  
(GtkAction  *action,

MousepadWindow *window);
 static void  mousepad_window_action_next_tab  
(GtkAction  *action,
@@ -454,6 +457,7 @@ static const GtkActionEntry action_entries[] =
   { "document-menu", NULL, N_("_Document"), NULL, NULL, NULL, },
 { "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
 { "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
+{ "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
 
   { "navigation-menu", NULL, N_("_Navigation"), NULL, },
 { "back", GTK_STOCK_GO_BACK, N_("_Previous Tab"), "Page_Up", 
N_("Select the previous tab"), G_CALLBACK (mousepad_window_action_prev_tab), },
@@ -620,6 +624,9 @@ mousepad_window_init (MousepadWindow *window)
   /* add color schemes menu */
   mousepad_window_menu_color_schemes (window);
 
+  /* add languages/filetypes menu */
+  mousepad_window_menu_languages (window);
+
   /* set accel group for the window */
   accel_group = gtk_ui_manager_get_accel_group (window->ui_manager);
   gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
@@ -3196,6 +3203,226 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
 
 
 /**
+ * Language/filetype functions
+ */
+static gint
+mousepad_window_languages_compare_by_name (gconstpointer a,
+   gconstpointer b)
+{
+  const gchar *name_a, *name_b;
+
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (a)))
+return -(a != b);
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (b)))
+return a != b;
+
+  name_a = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (a));
+  name_b = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (b));
+
+  return g_utf8_collate (name_a, name_b);
+}
+
+
+
+static GSList *
+mousepad_window_language_section_names_sorted (void)
+{
+  GSList   *list = NULL;
+  const gchar *const   *languages;
+  GtkSourceLanguage*language;
+  GtkSourceLanguageManager *manager;
+
+  manager = gtk_source_language_manager_get_default ();
+  languages = gtk_source_language_manager_get_language_ids (manager);
+
+  while (*languages)
+{
+  language = gtk_source_language_manager_get_language (manager, 
*languages);
+  if (G_LIKELY (GTK_IS_SOURCE_LANGUAGE (language)))
+{
+  /* 

[Xfce4-commits] Noise: remove extra whitespace added by editor.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to c5ac3ceeff8979a20d60e40f62f0b04d0ea67b9f (commit)
   from 7be1dde6dfe47b08cf49f6bfb3f4fe031d9fad8e (commit)

commit c5ac3ceeff8979a20d60e40f62f0b04d0ea67b9f
Author: Matthew Brush 
Date:   Tue Oct 4 01:28:34 2011 -0700

Noise: remove extra whitespace added by editor.

Apologies for the noise.

 mousepad/mousepad-document.c|   12 +-
 mousepad/mousepad-file.c|   20 
 mousepad/mousepad-preferences.c |2 +-
 mousepad/mousepad-statusbar.c   |6 ++--
 mousepad/mousepad-view.c|4 +-
 mousepad/mousepad-window.c  |   48 +++---
 6 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 843cd14..a3d9099 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -160,7 +160,7 @@ mousepad_document_class_init (MousepadDocumentClass *klass)
   0, NULL, NULL,
   g_cclosure_marshal_VOID__BOOLEAN,
   G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-  
+
   document_signals[LANGUAGE_CHANGED] =
 g_signal_new (I_("language-changed"),
   G_TYPE_FROM_CLASS (gobject_class),
@@ -241,7 +241,7 @@ mousepad_document_init (MousepadDocument *document)
   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);
-  
+
   if (g_strcmp0 (color_scheme, "none") != 0)
 scheme =  gtk_source_style_scheme_manager_get_scheme 
(gtk_source_style_scheme_manager_get_default (), color_scheme);
   gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER 
(document->buffer), (scheme != NULL));
@@ -369,13 +369,13 @@ mousepad_document_notify_language (GtkSourceBuffer  
*buffer,
MousepadDocument *document)
 {
   GtkSourceLanguage *language;
-  
+
   mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
   mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
-  
+
   /* the new language */
   language = gtk_source_buffer_get_language (buffer);
-  
+
   /* emit the signal */
   g_signal_emit (G_OBJECT (document), document_signals[LANGUAGE_CHANGED], 0, 
language);
 }
@@ -542,7 +542,7 @@ mousepad_document_send_signals (MousepadDocument *document)
 
   /* re-send the selection status */
   mousepad_document_notify_has_selection (document->buffer, NULL, document);
-  
+
   /* re-send the language signal */
   mousepad_document_notify_language (GTK_SOURCE_BUFFER (document->buffer), 
NULL, document);
 }
diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index 2e4a86c..0148b69 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -393,13 +393,13 @@ mousepad_file_get_line_ending (MousepadFile *file)
 
 
 
-void 
+void
 mousepad_file_set_language (MousepadFile  *file,
 GtkSourceLanguage *language)
 {
   mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
   mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
-  
+
   gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), language);
 }
 
@@ -410,7 +410,7 @@ mousepad_file_get_language (MousepadFile *file)
 {
   mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
   mousepad_return_val_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer), NULL);
-  
+
   return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (file->buffer));
 }
 
@@ -421,16 +421,16 @@ mousepad_file_set_language_id (MousepadFile *file,
const gchar  *language_id)
 {
   GtkSourceLanguage *lang;
-  
+
   mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
   mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
-  
+
   if (G_UNLIKELY (language_id == NULL))
 {
   gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), NULL);
   return;
 }
-  
+
   lang = gtk_source_language_manager_get_language 
(gtk_source_language_manager_get_default (), language_id);
   mousepad_file_set_language (file, lang);
 }
@@ -441,7 +441,7 @@ const gchar *
 mousepad_file_get_language_id (MousepadFile *file)
 {
   GtkSourceLanguage *lang;
-  
+
   lang = mousepad_file_get_language (file);
   return (lang != NULL) ? gtk_source_language_get_id (lang) : NULL;
 }
@@ -462,11 +462,11 @@ mousepad_file_guess_language (MousepadFile *file)
   content_type = NULL;
 }
 
-  language = gtk_source_language_manager_guess_language 
(gtk_source_language_manager_get_default (), 
- file->filename, 
+  language = gtk_source_language_manager_guess_language 
(gtk_source_language_manager_get_default (),
+ file->filename,
  content_type);

[Xfce4-commits] Use better string compare function for colour scheme names.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 7be1dde6dfe47b08cf49f6bfb3f4fe031d9fad8e (commit)
   from 349066029e579a6dc1014aff3759e0f78ec52eb7 (commit)

commit 7be1dde6dfe47b08cf49f6bfb3f4fe031d9fad8e
Author: Matthew Brush 
Date:   Tue Oct 4 00:08:50 2011 -0700

Use better string compare function for colour scheme names.

 mousepad/mousepad-window.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 45a9f82..f042aae 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -3087,8 +3087,8 @@ mousepad_window_color_schemes_compare_by_name 
(gconstpointer a,
   
   name_a = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (a));
   name_b = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (b));
-  
-  return g_strcmp0 (name_a, name_b);
+
+  return g_utf8_collate (name_a, name_b);
 }
 
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix kludge from last commit (FIXME comment).

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 349066029e579a6dc1014aff3759e0f78ec52eb7 (commit)
   from ba38b4940b2998c30ba9bde6c707bf1c589cae0b (commit)

commit 349066029e579a6dc1014aff3759e0f78ec52eb7
Author: Matthew Brush 
Date:   Mon Oct 3 23:47:52 2011 -0700

Fix kludge from last commit (FIXME comment).

Add a new signal 'language-changed' to MousepadDocument for the window
to use to get notified of when to update the language/filetype in the
statusbar.

 mousepad/mousepad-document.c |   35 +++
 mousepad/mousepad-window.c   |   23 +--
 2 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 1f80b12..843cd14 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -52,6 +52,9 @@ static void  mousepad_document_notify_has_selection
(GtkTextBuffer
 static void  mousepad_document_notify_overwrite(GtkTextView
*textview,
 GParamSpec 
*pspec,
 MousepadDocument   
*document);
+static void  mousepad_document_notify_language (GtkSourceBuffer
*buffer,
+GParamSpec 
*pspec,
+MousepadDocument   
*document);
 static void  mousepad_document_drag_data_received  (GtkWidget  
*widget,
 GdkDragContext 
*context,
 gint   
 x,
@@ -73,6 +76,7 @@ enum
   CURSOR_CHANGED,
   SELECTION_CHANGED,
   OVERWRITE_CHANGED,
+  LANGUAGE_CHANGED,
   LAST_SIGNAL
 };
 
@@ -156,6 +160,14 @@ mousepad_document_class_init (MousepadDocumentClass *klass)
   0, NULL, NULL,
   g_cclosure_marshal_VOID__BOOLEAN,
   G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+  
+  document_signals[LANGUAGE_CHANGED] =
+g_signal_new (I_("language-changed"),
+  G_TYPE_FROM_CLASS (gobject_class),
+  G_SIGNAL_RUN_LAST,
+  0, NULL, NULL,
+  g_cclosure_marshal_VOID__OBJECT,
+  G_TYPE_NONE, 1, GTK_TYPE_SOURCE_LANGUAGE);
 }
 
 
@@ -246,6 +258,7 @@ mousepad_document_init (MousepadDocument *document)
   g_signal_connect_swapped (G_OBJECT (document->file), "readonly-changed", 
G_CALLBACK (mousepad_document_label_color), document);
   g_signal_connect (G_OBJECT (document->textview), "notify::overwrite", 
G_CALLBACK (mousepad_document_notify_overwrite), document);
   g_signal_connect (G_OBJECT (document->textview), "drag-data-received", 
G_CALLBACK (mousepad_document_drag_data_received), document);
+  g_signal_connect (G_OBJECT (document->buffer), "notify::language", 
G_CALLBACK (mousepad_document_notify_language), document);
 }
 
 
@@ -351,6 +364,25 @@ mousepad_document_notify_overwrite (GtkTextView  
*textview,
 
 
 static void
+mousepad_document_notify_language (GtkSourceBuffer  *buffer,
+   GParamSpec   *pspec,
+   MousepadDocument *document)
+{
+  GtkSourceLanguage *language;
+  
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+  mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
+  
+  /* the new language */
+  language = gtk_source_buffer_get_language (buffer);
+  
+  /* emit the signal */
+  g_signal_emit (G_OBJECT (document), document_signals[LANGUAGE_CHANGED], 0, 
language);
+}
+
+
+
+static void
 mousepad_document_drag_data_received (GtkWidget*widget,
   GdkDragContext   *context,
   gint  x,
@@ -510,6 +542,9 @@ mousepad_document_send_signals (MousepadDocument *document)
 
   /* re-send the selection status */
   mousepad_document_notify_has_selection (document->buffer, NULL, document);
+  
+  /* re-send the language signal */
+  mousepad_document_notify_language (GTK_SOURCE_BUFFER (document->buffer), 
NULL, document);
 }
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 54a3520..45a9f82 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -152,6 +152,9 @@ static void  mousepad_window_selection_changed  
  (MousepadD
 static void  mousepad_window_overwrite_changed
(MousepadDocument   *document,

gbooleanoverwrite,

MousepadWindow *window);
+static void  m

[Xfce4-commits] Add colour scheme support.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to cc401c48985b9f06c855cac39175ddcbe0efe091 (commit)
   from 9a6ad0cb703ec1ef475458cec656cbeef9d865dc (commit)

commit cc401c48985b9f06c855cac39175ddcbe0efe091
Author: Matthew Brush 
Date:   Mon Oct 3 20:06:24 2011 -0700

Add colour scheme support.

* Add new preference 'color-scheme' that stores the scheme's ID string.
* Add new 'Color Schemes' menu and placeholder for items to UI XML file.
* Add new actions for all colour schemes and merge into UI manager menu.
* Handle actions by looping though all textview widgets and setting style.
* Using 'g_str_hash' of scheme id for radio action value which might be bad.

 mousepad/mousepad-document.c|   18 +++-
 mousepad/mousepad-preferences.c |9 ++
 mousepad/mousepad-private.h |2 +
 mousepad/mousepad-window-ui.xml |4 +
 mousepad/mousepad-window.c  |  196 +++
 5 files changed, 224 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 638f639..1f80b12 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -163,11 +163,12 @@ mousepad_document_class_init (MousepadDocumentClass 
*klass)
 static void
 mousepad_document_init (MousepadDocument *document)
 {
-  GtkTargetList   *target_list;
-  gboolean word_wrap, auto_indent, line_numbers, insert_spaces;
-  gchar   *font_name;
-  gint tab_size;
-  MousepadPreferences *preferences;
+  GtkTargetList*target_list;
+  gboolean  word_wrap, auto_indent, line_numbers, insert_spaces;
+  gchar*font_name, *color_scheme;
+  gint  tab_size;
+  GtkSourceStyleScheme *scheme = NULL;
+  MousepadPreferences  *preferences;
 
   /* private structure */
   document->priv = MOUSEPAD_DOCUMENT_GET_PRIVATE (document);
@@ -215,6 +216,7 @@ mousepad_document_init (MousepadDocument *document)
 "view-font-name", &font_name,
 "view-tab-size", &tab_size,
 "view-insert-spaces", &insert_spaces,
+"view-color-scheme", &color_scheme,
 NULL);
 
   /* release the preferences */
@@ -227,9 +229,15 @@ mousepad_document_init (MousepadDocument *document)
   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);
+  
+  if (g_strcmp0 (color_scheme, "none") != 0)
+scheme =  gtk_source_style_scheme_manager_get_scheme 
(gtk_source_style_scheme_manager_get_default (), color_scheme);
+  gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER 
(document->buffer), (scheme != NULL));
+  gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (document->buffer), 
scheme);
 
   /* cleanup */
   g_free (font_name);
+  g_free (color_scheme);
 
   /* attach signals to the text view and buffer */
   g_signal_connect (G_OBJECT (document->buffer), "notify::cursor-position", 
G_CALLBACK (mousepad_document_notify_cursor_position), document);
diff --git a/mousepad/mousepad-preferences.c b/mousepad/mousepad-preferences.c
index cbf1ec1..5b45b71 100644
--- a/mousepad/mousepad-preferences.c
+++ b/mousepad/mousepad-preferences.c
@@ -61,6 +61,7 @@ enum
   PROP_VIEW_TAB_WIDTH,
   PROP_VIEW_TABS_AS_SPACES,
   PROP_VIEW_WORD_WRAP,
+  PROP_VIEW_COLOR_SCHEME,
 
   /* window preferences */
   PROP_WINDOW_HEIGHT,
@@ -213,6 +214,14 @@ mousepad_preferences_class_init (MousepadPreferencesClass 
*klass)
  NULL,
  FALSE,
  
MOUSEPAD_PARAM_READWRITE));
+  
+  g_object_class_install_property (gobject_class,
+   PROP_VIEW_COLOR_SCHEME,
+   g_param_spec_string ("view-color-scheme",
+"ViewColorScheme",
+NULL,
+"none",
+
MOUSEPAD_PARAM_READWRITE));
 
 
   /**
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 520a9f7..85fae3c 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -22,6 +22,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 G_BEGIN_DECLS
 
diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index b6b6575..2fd1c3f 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -68,6 +68,10 @@
   
   
   
+  
+  
+
+ 

[Xfce4-commits] Update statusbar filetype when notebook pages are changed.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to ba38b4940b2998c30ba9bde6c707bf1c589cae0b (commit)
   from 82b6e834ddeea4be8bf901307e6e093bde24631c (commit)

commit ba38b4940b2998c30ba9bde6c707bf1c589cae0b
Author: Matthew Brush 
Date:   Mon Oct 3 22:33:51 2011 -0700

Update statusbar filetype when notebook pages are changed.

Note the FIXME in the comments, this will probably need some refactoring.

 mousepad/mousepad-statusbar.c |   31 +++
 mousepad/mousepad-statusbar.h |3 +++
 mousepad/mousepad-window.c|8 +++-
 3 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 9ed0d94..a7da0f8 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -50,6 +50,7 @@ struct _MousepadStatusbar
   guint   overwrite_enabled : 1;
 
   /* extra labels in the statusbar */
+  GtkWidget  *language;
   GtkWidget  *position;
   GtkWidget  *overwrite;
 };
@@ -119,6 +120,16 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   separator = gtk_vseparator_new ();
   gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
+  
+  /* language/filetype */
+  statusbar->language = gtk_label_new (_("Filetype: None"));
+  gtk_box_pack_start (GTK_BOX (box), statusbar->language, FALSE, TRUE, 0);
+  gtk_widget_show (statusbar->language);
+
+  /* separator */
+  separator = gtk_vseparator_new ();
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
+  gtk_widget_show (separator);
 
   /* line and column numbers */
   statusbar->position = gtk_label_new (NULL);
@@ -169,6 +180,26 @@ mousepad_statusbar_overwrite_clicked (GtkWidget 
*widget,
 
 
 void
+mousepad_statusbar_set_language (MousepadStatusbar *statusbar,
+ GtkSourceLanguage *language)
+{
+  gchar *label;
+  
+  mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
+  
+  if (language == NULL)
+  gtk_label_set_text (GTK_LABEL (statusbar->language), _("Filetype: 
None"));
+  else
+{
+  label = g_strdup_printf (_("Filetype: %s"), gtk_source_language_get_name 
(language));
+  gtk_label_set_text (GTK_LABEL (statusbar->language), label);
+  g_free (label);
+}
+}
+
+
+
+void
 mousepad_statusbar_set_cursor_position (MousepadStatusbar *statusbar,
 gint   line,
 gint   column,
diff --git a/mousepad/mousepad-statusbar.h b/mousepad/mousepad-statusbar.h
index c44b54e..8ebe7a6 100644
--- a/mousepad/mousepad-statusbar.h
+++ b/mousepad/mousepad-statusbar.h
@@ -41,6 +41,9 @@ voidmousepad_statusbar_set_cursor_position  
(MousepadStatusbar *statusba
 voidmousepad_statusbar_set_overwrite(MousepadStatusbar 
*statusbar,
  gboolean   
overwrite);
 
+voidmousepad_statusbar_set_language (MousepadStatusbar 
*statusbar,
+ GtkSourceLanguage 
*language);
+
 G_END_DECLS
 
 #endif /* !__MOUSEPAD_STATUSBAR_H__ */
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 4c5e33e..54a3520 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -1306,7 +1306,8 @@ mousepad_window_notebook_switch_page (GtkNotebook 
*notebook,
   guintpage_num,
   MousepadWindow  *window)
 {
-  MousepadDocument *document;
+  MousepadDocument  *document;
+  GtkSourceLanguage *language;
 
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
   mousepad_return_if_fail (GTK_IS_NOTEBOOK (notebook));
@@ -1328,6 +1329,11 @@ mousepad_window_notebook_switch_page (GtkNotebook 
*notebook,
 
   /* update the statusbar */
   mousepad_document_send_signals (window->active);
+  
+  /* set the filetype in the status bar 
+   * FIXME: this doesn't belong here */
+  language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER 
(window->active->buffer));
+  mousepad_statusbar_set_language (MOUSEPAD_STATUSBAR (window->statusbar), 
language);
 }
 }
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add initial filetype/language support and guess on file open.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 82b6e834ddeea4be8bf901307e6e093bde24631c (commit)
   from cc401c48985b9f06c855cac39175ddcbe0efe091 (commit)

commit 82b6e834ddeea4be8bf901307e6e093bde24631c
Author: Matthew Brush 
Date:   Mon Oct 3 21:48:03 2011 -0700

Add initial filetype/language support and guess on file open.

Still need to add UI elements to let user select language to use.

 mousepad/mousepad-file.c|   82 +++
 mousepad/mousepad-file.h|   12 ++
 mousepad/mousepad-private.h |2 +
 3 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index b45c980..2e4a86c 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -393,6 +393,85 @@ mousepad_file_get_line_ending (MousepadFile *file)
 
 
 
+void 
+mousepad_file_set_language (MousepadFile  *file,
+GtkSourceLanguage *language)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+  mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
+  
+  gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), language);
+}
+
+
+
+GtkSourceLanguage *
+mousepad_file_get_language (MousepadFile *file)
+{
+  mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
+  mousepad_return_val_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer), NULL);
+  
+  return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (file->buffer));
+}
+
+
+
+void
+mousepad_file_set_language_id (MousepadFile *file,
+   const gchar  *language_id)
+{
+  GtkSourceLanguage *lang;
+  
+  mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+  mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
+  
+  if (G_UNLIKELY (language_id == NULL))
+{
+  gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), NULL);
+  return;
+}
+  
+  lang = gtk_source_language_manager_get_language 
(gtk_source_language_manager_get_default (), language_id);
+  mousepad_file_set_language (file, lang);
+}
+
+
+
+const gchar *
+mousepad_file_get_language_id (MousepadFile *file)
+{
+  GtkSourceLanguage *lang;
+  
+  lang = mousepad_file_get_language (file);
+  return (lang != NULL) ? gtk_source_language_get_id (lang) : NULL;
+}
+
+
+
+GtkSourceLanguage *
+mousepad_file_guess_language (MousepadFile *file)
+{
+  gchar *content_type;
+  gboolean   result_uncertain;
+  GtkSourceLanguage *language = NULL;
+
+  content_type = g_content_type_guess (file->filename, NULL, 0, 
&result_uncertain);
+  if (result_uncertain)
+{
+  g_free (content_type);
+  content_type = NULL;
+}
+
+  language = gtk_source_language_manager_guess_language 
(gtk_source_language_manager_get_default (), 
+ file->filename, 
+ content_type);
+  g_free (content_type);
+  
+  return language;
+}
+
+
+
 gint
 mousepad_file_open (MousepadFile  *file,
 const gchar   *template_filename,
@@ -604,6 +683,9 @@ mousepad_file_open (MousepadFile  *file,
   g_mapped_file_free (mapped_file);
 #endif
 
+  /* guess and set the file's filetype/language */
+  mousepad_file_set_language (file, mousepad_file_guess_language (file));
+
   /* this does not count as a modified buffer */
   gtk_text_buffer_set_modified (file->buffer, FALSE);
 }
diff --git a/mousepad/mousepad-file.h b/mousepad/mousepad-file.h
index 18c5b6e..e9a8be3 100644
--- a/mousepad/mousepad-file.h
+++ b/mousepad/mousepad-file.h
@@ -68,6 +68,18 @@ voidmousepad_file_set_line_ending  
(MousepadFile
 
 MousepadLineEnding  mousepad_file_get_line_ending  (MousepadFile   
 *file);
 
+voidmousepad_file_set_language (MousepadFile   
 *file,
+GtkSourceLanguage  
 *language);
+
+GtkSourceLanguage  *mousepad_file_get_language (MousepadFile   
 *file);
+
+voidmousepad_file_set_language_id  (MousepadFile   
 *file,
+const gchar
 *language_id);
+
+const gchar*mousepad_file_get_language_id  (MousepadFile   
 *file);
+
+GtkSourceLanguage  *mousepad_file_guess_language   (MousepadFile   
 *file);
+
 gintmousepad_file_open (MousepadFile   
 *file,
 const gchar
 *template_filename,
 GError 
**error);
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 85fae3c..921767b 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -24,6 +24,8 @@
 #include 
 #incl

[Xfce4-commits] Remove undo manager code and use GtkSourceView's undo manager.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 728cb754e087cf0bbc2efa7167a8008b2c66752a (commit)
   from 6be5f6c5f9de3242f234f08506da31e55396d9b5 (commit)

commit 728cb754e087cf0bbc2efa7167a8008b2c66752a
Author: Matthew Brush 
Date:   Mon Oct 3 06:54:20 2011 -0700

Remove undo manager code and use GtkSourceView's undo manager.

There was a call to mousepad_undo_lock() in mousepad-encoding-dialog.c
that needs to be checked, since I wasn't sure what that call was for.

 mousepad/Makefile.am|2 -
 mousepad/mousepad-document.c|9 +-
 mousepad/mousepad-document.h|4 -
 mousepad/mousepad-encoding-dialog.c |3 -
 mousepad/mousepad-undo.c|  835 ---
 mousepad/mousepad-undo.h|   54 ---
 mousepad/mousepad-window.c  |   58 ++--
 7 files changed, 31 insertions(+), 934 deletions(-)

diff --git a/mousepad/Makefile.am b/mousepad/Makefile.am
index 41b7b1e..3dfb8ac 100644
--- a/mousepad/Makefile.am
+++ b/mousepad/Makefile.am
@@ -46,8 +46,6 @@ mousepad_SOURCES = \
mousepad-statusbar.h \
mousepad-view.c \
mousepad-view.h \
-   mousepad-undo.c \
-   mousepad-undo.h \
mousepad-util.c \
mousepad-util.h \
mousepad-window.c \
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 2e39044..638f639 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -185,7 +184,7 @@ mousepad_document_init (MousepadDocument *document)
   gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (document), NULL);
 
   /* create a textbuffer */
-  document->buffer = gtk_text_buffer_new (NULL);
+  document->buffer = GTK_TEXT_BUFFER (gtk_source_buffer_new (NULL));
 
   /* initialize the file */
   document->file = mousepad_file_new (document->buffer);
@@ -193,9 +192,6 @@ mousepad_document_init (MousepadDocument *document)
   /* connect signals to the file */
   g_signal_connect_swapped (G_OBJECT (document->file), "filename-changed", 
G_CALLBACK (mousepad_document_filename_changed), document);
 
-  /* initialize the undo manager */
-  document->undo = mousepad_undo_new (document->buffer);
-
   /* create the highlight tag */
   document->tag = gtk_text_buffer_create_tag (document->buffer, NULL, 
"background", "#78", NULL);
 
@@ -255,9 +251,6 @@ mousepad_document_finalize (GObject *object)
   g_free (document->priv->utf8_filename);
   g_free (document->priv->utf8_basename);
 
-  /* release the undo manager */
-  g_object_unref (G_OBJECT (document->undo));
-
   /* release the file */
   g_object_unref (G_OBJECT (document->file));
 
diff --git a/mousepad/mousepad-document.h b/mousepad/mousepad-document.h
index 2daff7f..f2176c1 100644
--- a/mousepad/mousepad-document.h
+++ b/mousepad/mousepad-document.h
@@ -21,7 +21,6 @@ G_BEGIN_DECLS
 
 #include 
 #include 
-#include 
 #include 
 
 typedef struct _MousepadDocumentPrivate MousepadDocumentPrivate;
@@ -47,9 +46,6 @@ struct _MousepadDocument
   /* file */
   MousepadFile*file;
 
-  /* undo manager */
-  MousepadUndo*undo;
-
   /* text buffer */
   GtkTextBuffer   *buffer;
 
diff --git a/mousepad/mousepad-encoding-dialog.c 
b/mousepad/mousepad-encoding-dialog.c
index 953bfbd..7d4ce76 100644
--- a/mousepad/mousepad-encoding-dialog.c
+++ b/mousepad/mousepad-encoding-dialog.c
@@ -213,9 +213,6 @@ mousepad_encoding_dialog_init (MousepadEncodingDialog 
*dialog)
   mousepad_view_set_line_numbers (dialog->document->textview, FALSE);
   mousepad_document_set_word_wrap (dialog->document, FALSE);
   gtk_widget_show (GTK_WIDGET (dialog->document));
-
-  /* lock undo manager forever */
-  mousepad_undo_lock (dialog->document->undo);
 }
 
 
diff --git a/mousepad/mousepad-undo.c b/mousepad/mousepad-undo.c
deleted file mode 100644
index ecea5cd..000
--- a/mousepad/mousepad-undo.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
- * 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
- */
-
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
-
-#include 
-#include 
-
-
-/* global */
-#define MOUSEPAD_UNDO_MAX_STEPS (100) /* maximum

[Xfce4-commits] Remove old tab size code and use GtkSourceView's tab-width.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 9a6ad0cb703ec1ef475458cec656cbeef9d865dc (commit)
   from 728cb754e087cf0bbc2efa7167a8008b2c66752a (commit)

commit 9a6ad0cb703ec1ef475458cec656cbeef9d865dc
Author: Matthew Brush 
Date:   Mon Oct 3 08:10:59 2011 -0700

Remove old tab size code and use GtkSourceView's tab-width.

 mousepad/mousepad-view.c |   92 +++---
 1 files changed, 14 insertions(+), 78 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 438b671..6c98b15 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -69,9 +69,6 @@ static void  mousepad_view_indent_decrease   
(MousepadView
 static void  mousepad_view_indent_selection  (MousepadView 
  *view,
   gboolean 
   increase,
   gboolean 
   force);
-static gint  mousepad_view_calculate_layout_width(GtkWidget
  *widget,
-  gsize
   length,
-  gchar
   fill_char);
 static void  mousepad_view_transpose_multi_selection (GtkTextBuffer
   *buffer,
   MousepadView 
   *view);
 static void  mousepad_view_transpose_range   (GtkTextBuffer
   *buffer,
@@ -114,9 +111,6 @@ struct _MousepadView
 
   /* if the selection is in editing mode */
   guint   selection_editing : 1;
-
-  /* settings */
-  guint   tab_size;
 };
 
 
@@ -147,9 +141,6 @@ mousepad_view_class_init (MousepadViewClass *klass)
 static void
 mousepad_view_init (MousepadView *view)
 {
-  /* initialize settings */
-  view->tab_size = 8;
-
   /* initialize selection variables */
   view->selection_timeout_id = 0;
   view->selection_tag = NULL;
@@ -240,9 +231,6 @@ mousepad_view_style_set (GtkWidget *widget,
 "foreground-gdk", 
&style->text[GTK_STATE_SELECTED],
 NULL);
 
-  /* update the tab size */
-  mousepad_view_set_tab_size (view, view->tab_size);
-
   /* redraw selection */
   if (view->selection_marks != NULL)
 mousepad_view_selection_draw (view, FALSE);
@@ -987,24 +975,25 @@ mousepad_view_indent_increase (MousepadView *view,
GtkTextIter  *iter)
 {
   gchar *string;
-  gint   offset, length, inline_len;
+  gint   offset, length, inline_len, tab_size;
   GtkTextBuffer *buffer;
 
   /* get the buffer */
   buffer = mousepad_view_get_buffer (view);
+  tab_size = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (view));
 
   if (gtk_source_view_get_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW 
(view)))
 {
   /* get the offset */
-  offset = mousepad_util_get_real_line_offset (iter, view->tab_size);
+  offset = mousepad_util_get_real_line_offset (iter, tab_size);
 
   /* calculate the length to inline with a tab */
-  inline_len = offset % view->tab_size;
+  inline_len = offset % tab_size;
 
   if (inline_len == 0)
-length = view->tab_size;
+length = tab_size;
   else
-length = view->tab_size - inline_len;
+length = tab_size - inline_len;
 
   /* create spaces string */
   string = g_strnfill (length, ' ');
@@ -1030,11 +1019,14 @@ mousepad_view_indent_decrease (MousepadView *view,
 {
   GtkTextBuffer *buffer;
   GtkTextIterstart, end;
-  gint   columns = view->tab_size;
+  gint   columns, tab_size;
   gunichar   c;
 
   /* set iters */
   start = end = *iter;
+  
+  tab_size = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (view));
+  columns = tab_size;
 
   /* walk until we've removed enough columns */
   while (columns > 0)
@@ -1043,7 +1035,7 @@ mousepad_view_indent_decrease (MousepadView *view,
   c = gtk_text_iter_get_char (&end);
 
   if (c == '\t')
-columns -= view->tab_size;
+columns -= tab_size;
   else if (c == ' ')
 columns--;
   else
@@ -1119,42 +,6 @@ mousepad_view_indent_selection (MousepadView *view,
 }
 
 
-
-static gint
-mousepad_view_calculate_layout_width (GtkWidget *widget,
-  gsize  length,
-  gchar  fill_char)
-{
-  PangoLayout *layout;
-  gchar   *string;
-  gint width = -1;
-
-  mousepad_return_val_if_fail (GTK_IS_WIDGET (widget), -1);
-  mousepad_return_val_if_fail (length > 0, -1);
-
-  /* create character string */
-  string = g_strnfill (length, fill_char);
-
-  /* create pango layout from widget 

[Xfce4-commits] Remove old insert spaces code and use GtkSourceView's.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 6be5f6c5f9de3242f234f08506da31e55396d9b5 (commit)
   from 898612c83495635ef657fea60f6b9048640b0f15 (commit)

commit 6be5f6c5f9de3242f234f08506da31e55396d9b5
Author: Matthew Brush 
Date:   Mon Oct 3 02:38:25 2011 -0700

Remove old insert spaces code and use GtkSourceView's.

Remove special tab handling since GtkSourceView handles it.

 mousepad/mousepad-view.c |   48 ++---
 1 files changed, 3 insertions(+), 45 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 8b600e4..438b671 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -116,7 +116,6 @@ struct _MousepadView
   guint   selection_editing : 1;
 
   /* settings */
-  guint   insert_spaces : 1;
   guint   tab_size;
 };
 
@@ -149,7 +148,6 @@ static void
 mousepad_view_init (MousepadView *view)
 {
   /* initialize settings */
-  view->insert_spaces = FALSE;
   view->tab_size = 8;
 
   /* initialize selection variables */
@@ -352,45 +350,6 @@ mousepad_view_key_press_event (GtkWidget   *widget,
   }
 break;
 
-  case GDK_Tab:
-  case GDK_KP_Tab:
-  case GDK_ISO_Left_Tab:
-if (G_LIKELY (is_editable))
-  {
-if (view->selection_marks != NULL)
-  {
-/* insert a tab in the selection */
-mousepad_view_selection_key_press_event (view, NULL, GDK_Tab, 
modifiers);
-
-return TRUE;
-  }
-else if (gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL))
-  {
-/* indent the selection */
-mousepad_view_indent_selection (view, !(modifiers & 
GDK_SHIFT_MASK), FALSE);
-
-return TRUE;
-  }
-else if (view->insert_spaces)
-  {
-/* get the iter position of the cursor */
-cursor = gtk_text_buffer_get_insert (buffer);
-gtk_text_buffer_get_iter_at_mark (buffer, &iter, cursor);
-
-/* begin user action */
-gtk_text_buffer_begin_user_action (buffer);
-
-/* insert spaces */
-mousepad_view_indent_increase (view, &iter);
-
-/* end user action */
-gtk_text_buffer_end_user_action (buffer);
-
-return TRUE;
-  }
-  }
-break;
-
   default:
 if (G_UNLIKELY (view->selection_marks != NULL && is_editable))
   {
@@ -1034,7 +993,7 @@ mousepad_view_indent_increase (MousepadView *view,
   /* get the buffer */
   buffer = mousepad_view_get_buffer (view);
 
-  if (view->insert_spaces)
+  if (gtk_source_view_get_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW 
(view)))
 {
   /* get the offset */
   offset = mousepad_util_get_real_line_offset (iter, view->tab_size);
@@ -2424,8 +2383,7 @@ mousepad_view_set_insert_spaces (MousepadView *view,
 {
   mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
 
-  /* set boolean */
-  view->insert_spaces = insert_spaces;
+  gtk_source_view_set_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (view), 
insert_spaces);
 }
 
 
@@ -2504,5 +2462,5 @@ mousepad_view_get_insert_spaces (MousepadView *view)
 {
   mousepad_return_val_if_fail (MOUSEPAD_IS_VIEW (view), FALSE);
 
-  return view->insert_spaces;
+  return gtk_source_view_get_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW 
(view));
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Remove old auto-indentation code and use GtkSourceView's auto-indent.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 898612c83495635ef657fea60f6b9048640b0f15 (commit)
   from 801eadc860c894420a1807e5a9f496895bd031c8 (commit)

commit 898612c83495635ef657fea60f6b9048640b0f15
Author: Matthew Brush 
Date:   Mon Oct 3 02:01:16 2011 -0700

Remove old auto-indentation code and use GtkSourceView's auto-indent.

 mousepad/mousepad-view.c |   78 +
 1 files changed, 2 insertions(+), 76 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index a16c594..8b600e4 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -69,8 +69,6 @@ static void  mousepad_view_indent_decrease   
(MousepadView
 static void  mousepad_view_indent_selection  (MousepadView 
  *view,
   gboolean 
   increase,
   gboolean 
   force);
-static gchar*mousepad_view_indent_string (GtkTextBuffer
  *buffer,
-  const 
GtkTextIter  *iter);
 static gint  mousepad_view_calculate_layout_width(GtkWidget
  *widget,
   gsize
   length,
   gchar
   fill_char);
@@ -118,7 +116,6 @@ struct _MousepadView
   guint   selection_editing : 1;
 
   /* settings */
-  guint   auto_indent : 1;
   guint   insert_spaces : 1;
   guint   tab_size;
 };
@@ -152,7 +149,6 @@ static void
 mousepad_view_init (MousepadView *view)
 {
   /* initialize settings */
-  view->auto_indent = FALSE;
   view->insert_spaces = FALSE;
   view->tab_size = 8;
 
@@ -266,7 +262,6 @@ mousepad_view_key_press_event (GtkWidget   *widget,
   GtkTextIteriter;
   GtkTextMark   *cursor;
   guint  modifiers;
-  gchar *string;
   gboolean   im_handled;
   gboolean   is_editable;
 
@@ -282,48 +277,6 @@ mousepad_view_key_press_event (GtkWidget   *widget,
   /* handle the key event */
   switch (event->keyval)
 {
-  case GDK_Return:
-  case GDK_KP_Enter:
-if (!(event->state & GDK_SHIFT_MASK) && view->auto_indent && 
is_editable)
-  {
-/* get the iter position of the cursor */
-cursor = gtk_text_buffer_get_insert (buffer);
-gtk_text_buffer_get_iter_at_mark (buffer, &iter, cursor);
-
-/* get the string of tabs and spaces we're going to indent */
-string = mousepad_view_indent_string (buffer, &iter);
-
-if (string != NULL)
-  {
-/* check if the input method emitted this event */
-im_handled = gtk_im_context_filter_keypress (GTK_TEXT_VIEW 
(view)->im_context, event);
-
-/* check if we're allowed to handle this event */
-if (G_LIKELY (im_handled == FALSE))
-  {
-/* begin a user action */
-gtk_text_buffer_begin_user_action (buffer);
-
-/* insert the indent characters */
-gtk_text_buffer_insert (buffer, &iter, "\n", 1);
-gtk_text_buffer_insert (buffer, &iter, string, -1);
-
-/* end user action */
-gtk_text_buffer_end_user_action (buffer);
-
-/* make sure the new string is visible for the user */
-mousepad_view_scroll_to_cursor (view);
-  }
-
-/* cleanup */
-g_free (string);
-
-/* return */
-return (im_handled == FALSE);
-  }
-  }
-break;
-
   case GDK_End:
   case GDK_KP_End:
 if (modifiers & GDK_CONTROL_MASK)
@@ -1208,32 +1161,6 @@ mousepad_view_indent_selection (MousepadView *view,
 
 
 
-static gchar *
-mousepad_view_indent_string (GtkTextBuffer *buffer,
- const GtkTextIter *iter)
-{
-  GtkTextIter start, end;
-  gintline;
-
-  /* get the line of the iter */
-  line = gtk_text_iter_get_line (iter);
-
-  /* get the iter of the beginning of this line */
-  gtk_text_buffer_get_iter_at_line (buffer, &start, line);
-
-  /* set the end iter */
-  end = start;
-
-  /* forward until we hit text */
-  if (mousepad_util_forward_iter_to_text (&end, iter) == FALSE)
-return NULL;
-
-  /* return the text between the iters */
-  return gtk_text_iter_get_slice (&start, &end);
-}
-
-
-
 static gint
 mousepad_view_calculate_layout_width (GtkWidget *widget,
   gsize  length,
@@ -2454,8 +2381,7 @@ mousepad_view_set_auto_indent (MousepadView *view,
 {

[Xfce4-commits] Remove old line number code and use GtkSourceView's show-line-numbers.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 801eadc860c894420a1807e5a9f496895bd031c8 (commit)
   from d1970d6b3ec4e212f8fd2823b6f5dd00c17fe4cf (commit)

commit 801eadc860c894420a1807e5a9f496895bd031c8
Author: Matthew Brush 
Date:   Mon Oct 3 01:52:27 2011 -0700

Remove old line number code and use GtkSourceView's show-line-numbers.

 mousepad/mousepad-view.c |  110 +
 1 files changed, 3 insertions(+), 107 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 5146811..a16c594 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -30,8 +30,6 @@
 
 
 
-#define LINE_NUMBER_MARGIN (10)
-#define LINE_NUMBER_OFFSET (4)
 #define mousepad_view_get_buffer(view) (GTK_TEXT_VIEW (view)->buffer)
 
 
@@ -121,7 +119,6 @@ struct _MousepadView
 
   /* settings */
   guint   auto_indent : 1;
-  guint   line_numbers : 1;
   guint   insert_spaces : 1;
   guint   tab_size;
 };
@@ -156,7 +153,6 @@ mousepad_view_init (MousepadView *view)
 {
   /* initialize settings */
   view->auto_indent = FALSE;
-  view->line_numbers = FALSE;
   view->insert_spaces = FALSE;
   view->tab_size = 8;
 
@@ -201,13 +197,6 @@ mousepad_view_expose (GtkWidget  *widget,
 {
   GtkTextView  *textview = GTK_TEXT_VIEW (widget);
   MousepadView *view = MOUSEPAD_VIEW (widget);
-  gint  y_start, y_offset, y_finish;
-  gint  y_iter, height;
-  gint  line_number, line_count;
-  GtkTextIter   iter;
-  gint  width, border_width;
-  PangoLayout  *layout;
-  gchar str[8]; /* maximum of 10e6 lines */
 
   if (G_UNLIKELY (view->selection_length == -1
   && (view->selection_marks != NULL || view->selection_end_x != -1)
@@ -216,90 +205,6 @@ mousepad_view_expose (GtkWidget  *widget,
   /* redraw the cursor lines for the vertical selection */
   mousepad_view_selection_draw (view, FALSE);
 }
-  else if (event->window == gtk_text_view_get_window (textview, 
GTK_TEXT_WINDOW_LEFT))
-{
-  /* get the real start position */
-  gtk_text_view_window_to_buffer_coords (textview, GTK_TEXT_WINDOW_LEFT,
- 0, event->area.y, NULL, &y_start);
-
-  /* get the left window y offset (this is *NOT* the textview offset!) */
-  y_offset = event->area.y - y_start;
-
-  /* get the bottom position */
-  y_finish = y_start + event->area.height;
-
-  /* get the start iter and its line number */
-  gtk_text_view_get_line_at_y (textview, &iter, y_start, NULL);
-  line_number = gtk_text_iter_get_line (&iter);
-
-  /* get the number of lines in the buffer */
-  line_count = gtk_text_buffer_get_line_count (textview->buffer);
-
-  /* string with the 'last' line number */
-  g_snprintf (str, sizeof (str), "%d", MAX (99, line_count));
-
-  /* create the pango layout */
-  layout = gtk_widget_create_pango_layout (widget, str);
-  pango_layout_get_pixel_size (layout, &width, NULL);
-
-  /* border width */
-  border_width = width + LINE_NUMBER_MARGIN;
-
-  /* check if we need to set the border size again */
-  if (G_UNLIKELY (gtk_text_view_get_border_window_size (textview, 
GTK_TEXT_WINDOW_LEFT) != border_width))
-{
-  /* set the new border size */
-  gtk_text_view_set_border_window_size (textview, 
GTK_TEXT_WINDOW_LEFT, border_width);
-
-  /* leave, we'll redraw on the next expose event */
-  goto bail_out;
-}
-
-  /* finish the pango layout */
-  pango_layout_set_width (layout, width);
-  pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
-
-  /* draw a vertical line to separate the numbers and text */
-  gtk_paint_vline (widget->style, event->window,
-   GTK_WIDGET_STATE (widget),
-   NULL, widget, NULL,
-   event->area.y,
-   event->area.y + event->area.height,
-   border_width - 2);
-
-  /* walk through the lines until we hit the last line */
-  for (; line_number < line_count; line_number++)
-{
-  /* get the y position and the height of the iter */
-  gtk_text_view_get_line_yrange (textview, &iter, &y_iter, &height);
-
-  /* create the number */
-  g_snprintf (str, sizeof (str), "%d", line_number + 1);
-
-  /* create the pange layout */
-  pango_layout_set_text (layout, str, -1);
-
-  /* draw the layout on the left window */
-  gtk_paint_layout (widget->style, event->window,
-GTK_WIDGET_STATE (widget),
-FALSE, NULL, widget, NULL,
-width + LINE_NUMBER_OFFSET,
-  

[Xfce4-commits] Make MousepadView a subclass of GtkSourceView instead of GtkTextView.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to d1970d6b3ec4e212f8fd2823b6f5dd00c17fe4cf (commit)
   from 4e5c46f563dc7e468041a62f82cab8e8bfc4a3dc (commit)

commit d1970d6b3ec4e212f8fd2823b6f5dd00c17fe4cf
Author: Matthew Brush 
Date:   Mon Oct 3 01:34:42 2011 -0700

Make MousepadView a subclass of GtkSourceView instead of GtkTextView.

Add include for gtksourceview.h in mousepad-private.h.

Causes the line numbers to always be shown initially but this should be
fixed once the line numbers code is ported to use GtkSourceView.

 mousepad/mousepad-private.h |1 +
 mousepad/mousepad-view.c|6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 4be50b1..520a9f7 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 G_BEGIN_DECLS
 
diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 4e12fa6..5146811 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -91,12 +91,12 @@ static void  mousepad_view_transpose_words  
 (GtkTextBuffer
 
 struct _MousepadViewClass
 {
-  GtkTextViewClass __parent__;
+  GtkSourceViewClass __parent__;
 };
 
 struct _MousepadView
 {
-  GtkTextView  __parent__;
+  GtkSourceView  __parent__;
 
   /* the selection style tag */
   GtkTextTag *selection_tag;
@@ -128,7 +128,7 @@ struct _MousepadView
 
 
 
-G_DEFINE_TYPE (MousepadView, mousepad_view, GTK_TYPE_TEXT_VIEW);
+G_DEFINE_TYPE (MousepadView, mousepad_view, GTK_TYPE_SOURCE_VIEW);
 
 
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add GtkSourceView dependency to build system.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 4e5c46f563dc7e468041a62f82cab8e8bfc4a3dc (commit)
   from b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)

commit 4e5c46f563dc7e468041a62f82cab8e8bfc4a3dc
Author: Matthew Brush 
Date:   Mon Oct 3 05:30:31 2011 -0700

Add GtkSourceView dependency to build system.

Still need to determine which version of GtkSourceView to depend on.

 configure.ac.in  |1 +
 mousepad/Makefile.am |4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index c4b7da2..9c820c6 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -83,6 +83,7 @@ dnl ***
 XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
+XDT_CHECK_PACKAGE([GTKSOURCEVIEW], [gtksourceview-2.0])
 
 dnl **
 dnl *** Optional support for D-BUS ***
diff --git a/mousepad/Makefile.am b/mousepad/Makefile.am
index a065629..41b7b1e 100644
--- a/mousepad/Makefile.am
+++ b/mousepad/Makefile.am
@@ -58,6 +58,7 @@ mousepad_CFLAGS = \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(GTHREAD_CFLAGS) \
+   $(GTKSOURCEVIEW_CFLAGS) \
$(PLATFORM_CFLAGS)
 
 mousepad_LDFLAGS = \
@@ -67,7 +68,8 @@ mousepad_LDFLAGS = \
 mousepad_LDADD = \
$(GLIB_LIBS) \
$(GTK_LIBS) \
-   $(GTHREAD_LIBS)
+   $(GTHREAD_LIBS) \
+   $(GTKSOURCEVIEW_LIBS)
 
 if HAVE_DBUS
 mousepad_built_sources +=  \
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Prevent warnings when messing around with statusbar internal widgets.

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)
   from 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415 (commit)

commit b401a34b8c6b88ebd26e26f03a70a13548cbc4c0
Author: Matthew Brush 
Date:   Mon Oct 3 05:20:18 2011 -0700

Prevent warnings when messing around with statusbar internal widgets.

Remove statusbar frame border.

 mousepad/mousepad-statusbar.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 0321c3e..9ed0d94 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -93,8 +93,9 @@ mousepad_statusbar_class_init (MousepadStatusbarClass *klass)
 static void
 mousepad_statusbar_init (MousepadStatusbar *statusbar)
 {
-  GtkWidget*ebox, *box, *separator;
+  GtkWidget*ebox, *box, *separator, *label;
   GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
+  GList *frame;
 
   /* init statusbar */
   gtk_statusbar_set_has_resize_grip (bar, TRUE);
@@ -104,11 +105,15 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   gtk_widget_show (box);
 
   /* reorder the gtk statusbar */
-  g_object_ref (G_OBJECT (bar->label));
-  gtk_container_remove (GTK_CONTAINER (bar->frame), bar->label);
-  gtk_container_add (GTK_CONTAINER (bar->frame), box);
-  gtk_box_pack_start (GTK_BOX (box), bar->label, TRUE, TRUE, 0);
-  g_object_unref (G_OBJECT (bar->label));
+  frame = gtk_container_get_children (GTK_CONTAINER (bar));
+  gtk_frame_set_shadow_type (GTK_FRAME (frame->data), GTK_SHADOW_NONE);
+  label = gtk_bin_get_child (GTK_BIN (frame->data));
+  g_object_ref (label);
+  gtk_container_remove (GTK_CONTAINER (frame->data), label);
+  gtk_container_add (GTK_CONTAINER (frame->data), box);
+  gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
+  g_object_unref (label);
+  g_list_free (frame);
 
   /* separator */
   separator = gtk_vseparator_new ();
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Revert "Drop usage of the GtkStatusbar."

2012-05-05 Thread Matthew Brush
Updating branch refs/heads/master
 to 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415 (commit)
   from ff0faf3c3250b4e56598aec891109d96f3aece7a (commit)

commit 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415
Author: Matthew Brush 
Date:   Mon Oct 3 03:56:58 2011 -0700

Revert "Drop usage of the GtkStatusbar."

This reverts commit 185821ae262235222f7ef1d3a86dc0ea2b19bbd9.

 mousepad/mousepad-statusbar.c |   54 +---
 mousepad/mousepad-statusbar.h |2 -
 mousepad/mousepad-window.c|   17 +++-
 3 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index dc4503f..0321c3e 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -39,20 +39,19 @@ enum
 
 struct _MousepadStatusbarClass
 {
-  GtkHBoxClass __parent__;
+  GtkStatusbarClass __parent__;
 };
 
 struct _MousepadStatusbar
 {
-  GtkHBox __parent__;
+  GtkStatusbar__parent__;
 
   /* whether overwrite is enabled */
-  guint  overwrite_enabled : 1;
+  guint   overwrite_enabled : 1;
 
   /* extra labels in the statusbar */
-  GtkWidget *tooltip;
-  GtkWidget *position;
-  GtkWidget *overwrite;
+  GtkWidget  *position;
+  GtkWidget  *overwrite;
 };
 
 
@@ -61,7 +60,7 @@ static guint statusbar_signals[LAST_SIGNAL];
 
 
 
-G_DEFINE_TYPE (MousepadStatusbar, mousepad_statusbar, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (MousepadStatusbar, mousepad_statusbar, GTK_TYPE_STATUSBAR);
 
 
 
@@ -94,38 +93,41 @@ mousepad_statusbar_class_init (MousepadStatusbarClass 
*klass)
 static void
 mousepad_statusbar_init (MousepadStatusbar *statusbar)
 {
-  GtkWidget *ebox, *separator;
+  GtkWidget*ebox, *box, *separator;
+  GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
 
   /* init statusbar */
-  gtk_box_set_spacing (GTK_BOX (statusbar), 6);
-  gtk_container_set_border_width (GTK_CONTAINER (statusbar), 2);
+  gtk_statusbar_set_has_resize_grip (bar, TRUE);
 
-  /* tooltip label */
-  statusbar->tooltip = gtk_label_new (NULL);
-  gtk_misc_set_alignment (GTK_MISC (statusbar->tooltip), 0.0, 0.5);
-  gtk_box_pack_start (GTK_BOX (statusbar), statusbar->tooltip, TRUE, TRUE, 0);
-  gtk_label_set_ellipsize (GTK_LABEL (statusbar->tooltip), 
PANGO_ELLIPSIZE_END);
-  gtk_label_set_single_line_mode (GTK_LABEL (statusbar->tooltip), TRUE);
-  gtk_widget_show (statusbar->tooltip);
+  /* create a new horizontal box */
+  box = gtk_hbox_new (FALSE, 8);
+  gtk_widget_show (box);
+
+  /* reorder the gtk statusbar */
+  g_object_ref (G_OBJECT (bar->label));
+  gtk_container_remove (GTK_CONTAINER (bar->frame), bar->label);
+  gtk_container_add (GTK_CONTAINER (bar->frame), box);
+  gtk_box_pack_start (GTK_BOX (box), bar->label, TRUE, TRUE, 0);
+  g_object_unref (G_OBJECT (bar->label));
 
   /* separator */
   separator = gtk_vseparator_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), separator, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
   /* line and column numbers */
   statusbar->position = gtk_label_new (NULL);
-  gtk_box_pack_start (GTK_BOX (statusbar), statusbar->position, FALSE, TRUE, 
0);
+  gtk_box_pack_start (GTK_BOX (box), statusbar->position, FALSE, TRUE, 0);
   gtk_widget_show (statusbar->position);
 
   /* separator */
   separator = gtk_vseparator_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), separator, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
   /* overwrite event box */
   ebox = gtk_event_box_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), ebox, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
   mousepad_widget_set_tooltip_text (ebox, _("Toggle the overwrite mode"));
   g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK 
(mousepad_statusbar_overwrite_clicked), statusbar);
@@ -193,13 +195,3 @@ mousepad_statusbar_set_overwrite (MousepadStatusbar 
*statusbar,
 
   statusbar->overwrite_enabled = overwrite;
 }
-
-
-
-void
-mousepad_statusbar_set_tooltip (MousepadStatusbar *statusbar,
-const gchar   *tooltip)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
-  gtk_label_set_text (GTK_LABEL (statusbar->tooltip), tooltip);
-}
diff --git a/mousepad/mousepad-statusbar.h b/mousepad/mousepad-statusbar.h
index 0a4fcf1..c44b54e 100644
--- a/mousepad/mousepad-statusbar.h
+++ b/mousepad/mousepad-statusbar.h
@@ -41,8 +41,6 @@ voidmousepad_statusbar_set_cursor_position  
(MousepadStatusbar *statusba
 voidmousepad_statusbar_set_overwrite(MousepadStatusbar 
*statusbar,
  gboolean   
overwrite);
 

[Xfce4-commits] Creating annotated tag legacy

2012-05-04 Thread Matthew Brush
Updating annotated tag refs/tags/legacy
 as new annotated tag
 to 379c908984d7dfb258315392039d1bee738eb9e2 (tag)
   succeeds mousepad-0.2.16-84-gc4250fd
  tagged by Matthew Brush 
 on 2012-05-05 05:48 +0200

Roger Pueyo Centelles (1):
  l10n: Updated Catalan (Valencian) (ca) translation to 100%

___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Fix a couple minor issues from last couple commits.

2011-10-09 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 4783ee11ebd8b90e70923d83a7468351d6fedb80 (commit)
   from 34cb31bbed2aef45bf0f85d34a87aea9d4eb0846 (commit)

commit 4783ee11ebd8b90e70923d83a7468351d6fedb80
Author: Matthew Brush 
Date:   Fri Oct 7 05:58:04 2011 -0700

Fix a couple minor issues from last couple commits.

 README|2 +-
 mousepad/mousepad-statusbar.c |8 
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/README b/README
index 92fa148..0c53e33 100644
--- a/README
+++ b/README
@@ -21,7 +21,7 @@ Required packages
 
 Mousepad depends on the following packages:
 
- - Gtk+ 2.10.0 or above
+ - Gtk+ 2.20.0 or above
  - Libxfce4util 4.4.0 or above
  - GtkSourceView 2.2.2 or above
 
diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 0967ebc..e69a494 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -236,10 +236,10 @@ mousepad_statusbar_filetype_clicked (GtkWidget 
*widget,
   gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, 
event->time);
 }
   else
-  {
-/* since the menu wasn't shown, just destroy it straight-away */
-gtk_widget_destroy (GTK_WIDGET (menu));
-  }
+{
+  /* since the menu wasn't shown, just destroy it straight-away */
+  gtk_widget_destroy (GTK_WIDGET (menu));
+}
 
   return TRUE;
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Update a few documentation files.

2011-10-07 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to adf4ea822a98376362f812ae1ff6488148218380 (commit)
   from ab93fe61fe7317e61ee6ec804e3d266bc1e50980 (commit)

commit adf4ea822a98376362f812ae1ff6488148218380
Author: Matthew Brush 
Date:   Fri Oct 7 03:24:38 2011 -0700

Update a few documentation files.

 AUTHORS |1 +
 NEWS|   18 +++---
 README  |1 +
 3 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/AUTHORS b/AUTHORS
index e39278b..fefc28d 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,3 +1,4 @@
 Erik Harrison 
 Nick Schermer 
 Benedikt Meurer 
+Matthew Brush 
diff --git a/NEWS b/NEWS
index dcfac04..b1dc310 100644
--- a/NEWS
+++ b/NEWS
@@ -6,7 +6,11 @@ Highlights:
 - Run multiple windows in one instance. We also invoke a running
   instance with DBus (optional), this is needed for tab DND between
   windows.
-- Support for multiple tabs in one window.
+- Drag and Drop support for text inside a document, between tabs and
+  between windows.  Also supports opening a file by dragging it into
+  the window.
+- Support for multiple tabs in one window which are both reorderable
+  and detachable.
 - Load multiple files at once from both the open dialog and the command
   line.
 - Type-ahead find and highlight feature like Firefox.
@@ -14,9 +18,11 @@ Highlights:
 - Reimplemented recent file support. You can cleanup the Mousepad history
   and a file is removed from the history when Mousepad was unable to open
   it.
+- Syntax highlighting of many filetypes (including printing).
 - Various hidden settings.
-- Statusbar with cursor location and whether overwrite is actived.
-- Mousepad depends on GTK+ 2.10.
+- Statusbar with filetype, cursor location and whether overwrite is
+  actived.
+- Mousepad depends on GTK+ 2.20.
 
 Bug fixes:
 - Save button is now default response in the dialog (Bug #2941).
@@ -28,3 +34,9 @@ Bug fixes:
 - The MousepadPreferences object uses XfceRc for saving the
   settings (Bug #2786).
 - No segfault when there is no rc file (Bug #2784).
+- Support syntax highlighting using GtkSourceView (Bug #3228 & #5803).
+- Proper Drag and Drop support (Bug #2055).
+- Fix recent files support (Bug #5635, #3850 & #7890).
+- Use GTK+ printing (Bug #4477).
+- Settings saved in Find (and Replace) dialogs (Bug #7246).
+- No deprecated dependencies (Bug #7259).
diff --git a/README b/README
index 839b458..92fa148 100644
--- a/README
+++ b/README
@@ -23,6 +23,7 @@ Mousepad depends on the following packages:
 
  - Gtk+ 2.10.0 or above
  - Libxfce4util 4.4.0 or above
+ - GtkSourceView 2.2.2 or above
 
 The following packages are optional:
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add filetype selection popup menu to statusbar.

2011-10-07 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 34cb31bbed2aef45bf0f85d34a87aea9d4eb0846 (commit)
   from adf4ea822a98376362f812ae1ff6488148218380 (commit)

commit 34cb31bbed2aef45bf0f85d34a87aea9d4eb0846
Author: Matthew Brush 
Date:   Fri Oct 7 05:45:14 2011 -0700

Add filetype selection popup menu to statusbar.

 mousepad/mousepad-statusbar.c |   75 +--
 mousepad/mousepad-window.c|   99 +
 2 files changed, 170 insertions(+), 4 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index bdeac76..0967ebc 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -25,15 +25,20 @@
 
 
 
-static gboolean  mousepad_statusbar_overwrite_clicked 
(GtkWidget  *widget,
-   
GdkEventButton *event,
-   
MousepadStatusbar  *statusbar);
+static gboolean mousepad_statusbar_overwrite_clicked (GtkWidget 
*widget,
+  GdkEventButton*event,
+  MousepadStatusbar 
*statusbar);
+
+static gboolean mousepad_statusbar_filetype_clicked  (GtkWidget 
*widget,
+  GdkEventButton*event,
+  MousepadStatusbar 
*statusbar);
 
 
 
 enum
 {
   ENABLE_OVERWRITE,
+  POPULATE_FILETYPE_POPUP,
   LAST_SIGNAL,
 };
 
@@ -87,6 +92,14 @@ mousepad_statusbar_class_init (MousepadStatusbarClass *klass)
   0, NULL, NULL,
   g_cclosure_marshal_VOID__BOOLEAN,
   G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+
+  statusbar_signals[POPULATE_FILETYPE_POPUP] =
+g_signal_new (I_("populate-filetype-popup"),
+  G_TYPE_FROM_CLASS (gobject_class),
+  G_SIGNAL_RUN_LAST,
+  0, NULL, NULL,
+  g_cclosure_marshal_VOID__OBJECT,
+  G_TYPE_NONE, 1, GTK_TYPE_MENU);
 }
 
 
@@ -121,9 +134,17 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
+  /* language/filetype event box */
+  ebox = gtk_event_box_new ();
+  gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
+  gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
+  mousepad_widget_set_tooltip_text (ebox, _("Choose a filetype"));
+  g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK 
(mousepad_statusbar_filetype_clicked), statusbar);
+  gtk_widget_show (ebox);
+
   /* language/filetype */
   statusbar->language = gtk_label_new (_("Filetype: None"));
-  gtk_box_pack_start (GTK_BOX (box), statusbar->language, FALSE, TRUE, 0);
+  gtk_container_add (GTK_CONTAINER (ebox), statusbar->language);
   gtk_widget_show (statusbar->language);
 
   /* separator */
@@ -179,6 +200,52 @@ mousepad_statusbar_overwrite_clicked (GtkWidget 
*widget,
 
 
 
+static gboolean
+mousepad_statusbar_filetype_clicked (GtkWidget *widget,
+ GdkEventButton*event,
+ MousepadStatusbar *statusbar)
+{
+  GtkMenu *menu;
+  GList   *children;
+  gint n_children = 0;
+
+  mousepad_return_val_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar), FALSE);
+
+  /* only respond on the left button click */
+  if (event->type != GDK_BUTTON_PRESS || event->button != 1)
+return FALSE;
+
+  /* create the popup menu */
+  menu = GTK_MENU (gtk_menu_new ());
+
+  /* send the signal to fill the menu */
+  g_signal_emit (G_OBJECT (statusbar), 
statusbar_signals[POPULATE_FILETYPE_POPUP], 0, menu);
+
+  /* get the number of items in the menu */
+  children = gtk_container_get_children (GTK_CONTAINER (menu));
+  n_children = g_list_length (children);
+  g_list_free (children);
+
+  /* make sure there's at least one item in the menu */
+  if (n_children)
+{
+  /* cleanup the menu once a selection is made or the menu is cancelled */
+  g_signal_connect (menu, "selection-done", G_CALLBACK 
(gtk_widget_destroy), NULL);
+
+  /* show the menu */
+  gtk_menu_popup (menu, NULL, NULL, NULL, NULL, event->button, 
event->time);
+}
+  else
+  {
+/* since the menu wasn't shown, just destroy it straight-away */
+gtk_widget_destroy (GTK_WIDGET (menu));
+  }
+
+  return TRUE;
+}
+
+
+
 void
 mousepad_statusbar_set_language (MousepadStatusbar *statusbar,
  GtkSourceLanguage *language)
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index db3a69e..3067788 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mou

[Xfce4-commits] Make Filetype separate in the Document menu.

2011-10-07 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to ab93fe61fe7317e61ee6ec804e3d266bc1e50980 (commit)
   from 4777a405afb12e26853328a9131c2c3f131014ec (commit)

commit ab93fe61fe7317e61ee6ec804e3d266bc1e50980
Author: Matthew Brush 
Date:   Fri Oct 7 02:15:21 2011 -0700

Make Filetype separate in the Document menu.

 mousepad/mousepad-window-ui.xml |7 ++-
 mousepad/mousepad-window.c  |   78 +++---
 2 files changed, 43 insertions(+), 42 deletions(-)

diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index bf49fd5..f960bc6 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -102,9 +102,6 @@
 
 
   
-  
-
-  
   
 
 
@@ -118,6 +115,10 @@
   
   
   
+  
+  
+
+  
 
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 1ababb9..db3a69e 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -317,8 +317,6 @@ static void  
mousepad_window_action_decrease_indent   (GtkAction

MousepadWindow *window);
 static void  mousepad_window_action_auto_indent   
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_language  
(GtkToggleAction*action,
-   
MousepadWindow *window);
 static void  mousepad_window_action_line_ending   
(GtkRadioAction *action,

GtkRadioAction *current,

MousepadWindow *window);
@@ -328,6 +326,8 @@ static void  mousepad_window_action_word_wrap   
  (GtkToggle

MousepadWindow *window);
 static void  mousepad_window_action_write_bom 
(GtkToggleAction*action,

MousepadWindow *window);
+static void  mousepad_window_action_language  
(GtkToggleAction*action,
+   
MousepadWindow *window);
 static void  mousepad_window_action_insert_spaces 
(GtkToggleAction*action,

MousepadWindow *window);
 static void  mousepad_window_action_prev_tab  
(GtkAction  *action,
@@ -450,9 +450,9 @@ static const GtkActionEntry action_entries[] =
 { "decrease-indent", GTK_STOCK_UNINDENT, N_("_Decrease Indent"), NULL, 
N_("Decrease the indentation of the selection or current line"), G_CALLBACK 
(mousepad_window_action_decrease_indent), },
 
   { "document-menu", NULL, N_("_Document"), NULL, NULL, NULL, },
-{ "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
 { "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
 { "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
+{ "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
 
   { "navigation-menu", NULL, N_("_Navigation"), NULL, },
 { "back", GTK_STOCK_GO_BACK, N_("_Previous Tab"), "Page_Up", 
N_("Select the previous tab"), G_CALLBACK (mousepad_window_action_prev_tab), },
@@ -4722,42 +4722,6 @@ mousepad_window_action_auto_indent (GtkToggleAction 
*action,
 
 
 static void
-mousepad_window_action_language (GtkToggleAction *action,
- MousepadWindow  *window)
-{
-  guint lang_hash;
-  const gchar *const   *lang_id;
-  GtkSourceLanguage*language;
-  GtkSourceLanguageManager *manager;
-  GtkSourceBuffer  *buffer;
-
-  lang_hash = (guint) gtk_radio_action_get_current_value (GTK_RADIO_ACTION 
(action));
-  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW 
(window->active->textview)));
-
-  if (lang_hash == g_str_hash ("none"))
-{
-  gtk_source_buffer_set_language (buffer, NULL);
-  return;
-}
-
-  manager = gtk_source_language_manager_get_default ();
-  lang_id = gtk_source_language_manager_get_language_ids (manager);
-
-  while (*lang_id)
-{
-  if (g_str_hash (*lang_id) == lang_hash)
-{
-  language = gtk_source_language_manager_get_language (manager, 
*l

[Xfce4-commits] Reorder action entry arrays (forgotten in last commit).

2011-10-07 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 4777a405afb12e26853328a9131c2c3f131014ec (commit)
   from 143b6ba6c2a8e024057bfca7e96deeb6bc3e765f (commit)

commit 4777a405afb12e26853328a9131c2c3f131014ec
Author: Matthew Brush 
Date:   Fri Oct 7 01:05:09 2011 -0700

Reorder action entry arrays (forgotten in last commit).

 mousepad/mousepad-window.c |   10 +-
 1 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 7524a39..1ababb9 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -450,9 +450,9 @@ static const GtkActionEntry action_entries[] =
 { "decrease-indent", GTK_STOCK_UNINDENT, N_("_Decrease Indent"), NULL, 
N_("Decrease the indentation of the selection or current line"), G_CALLBACK 
(mousepad_window_action_decrease_indent), },
 
   { "document-menu", NULL, N_("_Document"), NULL, NULL, NULL, },
-{ "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
-{ "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
 { "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
+{ "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
+{ "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
 
   { "navigation-menu", NULL, N_("_Navigation"), NULL, },
 { "back", GTK_STOCK_GO_BACK, N_("_Previous Tab"), "Page_Up", 
N_("Select the previous tab"), G_CALLBACK (mousepad_window_action_prev_tab), },
@@ -466,12 +466,12 @@ static const GtkActionEntry action_entries[] =
 
 static const GtkToggleActionEntry toggle_action_entries[] =
 {
-  { "statusbar", NULL, N_("St_atusbar"), NULL, N_("Change the visibility of 
the statusbar"), G_CALLBACK (mousepad_window_action_statusbar), FALSE, },
   { "line-numbers", NULL, N_("Line N_umbers"), NULL, N_("Show line numbers"), 
G_CALLBACK (mousepad_window_action_line_numbers), FALSE, },
+  { "statusbar", NULL, N_("St_atusbar"), NULL, N_("Change the visibility of 
the statusbar"), G_CALLBACK (mousepad_window_action_statusbar), FALSE, },
   { "auto-indent", NULL, N_("_Auto Indent"), NULL, N_("Auto indent a new 
line"), G_CALLBACK (mousepad_window_action_auto_indent), FALSE, },
+  { "insert-spaces", NULL, N_("Insert _Spaces"), NULL, N_("Insert spaces when 
the tab button is pressed"), G_CALLBACK (mousepad_window_action_insert_spaces), 
FALSE, },
   { "word-wrap", NULL, N_("_Word Wrap"), NULL, N_("Toggle breaking lines in 
between words"), G_CALLBACK (mousepad_window_action_word_wrap), FALSE, },
-  { "write-bom", NULL, N_("Write Unicode _BOM"), NULL, N_("Store the 
byte-order mark in the file"), G_CALLBACK (mousepad_window_action_write_bom), 
FALSE, },
-  { "insert-spaces", NULL, N_("Insert _Spaces"), NULL, N_("Insert spaces when 
the tab button is pressed"), G_CALLBACK (mousepad_window_action_insert_spaces), 
FALSE, }
+  { "write-bom", NULL, N_("Write Unicode _BOM"), NULL, N_("Store the 
byte-order mark in the file"), G_CALLBACK (mousepad_window_action_write_bom), 
FALSE, }
 };
 
 static const GtkRadioActionEntry radio_action_entries[] =
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Cleanup View and Document menus.

2011-10-07 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 143b6ba6c2a8e024057bfca7e96deeb6bc3e765f (commit)
   from 5c88d180a1e20cb51737990948bb041529a97357 (commit)

commit 143b6ba6c2a8e024057bfca7e96deeb6bc3e765f
Author: Matthew Brush 
Date:   Fri Oct 7 00:52:59 2011 -0700

Cleanup View and Document menus.

* Move "Line Numbers" from Document to View menu and apply it to all
  of the currently open textviews.
* Re-order View and Document menu items, mostly sorted alphabetically.
* Remove extra separators between related items.
* Re-arrange action handler functions to be in the same order as their
  items appear in the XML file.

 mousepad/mousepad-window-ui.xml |   27 ++--
 mousepad/mousepad-window.c  |  335 ---
 2 files changed, 185 insertions(+), 177 deletions(-)

diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index f782f96..bf49fd5 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -67,11 +67,12 @@
 
   
   
-  
-  
   
 
   
+  
+  
+  
 
 
 
@@ -100,27 +101,23 @@
 
 
 
-  
-  
-  
   
-  
-  
-  
-  
-
-
-
+  
+
   
   
 
 
 
   
-  
-  
-
+  
+
+
+
   
+  
+  
+  
 
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 118e7e9..7524a39 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -281,12 +281,14 @@ static void  mousepad_window_action_replace   
(GtkAction

MousepadWindow *window);
 static void  mousepad_window_action_select_font   
(GtkAction  *action,

MousepadWindow *window);
+static void  mousepad_window_action_color_scheme  
(GtkToggleAction*action,
+   
MousepadWindow *window);
+static void  mousepad_window_action_line_numbers  
(GtkToggleAction*action,
+   
MousepadWindow *window);
 static void  mousepad_window_action_statusbar_overwrite   
(MousepadWindow *window,

gbooleanoverwrite);
 static void  mousepad_window_action_statusbar 
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_color_scheme  
(GtkToggleAction*action,
-   
MousepadWindow *window);
 static void  mousepad_window_action_lowercase 
(GtkAction  *action,

MousepadWindow *window);
 static void  mousepad_window_action_uppercase 
(GtkAction  *action,
@@ -313,22 +315,20 @@ static void  
mousepad_window_action_increase_indent   (GtkAction

MousepadWindow *window);
 static void  mousepad_window_action_decrease_indent   
(GtkAction  *action,

MousepadWindow *window);
-static void  mousepad_window_action_line_numbers  
(GtkToggleAction*action,
-   
MousepadWindow *window);
-static void  mousepad_window_action_word_wrap 
(GtkToggleAction*action,
+static void  mousepad_window_action_auto_indent   
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_write_bom 
(GtkToggleAction*action,
+static void  mousepad_window_action_language  
(GtkToggleAction*action,

MousepadWindow *window);
-static void  mousepad_window_action_auto_indent   
(GtkToggleAction*action,
+static void  mousepad_window_action_line_ending   
(GtkRadioAction *action,
+   
GtkR

[Xfce4-commits] Add extra settings to custom print dialog tab.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 5c88d180a1e20cb51737990948bb041529a97357 (commit)
   from ba85e8dae9ae1c478242b3c678389191dd8e1e87 (commit)

commit 5c88d180a1e20cb51737990948bb041529a97357
Author: Matthew Brush 
Date:   Thu Oct 6 22:37:00 2011 -0700

Add extra settings to custom print dialog tab.

* Add line number increment setting.
* Add separate font settings for header, body and line numbers.

 mousepad/mousepad-print.c |  211 +
 1 files changed, 156 insertions(+), 55 deletions(-)

diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index c7bc53d..e647ae1 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -74,6 +74,15 @@ struct _MousepadPrint
   GtkWidget*widget_line_numbers;
   GtkWidget*widget_text_wrapping;
   GtkWidget*widget_syntax_highlighting;
+  GtkWidget*widget_header_font;
+  GtkWidget*widget_line_numbers_font;
+  GtkWidget*widget_body_font;
+  GtkWidget*widget_line_numbers_spin;
+  GtkWidget*widget_line_numbers_hbox;
+
+  /* settings */
+  gboolean  print_line_numbers;
+  gint  line_number_increment;
 
   /* source view print compositor */
   GtkSourcePrintCompositor *compositor;
@@ -108,6 +117,8 @@ static void
 mousepad_print_init (MousepadPrint *print)
 {
   /* init */
+  print->print_line_numbers = FALSE;
+  print->line_number_increment = 1;
   print->compositor = NULL;
 
   /* set a custom tab label */
@@ -140,7 +151,9 @@ mousepad_print_settings_load (GtkPrintOperation *operation)
   gint   i;
   gchar *key;
   gchar *value;
-  gchar *font_name = NULL;
+  gchar *body_font = NULL;
+  gchar *header_font = NULL;
+  gchar *line_numbers_font = NULL;
   GtkPageSetup  *page_setup;
   GtkPaperSize  *paper_size;
   PangoContext  *context;
@@ -229,46 +242,54 @@ mousepad_print_settings_load (GtkPrintOperation 
*operation)
   g_object_set (print->compositor,
 "print-header",
 gtk_print_settings_get_bool (settings, "print-header"),
-#if 0
-"print-footer",
-gtk_print_settings_get_bool (settings, "print-footer"),
-#endif
 "print-line-numbers",
-gtk_print_settings_get_bool (settings, 
"print-line-numbers"),
+gtk_print_settings_get_int (settings, 
"line-numbers-increment"),
 "wrap-mode",
 gtk_print_settings_get_bool (settings, "text-wrapping") ? 
GTK_WRAP_WORD : GTK_WRAP_NONE,
 "highlight-syntax",
 gtk_print_settings_get_bool (settings, "highlight-syntax"),
 NULL);
 
-  /* font-name setting sets the header, footer, line numbers and body 
fonts */
-  font_name = g_strdup (gtk_print_settings_get (settings, "font-name"));
+  print->print_line_numbers = gtk_print_settings_get_bool (settings, 
"print-line-numbers");
+  print->line_number_increment = gtk_print_settings_get_int (settings, 
"line-numbers-increment");
+
+  /* get the saved fonts, if set */
+  body_font = g_strdup (gtk_print_settings_get (settings, 
"body-font-name"));
+  header_font = g_strdup (gtk_print_settings_get (settings, 
"header-font-name"));
+  line_numbers_font = g_strdup (gtk_print_settings_get (settings, 
"line-numbers-font-name"));
 
   /* release reference */
   g_object_unref (G_OBJECT (settings));
 }
 
 /* if no font name is set, get the one used in the widget */
-if (G_UNLIKELY (font_name == NULL))
+if (G_UNLIKELY (body_font == NULL))
   {
 /* get the font description from the context and convert it into a 
string */
 context = gtk_widget_get_pango_context (GTK_WIDGET 
(print->document->textview));
 font_desc = pango_context_get_font_description (context);
-font_name = pango_font_description_to_string (font_desc);
+body_font = pango_font_description_to_string (font_desc);
   }
 
-/* set the same font for all the various parts of the pages the same */
-g_object_set (print->compositor,
-  "body-font-name", font_name,
-  "line-numbers-font-name", font_name,
-  "header-font-name", font_name,
-#if 0
-  "footer-font-name", font_name,
-#endif
-  NULL);
+/* set the restored body font or the one from the textview */
+gtk_source_print_compo

[Xfce4-commits] Switch to GtkSourcePrintCompositor for printing.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to c45ed8da1ae2ed17fb291084cebae1275d33f7c8 (commit)
   from 029bef60746206eaf08dc11c89afd59db186db8d (commit)

commit c45ed8da1ae2ed17fb291084cebae1275d33f7c8
Author: Matthew Brush 
Date:   Thu Oct 6 19:23:13 2011 -0700

Switch to GtkSourcePrintCompositor for printing.

* Add printing option for syntax highlighting.
* Some of the page footer code implemented in #if 0 blocks.
* Remove mousepad_print_end_print() function.

 mousepad/mousepad-print.c   |  444 +--
 mousepad/mousepad-private.h |1 +
 2 files changed, 137 insertions(+), 308 deletions(-)

diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index c2ae215..35f31f8 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -42,8 +42,6 @@ static void   mousepad_print_begin_print   
(GtkPrintOperation
 static void   mousepad_print_draw_page (GtkPrintOperation  
 *operation,
 GtkPrintContext
 *context,
 gint   
  page_nr);
-static void   mousepad_print_end_print (GtkPrintOperation  
 *operation,
-GtkPrintContext
 *context);
 static void   mousepad_print_page_setup_dialog (GtkWidget  
 *button,
 GtkPrintOperation  
 *operation);
 static void   mousepad_print_button_toggled(GtkWidget  
 *button,
@@ -68,31 +66,17 @@ struct _MousepadPrint
   GtkPrintOperation __parent__;
 
   /* the document we're going to print */
-  MousepadDocument *document;
-
-  /* pango layout containing all text */
-  PangoLayout  *layout;
-
-  /* array with the lines drawn on each page */
-  GArray   *lines;
-
-  /* drawing offsets */
-  gint  x_offset;
-  gint  y_offset;
-
-  /* page line number counter */
-  gint  line_number;
+  MousepadDocument*document;
 
   /* print dialog widgets */
-  GtkWidget*widget_page_headers;
-  GtkWidget*widget_line_numbers;
-  GtkWidget*widget_text_wrapping;
-
-  /* settings */
-  guint print_page_headers : 1;
-  guint print_line_numbers : 1;
-  guint text_wrapping : 1;
-  gchar*font_name;
+  GtkWidget*widget_page_headers;
+  GtkWidget*widget_page_footers;
+  GtkWidget*widget_line_numbers;
+  GtkWidget*widget_text_wrapping;
+  GtkWidget*widget_syntax_highlighting;
+
+  /* source view print compositor */
+  GtkSourcePrintCompositor *compositor;
 };
 
 
@@ -113,7 +97,6 @@ mousepad_print_class_init (MousepadPrintClass *klass)
   gtkprintoperation_class = GTK_PRINT_OPERATION_CLASS (klass);
   gtkprintoperation_class->begin_print = mousepad_print_begin_print;
   gtkprintoperation_class->draw_page = mousepad_print_draw_page;
-  gtkprintoperation_class->end_print = mousepad_print_end_print;
   gtkprintoperation_class->create_custom_widget = 
mousepad_print_create_custom_widget;
   gtkprintoperation_class->status_changed = mousepad_print_status_changed;
   gtkprintoperation_class->done = mousepad_print_done;
@@ -125,13 +108,7 @@ static void
 mousepad_print_init (MousepadPrint *print)
 {
   /* init */
-  print->print_page_headers = FALSE;
-  print->print_line_numbers = FALSE;
-  print->text_wrapping = FALSE;
-  print->x_offset = 0;
-  print->y_offset = 0;
-  print->line_number = 0;
-  print->font_name = NULL;
+  print->compositor = NULL;
 
   /* set a custom tab label */
   gtk_print_operation_set_custom_tab_label (GTK_PRINT_OPERATION (print), 
_("Document Settings"));
@@ -145,7 +122,7 @@ mousepad_print_finalize (GObject *object)
   MousepadPrint *print = MOUSEPAD_PRINT (object);
 
   /* cleanup */
-  g_free (print->font_name);
+  g_object_unref (print->compositor);
 
   (*G_OBJECT_CLASS (mousepad_print_parent_class)->finalize) (object);
 }
@@ -163,6 +140,7 @@ mousepad_print_settings_load (GtkPrintOperation *operation)
   gint   i;
   gchar *key;
   gchar *value;
+  gchar *font_name = NULL;
   GtkPageSetup  *page_setup;
   GtkPaperSize  *paper_size;
   PangoContext  *context;
@@ -248,23 +226,49 @@ mousepad_print_settings_load (GtkPrintOperation 
*operation)
 }
 
   /* restore print settings */
-  print->print_page_headers = gtk_print_settings_get_bool (settings, 
"print-page-headers");
-  print->print_line_numbers = gtk_print_settings_get_bool (settings, 
"print-line-numbers");
-  print->text_wrapping

[Xfce4-commits] Use GtkSourcePrintCompositor property names in config file.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to ba85e8dae9ae1c478242b3c678389191dd8e1e87 (commit)
   from c45ed8da1ae2ed17fb291084cebae1275d33f7c8 (commit)

commit ba85e8dae9ae1c478242b3c678389191dd8e1e87
Author: Matthew Brush 
Date:   Thu Oct 6 19:35:30 2011 -0700

Use GtkSourcePrintCompositor property names in config file.

 mousepad/mousepad-print.c |   12 ++--
 1 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/mousepad/mousepad-print.c b/mousepad/mousepad-print.c
index 35f31f8..c7bc53d 100644
--- a/mousepad/mousepad-print.c
+++ b/mousepad/mousepad-print.c
@@ -228,17 +228,17 @@ mousepad_print_settings_load (GtkPrintOperation 
*operation)
   /* restore print settings */
   g_object_set (print->compositor,
 "print-header",
-gtk_print_settings_get_bool (settings, 
"print-page-headers"),
+gtk_print_settings_get_bool (settings, "print-header"),
 #if 0
 "print-footer",
-gtk_print_settings_get_bool (settings, 
"print-page-footers"),
+gtk_print_settings_get_bool (settings, "print-footer"),
 #endif
 "print-line-numbers",
 gtk_print_settings_get_bool (settings, 
"print-line-numbers"),
 "wrap-mode",
 gtk_print_settings_get_bool (settings, "text-wrapping") ? 
GTK_WRAP_WORD : GTK_WRAP_NONE,
 "highlight-syntax",
-gtk_print_settings_get_bool (settings, 
"syntax-highlighting"),
+gtk_print_settings_get_bool (settings, "highlight-syntax"),
 NULL);
 
   /* font-name setting sets the header, footer, line numbers and body 
fonts */
@@ -344,11 +344,11 @@ mousepad_print_settings_save (GtkPrintOperation 
*operation)
 
   /* set print settings */
   gtk_print_settings_set_bool (settings,
-   "print-page-headers",
+   "print-header",

gtk_source_print_compositor_get_print_header (print->compositor));
 #if 0
   gtk_print_settings_set_bool (settings,
-   "print-page-footers",
+   "print-footer",

gtk_source_print_compositor_get_print_footer (print->compositor));
 #endif
   gtk_print_settings_set_bool (settings,
@@ -360,7 +360,7 @@ mousepad_print_settings_save (GtkPrintOperation *operation)

gtk_source_print_compositor_get_wrap_mode (print->compositor) == GTK_WRAP_NONE 
? FALSE : TRUE);
 
   gtk_print_settings_set_bool (settings,
-   "syntax-highlighting",
+   "highlight-syntax",

gtk_source_print_compositor_get_highlight_syntax (print->compositor));
 
   gtk_print_settings_set (settings,
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Prevent warnings when messing around with statusbar internal widgets.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/nick_0_3
 to b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)
   from 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415 (commit)

commit b401a34b8c6b88ebd26e26f03a70a13548cbc4c0
Author: Matthew Brush 
Date:   Mon Oct 3 05:20:18 2011 -0700

Prevent warnings when messing around with statusbar internal widgets.

Remove statusbar frame border.

 mousepad/mousepad-statusbar.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 0321c3e..9ed0d94 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -93,8 +93,9 @@ mousepad_statusbar_class_init (MousepadStatusbarClass *klass)
 static void
 mousepad_statusbar_init (MousepadStatusbar *statusbar)
 {
-  GtkWidget*ebox, *box, *separator;
+  GtkWidget*ebox, *box, *separator, *label;
   GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
+  GList *frame;
 
   /* init statusbar */
   gtk_statusbar_set_has_resize_grip (bar, TRUE);
@@ -104,11 +105,15 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   gtk_widget_show (box);
 
   /* reorder the gtk statusbar */
-  g_object_ref (G_OBJECT (bar->label));
-  gtk_container_remove (GTK_CONTAINER (bar->frame), bar->label);
-  gtk_container_add (GTK_CONTAINER (bar->frame), box);
-  gtk_box_pack_start (GTK_BOX (box), bar->label, TRUE, TRUE, 0);
-  g_object_unref (G_OBJECT (bar->label));
+  frame = gtk_container_get_children (GTK_CONTAINER (bar));
+  gtk_frame_set_shadow_type (GTK_FRAME (frame->data), GTK_SHADOW_NONE);
+  label = gtk_bin_get_child (GTK_BIN (frame->data));
+  g_object_ref (label);
+  gtk_container_remove (GTK_CONTAINER (frame->data), label);
+  gtk_container_add (GTK_CONTAINER (frame->data), box);
+  gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
+  g_object_unref (label);
+  g_list_free (frame);
 
   /* separator */
   separator = gtk_vseparator_new ();
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Prevent segfault when opening more that 100 files.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/nick_0_3
 to 52e5c6a0051cd456802d6b50b85b9190a33d62cf (commit)
   from b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)

commit 52e5c6a0051cd456802d6b50b85b9190a33d62cf
Author: Matthew Brush 
Date:   Thu Oct 6 03:56:42 2011 -0700

Prevent segfault when opening more that 100 files.

Reported by Mark_T on #xfce-dev IRC.

 mousepad/mousepad-window.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index b84ab6c..b14dabe 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2144,9 +2144,9 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   const gchar  *title;
   const gchar  *tooltip;
   gchar accelerator[7];
-  GtkAction*action;
   GtkRadioAction   *radio_action;
   GSList   *group = NULL;
+  GList*actions, *iter;
 
   mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
 
@@ -2164,14 +2164,14 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   gtk_ui_manager_remove_ui (window->ui_manager, window->gomenu_merge_id);
 
   /* drop all the old recent items from the menu */
-  for (n = 0; n < 100 /* arbitrary */; n++)
+  actions = gtk_action_group_list_actions (window->action_group);
+  for (iter = actions; iter != NULL; iter = g_list_next (iter))
 {
-  g_snprintf (name, sizeof (name), "mousepad-tab-%d", n);
-  action = gtk_action_group_get_action (window->action_group, name);
-  if (G_UNLIKELY (action == NULL))
-break;
-  gtk_action_group_remove_action (window->action_group, action);
+  /* match only actions starting with "mousepad-tab-" */
+  if (g_str_has_prefix (gtk_action_get_name (iter->data), 
"mousepad-tab-"))
+gtk_action_group_remove_action (window->action_group, iter->data);
 }
+  g_list_free (actions);
 }
 
   /* create a new merge id */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Revert "Drop usage of the GtkStatusbar."

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/nick_0_3
 to 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415 (commit)
   from ff0faf3c3250b4e56598aec891109d96f3aece7a (commit)

commit 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415
Author: Matthew Brush 
Date:   Mon Oct 3 03:56:58 2011 -0700

Revert "Drop usage of the GtkStatusbar."

This reverts commit 185821ae262235222f7ef1d3a86dc0ea2b19bbd9.

 mousepad/mousepad-statusbar.c |   54 +---
 mousepad/mousepad-statusbar.h |2 -
 mousepad/mousepad-window.c|   17 +++-
 3 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index dc4503f..0321c3e 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -39,20 +39,19 @@ enum
 
 struct _MousepadStatusbarClass
 {
-  GtkHBoxClass __parent__;
+  GtkStatusbarClass __parent__;
 };
 
 struct _MousepadStatusbar
 {
-  GtkHBox __parent__;
+  GtkStatusbar__parent__;
 
   /* whether overwrite is enabled */
-  guint  overwrite_enabled : 1;
+  guint   overwrite_enabled : 1;
 
   /* extra labels in the statusbar */
-  GtkWidget *tooltip;
-  GtkWidget *position;
-  GtkWidget *overwrite;
+  GtkWidget  *position;
+  GtkWidget  *overwrite;
 };
 
 
@@ -61,7 +60,7 @@ static guint statusbar_signals[LAST_SIGNAL];
 
 
 
-G_DEFINE_TYPE (MousepadStatusbar, mousepad_statusbar, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (MousepadStatusbar, mousepad_statusbar, GTK_TYPE_STATUSBAR);
 
 
 
@@ -94,38 +93,41 @@ mousepad_statusbar_class_init (MousepadStatusbarClass 
*klass)
 static void
 mousepad_statusbar_init (MousepadStatusbar *statusbar)
 {
-  GtkWidget *ebox, *separator;
+  GtkWidget*ebox, *box, *separator;
+  GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
 
   /* init statusbar */
-  gtk_box_set_spacing (GTK_BOX (statusbar), 6);
-  gtk_container_set_border_width (GTK_CONTAINER (statusbar), 2);
+  gtk_statusbar_set_has_resize_grip (bar, TRUE);
 
-  /* tooltip label */
-  statusbar->tooltip = gtk_label_new (NULL);
-  gtk_misc_set_alignment (GTK_MISC (statusbar->tooltip), 0.0, 0.5);
-  gtk_box_pack_start (GTK_BOX (statusbar), statusbar->tooltip, TRUE, TRUE, 0);
-  gtk_label_set_ellipsize (GTK_LABEL (statusbar->tooltip), 
PANGO_ELLIPSIZE_END);
-  gtk_label_set_single_line_mode (GTK_LABEL (statusbar->tooltip), TRUE);
-  gtk_widget_show (statusbar->tooltip);
+  /* create a new horizontal box */
+  box = gtk_hbox_new (FALSE, 8);
+  gtk_widget_show (box);
+
+  /* reorder the gtk statusbar */
+  g_object_ref (G_OBJECT (bar->label));
+  gtk_container_remove (GTK_CONTAINER (bar->frame), bar->label);
+  gtk_container_add (GTK_CONTAINER (bar->frame), box);
+  gtk_box_pack_start (GTK_BOX (box), bar->label, TRUE, TRUE, 0);
+  g_object_unref (G_OBJECT (bar->label));
 
   /* separator */
   separator = gtk_vseparator_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), separator, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
   /* line and column numbers */
   statusbar->position = gtk_label_new (NULL);
-  gtk_box_pack_start (GTK_BOX (statusbar), statusbar->position, FALSE, TRUE, 
0);
+  gtk_box_pack_start (GTK_BOX (box), statusbar->position, FALSE, TRUE, 0);
   gtk_widget_show (statusbar->position);
 
   /* separator */
   separator = gtk_vseparator_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), separator, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
   /* overwrite event box */
   ebox = gtk_event_box_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), ebox, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
   mousepad_widget_set_tooltip_text (ebox, _("Toggle the overwrite mode"));
   g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK 
(mousepad_statusbar_overwrite_clicked), statusbar);
@@ -193,13 +195,3 @@ mousepad_statusbar_set_overwrite (MousepadStatusbar 
*statusbar,
 
   statusbar->overwrite_enabled = overwrite;
 }
-
-
-
-void
-mousepad_statusbar_set_tooltip (MousepadStatusbar *statusbar,
-const gchar   *tooltip)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
-  gtk_label_set_text (GTK_LABEL (statusbar->tooltip), tooltip);
-}
diff --git a/mousepad/mousepad-statusbar.h b/mousepad/mousepad-statusbar.h
index 0a4fcf1..c44b54e 100644
--- a/mousepad/mousepad-statusbar.h
+++ b/mousepad/mousepad-statusbar.h
@@ -41,8 +41,6 @@ voidmousepad_statusbar_set_cursor_position  
(MousepadStatusbar *statusba
 voidmousepad_statusbar_set_overwrite(MousepadStatusbar 
*statusbar,
  gboolean   
overwrite);
 

[Xfce4-commits] Prevent segfault when opening more that 100 files.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 52e5c6a0051cd456802d6b50b85b9190a33d62cf (commit)
   from b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)

commit 52e5c6a0051cd456802d6b50b85b9190a33d62cf
Author: Matthew Brush 
Date:   Thu Oct 6 03:56:42 2011 -0700

Prevent segfault when opening more that 100 files.

Reported by Mark_T on #xfce-dev IRC.

 mousepad/mousepad-window.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index b84ab6c..b14dabe 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2144,9 +2144,9 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   const gchar  *title;
   const gchar  *tooltip;
   gchar accelerator[7];
-  GtkAction*action;
   GtkRadioAction   *radio_action;
   GSList   *group = NULL;
+  GList*actions, *iter;
 
   mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
 
@@ -2164,14 +2164,14 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   gtk_ui_manager_remove_ui (window->ui_manager, window->gomenu_merge_id);
 
   /* drop all the old recent items from the menu */
-  for (n = 0; n < 100 /* arbitrary */; n++)
+  actions = gtk_action_group_list_actions (window->action_group);
+  for (iter = actions; iter != NULL; iter = g_list_next (iter))
 {
-  g_snprintf (name, sizeof (name), "mousepad-tab-%d", n);
-  action = gtk_action_group_get_action (window->action_group, name);
-  if (G_UNLIKELY (action == NULL))
-break;
-  gtk_action_group_remove_action (window->action_group, action);
+  /* match only actions starting with "mousepad-tab-" */
+  if (g_str_has_prefix (gtk_action_get_name (iter->data), 
"mousepad-tab-"))
+gtk_action_group_remove_action (window->action_group, iter->data);
 }
+  g_list_free (actions);
 }
 
   /* create a new merge id */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Merge branch 'nick_0_3' into gtksourceview

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 029bef60746206eaf08dc11c89afd59db186db8d (commit)
   from 05b3c46c8b9877fa62b07fd6a04b1b82fc5576ed (commit)

commit 029bef60746206eaf08dc11c89afd59db186db8d
Merge: 05b3c46 52e5c6a
Author: Matthew Brush 
Date:   Thu Oct 6 04:05:33 2011 -0700

Merge branch 'nick_0_3' into gtksourceview

commit 52e5c6a0051cd456802d6b50b85b9190a33d62cf
Author: Matthew Brush 
Date:   Thu Oct 6 03:56:42 2011 -0700

Prevent segfault when opening more that 100 files.

Reported by Mark_T on #xfce-dev IRC.

 mousepad/mousepad-window.c |   14 +++---
 1 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 5897108..118e7e9 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -2213,9 +2213,9 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   const gchar  *title;
   const gchar  *tooltip;
   gchar accelerator[7];
-  GtkAction*action;
   GtkRadioAction   *radio_action;
   GSList   *group = NULL;
+  GList*actions, *iter;
 
   mousepad_return_val_if_fail (MOUSEPAD_IS_WINDOW (user_data), FALSE);
 
@@ -2233,14 +2233,14 @@ mousepad_window_update_gomenu_idle (gpointer user_data)
   gtk_ui_manager_remove_ui (window->ui_manager, window->gomenu_merge_id);
 
   /* drop all the old recent items from the menu */
-  for (n = 0; n < 100 /* arbitrary */; n++)
+  actions = gtk_action_group_list_actions (window->action_group);
+  for (iter = actions; iter != NULL; iter = g_list_next (iter))
 {
-  g_snprintf (name, sizeof (name), "mousepad-tab-%d", n);
-  action = gtk_action_group_get_action (window->action_group, name);
-  if (G_UNLIKELY (action == NULL))
-break;
-  gtk_action_group_remove_action (window->action_group, action);
+  /* match only actions starting with "mousepad-tab-" */
+  if (g_str_has_prefix (gtk_action_get_name (iter->data), 
"mousepad-tab-"))
+gtk_action_group_remove_action (window->action_group, iter->data);
 }
+  g_list_free (actions);
 }
 
   /* create a new merge id */
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Select filetype radio menu item when detecting filetype.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 05b3c46c8b9877fa62b07fd6a04b1b82fc5576ed (commit)
   from 66a2d472174195507aa00ae8287ff4c1b62c6604 (commit)

commit 05b3c46c8b9877fa62b07fd6a04b1b82fc5576ed
Author: Matthew Brush 
Date:   Thu Oct 6 03:11:18 2011 -0700

Select filetype radio menu item when detecting filetype.

Fix setting filetype to None.

 mousepad/mousepad-window.c |   37 -
 1 files changed, 36 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 313ec76..5897108 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -1687,6 +1687,34 @@ mousepad_window_language_changed (MousepadDocument  
*document,
   GtkSourceLanguage *language,
   MousepadWindow*window)
 {
+  gchar *path;
+  GtkWidget *item;
+
+  if (!GTK_IS_SOURCE_LANGUAGE (language))
+goto set_none;
+
+  path = g_strdup_printf ("/main-menu/document-menu/language-menu/"
+  "placeholder-language-section-items/"
+  "language-section-%s/language-%s",
+  gtk_source_language_get_section (language),
+  gtk_source_language_get_id (language));
+  item = gtk_ui_manager_get_widget (window->ui_manager, path);
+  g_free (path);
+
+  /* activate the appropriate menu item for the new language */
+  if (GTK_IS_CHECK_MENU_ITEM (item))
+{
+  gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
+  goto set_statusbar;
+}
+
+set_none:
+  item = gtk_ui_manager_get_widget (window->ui_manager,
+
"/main-menu/document-menu/language-menu/language-none");
+  if (GTK_IS_CHECK_MENU_ITEM (item))
+gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (item), TRUE);
+
+set_statusbar:
   /* set the filetype in the statusbar */
   if (window->statusbar)
 mousepad_statusbar_set_language (MOUSEPAD_STATUSBAR (window->statusbar), 
language);
@@ -4835,6 +4863,14 @@ mousepad_window_action_language (GtkToggleAction *action,
   GtkSourceBuffer  *buffer;
 
   lang_hash = (guint) gtk_radio_action_get_current_value (GTK_RADIO_ACTION 
(action));
+  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW 
(window->active->textview)));
+
+  if (lang_hash == g_str_hash ("none"))
+{
+  gtk_source_buffer_set_language (buffer, NULL);
+  return;
+}
+
   manager = gtk_source_language_manager_get_default ();
   lang_id = gtk_source_language_manager_get_language_ids (manager);
 
@@ -4843,7 +4879,6 @@ mousepad_window_action_language (GtkToggleAction *action,
   if (g_str_hash (*lang_id) == lang_hash)
 {
   language = gtk_source_language_manager_get_language (manager, 
*lang_id);
-  buffer = GTK_SOURCE_BUFFER (gtk_text_view_get_buffer (GTK_TEXT_VIEW 
(window->active->textview)));
   gtk_source_buffer_set_language (buffer, language);
   break;
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Cleanup colour scheme util functions a bit.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 66a2d472174195507aa00ae8287ff4c1b62c6604 (commit)
   from 5d74b7018dd0f821f6f37a0293868466a9b836b3 (commit)

commit 66a2d472174195507aa00ae8287ff4c1b62c6604
Author: Matthew Brush 
Date:   Thu Oct 6 01:35:14 2011 -0700

Cleanup colour scheme util functions a bit.

 mousepad/mousepad-util.c   |   17 +
 mousepad/mousepad-util.h   |2 ++
 mousepad/mousepad-window.c |2 +-
 3 files changed, 16 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 31bac40..05ed8af 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -1078,9 +1078,9 @@ mousepad_util_color_schemes_name_compare (gconstpointer a,
 {
   const gchar *name_a, *name_b;
 
-  if (G_UNLIKELY (!a))
+  if (G_UNLIKELY (!GTK_IS_SOURCE_STYLE_SCHEME (a)))
 return -(a != b);
-  if (G_UNLIKELY (!b))
+  if (G_UNLIKELY (!GTK_IS_SOURCE_STYLE_SCHEME (b)))
 return a != b;
 
   name_a = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (a));
@@ -1092,7 +1092,7 @@ mousepad_util_color_schemes_name_compare (gconstpointer a,
 
 
 GSList *
-mousepad_util_color_schemes_get_sorted (void)
+mousepad_util_color_schemes_get (void)
 {
   GSList   *list = NULL;
   const gchar * const  *schemes;
@@ -1109,7 +1109,16 @@ mousepad_util_color_schemes_get_sorted (void)
   schemes++;
 }
 
-  return g_slist_sort (list, mousepad_util_color_schemes_name_compare);
+  return list;
+}
+
+
+
+GSList *
+mousepad_util_color_schemes_get_sorted (void)
+{
+  return g_slist_sort (mousepad_util_color_schemes_get (),
+   mousepad_util_color_schemes_name_compare);
 }
 
 
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index 539e11e..dbafd81 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -122,6 +122,8 @@ gint   mousepad_util_search   
(GtkTextBuffer   *
 gint   mousepad_util_color_schemes_name_compare   (gconstpointer   
 a,
gconstpointer   
 b);
 
+GSList*mousepad_util_color_schemes_get(void);
+
 GSList*mousepad_util_color_schemes_get_sorted (void);
 
 gint   mousepad_util_languages_name_compare   (gconstpointer   
 a,
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index e2d51db..313ec76 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -4428,7 +4428,7 @@ mousepad_window_action_color_scheme (GtkToggleAction 
*action,
   if (scheme_id_hash != g_str_hash ("none"))
 {
   /* lookup the scheme from the id hash */
-  schemes = mousepad_util_color_schemes_get_sorted ();
+  schemes = mousepad_util_color_schemes_get ();
   for (iter = schemes; iter != NULL; iter = g_slist_next (iter))
 {
   if (scheme_id_hash == g_str_hash (gtk_source_style_scheme_get_id 
(iter->data)))
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Change mousepad_util_color_schemes_get_sorted to use GSList.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 5d74b7018dd0f821f6f37a0293868466a9b836b3 (commit)
   from 81eb018689978502e6a128436ed4cb8ab5de77cf (commit)

commit 5d74b7018dd0f821f6f37a0293868466a9b836b3
Author: Matthew Brush 
Date:   Wed Oct 5 20:50:06 2011 -0700

Change mousepad_util_color_schemes_get_sorted to use GSList.

Also add some comments and set default value on selected_color_scheme in
mousepad_window_menu_color_schemes.

 mousepad/mousepad-util.c   |8 
 mousepad/mousepad-util.h   |6 +-
 mousepad/mousepad-window.c |   16 
 3 files changed, 17 insertions(+), 13 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index 8e4bfa4..31bac40 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -1091,10 +1091,10 @@ mousepad_util_color_schemes_name_compare (gconstpointer 
a,
 
 
 
-GList *
+GSList *
 mousepad_util_color_schemes_get_sorted (void)
 {
-  GList*list = NULL;
+  GSList   *list = NULL;
   const gchar * const  *schemes;
   GtkSourceStyleScheme *scheme;
 
@@ -1105,11 +1105,11 @@ mousepad_util_color_schemes_get_sorted (void)
 {
   scheme = gtk_source_style_scheme_manager_get_scheme (
 gtk_source_style_scheme_manager_get_default (), *schemes);
-  list = g_list_prepend (list, scheme);
+  list = g_slist_prepend (list, scheme);
   schemes++;
 }
 
-  return g_list_sort (list, mousepad_util_color_schemes_name_compare);
+  return g_slist_sort (list, mousepad_util_color_schemes_name_compare);
 }
 
 
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index bdf22d1..539e11e 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -121,10 +121,14 @@ gint   mousepad_util_search   
(GtkTextBuffer   *
 
 gint   mousepad_util_color_schemes_name_compare   (gconstpointer   
 a,
gconstpointer   
 b);
-GList *mousepad_util_color_schemes_get_sorted (void);
+
+GSList*mousepad_util_color_schemes_get_sorted (void);
+
 gint   mousepad_util_languages_name_compare   (gconstpointer   
 a,
gconstpointer   
 b);
+
 GSList*mousepad_util_language_sections_get_sorted (void);
+
 GSList*mousepad_util_languages_get_sorted_for_section (const gchar 
*section);
 
 G_END_DECLS
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 07fddfe..e2d51db 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -3077,10 +3077,9 @@ static void
 mousepad_window_menu_color_schemes (MousepadWindow *window)
 {
   GtkRadioAction   *action;
-  GSList   *group = NULL;
-  GList*schemes, *iter;
+  GSList   *group = NULL, *schemes, *iter;
   gint  merge_id;
-  gchar*name, *selected_color_scheme;
+  gchar*name, *selected_color_scheme = NULL;
 
   /* lock menu updates */
   lock_menu_updates++;
@@ -3119,11 +3118,12 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
  "color-scheme-separator", NULL, 
GTK_UI_MANAGER_SEPARATOR, FALSE);
 
   /* add the color schemes to the menu */
-  for (iter = schemes; iter != NULL; iter = g_list_next (iter))
+  for (iter = schemes; iter != NULL; iter = g_slist_next (iter))
 {
   /* create action name */
   name = g_strdup_printf ("color-scheme_%s", 
gtk_source_style_scheme_get_id (iter->data));
 
+  /* create action for colour scheme */
   action = gtk_radio_action_new (name,
  gtk_source_style_scheme_get_name 
(iter->data),
  gtk_source_style_scheme_get_description 
(iter->data),
@@ -3151,7 +3151,7 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
 }
 
   /* cleanup the list */
-  g_list_free (schemes);
+  g_slist_free (schemes);
 
   /* unlock */
   lock_menu_updates--;
@@ -4413,7 +4413,7 @@ mousepad_window_action_color_scheme (GtkToggleAction 
*action,
   GtkTextBuffer*buffer;
   GtkSourceStyleScheme *scheme = NULL;
   MousepadDocument *document;
-  GList*schemes, *iter;
+  GSList   *schemes, *iter;
 
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
 
@@ -4429,7 +4429,7 @@ mousepad_window_action_color_scheme (GtkToggleAction 
*action,
 {
   /* lookup the scheme from the id hash */
   schemes = mousepad_util_color_schemes_get_sorted ();
-  for (iter = schemes; iter != NULL; iter = g_list_next (iter))
+  for (iter = schemes; iter != NULL; iter = g_slist_next (iter))
 {
   if (scheme_id_hash == g_str_hash (gtk_source_style_scheme_get_id 
(iter->data)))
 

[Xfce4-commits] Cleanup and refactor some code from the last few commits.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 6ceb27df8efb7b23acc73c147511721cbea45b20 (commit)
   from 92b22bcb38d66f63b5ce69d9df7d3f14e60ac15a (commit)

commit 6ceb27df8efb7b23acc73c147511721cbea45b20
Author: Matthew Brush 
Date:   Wed Oct 5 15:49:10 2011 -0700

Cleanup and refactor some code from the last few commits.

* Move colour scheme and language utility functions to mousepad-util.[ch].
* Rename colour scheme and language utility functions with better names.
* Put colour scheme action func/proto in the correct order of appearance.

 mousepad/mousepad-util.c   |  129 +
 mousepad/mousepad-util.h   |   86 ---
 mousepad/mousepad-window.c |  267 +++-
 3 files changed, 243 insertions(+), 239 deletions(-)

diff --git a/mousepad/mousepad-util.c b/mousepad/mousepad-util.c
index f9abdf6..8e4bfa4 100644
--- a/mousepad/mousepad-util.c
+++ b/mousepad/mousepad-util.c
@@ -1066,3 +1066,132 @@ mousepad_util_search (GtkTextBuffer   *buffer,
 
   return counter;
 }
+
+
+
+/**
+ * Colour scheme functions
+ */
+gint
+mousepad_util_color_schemes_name_compare (gconstpointer a,
+  gconstpointer b)
+{
+  const gchar *name_a, *name_b;
+
+  if (G_UNLIKELY (!a))
+return -(a != b);
+  if (G_UNLIKELY (!b))
+return a != b;
+
+  name_a = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (a));
+  name_b = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (b));
+
+  return g_utf8_collate (name_a, name_b);
+}
+
+
+
+GList *
+mousepad_util_color_schemes_get_sorted (void)
+{
+  GList*list = NULL;
+  const gchar * const  *schemes;
+  GtkSourceStyleScheme *scheme;
+
+  schemes = gtk_source_style_scheme_manager_get_scheme_ids (
+  gtk_source_style_scheme_manager_get_default ());
+
+  while (*schemes)
+{
+  scheme = gtk_source_style_scheme_manager_get_scheme (
+gtk_source_style_scheme_manager_get_default (), *schemes);
+  list = g_list_prepend (list, scheme);
+  schemes++;
+}
+
+  return g_list_sort (list, mousepad_util_color_schemes_name_compare);
+}
+
+
+
+/**
+ * Language/filetype functions
+ */
+gint
+mousepad_util_languages_name_compare (gconstpointer a,
+  gconstpointer b)
+{
+  const gchar *name_a, *name_b;
+
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (a)))
+return -(a != b);
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (b)))
+return a != b;
+
+  name_a = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (a));
+  name_b = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (b));
+
+  return g_utf8_collate (name_a, name_b);
+}
+
+
+
+GSList *
+mousepad_util_language_sections_get_sorted (void)
+{
+  GSList   *list = NULL;
+  const gchar *const   *languages;
+  GtkSourceLanguage*language;
+  GtkSourceLanguageManager *manager;
+
+  manager = gtk_source_language_manager_get_default ();
+  languages = gtk_source_language_manager_get_language_ids (manager);
+
+  while (*languages)
+{
+  language = gtk_source_language_manager_get_language (manager, 
*languages);
+  if (G_LIKELY (GTK_IS_SOURCE_LANGUAGE (language)))
+{
+  /* ensure no duplicates in list */
+  if (!g_slist_find_custom (list,
+gtk_source_language_get_section (language),
+(GCompareFunc)g_strcmp0))
+{
+  list = g_slist_prepend (list, (gchar 
*)gtk_source_language_get_section (language));
+}
+}
+  languages++;
+}
+
+  return g_slist_sort (list, (GCompareFunc)g_strcmp0);
+}
+
+
+
+GSList *
+mousepad_util_languages_get_sorted_for_section (const gchar *section)
+{
+  GSList   *list = NULL;
+  const gchar *const   *languages;
+  GtkSourceLanguage*language;
+  GtkSourceLanguageManager *manager;
+
+  mousepad_return_val_if_fail (section != NULL, NULL);
+
+  manager = gtk_source_language_manager_get_default ();
+  languages = gtk_source_language_manager_get_language_ids (manager);
+
+  while (*languages)
+{
+  language = gtk_source_language_manager_get_language (manager, 
*languages);
+  if (G_LIKELY (GTK_IS_SOURCE_LANGUAGE (language)))
+{
+  /* only get languages in the specified section */
+  if (g_strcmp0 (gtk_source_language_get_section (language), section) 
== 0)
+list = g_slist_prepend (list, language);
+}
+  languages++;
+}
+
+  return g_slist_sort(list, 
(GCompareFunc)mousepad_util_languages_name_compare);
+}
diff --git a/mousepad/mousepad-util.h b/mousepad/mousepad-util.h
index 0aa6513..bdf22d1 100644
--- a/mousepad/mousepad-util.h
+++ b/mousepad/mousepad-util.h
@@ -55,69 +55,77 @@ enum _MousepadSearchFlags
   MOUSEPAD_SEARCH_FLAGS_ACTION_REPLACE= 1 << 17, /* replace the match */
 };
 
-gb

[Xfce4-commits] Select the last saved colour scheme in the menu on application start.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 81eb018689978502e6a128436ed4cb8ab5de77cf (commit)
   from 6ceb27df8efb7b23acc73c147511721cbea45b20 (commit)

commit 81eb018689978502e6a128436ed4cb8ab5de77cf
Author: Matthew Brush 
Date:   Wed Oct 5 15:59:11 2011 -0700

Select the last saved colour scheme in the menu on application start.

 mousepad/mousepad-window.c |9 -
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 445ef66..07fddfe 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -3080,11 +3080,14 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
   GSList   *group = NULL;
   GList*schemes, *iter;
   gint  merge_id;
-  gchar*name;
+  gchar*name, *selected_color_scheme;
 
   /* lock menu updates */
   lock_menu_updates++;
 
+  /* get the previously saved colour scheme name */
+  g_object_get (window->preferences, "view-color-scheme", 
&selected_color_scheme, NULL);
+
   /* get list of schemes */
   schemes = mousepad_util_color_schemes_get_sorted ();
 
@@ -3131,6 +3134,10 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
   g_signal_connect (G_OBJECT (action), "activate", G_CALLBACK 
(mousepad_window_action_color_scheme), window);
   gtk_action_group_add_action_with_accel (window->action_group, GTK_ACTION 
(action), "");
 
+  /* activate the radio button if it was the last saved colour scheme */
+  if (g_strcmp0 (gtk_source_style_scheme_get_id (iter->data), 
selected_color_scheme) == 0)
+  gtk_toggle_action_set_active (GTK_TOGGLE_ACTION (action), TRUE);
+
   /* release the action */
   g_object_unref (G_OBJECT (action));
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add menu to manually select filetype/language.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 92b22bcb38d66f63b5ce69d9df7d3f14e60ac15a (commit)
   from c5ac3ceeff8979a20d60e40f62f0b04d0ea67b9f (commit)

commit 92b22bcb38d66f63b5ce69d9df7d3f14e60ac15a
Author: Matthew Brush 
Date:   Wed Oct 5 15:05:43 2011 -0700

Add menu to manually select filetype/language.

This code needs to be reviewed and cleaned up more.
Thanks to "cavalier" on #xfce-dev IRC for help getting this working.

 mousepad/mousepad-window-ui.xml |4 +
 mousepad/mousepad-window.c  |  256 +++
 2 files changed, 260 insertions(+), 0 deletions(-)

diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index 2fd1c3f..f782f96 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -117,6 +117,10 @@
 
 
   
+  
+  
+
+  
 
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 06f9a9f..97e84f2 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -180,6 +180,7 @@ static gboolean  mousepad_window_update_gomenu_idle 
  (gpointer
 static void  mousepad_window_update_gomenu_idle_destroy   
(gpointeruser_data);
 static void  mousepad_window_update_gomenu
(MousepadWindow *window);
 static void  mousepad_window_menu_color_schemes   
(MousepadWindow *window);
+static void  mousepad_window_menu_languages   
(MousepadWindow *window);
 
 /* recent functions */
 static void  mousepad_window_recent_add   
(MousepadWindow *window,
@@ -332,6 +333,8 @@ static void  
mousepad_window_action_insert_spaces (GtkToggle
 static void  mousepad_window_action_line_ending   
(GtkRadioAction *action,

GtkRadioAction *current,

MousepadWindow *window);
+static void  mousepad_window_action_language  
(GtkToggleAction*action,
+   
MousepadWindow *window);
 static void  mousepad_window_action_prev_tab  
(GtkAction  *action,

MousepadWindow *window);
 static void  mousepad_window_action_next_tab  
(GtkAction  *action,
@@ -454,6 +457,7 @@ static const GtkActionEntry action_entries[] =
   { "document-menu", NULL, N_("_Document"), NULL, NULL, NULL, },
 { "tab-size-menu", NULL, N_("Tab _Size"), NULL, NULL, NULL, },
 { "eol-menu", NULL, N_("Line E_nding"), NULL, NULL, NULL, },
+{ "language-menu", NULL, N_("_Filetype"), NULL, NULL, NULL, },
 
   { "navigation-menu", NULL, N_("_Navigation"), NULL, },
 { "back", GTK_STOCK_GO_BACK, N_("_Previous Tab"), "Page_Up", 
N_("Select the previous tab"), G_CALLBACK (mousepad_window_action_prev_tab), },
@@ -620,6 +624,9 @@ mousepad_window_init (MousepadWindow *window)
   /* add color schemes menu */
   mousepad_window_menu_color_schemes (window);
 
+  /* add languages/filetypes menu */
+  mousepad_window_menu_languages (window);
+
   /* set accel group for the window */
   accel_group = gtk_ui_manager_get_accel_group (window->ui_manager);
   gtk_window_add_accel_group (GTK_WINDOW (window), accel_group);
@@ -3196,6 +3203,226 @@ mousepad_window_menu_color_schemes (MousepadWindow 
*window)
 
 
 /**
+ * Language/filetype functions
+ */
+static gint
+mousepad_window_languages_compare_by_name (gconstpointer a,
+   gconstpointer b)
+{
+  const gchar *name_a, *name_b;
+
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (a)))
+return -(a != b);
+  if (G_UNLIKELY (!GTK_IS_SOURCE_LANGUAGE (b)))
+return a != b;
+
+  name_a = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (a));
+  name_b = gtk_source_language_get_name (GTK_SOURCE_LANGUAGE (b));
+
+  return g_utf8_collate (name_a, name_b);
+}
+
+
+
+static GSList *
+mousepad_window_language_section_names_sorted (void)
+{
+  GSList   *list = NULL;
+  const gchar *const   *languages;
+  GtkSourceLanguage*language;
+  GtkSourceLanguageManager *manager;
+
+  manager = gtk_source_language_manager_get_default ();
+  languages = gtk_source_language_manager_get_language_ids (manager);
+
+  while (*languages)
+{
+  language = gtk_source_language_manager_get_language (manager, 
*languages);
+  if (G_LIKELY (GTK_IS_SOURCE_LANGUAGE (language)))
+{
+  /* 

[Xfce4-commits] Noise: remove extra whitespace added by editor.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to c5ac3ceeff8979a20d60e40f62f0b04d0ea67b9f (commit)
   from 7be1dde6dfe47b08cf49f6bfb3f4fe031d9fad8e (commit)

commit c5ac3ceeff8979a20d60e40f62f0b04d0ea67b9f
Author: Matthew Brush 
Date:   Tue Oct 4 01:28:34 2011 -0700

Noise: remove extra whitespace added by editor.

Apologies for the noise.

 mousepad/mousepad-document.c|   12 +-
 mousepad/mousepad-file.c|   20 
 mousepad/mousepad-preferences.c |2 +-
 mousepad/mousepad-statusbar.c   |6 ++--
 mousepad/mousepad-view.c|4 +-
 mousepad/mousepad-window.c  |   48 +++---
 6 files changed, 46 insertions(+), 46 deletions(-)

diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 843cd14..a3d9099 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -160,7 +160,7 @@ mousepad_document_class_init (MousepadDocumentClass *klass)
   0, NULL, NULL,
   g_cclosure_marshal_VOID__BOOLEAN,
   G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
-  
+
   document_signals[LANGUAGE_CHANGED] =
 g_signal_new (I_("language-changed"),
   G_TYPE_FROM_CLASS (gobject_class),
@@ -241,7 +241,7 @@ mousepad_document_init (MousepadDocument *document)
   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);
-  
+
   if (g_strcmp0 (color_scheme, "none") != 0)
 scheme =  gtk_source_style_scheme_manager_get_scheme 
(gtk_source_style_scheme_manager_get_default (), color_scheme);
   gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER 
(document->buffer), (scheme != NULL));
@@ -369,13 +369,13 @@ mousepad_document_notify_language (GtkSourceBuffer  
*buffer,
MousepadDocument *document)
 {
   GtkSourceLanguage *language;
-  
+
   mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
   mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
-  
+
   /* the new language */
   language = gtk_source_buffer_get_language (buffer);
-  
+
   /* emit the signal */
   g_signal_emit (G_OBJECT (document), document_signals[LANGUAGE_CHANGED], 0, 
language);
 }
@@ -542,7 +542,7 @@ mousepad_document_send_signals (MousepadDocument *document)
 
   /* re-send the selection status */
   mousepad_document_notify_has_selection (document->buffer, NULL, document);
-  
+
   /* re-send the language signal */
   mousepad_document_notify_language (GTK_SOURCE_BUFFER (document->buffer), 
NULL, document);
 }
diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index 2e4a86c..0148b69 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -393,13 +393,13 @@ mousepad_file_get_line_ending (MousepadFile *file)
 
 
 
-void 
+void
 mousepad_file_set_language (MousepadFile  *file,
 GtkSourceLanguage *language)
 {
   mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
   mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
-  
+
   gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), language);
 }
 
@@ -410,7 +410,7 @@ mousepad_file_get_language (MousepadFile *file)
 {
   mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
   mousepad_return_val_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer), NULL);
-  
+
   return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (file->buffer));
 }
 
@@ -421,16 +421,16 @@ mousepad_file_set_language_id (MousepadFile *file,
const gchar  *language_id)
 {
   GtkSourceLanguage *lang;
-  
+
   mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
   mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
-  
+
   if (G_UNLIKELY (language_id == NULL))
 {
   gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), NULL);
   return;
 }
-  
+
   lang = gtk_source_language_manager_get_language 
(gtk_source_language_manager_get_default (), language_id);
   mousepad_file_set_language (file, lang);
 }
@@ -441,7 +441,7 @@ const gchar *
 mousepad_file_get_language_id (MousepadFile *file)
 {
   GtkSourceLanguage *lang;
-  
+
   lang = mousepad_file_get_language (file);
   return (lang != NULL) ? gtk_source_language_get_id (lang) : NULL;
 }
@@ -462,11 +462,11 @@ mousepad_file_guess_language (MousepadFile *file)
   content_type = NULL;
 }
 
-  language = gtk_source_language_manager_guess_language 
(gtk_source_language_manager_get_default (), 
- file->filename, 
+  language = gtk_source_language_manager_guess_language 
(gtk_source_language_manager_get_default (),
+ file->filename,
  con

[Xfce4-commits] Fix kludge from last commit (FIXME comment).

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 349066029e579a6dc1014aff3759e0f78ec52eb7 (commit)
   from ba38b4940b2998c30ba9bde6c707bf1c589cae0b (commit)

commit 349066029e579a6dc1014aff3759e0f78ec52eb7
Author: Matthew Brush 
Date:   Mon Oct 3 23:47:52 2011 -0700

Fix kludge from last commit (FIXME comment).

Add a new signal 'language-changed' to MousepadDocument for the window
to use to get notified of when to update the language/filetype in the
statusbar.

 mousepad/mousepad-document.c |   35 +++
 mousepad/mousepad-window.c   |   23 +--
 2 files changed, 52 insertions(+), 6 deletions(-)

diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 1f80b12..843cd14 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -52,6 +52,9 @@ static void  mousepad_document_notify_has_selection
(GtkTextBuffer
 static void  mousepad_document_notify_overwrite(GtkTextView
*textview,
 GParamSpec 
*pspec,
 MousepadDocument   
*document);
+static void  mousepad_document_notify_language (GtkSourceBuffer
*buffer,
+GParamSpec 
*pspec,
+MousepadDocument   
*document);
 static void  mousepad_document_drag_data_received  (GtkWidget  
*widget,
 GdkDragContext 
*context,
 gint   
 x,
@@ -73,6 +76,7 @@ enum
   CURSOR_CHANGED,
   SELECTION_CHANGED,
   OVERWRITE_CHANGED,
+  LANGUAGE_CHANGED,
   LAST_SIGNAL
 };
 
@@ -156,6 +160,14 @@ mousepad_document_class_init (MousepadDocumentClass *klass)
   0, NULL, NULL,
   g_cclosure_marshal_VOID__BOOLEAN,
   G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
+  
+  document_signals[LANGUAGE_CHANGED] =
+g_signal_new (I_("language-changed"),
+  G_TYPE_FROM_CLASS (gobject_class),
+  G_SIGNAL_RUN_LAST,
+  0, NULL, NULL,
+  g_cclosure_marshal_VOID__OBJECT,
+  G_TYPE_NONE, 1, GTK_TYPE_SOURCE_LANGUAGE);
 }
 
 
@@ -246,6 +258,7 @@ mousepad_document_init (MousepadDocument *document)
   g_signal_connect_swapped (G_OBJECT (document->file), "readonly-changed", 
G_CALLBACK (mousepad_document_label_color), document);
   g_signal_connect (G_OBJECT (document->textview), "notify::overwrite", 
G_CALLBACK (mousepad_document_notify_overwrite), document);
   g_signal_connect (G_OBJECT (document->textview), "drag-data-received", 
G_CALLBACK (mousepad_document_drag_data_received), document);
+  g_signal_connect (G_OBJECT (document->buffer), "notify::language", 
G_CALLBACK (mousepad_document_notify_language), document);
 }
 
 
@@ -351,6 +364,25 @@ mousepad_document_notify_overwrite (GtkTextView  
*textview,
 
 
 static void
+mousepad_document_notify_language (GtkSourceBuffer  *buffer,
+   GParamSpec   *pspec,
+   MousepadDocument *document)
+{
+  GtkSourceLanguage *language;
+  
+  mousepad_return_if_fail (MOUSEPAD_IS_DOCUMENT (document));
+  mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (buffer));
+  
+  /* the new language */
+  language = gtk_source_buffer_get_language (buffer);
+  
+  /* emit the signal */
+  g_signal_emit (G_OBJECT (document), document_signals[LANGUAGE_CHANGED], 0, 
language);
+}
+
+
+
+static void
 mousepad_document_drag_data_received (GtkWidget*widget,
   GdkDragContext   *context,
   gint  x,
@@ -510,6 +542,9 @@ mousepad_document_send_signals (MousepadDocument *document)
 
   /* re-send the selection status */
   mousepad_document_notify_has_selection (document->buffer, NULL, document);
+  
+  /* re-send the language signal */
+  mousepad_document_notify_language (GTK_SOURCE_BUFFER (document->buffer), 
NULL, document);
 }
 
 
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 54a3520..45a9f82 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -152,6 +152,9 @@ static void  mousepad_window_selection_changed  
  (MousepadD
 static void  mousepad_window_overwrite_changed
(MousepadDocument   *document,

gbooleanoverwrite,

MousepadWindow *window);
+static void  m

[Xfce4-commits] Use better string compare function for colour scheme names.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 7be1dde6dfe47b08cf49f6bfb3f4fe031d9fad8e (commit)
   from 349066029e579a6dc1014aff3759e0f78ec52eb7 (commit)

commit 7be1dde6dfe47b08cf49f6bfb3f4fe031d9fad8e
Author: Matthew Brush 
Date:   Tue Oct 4 00:08:50 2011 -0700

Use better string compare function for colour scheme names.

 mousepad/mousepad-window.c |4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 45a9f82..f042aae 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -3087,8 +3087,8 @@ mousepad_window_color_schemes_compare_by_name 
(gconstpointer a,
   
   name_a = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (a));
   name_b = gtk_source_style_scheme_get_name (GTK_SOURCE_STYLE_SCHEME (b));
-  
-  return g_strcmp0 (name_a, name_b);
+
+  return g_utf8_collate (name_a, name_b);
 }
 
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add colour scheme support.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to cc401c48985b9f06c855cac39175ddcbe0efe091 (commit)
   from 9a6ad0cb703ec1ef475458cec656cbeef9d865dc (commit)

commit cc401c48985b9f06c855cac39175ddcbe0efe091
Author: Matthew Brush 
Date:   Mon Oct 3 20:06:24 2011 -0700

Add colour scheme support.

* Add new preference 'color-scheme' that stores the scheme's ID string.
* Add new 'Color Schemes' menu and placeholder for items to UI XML file.
* Add new actions for all colour schemes and merge into UI manager menu.
* Handle actions by looping though all textview widgets and setting style.
* Using 'g_str_hash' of scheme id for radio action value which might be bad.

 mousepad/mousepad-document.c|   18 +++-
 mousepad/mousepad-preferences.c |9 ++
 mousepad/mousepad-private.h |2 +
 mousepad/mousepad-window-ui.xml |4 +
 mousepad/mousepad-window.c  |  196 +++
 5 files changed, 224 insertions(+), 5 deletions(-)

diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 638f639..1f80b12 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -163,11 +163,12 @@ mousepad_document_class_init (MousepadDocumentClass 
*klass)
 static void
 mousepad_document_init (MousepadDocument *document)
 {
-  GtkTargetList   *target_list;
-  gboolean word_wrap, auto_indent, line_numbers, insert_spaces;
-  gchar   *font_name;
-  gint tab_size;
-  MousepadPreferences *preferences;
+  GtkTargetList*target_list;
+  gboolean  word_wrap, auto_indent, line_numbers, insert_spaces;
+  gchar*font_name, *color_scheme;
+  gint  tab_size;
+  GtkSourceStyleScheme *scheme = NULL;
+  MousepadPreferences  *preferences;
 
   /* private structure */
   document->priv = MOUSEPAD_DOCUMENT_GET_PRIVATE (document);
@@ -215,6 +216,7 @@ mousepad_document_init (MousepadDocument *document)
 "view-font-name", &font_name,
 "view-tab-size", &tab_size,
 "view-insert-spaces", &insert_spaces,
+"view-color-scheme", &color_scheme,
 NULL);
 
   /* release the preferences */
@@ -227,9 +229,15 @@ mousepad_document_init (MousepadDocument *document)
   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);
+  
+  if (g_strcmp0 (color_scheme, "none") != 0)
+scheme =  gtk_source_style_scheme_manager_get_scheme 
(gtk_source_style_scheme_manager_get_default (), color_scheme);
+  gtk_source_buffer_set_highlight_syntax (GTK_SOURCE_BUFFER 
(document->buffer), (scheme != NULL));
+  gtk_source_buffer_set_style_scheme (GTK_SOURCE_BUFFER (document->buffer), 
scheme);
 
   /* cleanup */
   g_free (font_name);
+  g_free (color_scheme);
 
   /* attach signals to the text view and buffer */
   g_signal_connect (G_OBJECT (document->buffer), "notify::cursor-position", 
G_CALLBACK (mousepad_document_notify_cursor_position), document);
diff --git a/mousepad/mousepad-preferences.c b/mousepad/mousepad-preferences.c
index cbf1ec1..5b45b71 100644
--- a/mousepad/mousepad-preferences.c
+++ b/mousepad/mousepad-preferences.c
@@ -61,6 +61,7 @@ enum
   PROP_VIEW_TAB_WIDTH,
   PROP_VIEW_TABS_AS_SPACES,
   PROP_VIEW_WORD_WRAP,
+  PROP_VIEW_COLOR_SCHEME,
 
   /* window preferences */
   PROP_WINDOW_HEIGHT,
@@ -213,6 +214,14 @@ mousepad_preferences_class_init (MousepadPreferencesClass 
*klass)
  NULL,
  FALSE,
  
MOUSEPAD_PARAM_READWRITE));
+  
+  g_object_class_install_property (gobject_class,
+   PROP_VIEW_COLOR_SCHEME,
+   g_param_spec_string ("view-color-scheme",
+"ViewColorScheme",
+NULL,
+"none",
+
MOUSEPAD_PARAM_READWRITE));
 
 
   /**
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 520a9f7..85fae3c 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -22,6 +22,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 G_BEGIN_DECLS
 
diff --git a/mousepad/mousepad-window-ui.xml b/mousepad/mousepad-window-ui.xml
index b6b6575..2fd1c3f 100644
--- a/mousepad/mousepad-window-ui.xml
+++ b/mousepad/mousepad-window-ui.xml
@@ -68,6 +68,10 @@
   
   
   
+  
+  
+

[Xfce4-commits] Remove undo manager code and use GtkSourceView's undo manager.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 728cb754e087cf0bbc2efa7167a8008b2c66752a (commit)
   from 6be5f6c5f9de3242f234f08506da31e55396d9b5 (commit)

commit 728cb754e087cf0bbc2efa7167a8008b2c66752a
Author: Matthew Brush 
Date:   Mon Oct 3 06:54:20 2011 -0700

Remove undo manager code and use GtkSourceView's undo manager.

There was a call to mousepad_undo_lock() in mousepad-encoding-dialog.c
that needs to be checked, since I wasn't sure what that call was for.

 mousepad/Makefile.am|2 -
 mousepad/mousepad-document.c|9 +-
 mousepad/mousepad-document.h|4 -
 mousepad/mousepad-encoding-dialog.c |3 -
 mousepad/mousepad-undo.c|  835 ---
 mousepad/mousepad-undo.h|   54 ---
 mousepad/mousepad-window.c  |   58 ++--
 7 files changed, 31 insertions(+), 934 deletions(-)

diff --git a/mousepad/Makefile.am b/mousepad/Makefile.am
index 41b7b1e..3dfb8ac 100644
--- a/mousepad/Makefile.am
+++ b/mousepad/Makefile.am
@@ -46,8 +46,6 @@ mousepad_SOURCES = \
mousepad-statusbar.h \
mousepad-view.c \
mousepad-view.h \
-   mousepad-undo.c \
-   mousepad-undo.h \
mousepad-util.c \
mousepad-util.h \
mousepad-window.c \
diff --git a/mousepad/mousepad-document.c b/mousepad/mousepad-document.c
index 2e39044..638f639 100644
--- a/mousepad/mousepad-document.c
+++ b/mousepad/mousepad-document.c
@@ -33,7 +33,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 
@@ -185,7 +184,7 @@ mousepad_document_init (MousepadDocument *document)
   gtk_scrolled_window_set_vadjustment (GTK_SCROLLED_WINDOW (document), NULL);
 
   /* create a textbuffer */
-  document->buffer = gtk_text_buffer_new (NULL);
+  document->buffer = GTK_TEXT_BUFFER (gtk_source_buffer_new (NULL));
 
   /* initialize the file */
   document->file = mousepad_file_new (document->buffer);
@@ -193,9 +192,6 @@ mousepad_document_init (MousepadDocument *document)
   /* connect signals to the file */
   g_signal_connect_swapped (G_OBJECT (document->file), "filename-changed", 
G_CALLBACK (mousepad_document_filename_changed), document);
 
-  /* initialize the undo manager */
-  document->undo = mousepad_undo_new (document->buffer);
-
   /* create the highlight tag */
   document->tag = gtk_text_buffer_create_tag (document->buffer, NULL, 
"background", "#78", NULL);
 
@@ -255,9 +251,6 @@ mousepad_document_finalize (GObject *object)
   g_free (document->priv->utf8_filename);
   g_free (document->priv->utf8_basename);
 
-  /* release the undo manager */
-  g_object_unref (G_OBJECT (document->undo));
-
   /* release the file */
   g_object_unref (G_OBJECT (document->file));
 
diff --git a/mousepad/mousepad-document.h b/mousepad/mousepad-document.h
index 2daff7f..f2176c1 100644
--- a/mousepad/mousepad-document.h
+++ b/mousepad/mousepad-document.h
@@ -21,7 +21,6 @@ G_BEGIN_DECLS
 
 #include 
 #include 
-#include 
 #include 
 
 typedef struct _MousepadDocumentPrivate MousepadDocumentPrivate;
@@ -47,9 +46,6 @@ struct _MousepadDocument
   /* file */
   MousepadFile*file;
 
-  /* undo manager */
-  MousepadUndo*undo;
-
   /* text buffer */
   GtkTextBuffer   *buffer;
 
diff --git a/mousepad/mousepad-encoding-dialog.c 
b/mousepad/mousepad-encoding-dialog.c
index 953bfbd..7d4ce76 100644
--- a/mousepad/mousepad-encoding-dialog.c
+++ b/mousepad/mousepad-encoding-dialog.c
@@ -213,9 +213,6 @@ mousepad_encoding_dialog_init (MousepadEncodingDialog 
*dialog)
   mousepad_view_set_line_numbers (dialog->document->textview, FALSE);
   mousepad_document_set_word_wrap (dialog->document, FALSE);
   gtk_widget_show (GTK_WIDGET (dialog->document));
-
-  /* lock undo manager forever */
-  mousepad_undo_lock (dialog->document->undo);
 }
 
 
diff --git a/mousepad/mousepad-undo.c b/mousepad/mousepad-undo.c
deleted file mode 100644
index ecea5cd..000
--- a/mousepad/mousepad-undo.c
+++ /dev/null
@@ -1,835 +0,0 @@
-/*
- * 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
- */
-
-#ifdef HAVE_CONFIG_H
-#include 
-#endif
-
-#include 
-#include 
-
-
-/* global */
-#define MOUSEPAD_UNDO_MAX_STEPS 

[Xfce4-commits] Update statusbar filetype when notebook pages are changed.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to ba38b4940b2998c30ba9bde6c707bf1c589cae0b (commit)
   from 82b6e834ddeea4be8bf901307e6e093bde24631c (commit)

commit ba38b4940b2998c30ba9bde6c707bf1c589cae0b
Author: Matthew Brush 
Date:   Mon Oct 3 22:33:51 2011 -0700

Update statusbar filetype when notebook pages are changed.

Note the FIXME in the comments, this will probably need some refactoring.

 mousepad/mousepad-statusbar.c |   31 +++
 mousepad/mousepad-statusbar.h |3 +++
 mousepad/mousepad-window.c|8 +++-
 3 files changed, 41 insertions(+), 1 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 9ed0d94..a7da0f8 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -50,6 +50,7 @@ struct _MousepadStatusbar
   guint   overwrite_enabled : 1;
 
   /* extra labels in the statusbar */
+  GtkWidget  *language;
   GtkWidget  *position;
   GtkWidget  *overwrite;
 };
@@ -119,6 +120,16 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   separator = gtk_vseparator_new ();
   gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
+  
+  /* language/filetype */
+  statusbar->language = gtk_label_new (_("Filetype: None"));
+  gtk_box_pack_start (GTK_BOX (box), statusbar->language, FALSE, TRUE, 0);
+  gtk_widget_show (statusbar->language);
+
+  /* separator */
+  separator = gtk_vseparator_new ();
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
+  gtk_widget_show (separator);
 
   /* line and column numbers */
   statusbar->position = gtk_label_new (NULL);
@@ -169,6 +180,26 @@ mousepad_statusbar_overwrite_clicked (GtkWidget 
*widget,
 
 
 void
+mousepad_statusbar_set_language (MousepadStatusbar *statusbar,
+ GtkSourceLanguage *language)
+{
+  gchar *label;
+  
+  mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
+  
+  if (language == NULL)
+  gtk_label_set_text (GTK_LABEL (statusbar->language), _("Filetype: 
None"));
+  else
+{
+  label = g_strdup_printf (_("Filetype: %s"), gtk_source_language_get_name 
(language));
+  gtk_label_set_text (GTK_LABEL (statusbar->language), label);
+  g_free (label);
+}
+}
+
+
+
+void
 mousepad_statusbar_set_cursor_position (MousepadStatusbar *statusbar,
 gint   line,
 gint   column,
diff --git a/mousepad/mousepad-statusbar.h b/mousepad/mousepad-statusbar.h
index c44b54e..8ebe7a6 100644
--- a/mousepad/mousepad-statusbar.h
+++ b/mousepad/mousepad-statusbar.h
@@ -41,6 +41,9 @@ voidmousepad_statusbar_set_cursor_position  
(MousepadStatusbar *statusba
 voidmousepad_statusbar_set_overwrite(MousepadStatusbar 
*statusbar,
  gboolean   
overwrite);
 
+voidmousepad_statusbar_set_language (MousepadStatusbar 
*statusbar,
+ GtkSourceLanguage 
*language);
+
 G_END_DECLS
 
 #endif /* !__MOUSEPAD_STATUSBAR_H__ */
diff --git a/mousepad/mousepad-window.c b/mousepad/mousepad-window.c
index 4c5e33e..54a3520 100644
--- a/mousepad/mousepad-window.c
+++ b/mousepad/mousepad-window.c
@@ -1306,7 +1306,8 @@ mousepad_window_notebook_switch_page (GtkNotebook 
*notebook,
   guintpage_num,
   MousepadWindow  *window)
 {
-  MousepadDocument *document;
+  MousepadDocument  *document;
+  GtkSourceLanguage *language;
 
   mousepad_return_if_fail (MOUSEPAD_IS_WINDOW (window));
   mousepad_return_if_fail (GTK_IS_NOTEBOOK (notebook));
@@ -1328,6 +1329,11 @@ mousepad_window_notebook_switch_page (GtkNotebook 
*notebook,
 
   /* update the statusbar */
   mousepad_document_send_signals (window->active);
+  
+  /* set the filetype in the status bar 
+   * FIXME: this doesn't belong here */
+  language = gtk_source_buffer_get_language (GTK_SOURCE_BUFFER 
(window->active->buffer));
+  mousepad_statusbar_set_language (MOUSEPAD_STATUSBAR (window->statusbar), 
language);
 }
 }
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Remove old auto-indentation code and use GtkSourceView's auto-indent.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 898612c83495635ef657fea60f6b9048640b0f15 (commit)
   from 801eadc860c894420a1807e5a9f496895bd031c8 (commit)

commit 898612c83495635ef657fea60f6b9048640b0f15
Author: Matthew Brush 
Date:   Mon Oct 3 02:01:16 2011 -0700

Remove old auto-indentation code and use GtkSourceView's auto-indent.

 mousepad/mousepad-view.c |   78 +
 1 files changed, 2 insertions(+), 76 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index a16c594..8b600e4 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -69,8 +69,6 @@ static void  mousepad_view_indent_decrease   
(MousepadView
 static void  mousepad_view_indent_selection  (MousepadView 
  *view,
   gboolean 
   increase,
   gboolean 
   force);
-static gchar*mousepad_view_indent_string (GtkTextBuffer
  *buffer,
-  const 
GtkTextIter  *iter);
 static gint  mousepad_view_calculate_layout_width(GtkWidget
  *widget,
   gsize
   length,
   gchar
   fill_char);
@@ -118,7 +116,6 @@ struct _MousepadView
   guint   selection_editing : 1;
 
   /* settings */
-  guint   auto_indent : 1;
   guint   insert_spaces : 1;
   guint   tab_size;
 };
@@ -152,7 +149,6 @@ static void
 mousepad_view_init (MousepadView *view)
 {
   /* initialize settings */
-  view->auto_indent = FALSE;
   view->insert_spaces = FALSE;
   view->tab_size = 8;
 
@@ -266,7 +262,6 @@ mousepad_view_key_press_event (GtkWidget   *widget,
   GtkTextIteriter;
   GtkTextMark   *cursor;
   guint  modifiers;
-  gchar *string;
   gboolean   im_handled;
   gboolean   is_editable;
 
@@ -282,48 +277,6 @@ mousepad_view_key_press_event (GtkWidget   *widget,
   /* handle the key event */
   switch (event->keyval)
 {
-  case GDK_Return:
-  case GDK_KP_Enter:
-if (!(event->state & GDK_SHIFT_MASK) && view->auto_indent && 
is_editable)
-  {
-/* get the iter position of the cursor */
-cursor = gtk_text_buffer_get_insert (buffer);
-gtk_text_buffer_get_iter_at_mark (buffer, &iter, cursor);
-
-/* get the string of tabs and spaces we're going to indent */
-string = mousepad_view_indent_string (buffer, &iter);
-
-if (string != NULL)
-  {
-/* check if the input method emitted this event */
-im_handled = gtk_im_context_filter_keypress (GTK_TEXT_VIEW 
(view)->im_context, event);
-
-/* check if we're allowed to handle this event */
-if (G_LIKELY (im_handled == FALSE))
-  {
-/* begin a user action */
-gtk_text_buffer_begin_user_action (buffer);
-
-/* insert the indent characters */
-gtk_text_buffer_insert (buffer, &iter, "\n", 1);
-gtk_text_buffer_insert (buffer, &iter, string, -1);
-
-/* end user action */
-gtk_text_buffer_end_user_action (buffer);
-
-/* make sure the new string is visible for the user */
-mousepad_view_scroll_to_cursor (view);
-  }
-
-/* cleanup */
-g_free (string);
-
-/* return */
-return (im_handled == FALSE);
-  }
-  }
-break;
-
   case GDK_End:
   case GDK_KP_End:
 if (modifiers & GDK_CONTROL_MASK)
@@ -1208,32 +1161,6 @@ mousepad_view_indent_selection (MousepadView *view,
 
 
 
-static gchar *
-mousepad_view_indent_string (GtkTextBuffer *buffer,
- const GtkTextIter *iter)
-{
-  GtkTextIter start, end;
-  gintline;
-
-  /* get the line of the iter */
-  line = gtk_text_iter_get_line (iter);
-
-  /* get the iter of the beginning of this line */
-  gtk_text_buffer_get_iter_at_line (buffer, &start, line);
-
-  /* set the end iter */
-  end = start;
-
-  /* forward until we hit text */
-  if (mousepad_util_forward_iter_to_text (&end, iter) == FALSE)
-return NULL;
-
-  /* return the text between the iters */
-  return gtk_text_iter_get_slice (&start, &end);
-}
-
-
-
 static gint
 mousepad_view_calculate_layout_width (GtkWidget *widget,
   gsize  length,
@@ -2454,8 +2381,7 @@ mousepad_view_set_auto_indent (MousepadV

[Xfce4-commits] Remove old tab size code and use GtkSourceView's tab-width.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 9a6ad0cb703ec1ef475458cec656cbeef9d865dc (commit)
   from 728cb754e087cf0bbc2efa7167a8008b2c66752a (commit)

commit 9a6ad0cb703ec1ef475458cec656cbeef9d865dc
Author: Matthew Brush 
Date:   Mon Oct 3 08:10:59 2011 -0700

Remove old tab size code and use GtkSourceView's tab-width.

 mousepad/mousepad-view.c |   92 +++---
 1 files changed, 14 insertions(+), 78 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 438b671..6c98b15 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -69,9 +69,6 @@ static void  mousepad_view_indent_decrease   
(MousepadView
 static void  mousepad_view_indent_selection  (MousepadView 
  *view,
   gboolean 
   increase,
   gboolean 
   force);
-static gint  mousepad_view_calculate_layout_width(GtkWidget
  *widget,
-  gsize
   length,
-  gchar
   fill_char);
 static void  mousepad_view_transpose_multi_selection (GtkTextBuffer
   *buffer,
   MousepadView 
   *view);
 static void  mousepad_view_transpose_range   (GtkTextBuffer
   *buffer,
@@ -114,9 +111,6 @@ struct _MousepadView
 
   /* if the selection is in editing mode */
   guint   selection_editing : 1;
-
-  /* settings */
-  guint   tab_size;
 };
 
 
@@ -147,9 +141,6 @@ mousepad_view_class_init (MousepadViewClass *klass)
 static void
 mousepad_view_init (MousepadView *view)
 {
-  /* initialize settings */
-  view->tab_size = 8;
-
   /* initialize selection variables */
   view->selection_timeout_id = 0;
   view->selection_tag = NULL;
@@ -240,9 +231,6 @@ mousepad_view_style_set (GtkWidget *widget,
 "foreground-gdk", 
&style->text[GTK_STATE_SELECTED],
 NULL);
 
-  /* update the tab size */
-  mousepad_view_set_tab_size (view, view->tab_size);
-
   /* redraw selection */
   if (view->selection_marks != NULL)
 mousepad_view_selection_draw (view, FALSE);
@@ -987,24 +975,25 @@ mousepad_view_indent_increase (MousepadView *view,
GtkTextIter  *iter)
 {
   gchar *string;
-  gint   offset, length, inline_len;
+  gint   offset, length, inline_len, tab_size;
   GtkTextBuffer *buffer;
 
   /* get the buffer */
   buffer = mousepad_view_get_buffer (view);
+  tab_size = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (view));
 
   if (gtk_source_view_get_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW 
(view)))
 {
   /* get the offset */
-  offset = mousepad_util_get_real_line_offset (iter, view->tab_size);
+  offset = mousepad_util_get_real_line_offset (iter, tab_size);
 
   /* calculate the length to inline with a tab */
-  inline_len = offset % view->tab_size;
+  inline_len = offset % tab_size;
 
   if (inline_len == 0)
-length = view->tab_size;
+length = tab_size;
   else
-length = view->tab_size - inline_len;
+length = tab_size - inline_len;
 
   /* create spaces string */
   string = g_strnfill (length, ' ');
@@ -1030,11 +1019,14 @@ mousepad_view_indent_decrease (MousepadView *view,
 {
   GtkTextBuffer *buffer;
   GtkTextIterstart, end;
-  gint   columns = view->tab_size;
+  gint   columns, tab_size;
   gunichar   c;
 
   /* set iters */
   start = end = *iter;
+  
+  tab_size = gtk_source_view_get_tab_width (GTK_SOURCE_VIEW (view));
+  columns = tab_size;
 
   /* walk until we've removed enough columns */
   while (columns > 0)
@@ -1043,7 +1035,7 @@ mousepad_view_indent_decrease (MousepadView *view,
   c = gtk_text_iter_get_char (&end);
 
   if (c == '\t')
-columns -= view->tab_size;
+columns -= tab_size;
   else if (c == ' ')
 columns--;
   else
@@ -1119,42 +,6 @@ mousepad_view_indent_selection (MousepadView *view,
 }
 
 
-
-static gint
-mousepad_view_calculate_layout_width (GtkWidget *widget,
-  gsize  length,
-  gchar  fill_char)
-{
-  PangoLayout *layout;
-  gchar   *string;
-  gint width = -1;
-
-  mousepad_return_val_if_fail (GTK_IS_WIDGET (widget), -1);
-  mousepad_return_val_if_fail (length > 0, -1);
-
-  /* create character string */
-  string = g_strnfill (length, fill_char);
-
-  /* create pango layout from

[Xfce4-commits] Add initial filetype/language support and guess on file open.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 82b6e834ddeea4be8bf901307e6e093bde24631c (commit)
   from cc401c48985b9f06c855cac39175ddcbe0efe091 (commit)

commit 82b6e834ddeea4be8bf901307e6e093bde24631c
Author: Matthew Brush 
Date:   Mon Oct 3 21:48:03 2011 -0700

Add initial filetype/language support and guess on file open.

Still need to add UI elements to let user select language to use.

 mousepad/mousepad-file.c|   82 +++
 mousepad/mousepad-file.h|   12 ++
 mousepad/mousepad-private.h |2 +
 3 files changed, 96 insertions(+), 0 deletions(-)

diff --git a/mousepad/mousepad-file.c b/mousepad/mousepad-file.c
index b45c980..2e4a86c 100644
--- a/mousepad/mousepad-file.c
+++ b/mousepad/mousepad-file.c
@@ -393,6 +393,85 @@ mousepad_file_get_line_ending (MousepadFile *file)
 
 
 
+void 
+mousepad_file_set_language (MousepadFile  *file,
+GtkSourceLanguage *language)
+{
+  mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+  mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
+  
+  gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), language);
+}
+
+
+
+GtkSourceLanguage *
+mousepad_file_get_language (MousepadFile *file)
+{
+  mousepad_return_val_if_fail (MOUSEPAD_IS_FILE (file), NULL);
+  mousepad_return_val_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer), NULL);
+  
+  return gtk_source_buffer_get_language (GTK_SOURCE_BUFFER (file->buffer));
+}
+
+
+
+void
+mousepad_file_set_language_id (MousepadFile *file,
+   const gchar  *language_id)
+{
+  GtkSourceLanguage *lang;
+  
+  mousepad_return_if_fail (MOUSEPAD_IS_FILE (file));
+  mousepad_return_if_fail (GTK_IS_SOURCE_BUFFER (file->buffer));
+  
+  if (G_UNLIKELY (language_id == NULL))
+{
+  gtk_source_buffer_set_language (GTK_SOURCE_BUFFER (file->buffer), NULL);
+  return;
+}
+  
+  lang = gtk_source_language_manager_get_language 
(gtk_source_language_manager_get_default (), language_id);
+  mousepad_file_set_language (file, lang);
+}
+
+
+
+const gchar *
+mousepad_file_get_language_id (MousepadFile *file)
+{
+  GtkSourceLanguage *lang;
+  
+  lang = mousepad_file_get_language (file);
+  return (lang != NULL) ? gtk_source_language_get_id (lang) : NULL;
+}
+
+
+
+GtkSourceLanguage *
+mousepad_file_guess_language (MousepadFile *file)
+{
+  gchar *content_type;
+  gboolean   result_uncertain;
+  GtkSourceLanguage *language = NULL;
+
+  content_type = g_content_type_guess (file->filename, NULL, 0, 
&result_uncertain);
+  if (result_uncertain)
+{
+  g_free (content_type);
+  content_type = NULL;
+}
+
+  language = gtk_source_language_manager_guess_language 
(gtk_source_language_manager_get_default (), 
+ file->filename, 
+ content_type);
+  g_free (content_type);
+  
+  return language;
+}
+
+
+
 gint
 mousepad_file_open (MousepadFile  *file,
 const gchar   *template_filename,
@@ -604,6 +683,9 @@ mousepad_file_open (MousepadFile  *file,
   g_mapped_file_free (mapped_file);
 #endif
 
+  /* guess and set the file's filetype/language */
+  mousepad_file_set_language (file, mousepad_file_guess_language (file));
+
   /* this does not count as a modified buffer */
   gtk_text_buffer_set_modified (file->buffer, FALSE);
 }
diff --git a/mousepad/mousepad-file.h b/mousepad/mousepad-file.h
index 18c5b6e..e9a8be3 100644
--- a/mousepad/mousepad-file.h
+++ b/mousepad/mousepad-file.h
@@ -68,6 +68,18 @@ voidmousepad_file_set_line_ending  
(MousepadFile
 
 MousepadLineEnding  mousepad_file_get_line_ending  (MousepadFile   
 *file);
 
+voidmousepad_file_set_language (MousepadFile   
 *file,
+GtkSourceLanguage  
 *language);
+
+GtkSourceLanguage  *mousepad_file_get_language (MousepadFile   
 *file);
+
+voidmousepad_file_set_language_id  (MousepadFile   
 *file,
+const gchar
 *language_id);
+
+const gchar*mousepad_file_get_language_id  (MousepadFile   
 *file);
+
+GtkSourceLanguage  *mousepad_file_guess_language   (MousepadFile   
 *file);
+
 gintmousepad_file_open (MousepadFile   
 *file,
 const gchar
 *template_filename,
 GError 
**error);
diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 85fae3c..921767b 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -24,6 +24,8 @@
 #incl

[Xfce4-commits] Creating branch matt/gtksourceview

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 as new branch
 to 029bef60746206eaf08dc11c89afd59db186db8d (commit)

Branches are created implicitly by pushing. This mail only exists to 
let you know that there was code pushed to 

  refs/heads/matt/gtksourceview

for the first time. Mails for the commits that lead to the creation 
of the branch will follow after this mail.
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Add GtkSourceView dependency to build system.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 4e5c46f563dc7e468041a62f82cab8e8bfc4a3dc (commit)
   from b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)

commit 4e5c46f563dc7e468041a62f82cab8e8bfc4a3dc
Author: Matthew Brush 
Date:   Mon Oct 3 05:30:31 2011 -0700

Add GtkSourceView dependency to build system.

Still need to determine which version of GtkSourceView to depend on.

 configure.ac.in  |1 +
 mousepad/Makefile.am |4 +++-
 2 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/configure.ac.in b/configure.ac.in
index c4b7da2..9c820c6 100644
--- a/configure.ac.in
+++ b/configure.ac.in
@@ -83,6 +83,7 @@ dnl ***
 XDT_CHECK_PACKAGE([GLIB], [glib-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([GTHREAD], [gthread-2.0], [2.12.0])
 XDT_CHECK_PACKAGE([GTK], [gtk+-2.0], [2.10.0])
+XDT_CHECK_PACKAGE([GTKSOURCEVIEW], [gtksourceview-2.0])
 
 dnl **
 dnl *** Optional support for D-BUS ***
diff --git a/mousepad/Makefile.am b/mousepad/Makefile.am
index a065629..41b7b1e 100644
--- a/mousepad/Makefile.am
+++ b/mousepad/Makefile.am
@@ -58,6 +58,7 @@ mousepad_CFLAGS = \
$(GLIB_CFLAGS) \
$(GTK_CFLAGS) \
$(GTHREAD_CFLAGS) \
+   $(GTKSOURCEVIEW_CFLAGS) \
$(PLATFORM_CFLAGS)
 
 mousepad_LDFLAGS = \
@@ -67,7 +68,8 @@ mousepad_LDFLAGS = \
 mousepad_LDADD = \
$(GLIB_LIBS) \
$(GTK_LIBS) \
-   $(GTHREAD_LIBS)
+   $(GTHREAD_LIBS) \
+   $(GTKSOURCEVIEW_LIBS)
 
 if HAVE_DBUS
 mousepad_built_sources +=  \
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Make MousepadView a subclass of GtkSourceView instead of GtkTextView.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to d1970d6b3ec4e212f8fd2823b6f5dd00c17fe4cf (commit)
   from 4e5c46f563dc7e468041a62f82cab8e8bfc4a3dc (commit)

commit d1970d6b3ec4e212f8fd2823b6f5dd00c17fe4cf
Author: Matthew Brush 
Date:   Mon Oct 3 01:34:42 2011 -0700

Make MousepadView a subclass of GtkSourceView instead of GtkTextView.

Add include for gtksourceview.h in mousepad-private.h.

Causes the line numbers to always be shown initially but this should be
fixed once the line numbers code is ported to use GtkSourceView.

 mousepad/mousepad-private.h |1 +
 mousepad/mousepad-view.c|6 +++---
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/mousepad/mousepad-private.h b/mousepad/mousepad-private.h
index 4be50b1..520a9f7 100644
--- a/mousepad/mousepad-private.h
+++ b/mousepad/mousepad-private.h
@@ -21,6 +21,7 @@
 #include 
 #include 
 #include 
+#include 
 
 G_BEGIN_DECLS
 
diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 4e12fa6..5146811 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -91,12 +91,12 @@ static void  mousepad_view_transpose_words  
 (GtkTextBuffer
 
 struct _MousepadViewClass
 {
-  GtkTextViewClass __parent__;
+  GtkSourceViewClass __parent__;
 };
 
 struct _MousepadView
 {
-  GtkTextView  __parent__;
+  GtkSourceView  __parent__;
 
   /* the selection style tag */
   GtkTextTag *selection_tag;
@@ -128,7 +128,7 @@ struct _MousepadView
 
 
 
-G_DEFINE_TYPE (MousepadView, mousepad_view, GTK_TYPE_TEXT_VIEW);
+G_DEFINE_TYPE (MousepadView, mousepad_view, GTK_TYPE_SOURCE_VIEW);
 
 
 
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Prevent warnings when messing around with statusbar internal widgets.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to b401a34b8c6b88ebd26e26f03a70a13548cbc4c0 (commit)
   from 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415 (commit)

commit b401a34b8c6b88ebd26e26f03a70a13548cbc4c0
Author: Matthew Brush 
Date:   Mon Oct 3 05:20:18 2011 -0700

Prevent warnings when messing around with statusbar internal widgets.

Remove statusbar frame border.

 mousepad/mousepad-statusbar.c |   17 +++--
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index 0321c3e..9ed0d94 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -93,8 +93,9 @@ mousepad_statusbar_class_init (MousepadStatusbarClass *klass)
 static void
 mousepad_statusbar_init (MousepadStatusbar *statusbar)
 {
-  GtkWidget*ebox, *box, *separator;
+  GtkWidget*ebox, *box, *separator, *label;
   GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
+  GList *frame;
 
   /* init statusbar */
   gtk_statusbar_set_has_resize_grip (bar, TRUE);
@@ -104,11 +105,15 @@ mousepad_statusbar_init (MousepadStatusbar *statusbar)
   gtk_widget_show (box);
 
   /* reorder the gtk statusbar */
-  g_object_ref (G_OBJECT (bar->label));
-  gtk_container_remove (GTK_CONTAINER (bar->frame), bar->label);
-  gtk_container_add (GTK_CONTAINER (bar->frame), box);
-  gtk_box_pack_start (GTK_BOX (box), bar->label, TRUE, TRUE, 0);
-  g_object_unref (G_OBJECT (bar->label));
+  frame = gtk_container_get_children (GTK_CONTAINER (bar));
+  gtk_frame_set_shadow_type (GTK_FRAME (frame->data), GTK_SHADOW_NONE);
+  label = gtk_bin_get_child (GTK_BIN (frame->data));
+  g_object_ref (label);
+  gtk_container_remove (GTK_CONTAINER (frame->data), label);
+  gtk_container_add (GTK_CONTAINER (frame->data), box);
+  gtk_box_pack_start (GTK_BOX (box), label, TRUE, TRUE, 0);
+  g_object_unref (label);
+  g_list_free (frame);
 
   /* separator */
   separator = gtk_vseparator_new ();
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Revert "Drop usage of the GtkStatusbar."

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415 (commit)
   from ff0faf3c3250b4e56598aec891109d96f3aece7a (commit)

commit 6bdfbdf87e4ac5ffd528b6daafd9755acfe04415
Author: Matthew Brush 
Date:   Mon Oct 3 03:56:58 2011 -0700

Revert "Drop usage of the GtkStatusbar."

This reverts commit 185821ae262235222f7ef1d3a86dc0ea2b19bbd9.

 mousepad/mousepad-statusbar.c |   54 +---
 mousepad/mousepad-statusbar.h |2 -
 mousepad/mousepad-window.c|   17 +++-
 3 files changed, 38 insertions(+), 35 deletions(-)

diff --git a/mousepad/mousepad-statusbar.c b/mousepad/mousepad-statusbar.c
index dc4503f..0321c3e 100644
--- a/mousepad/mousepad-statusbar.c
+++ b/mousepad/mousepad-statusbar.c
@@ -39,20 +39,19 @@ enum
 
 struct _MousepadStatusbarClass
 {
-  GtkHBoxClass __parent__;
+  GtkStatusbarClass __parent__;
 };
 
 struct _MousepadStatusbar
 {
-  GtkHBox __parent__;
+  GtkStatusbar__parent__;
 
   /* whether overwrite is enabled */
-  guint  overwrite_enabled : 1;
+  guint   overwrite_enabled : 1;
 
   /* extra labels in the statusbar */
-  GtkWidget *tooltip;
-  GtkWidget *position;
-  GtkWidget *overwrite;
+  GtkWidget  *position;
+  GtkWidget  *overwrite;
 };
 
 
@@ -61,7 +60,7 @@ static guint statusbar_signals[LAST_SIGNAL];
 
 
 
-G_DEFINE_TYPE (MousepadStatusbar, mousepad_statusbar, GTK_TYPE_HBOX);
+G_DEFINE_TYPE (MousepadStatusbar, mousepad_statusbar, GTK_TYPE_STATUSBAR);
 
 
 
@@ -94,38 +93,41 @@ mousepad_statusbar_class_init (MousepadStatusbarClass 
*klass)
 static void
 mousepad_statusbar_init (MousepadStatusbar *statusbar)
 {
-  GtkWidget *ebox, *separator;
+  GtkWidget*ebox, *box, *separator;
+  GtkStatusbar *bar = GTK_STATUSBAR (statusbar);
 
   /* init statusbar */
-  gtk_box_set_spacing (GTK_BOX (statusbar), 6);
-  gtk_container_set_border_width (GTK_CONTAINER (statusbar), 2);
+  gtk_statusbar_set_has_resize_grip (bar, TRUE);
 
-  /* tooltip label */
-  statusbar->tooltip = gtk_label_new (NULL);
-  gtk_misc_set_alignment (GTK_MISC (statusbar->tooltip), 0.0, 0.5);
-  gtk_box_pack_start (GTK_BOX (statusbar), statusbar->tooltip, TRUE, TRUE, 0);
-  gtk_label_set_ellipsize (GTK_LABEL (statusbar->tooltip), 
PANGO_ELLIPSIZE_END);
-  gtk_label_set_single_line_mode (GTK_LABEL (statusbar->tooltip), TRUE);
-  gtk_widget_show (statusbar->tooltip);
+  /* create a new horizontal box */
+  box = gtk_hbox_new (FALSE, 8);
+  gtk_widget_show (box);
+
+  /* reorder the gtk statusbar */
+  g_object_ref (G_OBJECT (bar->label));
+  gtk_container_remove (GTK_CONTAINER (bar->frame), bar->label);
+  gtk_container_add (GTK_CONTAINER (bar->frame), box);
+  gtk_box_pack_start (GTK_BOX (box), bar->label, TRUE, TRUE, 0);
+  g_object_unref (G_OBJECT (bar->label));
 
   /* separator */
   separator = gtk_vseparator_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), separator, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
   /* line and column numbers */
   statusbar->position = gtk_label_new (NULL);
-  gtk_box_pack_start (GTK_BOX (statusbar), statusbar->position, FALSE, TRUE, 
0);
+  gtk_box_pack_start (GTK_BOX (box), statusbar->position, FALSE, TRUE, 0);
   gtk_widget_show (statusbar->position);
 
   /* separator */
   separator = gtk_vseparator_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), separator, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (box), separator, FALSE, FALSE, 0);
   gtk_widget_show (separator);
 
   /* overwrite event box */
   ebox = gtk_event_box_new ();
-  gtk_box_pack_start (GTK_BOX (statusbar), ebox, FALSE, TRUE, 0);
+  gtk_box_pack_start (GTK_BOX (box), ebox, FALSE, TRUE, 0);
   gtk_event_box_set_visible_window (GTK_EVENT_BOX (ebox), FALSE);
   mousepad_widget_set_tooltip_text (ebox, _("Toggle the overwrite mode"));
   g_signal_connect (G_OBJECT (ebox), "button-press-event", G_CALLBACK 
(mousepad_statusbar_overwrite_clicked), statusbar);
@@ -193,13 +195,3 @@ mousepad_statusbar_set_overwrite (MousepadStatusbar 
*statusbar,
 
   statusbar->overwrite_enabled = overwrite;
 }
-
-
-
-void
-mousepad_statusbar_set_tooltip (MousepadStatusbar *statusbar,
-const gchar   *tooltip)
-{
-  mousepad_return_if_fail (MOUSEPAD_IS_STATUSBAR (statusbar));
-  gtk_label_set_text (GTK_LABEL (statusbar->tooltip), tooltip);
-}
diff --git a/mousepad/mousepad-statusbar.h b/mousepad/mousepad-statusbar.h
index 0a4fcf1..c44b54e 100644
--- a/mousepad/mousepad-statusbar.h
+++ b/mousepad/mousepad-statusbar.h
@@ -41,8 +41,6 @@ voidmousepad_statusbar_set_cursor_position  
(MousepadStatusbar *statusba
 voidmousepad_statusbar_set_overwrite(MousepadStatusbar 
*statusbar,
  gboolean   
overwrite);
 

[Xfce4-commits] Remove old insert spaces code and use GtkSourceView's.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 6be5f6c5f9de3242f234f08506da31e55396d9b5 (commit)
   from 898612c83495635ef657fea60f6b9048640b0f15 (commit)

commit 6be5f6c5f9de3242f234f08506da31e55396d9b5
Author: Matthew Brush 
Date:   Mon Oct 3 02:38:25 2011 -0700

Remove old insert spaces code and use GtkSourceView's.

Remove special tab handling since GtkSourceView handles it.

 mousepad/mousepad-view.c |   48 ++---
 1 files changed, 3 insertions(+), 45 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 8b600e4..438b671 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -116,7 +116,6 @@ struct _MousepadView
   guint   selection_editing : 1;
 
   /* settings */
-  guint   insert_spaces : 1;
   guint   tab_size;
 };
 
@@ -149,7 +148,6 @@ static void
 mousepad_view_init (MousepadView *view)
 {
   /* initialize settings */
-  view->insert_spaces = FALSE;
   view->tab_size = 8;
 
   /* initialize selection variables */
@@ -352,45 +350,6 @@ mousepad_view_key_press_event (GtkWidget   *widget,
   }
 break;
 
-  case GDK_Tab:
-  case GDK_KP_Tab:
-  case GDK_ISO_Left_Tab:
-if (G_LIKELY (is_editable))
-  {
-if (view->selection_marks != NULL)
-  {
-/* insert a tab in the selection */
-mousepad_view_selection_key_press_event (view, NULL, GDK_Tab, 
modifiers);
-
-return TRUE;
-  }
-else if (gtk_text_buffer_get_selection_bounds (buffer, NULL, NULL))
-  {
-/* indent the selection */
-mousepad_view_indent_selection (view, !(modifiers & 
GDK_SHIFT_MASK), FALSE);
-
-return TRUE;
-  }
-else if (view->insert_spaces)
-  {
-/* get the iter position of the cursor */
-cursor = gtk_text_buffer_get_insert (buffer);
-gtk_text_buffer_get_iter_at_mark (buffer, &iter, cursor);
-
-/* begin user action */
-gtk_text_buffer_begin_user_action (buffer);
-
-/* insert spaces */
-mousepad_view_indent_increase (view, &iter);
-
-/* end user action */
-gtk_text_buffer_end_user_action (buffer);
-
-return TRUE;
-  }
-  }
-break;
-
   default:
 if (G_UNLIKELY (view->selection_marks != NULL && is_editable))
   {
@@ -1034,7 +993,7 @@ mousepad_view_indent_increase (MousepadView *view,
   /* get the buffer */
   buffer = mousepad_view_get_buffer (view);
 
-  if (view->insert_spaces)
+  if (gtk_source_view_get_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW 
(view)))
 {
   /* get the offset */
   offset = mousepad_util_get_real_line_offset (iter, view->tab_size);
@@ -2424,8 +2383,7 @@ mousepad_view_set_insert_spaces (MousepadView *view,
 {
   mousepad_return_if_fail (MOUSEPAD_IS_VIEW (view));
 
-  /* set boolean */
-  view->insert_spaces = insert_spaces;
+  gtk_source_view_set_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW (view), 
insert_spaces);
 }
 
 
@@ -2504,5 +2462,5 @@ mousepad_view_get_insert_spaces (MousepadView *view)
 {
   mousepad_return_val_if_fail (MOUSEPAD_IS_VIEW (view), FALSE);
 
-  return view->insert_spaces;
+  return gtk_source_view_get_insert_spaces_instead_of_tabs (GTK_SOURCE_VIEW 
(view));
 }
___
Xfce4-commits mailing list
Xfce4-commits@xfce.org
https://mail.xfce.org/mailman/listinfo/xfce4-commits


[Xfce4-commits] Remove old line number code and use GtkSourceView's show-line-numbers.

2011-10-06 Thread Matthew Brush
Updating branch refs/heads/matt/gtksourceview
 to 801eadc860c894420a1807e5a9f496895bd031c8 (commit)
   from d1970d6b3ec4e212f8fd2823b6f5dd00c17fe4cf (commit)

commit 801eadc860c894420a1807e5a9f496895bd031c8
Author: Matthew Brush 
Date:   Mon Oct 3 01:52:27 2011 -0700

Remove old line number code and use GtkSourceView's show-line-numbers.

 mousepad/mousepad-view.c |  110 +
 1 files changed, 3 insertions(+), 107 deletions(-)

diff --git a/mousepad/mousepad-view.c b/mousepad/mousepad-view.c
index 5146811..a16c594 100644
--- a/mousepad/mousepad-view.c
+++ b/mousepad/mousepad-view.c
@@ -30,8 +30,6 @@
 
 
 
-#define LINE_NUMBER_MARGIN (10)
-#define LINE_NUMBER_OFFSET (4)
 #define mousepad_view_get_buffer(view) (GTK_TEXT_VIEW (view)->buffer)
 
 
@@ -121,7 +119,6 @@ struct _MousepadView
 
   /* settings */
   guint   auto_indent : 1;
-  guint   line_numbers : 1;
   guint   insert_spaces : 1;
   guint   tab_size;
 };
@@ -156,7 +153,6 @@ mousepad_view_init (MousepadView *view)
 {
   /* initialize settings */
   view->auto_indent = FALSE;
-  view->line_numbers = FALSE;
   view->insert_spaces = FALSE;
   view->tab_size = 8;
 
@@ -201,13 +197,6 @@ mousepad_view_expose (GtkWidget  *widget,
 {
   GtkTextView  *textview = GTK_TEXT_VIEW (widget);
   MousepadView *view = MOUSEPAD_VIEW (widget);
-  gint  y_start, y_offset, y_finish;
-  gint  y_iter, height;
-  gint  line_number, line_count;
-  GtkTextIter   iter;
-  gint  width, border_width;
-  PangoLayout  *layout;
-  gchar str[8]; /* maximum of 10e6 lines */
 
   if (G_UNLIKELY (view->selection_length == -1
   && (view->selection_marks != NULL || view->selection_end_x != -1)
@@ -216,90 +205,6 @@ mousepad_view_expose (GtkWidget  *widget,
   /* redraw the cursor lines for the vertical selection */
   mousepad_view_selection_draw (view, FALSE);
 }
-  else if (event->window == gtk_text_view_get_window (textview, 
GTK_TEXT_WINDOW_LEFT))
-{
-  /* get the real start position */
-  gtk_text_view_window_to_buffer_coords (textview, GTK_TEXT_WINDOW_LEFT,
- 0, event->area.y, NULL, &y_start);
-
-  /* get the left window y offset (this is *NOT* the textview offset!) */
-  y_offset = event->area.y - y_start;
-
-  /* get the bottom position */
-  y_finish = y_start + event->area.height;
-
-  /* get the start iter and its line number */
-  gtk_text_view_get_line_at_y (textview, &iter, y_start, NULL);
-  line_number = gtk_text_iter_get_line (&iter);
-
-  /* get the number of lines in the buffer */
-  line_count = gtk_text_buffer_get_line_count (textview->buffer);
-
-  /* string with the 'last' line number */
-  g_snprintf (str, sizeof (str), "%d", MAX (99, line_count));
-
-  /* create the pango layout */
-  layout = gtk_widget_create_pango_layout (widget, str);
-  pango_layout_get_pixel_size (layout, &width, NULL);
-
-  /* border width */
-  border_width = width + LINE_NUMBER_MARGIN;
-
-  /* check if we need to set the border size again */
-  if (G_UNLIKELY (gtk_text_view_get_border_window_size (textview, 
GTK_TEXT_WINDOW_LEFT) != border_width))
-{
-  /* set the new border size */
-  gtk_text_view_set_border_window_size (textview, 
GTK_TEXT_WINDOW_LEFT, border_width);
-
-  /* leave, we'll redraw on the next expose event */
-  goto bail_out;
-}
-
-  /* finish the pango layout */
-  pango_layout_set_width (layout, width);
-  pango_layout_set_alignment (layout, PANGO_ALIGN_RIGHT);
-
-  /* draw a vertical line to separate the numbers and text */
-  gtk_paint_vline (widget->style, event->window,
-   GTK_WIDGET_STATE (widget),
-   NULL, widget, NULL,
-   event->area.y,
-   event->area.y + event->area.height,
-   border_width - 2);
-
-  /* walk through the lines until we hit the last line */
-  for (; line_number < line_count; line_number++)
-{
-  /* get the y position and the height of the iter */
-  gtk_text_view_get_line_yrange (textview, &iter, &y_iter, &height);
-
-  /* create the number */
-  g_snprintf (str, sizeof (str), "%d", line_number + 1);
-
-  /* create the pange layout */
-  pango_layout_set_text (layout, str, -1);
-
-  /* draw the layout on the left window */
-  gtk_paint_layout (widget->style, event->window,
-GTK_WIDGET_STATE (widget),
-FALSE, NULL, widget, NULL,
-width + LINE_NUMBER_OFFSET,
-