SF.net SVN: geany: [904] trunk

eht16 at users.sourceforge.net eht16 at xxxxx
Wed Oct 18 20:49:04 UTC 2006


Revision: 904
          http://svn.sourceforge.net/geany/?rev=904&view=rev
Author:   eht16
Date:     2006-10-18 13:48:54 -0700 (Wed, 18 Oct 2006)

Log Message:
-----------
Use enum values to reference different treeview widgets (code cleanup).

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/geany.h
    trunk/src/msgwindow.c
    trunk/src/msgwindow.h
    trunk/src/treeviews.c

Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-10-18 20:11:05 UTC (rev 903)
+++ trunk/ChangeLog	2006-10-18 20:48:54 UTC (rev 904)
@@ -3,6 +3,9 @@
  * src/utils.c, src/treeviews.c, tagmanager/c.c:
    Use "::" as context separator only for C++, otherwise use ".".
    Detect module declarations in D and put them in the symbol list.
+ * src/callbacks.c, src/geany.h, src/msgwindow.c, src/treeviews.c:
+   Use enum values to reference different treeview widgets
+   (code cleanup).
 
 
 2006-10-18  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-10-18 20:11:05 UTC (rev 903)
+++ trunk/src/callbacks.c	2006-10-18 20:48:54 UTC (rev 904)
@@ -1404,17 +1404,17 @@
 {
 	if (event->type == GDK_2BUTTON_PRESS && user_data)
 	{
-		if (GPOINTER_TO_INT(user_data) == 4)
+		if (GPOINTER_TO_INT(user_data) == MSG_MESSAGE)
 		{	// double click in the message treeview (results of 'Find usage')
 			msgwin_goto_messages_file_line();
 		}
-		else if (GPOINTER_TO_INT(user_data) == 5)
+		else if (GPOINTER_TO_INT(user_data) == MSG_COMPILER)
 		{	// double click in the compiler treeview
 			msgwin_goto_compiler_file_line();
 		}
 	}
 
-	if (event->button == 1 && user_data && GPOINTER_TO_INT(user_data) == 7)
+	if (event->button == 1 && user_data && GPOINTER_TO_INT(user_data) == TREEVIEW_SYMBOL)
 	{	// allow reclicking of taglist treeview item
 		GtkTreeSelection *select =
 			gtk_tree_view_get_selection(GTK_TREE_VIEW(widget));
@@ -1423,15 +1423,15 @@
 
 	if (user_data && event->button == 3)
 	{	// popupmenu to hide or clear the active treeview
-		if (user_data && GPOINTER_TO_INT(user_data) == 3)
+		if (GPOINTER_TO_INT(user_data) == MSG_STATUS)
 			gtk_menu_popup(GTK_MENU(msgwindow.popup_status_menu), NULL, NULL, NULL, NULL, event->button, event->time);
-		else if (user_data && GPOINTER_TO_INT(user_data) == 4)
+		else if (GPOINTER_TO_INT(user_data) == MSG_MESSAGE)
 			gtk_menu_popup(GTK_MENU(msgwindow.popup_msg_menu), NULL, NULL, NULL, NULL, event->button, event->time);
-		else if (user_data && GPOINTER_TO_INT(user_data) == 5)
+		else if (GPOINTER_TO_INT(user_data) == MSG_COMPILER)
 			gtk_menu_popup(GTK_MENU(msgwindow.popup_compiler_menu), NULL, NULL, NULL, NULL, event->button, event->time);
-		else if (user_data && GPOINTER_TO_INT(user_data) == 6)
+		else if (GPOINTER_TO_INT(user_data) == TREEVIEW_OPENFILES)
 			gtk_menu_popup(GTK_MENU(tv.popup_openfiles), NULL, NULL, NULL, NULL, event->button, event->time);
-		else if (user_data && GPOINTER_TO_INT(user_data) == 7)
+		else if (GPOINTER_TO_INT(user_data) == TREEVIEW_SYMBOL)
 			gtk_menu_popup(GTK_MENU(tv.popup_taglist), NULL, NULL, NULL, NULL, event->button, event->time);
 	}
 	return FALSE;

Modified: trunk/src/geany.h
===================================================================
--- trunk/src/geany.h	2006-10-18 20:11:05 UTC (rev 903)
+++ trunk/src/geany.h	2006-10-18 20:48:54 UTC (rev 904)
@@ -210,5 +210,16 @@
 	GIGABYTE = (MEGABYTE*1024)
 };
 
+enum
+{
+	MSG_STATUS = 1,
+	MSG_COMPILER,
+	MSG_MESSAGE,
+	MSG_SCRATCH,
+	MSG_VTE,
+	TREEVIEW_SYMBOL,
+	TREEVIEW_OPENFILES
+};
 
+
 #endif

Modified: trunk/src/msgwindow.c
===================================================================
--- trunk/src/msgwindow.c	2006-10-18 20:11:05 UTC (rev 903)
+++ trunk/src/msgwindow.c	2006-10-18 20:48:54 UTC (rev 904)
@@ -90,7 +90,7 @@
 
 	gtk_widget_modify_font(msgwindow.tree_status, pango_font_description_from_string(app->msgwin_font));
 	g_signal_connect(G_OBJECT(msgwindow.tree_status), "button-press-event",
-				G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(3));
+				G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(MSG_STATUS));
 
 }
 
