SF.net SVN: geany: [535] trunk

ntrel at users.sourceforge.net ntrel at xxxxx
Wed Jul 5 15:09:30 UTC 2006


Revision: 535
Author:   ntrel
Date:     2006-07-05 08:09:20 -0700 (Wed, 05 Jul 2006)
ViewCVS:  http://svn.sourceforge.net/geany/?rev=535&view=rev

Log Message:
-----------
Add Make object command to compile the current file. Added some separators and renamed Build with make items

Modified Paths:
--------------
    trunk/ChangeLog
    trunk/src/callbacks.c
    trunk/src/dialogs.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog	2006-07-05 12:37:46 UTC (rev 534)
+++ trunk/ChangeLog	2006-07-05 15:09:20 UTC (rev 535)
@@ -2,6 +2,9 @@
 
  * src/sciwrappers.c: Make sci_goto_line_scroll work better with
                       line wrapping and folding.
+ * src/callbacks.c, src/dialogs.c:
+   Add Make object command to compile the current file.
+   Added some separators and renamed Build with make items.
 
 
 2006-07-03  Nick Treleaven  <nick.treleaven at btinternet.com>

Modified: trunk/src/callbacks.c
===================================================================
--- trunk/src/callbacks.c	2006-07-05 12:37:46 UTC (rev 534)
+++ trunk/src/callbacks.c	2006-07-05 15:09:20 UTC (rev 535)
@@ -1665,22 +1665,49 @@
                                         gpointer         user_data)
 {
 	gint idx = document_get_cur_idx();
+	gboolean make_object = FALSE;
 
-	if (GPOINTER_TO_INT(user_data) == 1)
+	switch (GPOINTER_TO_INT(user_data))
 	{
+		case 1: //custom target
 		dialogs_show_make_target();
-	}
-	else
-	{
-		GPid child_pid;
+		break;
 
-		if (doc_list[idx].changed) document_save_file(idx);
+		case 2: //make object
+		{
+			gchar *locale_filename, *short_file, *noext, *object_file; //temp
+			locale_filename = g_locale_from_utf8(doc_list[idx].file_name,
+				-1, NULL, NULL, NULL);
+			if (locale_filename == NULL)
+				locale_filename = g_strdup(doc_list[idx].file_name);
 
-		child_pid = build_make_file(idx, FALSE);
-		if (child_pid != (GPid) 0)
+			short_file = g_path_get_basename(locale_filename);
+			g_free(locale_filename);
+
+			noext = utils_remove_ext_from_filename(short_file);
+			g_free(short_file);
+
+			object_file = g_strdup_printf("%s.o", noext);
+			g_free(noext);
+
+			g_strlcpy(app->build_make_custopt, object_file, 255);
+			g_free(object_file);
+			make_object = TRUE;
+		}
+		// fall through
+
+		case 0: //make all
 		{
-			gtk_widget_set_sensitive(app->compile_button, FALSE);
-			g_child_watch_add(child_pid, build_exit_cb, NULL);
+			GPid child_pid;
+
+			if (doc_list[idx].changed) document_save_file(idx);
+
+			child_pid = build_make_file(idx, make_object);
+			if (child_pid != (GPid) 0)
+			{
+				gtk_widget_set_sensitive(app->compile_button, FALSE);
+				g_child_watch_add(child_pid, build_exit_cb, NULL);
+			}
 		}
 	}
 }

Modified: trunk/src/dialogs.c
===================================================================
--- trunk/src/dialogs.c	2006-07-05 12:37:46 UTC (rev 534)
+++ trunk/src/dialogs.c	2006-07-05 15:09:20 UTC (rev 535)
@@ -494,7 +494,7 @@
 
 GtkWidget *dialogs_create_build_menu_gen(gint idx)
 {
-	GtkWidget *menu, *item, *image, *separator;
+	GtkWidget *menu, *item = NULL, *image, *separator;
 	GtkAccelGroup *accel_group = gtk_accel_group_new();
 	GtkTooltips *tooltips = GTK_TOOLTIPS(lookup_widget(app->window, "tooltips"));
 	filetype *ft = doc_list[idx].file_type;
@@ -532,8 +532,15 @@
 		ft->menu_items->item_link = item;
 	}
 
+	if (item != NULL)
+	{
+		item = gtk_separator_menu_item_new();
+		gtk_widget_show(item);
+		gtk_container_add(GTK_CONTAINER(menu), item);
+	}
+
 	// build the code with make all
-	item = gtk_image_menu_item_new_with_mnemonic(_("Build with \"make\""));
+	item = gtk_image_menu_item_new_with_mnemonic(_("_Make all"));
 	gtk_widget_show(item);
 	gtk_container_add(GTK_CONTAINER(menu), item);
 	gtk_tooltips_set_tip(tooltips, item, _("Builds the current file with the "
@@ -544,7 +551,7 @@
 	g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(0));
 
 	// build the code with make
-	item = gtk_image_menu_item_new_with_mnemonic(_("Build with \"_make\" (custom _target)"));
+	item = gtk_image_menu_item_new_with_mnemonic(_("Make custom _target"));
 	gtk_widget_show(item);
 	if (keys[GEANY_KEYS_BUILD_MAKEOWNTARGET]->key)
 		gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_MAKEOWNTARGET]->key,
@@ -554,8 +561,20 @@
 										   "make tool and the specified target"), NULL);
 	g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(1));
 
+	// build the code with make object
+	item = gtk_image_menu_item_new_with_mnemonic(_("Make _object"));
+	gtk_widget_show(item);
+	gtk_container_add(GTK_CONTAINER(menu), item);
+	gtk_tooltips_set_tip(tooltips, item, _("Compiles the current file using the "
+										   "make tool"), NULL);
+	g_signal_connect((gpointer) item, "activate", G_CALLBACK(on_build_make_activate), GINT_TO_POINTER(2));
+
 	if (ft->menu_items->can_exec)
 	{	// execute the code
+		item = gtk_separator_menu_item_new();
+		gtk_widget_show(item);
+		gtk_container_add(GTK_CONTAINER(menu), item);
+
 		item = gtk_image_menu_item_new_from_stock("gtk-execute", accel_group);
 		gtk_widget_show(item);
 		gtk_container_add(GTK_CONTAINER(menu), item);
@@ -576,7 +595,7 @@
 		gtk_container_add(GTK_CONTAINER(menu), separator);
 		gtk_widget_set_sensitive(separator, FALSE);
 
-		item = gtk_image_menu_item_new_with_mnemonic(_("Set Includes and Arguments"));
+		item = gtk_image_menu_item_new_with_mnemonic(_("_Set Includes and Arguments"));
 		gtk_widget_show(item);
 		if (keys[GEANY_KEYS_BUILD_OPTIONS]->key)
 			gtk_widget_add_accelerator(item, "activate", accel_group, keys[GEANY_KEYS_BUILD_OPTIONS]->key,


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