[Geany-devel] Sidebar and MsgWindow Notebook Patches

2011-03-20 Thread Matthew Brush

Hi,

I have a few patches working towards making the sidebar and message 
window notebooks more friendly.


#0001
Makes original sidebar tabs and any new tabs added reorderable.

#0002
Makes original message window tabs and any new tabs added reorderable.

#0003
Enables drag and drop support between the sidebar notebook and message 
window notebook tabs.  This will reduce code in plugins who all do this 
independently and make projects such as geany-sidebarterm pointless.


I have not thoroughly tested the implications of this, like if somewhere 
Geany is using the tab order or location within a specific notebook to 
access the children.  If this is the case, it will be an opportunity to 
fix the code that is doing that.


I need some guidance on how to make the order and location of the tabs 
to be persistent so it it's saved/loaded with the session.  Any hints 
would be appreciated.


Cheers,
Matthew Brush (codebrainz)
From fb1ca08bf09b232564e34b023ff7edd1ac964805 Mon Sep 17 00:00:00 2001
From: Matthew Brush matthewbr...@gmail.com
Date: Sun, 20 Mar 2011 13:22:41 -0700
Subject: [PATCH 1/3] Keep all sidebar tabs reorderable.

---
 src/sidebar.c |   20 
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/src/sidebar.c b/src/sidebar.c
index 56d9c51..99c2d25 100644
--- a/src/sidebar.c
+++ b/src/sidebar.c
@@ -109,6 +109,7 @@ static void on_list_symbol_activate(GtkCheckMenuItem *item, gpointer user_data);
 static void documents_menu_update(GtkTreeSelection *selection);
 static void sidebar_tabs_show_hide(GtkNotebook *notebook, GtkWidget *child,
    guint page_num, gpointer data);
+static void sidebar_set_all_tabs_reorderable(GtkNotebook *notebook);
 
 
 /* the prepare_* functions are document-related, but I think they fit better here than in document.c */
@@ -1051,6 +1052,7 @@ void sidebar_init(void)
 
 	if (gtk_check_version(2, 10, 0) == NULL)
 	{
+		
 		g_signal_connect(main_widgets.sidebar_notebook, page-added,
 			G_CALLBACK(sidebar_tabs_show_hide), NULL);
 
@@ -1060,6 +1062,8 @@ void sidebar_init(void)
 		/* tabs may have changed when sidebar is reshown */
 		g_signal_connect(main_widgets.sidebar_notebook, show,
 			G_CALLBACK(sidebar_tabs_show_hide), NULL);
+			
+		sidebar_set_all_tabs_reorderable(GTK_NOTEBOOK(main_widgets.sidebar_notebook));
 	}
 	sidebar_tabs_show_hide(GTK_NOTEBOOK(main_widgets.sidebar_notebook), NULL, 0, NULL);
 }
@@ -1121,5 +1125,21 @@ static void sidebar_tabs_show_hide(GtkNotebook *notebook, GtkWidget *child,
 			tabs--;
 
 		gtk_notebook_set_show_tabs(notebook, (tabs  1));
+		
+		sidebar_set_all_tabs_reorderable(notebook);
+	}
+}
+
+
+static void sidebar_set_all_tabs_reorderable(GtkNotebook *notebook)
+{
+	gint i;
+	GtkWidget *child;
+	
+	
+	for (i=0; i  gtk_notebook_get_n_pages(notebook); i++)
+	{
+		child = gtk_notebook_get_nth_page(notebook, i);
+		gtk_notebook_set_tab_reorderable(notebook, child, TRUE);
 	}
 }
-- 
1.7.1

From c1165f27a5f0af7dd21193ec76fbe7ca47482218 Mon Sep 17 00:00:00 2001
From: Matthew Brush matthewbr...@gmail.com
Date: Sun, 20 Mar 2011 13:34:27 -0700
Subject: [PATCH 2/3] Keep all msgwin tabs reorderable.

---
 src/msgwindow.c |   36 +++-
 1 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/src/msgwindow.c b/src/msgwindow.c
index 78ca5aa..d367c73 100644
--- a/src/msgwindow.c
+++ b/src/msgwindow.c
@@ -75,7 +75,11 @@ static void msgwin_parse_grep_line(const gchar *string, gchar **filename, gint *
 static gboolean on_msgwin_button_press_event(GtkWidget *widget, GdkEventButton *event,
 			gpointer user_data);
 static void on_scribble_populate(GtkTextView *textview, GtkMenu *arg1, gpointer user_data);
-
+static void on_msgwin_notebook_page_added(GtkNotebook *notebook,
+			GtkWidget *child,
+			guint page_num,
+			gpointer user_data);
+static void msgwin_set_all_tabs_reorderable(GtkNotebook *notebook);
 
 void msgwin_show_hide_tabs(void)
 {
@@ -114,6 +118,15 @@ void msgwin_init(void)
 
 	ui_widget_modify_font_from_string(msgwindow.scribble, interface_prefs.msgwin_font);
 	g_signal_connect(msgwindow.scribble, populate-popup, G_CALLBACK(on_scribble_populate), NULL);
+	
+	if (gtk_check_version(2, 10, 0) == NULL)
+	{
+		g_signal_connect(main_widgets.message_window_notebook,
+		 page-added,
+		 G_CALLBACK(on_msgwin_notebook_page_added),
+		 NULL);
+		msgwin_set_all_tabs_reorderable(GTK_NOTEBOOK(main_widgets.message_window_notebook));
+	}
 }
 
 
@@ -1191,3 +1204,24 @@ void msgwin_clear_tab(gint tabnum)
 }
 
 
+static void msgwin_set_all_tabs_reorderable(GtkNotebook *notebook)
+{
+	gint i;
+	GtkWidget *child;
+	
+	for (i=0; i  gtk_notebook_get_n_pages(notebook); i++)
+	{
+		child = gtk_notebook_get_nth_page(notebook, i);
+		gtk_notebook_set_tab_reorderable(notebook, child, TRUE);
+	}
+}
+
+
+static void on_msgwin_notebook_page_added(GtkNotebook *notebook,
+			GtkWidget *child,
+			guint page_num,
+			gpointer 

Re: [Geany-devel] Changes to templates

2011-03-20 Thread Lex Trotman
On 21 March 2011 02:19, Colomban Wendling lists@herbesfolles.org wrote:
 Le 20/03/2011 00:09, Lex Trotman a écrit :

 Agreed. But supporting both single and multiline comments as a filetype
 setting seems still a good idea.

 I think it should go near the top of the to-do list.  We have been
 talking about the technical reasons for using block or line comments,
 but there is also the local style reasons.  Many places *require* that
 fileheaders and function descriptions be block comments.  That means
 you can't insert nestable comments because there is only one setting.

 Done in r5609, I added new filetype setting comment_single, and use it
 in priority for ^E-style commands, and comment_open/close for templates.
 I also updated all filetypes.* to use this new setting.


Great, well done, and you updated the documentation! +100 points

Cheers
Lex

 Cheers,
 Colomban

___
Geany-devel mailing list
Geany-devel@uvena.de
http://lists.uvena.de/cgi-bin/mailman/listinfo/geany-devel