@@ -114,7 +114,7 @@
 
 	gtk_widget_modify_font(msgwindow.tree_msg, pango_font_description_from_string(app->msgwin_font));
 	g_signal_connect(G_OBJECT(msgwindow.tree_msg), "button-press-event",
-					G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(4));
+					G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(MSG_MESSAGE));
 
 	// selection handling
 	select = gtk_tree_view_get_selection(GTK_TREE_VIEW(msgwindow.tree_msg));
@@ -141,7 +141,7 @@
 
 	gtk_widget_modify_font(msgwindow.tree_compiler, pango_font_description_from_string(app->msgwin_font));
 	g_signal_connect(G_OBJECT(msgwindow.tree_compiler), "button-press-event",
-					G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(5));
+					G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(MSG_COMPILER));
 
 	// selection handling
 	select = gtk_tree_view_get_selection(GTK_TREE_VIEW(msgwindow.tree_compiler));

Modified: trunk/src/msgwindow.h
===================================================================
--- trunk/src/msgwindow.h	2006-10-18 20:11:05 UTC (rev 903)
+++ trunk/src/msgwindow.h	2006-10-18 20:48:54 UTC (rev 904)
@@ -33,14 +33,6 @@
 	COLOR_BLUE
 };
 
-enum
-{
-	MSG_STATUS = 0,
-	MSG_COMPILER,
-	MSG_MESSAGE,
-	MSG_SCRATCH,
-	MSG_VTE
-};
 
 
 typedef struct

Modified: trunk/src/treeviews.c
===================================================================
--- trunk/src/treeviews.c	2006-10-18 20:11:05 UTC (rev 903)
+++ trunk/src/treeviews.c	2006-10-18 20:48:54 UTC (rev 904)
@@ -44,7 +44,7 @@
 	gtk_widget_modify_font(tree, pango_font_description_from_string(app->tagbar_font));
 	gtk_tree_view_set_model(GTK_TREE_VIEW(tree), GTK_TREE_MODEL(store));
 	g_signal_connect(G_OBJECT(tree), "button-press-event",
-						G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(7));
+						G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(TREEVIEW_SYMBOL));
 
 	gtk_tree_view_set_enable_search(GTK_TREE_VIEW(tree), FALSE);
 
@@ -254,7 +254,7 @@
 
 	gtk_widget_modify_font(tv.tree_openfiles, pango_font_description_from_string(app->tagbar_font));
 	g_signal_connect(G_OBJECT(tv.tree_openfiles), "button-press-event",
-						G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(6));
+						G_CALLBACK(on_tree_view_button_press_event), GINT_TO_POINTER(TREEVIEW_OPENFILES));
 
 	// selection handling
 	select = gtk_tree_view_get_selection(GTK_TREE_VIEW(tv.tree_openfiles));


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



More information about the Commits mailing list